Now the links in the description are clickable. Fixes #49.
authorPhilipp Spitzer <philipp@spitzer.priv.at>
Wed, 27 Sep 2017 21:33:33 +0000 (23:33 +0200)
committerPhilipp Spitzer <philipp@spitzer.priv.at>
Wed, 27 Sep 2017 21:36:30 +0000 (23:36 +0200)
src/gui/eventdialog.cpp

index 4103ad6..6f3014e 100644 (file)
@@ -67,7 +67,10 @@ EventDialog::EventDialog(int conferenceId, int eventId, QWidget *parent): QDialo
     if (Qt::mightBeRichText(event.description())) {
         info += event.description();
     } else {
-        info += Qt::convertFromPlainText(event.description(), Qt::WhiteSpaceNormal);
+        QString description = Qt::convertFromPlainText(event.description(), Qt::WhiteSpaceNormal);
+        // make links clickable
+        QRegExp rx("<?(((s?ftp|https?|svn|svn\\+ssh|git|git\\+ssh)://|(file|news):|www\\.)[-a-z0-9_.:%]*[a-z0-9](/[^][{}\\s\"<>()]*[^][{}\\s\"<>().,:!])?/?)>?");
+        info += description.replace(rx, "<a href=\"\\1\">\\1</a>");
     }
 
     // links