X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Fchatitem.cpp;h=be19367bc80369355f5fd7d9cd956719bf5eb774;hp=b72b8ad459775b724a5ee94983a64475ba16eea5;hb=a25d2ec9cf8caf283624eef270998c0ba9e903dd;hpb=577ee31dab1adb418e87eba7fb0dfed61abe2e7a diff --git a/src/qtui/chatitem.cpp b/src/qtui/chatitem.cpp index b72b8ad4..be19367b 100644 --- a/src/qtui/chatitem.cpp +++ b/src/qtui/chatitem.cpp @@ -450,8 +450,17 @@ QList ContentsChatItem::findClickables() const { } if(type >= 0) { idx = matchEnd[type]; + QString match = str.mid(matches[type], matchEnd[type] - matches[type]); if(type == Clickable::Url && str.at(idx-1) == ')') { // special case: closing paren only matches if we had an open one - if(!str.mid(matches[type], matchEnd[type]-matches[type]).contains('(')) matchEnd[type]--; + if(!match.contains('(')) { + matchEnd[type]--; + match.chop(1); + } + } + if(type == Clickable::Channel) { + // don't make clickable if it could be a #number + if(QRegExp("^#\\d+$").exactMatch(match)) + continue; } result.append(Clickable((Clickable::Type)type, matches[type], matchEnd[type] - matches[type])); } @@ -572,13 +581,10 @@ void ContentsChatItem::hoverMoveEvent(QGraphicsSceneHoverEvent *event) { showWebPreview(click); } else if(click.type == Clickable::Channel) { QString name = data(ChatLineModel::DisplayRole).toString().mid(click.start, click.length); - // don't make clickable if it could be a #number - if(!QRegExp("^#\\d+$").exactMatch(name)) { // don't make clickable if it's our own name - BufferId myId = data(MessageModel::BufferIdRole).value(); - if(Client::networkModel()->bufferName(myId) != name) - onClickable = true; - } + BufferId myId = data(MessageModel::BufferIdRole).value(); + if(Client::networkModel()->bufferName(myId) != name) + onClickable = true; } if(onClickable) { setCursor(Qt::PointingHandCursor);