client: Handle newlines in Ignore rule scope edit
[quassel.git] / src / qtui / settingspages / ignorelistsettingspage.cpp
index f1b5602..f2175be 100644 (file)
@@ -1,5 +1,5 @@
 /***************************************************************************
- *   Copyright (C) 2005-09 by the Quassel Project                          *
+ *   Copyright (C) 2005-2018 by the Quassel Project                        *
  *   devel@quassel-irc.org                                                 *
  *                                                                         *
  *   This program is free software; you can redistribute it and/or modify  *
@@ -15,7 +15,7 @@
  *   You should have received a copy of the GNU General Public License     *
  *   along with this program; if not, write to the                         *
  *   Free Software Foundation, Inc.,                                       *
- *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
+ *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.         *
  ***************************************************************************/
 
 #include "ignorelistsettingspage.h"
 #include <QString>
 #include <QEvent>
 #include <QDebug>
-#include "iconloader.h"
+
+#include "expressionmatch.h"
+
+#include "icon.h"
 
 IgnoreListSettingsPage::IgnoreListSettingsPage(QWidget *parent)
     : SettingsPage(tr("IRC"), tr("Ignore List"), parent)
 {
     ui.setupUi(this);
     _delegate = new IgnoreListDelegate(ui.ignoreListView);
-    ui.newIgnoreRuleButton->setIcon(SmallIcon("list-add"));
-    ui.deleteIgnoreRuleButton->setIcon(SmallIcon("edit-delete"));
-    ui.editIgnoreRuleButton->setIcon(SmallIcon("configure"));
+    ui.newIgnoreRuleButton->setIcon(icon::get("list-add"));
+    ui.deleteIgnoreRuleButton->setIcon(icon::get("edit-delete"));
+    ui.editIgnoreRuleButton->setIcon(icon::get("configure"));
 
     ui.ignoreListView->setSelectionBehavior(QAbstractItemView::SelectRows);
     ui.ignoreListView->setSelectionMode(QAbstractItemView::SingleSelection);
@@ -329,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();