/***************************************************************************
- * Copyright (C) 2005-2016 by the Quassel Project *
+ * Copyright (C) 2005-2018 by the Quassel Project *
* devel@quassel-irc.org *
* *
* This program is free software; you can redistribute it and/or modify *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
+#include "chatscene.h"
+
#include <QApplication>
#include <QClipboard>
#include <QDesktopServices>
#include <QDrag>
#include <QGraphicsSceneMouseEvent>
-#include <QIcon>
#include <QMenu>
#include <QMenuBar>
#include <QMimeData>
#include <QPersistentModelIndex>
#include <QUrl>
-#ifdef HAVE_KDE4
-# include <KMenuBar>
-#else
-# include <QMenuBar>
-#endif
-
#ifdef HAVE_WEBENGINE
# include <QWebEngineView>
#elif defined HAVE_WEBKIT
#include "chatitem.h"
#include "chatline.h"
#include "chatlinemodelitem.h"
-#include "chatscene.h"
#include "chatview.h"
+#include "chatviewsettings.h"
#include "client.h"
#include "clientbacklogmanager.h"
#include "columnhandleitem.h"
#include "contextmenuactionprovider.h"
+#include "icon.h"
#include "mainwin.h"
#include "markerlineitem.h"
#include "messagefilter.h"
#include "qtui.h"
#include "qtuistyle.h"
-#include "chatviewsettings.h"
#include "webpreviewitem.h"
const qreal minContentsWidth = 200;
_markerLineValid(false),
_markerLineJumpPending(false),
_cutoffMode(CutoffRight),
+ _alwaysBracketSender(false),
_selectingItem(0),
_selectionStart(-1),
_isSelecting(false),
// If we have text selected, insert the Copy Selection as first item
if (isPosOverSelection(pos)) {
QAction *sep = menu.insertSeparator(menu.actions().first());
- QAction *act = new Action(QIcon::fromTheme("edit-copy"), tr("Copy Selection"), &menu, this,
+ QAction *act = new Action(icon::get("edit-copy"), tr("Copy Selection"), &menu, this,
SLOT(selectionToClipboard()), QKeySequence::Copy);
menu.insertAction(sep, act);
searchSelectionText = searchSelectionText.left(_webSearchSelectionTextMaxVisible).append(QString::fromUtf8("…"));
searchSelectionText = tr("Search '%1'").arg(searchSelectionText);
- QAction *webSearchAction = new Action(QIcon::fromTheme("edit-find"), searchSelectionText, &menu, this, SLOT(webSearchOnSelection()));
+ QAction *webSearchAction = new Action(icon::get("edit-find"), searchSelectionText, &menu, this, SLOT(webSearchOnSelection()));
menu.insertAction(sep, webSearchAction);
}
}
if (_selectionMinCol <= ChatLineModel::SenderColumn) {
ChatItem *item = _lines[l]->item(ChatLineModel::SenderColumn);
- if (!_showSenderBrackets && item->chatLine()->msgType() == Message::Plain) {
- // Copying to plain-text. Only re-add the sender brackets if they're normally
- // hidden.
+ if (!_showSenderBrackets && (_alwaysBracketSender
+ || item->chatLine()->msgType() == Message::Plain)) {
+ // Copying to plain-text. Re-add the sender brackets if they're normally hidden
+ // for...
+ // * Plain messages
+ // * All messages in the Chat Monitor
+ //
+ // The Chat Monitor sets alwaysBracketSender() to true.
result += QString("<%1> ").arg(item->data(MessageModel::DisplayRole)
.toString());
} else {
case WebPreview::ShowPreview:
qWarning() << "ChatScene::webPreviewNextStep() called while in ShowPreview Step!";
qWarning() << "removing preview";
- if (webPreview.previewItem && webPreview.previewItem->scene())
+ if (webPreview.previewItem && webPreview.previewItem->scene()) {
removeItem(webPreview.previewItem);
- // Fall through to deletion!
+ }
+
+ // Intentional fallthrough
+
case WebPreview::HidePreview:
if (webPreview.previewItem) {
delete webPreview.previewItem;
if (webPreview.previewItem && webPreview.previewItem->scene())
removeItem(webPreview.previewItem);
}
- // fall through into to set hidden state
+
+ // Intentional fallthrough
+
case WebPreview::DelayPreview:
// we're just loading, so haven't shown the preview yet.
webPreview.previewState = WebPreview::HidePreview;