Merging r780:797 from trunk to branches/0.3.
[quassel.git] / src / qtui / chatwidget.cpp
index 131caa4..f386b8e 100644 (file)
@@ -384,7 +384,8 @@ void ChatWidget::mouseDoubleClickEvent(QMouseEvent *event) {
     len = end - start;
   }
   QString word = text.mid(start, len);
-  if(word.startsWith("http://")) {
+  QRegExp regex("^(h|f)t{1,2}ps?:\\/\\/");
+  if(regex.indexIn(word) != -1) {
     QDesktopServices::openUrl(QUrl(word));
   }
   
@@ -410,7 +411,11 @@ void ChatWidget::mouseReleaseEvent(QMouseEvent *event) {
         selectionStart = qMin(dragStartCursor, curCursor);
         selectionEnd = qMax(dragStartCursor, curCursor);
         // TODO Make X11SelectionMode configurable!
+#ifdef Q_WS_X11
+        QApplication::clipboard()->setText(selectionToString(), QClipboard::Selection);
+#else
         QApplication::clipboard()->setText(selectionToString());
+#endif
         break;
       case MarkLines:
         mouseMode = Normal;
@@ -418,7 +423,11 @@ void ChatWidget::mouseReleaseEvent(QMouseEvent *event) {
         selectionStart = qMin(dragStartLine, curLine);
         selectionEnd = qMax(dragStartLine, curLine);
         // TODO Make X11SelectionMode configurable!
+#ifdef Q_WS_X11
+        QApplication::clipboard()->setText(selectionToString(), QClipboard::Selection);
+#else
         QApplication::clipboard()->setText(selectionToString());
+#endif
         break;
       default:
         mouseMode = Normal;