Now the links in the description are clickable. Fixes #49.
[toast/confclerk.git] / 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