Pressing enter in the topic line now sets the channel topic.
[quassel.git] / src / qtui / mainwin.cpp
index b44f7dd..e6f3a54 100644 (file)
@@ -254,6 +254,8 @@ void MainWin::setupTopicWidget() {
   VerticalDock *dock = new VerticalDock(tr("Topic"), this);
   dock->setObjectName("TopicDock");
   TopicWidget *topicwidget = new TopicWidget(dock);
+  connect(topicwidget, SIGNAL(topicChanged(const QString &)), this, SLOT(changeTopic(const QString &)));
+
   dock->setWidget(topicwidget);
 
   Client::bufferModel()->mapProperty(1, Qt::DisplayRole, topicwidget, "topic");
@@ -303,6 +305,14 @@ void MainWin::changeEvent(QEvent *event) {
   }
 }
 
+// FIXME this should be made prettier...
+void MainWin::changeTopic(const QString &topic) {
+  BufferId id = ui.bufferWidget->currentBuffer();
+  if(!id.isValid()) return;
+  Buffer *buffer = Client::buffer(id);
+  if(buffer) Client::userInput(buffer->bufferInfo(), QString("/topic %1").arg(topic));
+}
+
 void MainWin::connectedToCore() {
   foreach(BufferInfo id, Client::allBufferInfos()) {
     emit requestBacklog(id, 1000, -1);