From f5f53f6c963f376b3003582f22314d744d157229 Mon Sep 17 00:00:00 2001 From: Manuel Nickschas Date: Wed, 6 Aug 2008 16:59:45 +0200 Subject: [PATCH] Fixed URL recognizer to not endlessly loop anymore --- src/qtui/chatitem.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/qtui/chatitem.cpp b/src/qtui/chatitem.cpp index d58c6bcf..14fd3add 100644 --- a/src/qtui/chatitem.cpp +++ b/src/qtui/chatitem.cpp @@ -248,7 +248,7 @@ void ChatItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { void ChatItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) { // FIXME dirty and fast hack to make http:// urls klickable - QRegExp regex("\\b((?:h|f)t{1,2}ps?://[^\\s]+)\\b"); + QRegExp regex("\\b([hf]t{1,2}ps?://[^\\s]+)\\b"); QString str = data(ChatLineModel::DisplayRole).toString(); int idx = posToCursor(event->pos()); int mi = 0; @@ -259,6 +259,7 @@ void ChatItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) { QDesktopServices::openUrl(QUrl(regex.capturedTexts()[1])); break; } + mi += regex.matchedLength(); } while(mi >= 0); event->accept(); } -- 2.20.1