From: Shane Synan Date: Sat, 1 Sep 2018 20:53:16 +0000 (-0500) Subject: client: Handle newlines in Ignore rule scope edit X-Git-Tag: 0.13-rc2~60 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=a6586b5f46fd062982111c0154f66216727cbc3a client: Handle newlines in Ignore rule scope edit Handle "\n" and ";" as separator in scope rules. This fixes using newlines in the Configure Ignore Rule dialog. Make use of ExpressionMatch::trimMultiWildcardWhitespace() to handle all of the arcane details, unifying code into one place. --- diff --git a/src/qtui/settingspages/ignorelistsettingspage.cpp b/src/qtui/settingspages/ignorelistsettingspage.cpp index dcf59a2a..f2175be7 100644 --- a/src/qtui/settingspages/ignorelistsettingspage.cpp +++ b/src/qtui/settingspages/ignorelistsettingspage.cpp @@ -29,6 +29,8 @@ #include #include +#include "expressionmatch.h" + #include "icon.h" IgnoreListSettingsPage::IgnoreListSettingsPage(QWidget *parent) @@ -330,14 +332,9 @@ void IgnoreListEditDlg::widgetHasChanged() _clonedIgnoreListItem.scopeRule = QString(); } else { - QStringList text = ui.scopeRuleTextEdit->toPlainText().split(";", QString::SkipEmptyParts); - QStringList::iterator it = text.begin(); - while (it != text.end()) { - *it = it->trimmed(); - ++it; - } - - _clonedIgnoreListItem.scopeRule = text.join("; "); + // Trim the resulting MultiWildcard expression + _clonedIgnoreListItem.scopeRule = + ExpressionMatch::trimMultiWildcardWhitespace(ui.scopeRuleTextEdit->toPlainText()); } _clonedIgnoreListItem.ignoreRule = ui.ignoreRuleLineEdit->text();