+ case BufferInfo::ChannelBuffer:
+ newtopic = index.sibling(index.row(), 1).data().toString();
+ readonly = false;
+ break;
+
+ case BufferInfo::QueryBuffer: {
+ QString nickname = index0.data(Qt::DisplayRole).toString();
+ if (network) {
+ const IrcUser* user = network->ircUser(nickname);
+ if (user) {
+ newtopic = QString("%1%2%3 | %4@%5")
+ .arg(nickname)
+ .arg(user->userModes().isEmpty() ? QString() : QString(" (+%1)").arg(user->userModes()))
+ .arg(user->realName().isEmpty() ? QString() : QString(" | %1").arg(user->realName()))
+ .arg(user->user())
+ .arg(user->host());
+ }
+ else { // no such user
+ newtopic = nickname;
+ }
+ }
+ else { // no valid Network-Obj.
+ newtopic = nickname;
+ }
+ break;
+ }
+ default:
+ newtopic = index0.data(Qt::DisplayRole).toString();
+ }
+ }
+
+ QString sanitizedNewTopic = sanitizeTopic(newtopic);
+ if (readonly != _readonly || sanitizedNewTopic != _topic)
+ {
+ _topic = sanitizedNewTopic;
+ _readonly = readonly;
+
+ ui.topicEditButton->setVisible(!_readonly);
+ ui.topicLabel->setText(_topic);
+ ui.topicLineEdit->setPlainText(_topic);
+ switchPlain();
+ }