/***************************************************************************
- * Copyright (C) 2005-2018 by the Quassel Project *
+ * Copyright (C) 2005-2022 by the Quassel Project *
* devel@quassel-irc.org *
* *
* This program is free software; you can redistribute it and/or modify *
}
}
- _topic = sanitizeTopic(newtopic);
- _readonly = readonly;
+ 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();
+ ui.topicEditButton->setVisible(!_readonly);
+ ui.topicLabel->setText(_topic);
+ ui.topicLineEdit->setPlainText(_topic);
+ switchPlain();
+ }
}
void TopicWidget::setReadOnly(const bool& readonly)
QString TopicWidget::sanitizeTopic(const QString& topic)
{
// Normally, you don't have new lines in topic messages
- // But the use of "plain text" functionnality from Qt replaces
+ // But the use of "plain text" functionality from Qt replaces
// some unicode characters with a new line, which then triggers
// a stack overflow later
QString result(topic);