/***************************************************************************
- * Copyright (C) 2005-2013 by the Quassel Project *
+ * Copyright (C) 2005-2014 by the Quassel Project *
* devel@quassel-irc.org *
* *
* This program is free software; you can redistribute it and/or modify *
{
ui.setupUi(this);
ui.topicEditButton->setIcon(SmallIcon("edit-rename"));
- ui.topicLineEdit->setWordWrapEnabled(true);
+ ui.topicLineEdit->setLineWrapEnabled(true);
ui.topicLineEdit->installEventFilter(this);
connect(ui.topicLabel, SIGNAL(clickableActivated(Clickable)), SLOT(clickableActivated(Clickable)));
}
}
- _topic = newtopic;
+ _topic = sanitizeTopic(newtopic);
_readonly = readonly;
ui.topicEditButton->setVisible(!_readonly);
- ui.topicLabel->setText(newtopic);
- ui.topicLineEdit->setPlainText(newtopic);
+ ui.topicLabel->setText(_topic);
+ ui.topicLineEdit->setPlainText(_topic);
switchPlain();
}
return false;
}
+
+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
+ // some unicode characters with a new line, which then triggers
+ // a stack overflow later
+ QString result(topic);
+ result.replace(QChar::ParagraphSeparator, " ");
+ result.replace(QChar::LineSeparator, " ");
+
+ return result;
+}