diff --git a/src/chatlog/chatlog.cpp b/src/chatlog/chatlog.cpp index 4d3698cac..10e600490 100644 --- a/src/chatlog/chatlog.cpp +++ b/src/chatlog/chatlog.cpp @@ -180,6 +180,16 @@ void ChatLog::mousePressEvent(QMouseEvent* ev) if(!isOverSelection(scenePos)) clearSelection(); } + +#ifdef Q_OS_LINUX + if(ev->button() == Qt::MiddleButton) + { + copySelectedText(true); + + if(!isOverSelection(scenePos)) + clearSelection(); + } +#endif } void ChatLog::mouseReleaseEvent(QMouseEvent* ev) @@ -528,13 +538,13 @@ void ChatLog::clear() updateSceneRect(); } -void ChatLog::copySelectedText() const +void ChatLog::copySelectedText(bool toSelectionBuffer) const { QString text = getSelectedText(); QClipboard* clipboard = QApplication::clipboard(); if(clipboard && !text.isNull()) - clipboard->setText(text); + clipboard->setText(text, toSelectionBuffer ? QClipboard::Selection : QClipboard::Clipboard); } void ChatLog::setBusyNotification(ChatLine::Ptr notification) diff --git a/src/chatlog/chatlog.h b/src/chatlog/chatlog.h index 0ab495e4d..e89c789de 100644 --- a/src/chatlog/chatlog.h +++ b/src/chatlog/chatlog.h @@ -43,7 +43,7 @@ public: void insertChatlineOnTop(const QList& newLines); void clearSelection(); void clear(); - void copySelectedText() const; + void copySelectedText(bool toSelectionBuffer = false) const; void setBusyNotification(ChatLine::Ptr notification); void setTypingNotification(ChatLine::Ptr notification); void setTypingNotificationVisible(bool visible);