client: Handle newlines in Ignore rule scope edit
authorShane Synan <digitalcircuit36939@gmail.com>
Sat, 1 Sep 2018 20:53:16 +0000 (15:53 -0500)
committerManuel Nickschas <sputnick@quassel-irc.org>
Mon, 3 Sep 2018 20:12:02 +0000 (22:12 +0200)
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.

src/qtui/settingspages/ignorelistsettingspage.cpp

index dcf59a2..f2175be 100644 (file)
@@ -29,6 +29,8 @@
 #include <QEvent>
 #include <QDebug>
 
+#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();