/***************************************************************************
- * Copyright (C) 2005-07 by the Quassel IRC Team *
+ * Copyright (C) 2005-08 by the Quassel Project *
* devel@quassel-irc.org *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
+ * (at your option) version 3. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
}
void MainWidget::setBuffer(Buffer *buf) {
+ if(!buf) {
+ ui.stack->setCurrentIndex(0);
+ currentBuffer = 0;
+ return;
+ }
// TODO update topic if changed; handle status buffer display
QString title = QString("%1 (%2): \"%3\"").arg(buf->name()).arg(buf->networkName()).arg(buf->topic());
ui.topicBar->setContents(title);
chatWidget->setContents(lines);
connect(buf, SIGNAL(msgAppended(AbstractUiMsg *)), chatWidget, SLOT(appendMsg(AbstractUiMsg *)));
connect(buf, SIGNAL(msgPrepended(AbstractUiMsg *)), chatWidget, SLOT(prependMsg(AbstractUiMsg *)));
- //connect(buf, SIGNAL(topicSet(QString)), this, SLOT(setTopic(QString)));
+ connect(buf, SIGNAL(topicSet(QString)), this, SLOT(setTopic(QString)));
//connect(buf, SIGNAL(ownNickSet(QString)), this, SLOT(setOwnNick(QString)));
ui.stack->addWidget(chatWidget);
chatWidgets.insert(buf, chatWidget);
}
ui.inputLine->clear();
}
+
+// FIXME make this more elegant, we don't need to send a string around...
+void MainWidget::setTopic(QString topic) {
+ Q_UNUSED(topic);
+ if(currentBuffer) {
+ QString title = QString("%1 (%2): \"%3\"").arg(currentBuffer->name()).arg(currentBuffer->networkName()).arg(currentBuffer->topic());
+ ui.topicBar->setContents(title);
+ }
+}