X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Fchatitem.cpp;h=934fadf328b3103b1c9f1b96344989a78c104bd4;hp=fc45b77c0e6eafad02955fb05722555ba789acad;hb=7d7c70c5c27be65af2d53df5cca27265c2d1d666;hpb=86d792a90e2868635170a1092ac7a9278a84ef71 diff --git a/src/qtui/chatitem.cpp b/src/qtui/chatitem.cpp index fc45b77c..934fadf3 100644 --- a/src/qtui/chatitem.cpp +++ b/src/qtui/chatitem.cpp @@ -32,6 +32,7 @@ #include "bufferview.h" #include "chatitem.h" #include "chatlinemodel.h" +#include "contextmenuactionprovider.h" #include "iconloader.h" #include "mainwin.h" #include "qtui.h" @@ -278,7 +279,7 @@ void ChatItem::mousePressEvent(QGraphicsSceneMouseEvent *event) { } void ChatItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { - if(_selectionMode != NoSelection && !event->buttons() & Qt::LeftButton) { + if(_selectionMode != NoSelection && event->button() == Qt::LeftButton) { chatScene()->selectionToClipboard(QClipboard::Selection); event->accept(); } else @@ -286,9 +287,9 @@ void ChatItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { } void ChatItem::addActionsToMenu(QMenu *menu, const QPointF &pos) { - Q_UNUSED(menu); Q_UNUSED(pos); + GraphicalUi::contextMenuActionProvider()->addActions(menu, chatScene()->filter(), data(MessageModel::BufferIdRole).value()); } // ************************************************************ @@ -444,7 +445,7 @@ QList ContentsChatItem::findClickables() const { for(int i = 0; i < regExpCount; i++) { if(matches[i] < 0 || matchEnd[i] > str.length()) continue; if(idx >= matchEnd[i]) { - matches[i] = str.indexOf(regExp[i], qMax(matchEnd[i], idx)); + matches[i] = regExp[i].indexIn(str, qMax(matchEnd[i], idx)); if(matches[i] >= 0) matchEnd[i] = matches[i] + regExp[i].cap(1).length(); } if(matches[i] >= 0 && matches[i] < minidx) { @@ -602,8 +603,6 @@ void ContentsChatItem::hoverMoveEvent(QGraphicsSceneHoverEvent *event) { } void ContentsChatItem::addActionsToMenu(QMenu *menu, const QPointF &pos) { - Q_UNUSED(pos); // we assume that the current mouse cursor pos is the point of invocation - if(privateData()->currentClickable.isValid()) { Clickable click = privateData()->currentClickable; switch(click.type) { @@ -617,16 +616,15 @@ void ContentsChatItem::addActionsToMenu(QMenu *menu, const QPointF &pos) { foreach(QAction *action, menu->actions()) action->setVisible(false); QString name = data(ChatLineModel::DisplayRole).toString().mid(click.start, click.length); - Client::mainUi()->actionProvider()->addActions(menu, chatScene()->filter(), data(MessageModel::BufferIdRole).value(), name); + GraphicalUi::contextMenuActionProvider()->addActions(menu, chatScene()->filter(), data(MessageModel::BufferIdRole).value(), name); break; } default: break; } } else { - // Buffer-specific actions - Client::mainUi()->actionProvider()->addActions(menu, chatScene()->filter(), data(MessageModel::BufferIdRole).value()); + ChatItem::addActionsToMenu(menu, pos); } }