Make URLs (and channel names!) in the topic widget clickable again
[quassel.git] / src / qtui / topicwidget.cpp
index 8a49d27..2f8f5fa 100644 (file)
@@ -30,8 +30,9 @@ TopicWidget::TopicWidget(QWidget *parent)
   ui.setupUi(this);
   ui.topicEditButton->setIcon(SmallIcon("edit-rename"));
   ui.topicLineEdit->setWordWrapEnabled(true);
-
   ui.topicLineEdit->installEventFilter(this);
+
+  connect(ui.topicLabel, SIGNAL(clickableActivated(Clickable)), SLOT(clickableActivated(Clickable)));
 }
 
 void TopicWidget::currentChanged(const QModelIndex &current, const QModelIndex &previous) {
@@ -56,6 +57,11 @@ void TopicWidget::setTopic(const QString &newtopic) {
   switchPlain();
 }
 
+void TopicWidget::clickableActivated(const Clickable &click) {
+  NetworkId networkId = selectionModel()->currentIndex().data(NetworkModel::NetworkIdRole).value<NetworkId>();
+  click.activate(networkId, _topic);
+}
+
 void TopicWidget::on_topicLineEdit_textEntered() {
   QModelIndex currentIdx = currentIndex();
   if(currentIdx.isValid() && currentIdx.data(NetworkModel::BufferTypeRole) == BufferInfo::ChannelBuffer) {