X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Ftopicwidget.cpp;h=e9d71b7bbddf744dde9148731ad73f8befafa92e;hp=033acaa5006bb82bba20a65196dc307b11301f7e;hb=HEAD;hpb=c1cf157116de7fc3da96203aa6f03c38c7ebb650 diff --git a/src/qtui/topicwidget.cpp b/src/qtui/topicwidget.cpp index 033acaa5..e9d71b7b 100644 --- a/src/qtui/topicwidget.cpp +++ b/src/qtui/topicwidget.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * 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 * @@ -152,13 +152,17 @@ void TopicWidget::setTopic(const QModelIndex& index) } } - _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) @@ -257,7 +261,7 @@ bool TopicWidget::eventFilter(QObject* obj, QEvent* event) 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);