client: Fix lost unsaved highlights on Import
authorShane Synan <digitalcircuit36939@gmail.com>
Mon, 16 Jul 2018 21:47:29 +0000 (16:47 -0500)
committerManuel Nickschas <sputnick@quassel-irc.org>
Tue, 17 Jul 2018 17:57:45 +0000 (19:57 +0200)
Save highlights before importing if changes exist to avoid losing
any unsaved rules when loading the highlight rule list from the
client.

Test case:
1.  Have at least 1 local highlight rule
2.  Add remote highlight rule, don't save
3.  Import local highlights
4.  Unsaved highlight rule gets deleted

src/qtui/settingspages/corehighlightsettingspage.cpp

index cafe98f..9d2f155 100644 (file)
@@ -738,6 +738,11 @@ void CoreHighlightSettingsPage::importRules()
         return;
     }
 
+    if (hasChanged()) {
+        // Save existing changes first to avoid overwriting them
+        save();
+    }
+
     auto clonedManager = HighlightRuleManager();
     clonedManager.fromVariantMap(Client::highlightRuleManager()->toVariantMap());