From: Shane Synan Date: Mon, 18 Jun 2018 01:02:49 +0000 (-0500) Subject: client: Fix Remote Cores marked unsaved on load X-Git-Tag: 0.13-rc1~40 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=f7b02c31c6fd2ef2cae343c2df8b1fed1c4fb177;hp=db6e6642a43143bc45ddb0732d144815b68e37f8 client: Fix Remote Cores marked unsaved on load Fix Remote Cores (CoreAccountSettingsPage) wrongly being marked as unsaved when loading if a default core account was chosen and the index in the QComboBox was not 0. This likely happened due to the change of setCurrentIndex on autoConnectAccount triggering the state as changed, due to a missing call to setChangedState(). Possibly. Also clean up if statement scopes while we're here. Test case: > Add two accounts, "A" and "B" > Pick "B" as default account > Save, close Settings dialog, re-open > Select Remote Cores, note that it's treated as if changes were there --- diff --git a/src/qtui/settingspages/coreaccountsettingspage.cpp b/src/qtui/settingspages/coreaccountsettingspage.cpp index 0ccf5ad4..dfb74561 100644 --- a/src/qtui/settingspages/coreaccountsettingspage.cpp +++ b/src/qtui/settingspages/coreaccountsettingspage.cpp @@ -81,6 +81,8 @@ void CoreAccountSettingsPage::load() ui.autoConnectAccount->setCurrentIndex(idx.isValid() ? idx.row() : 0); ui.autoConnectAccount->setProperty("storedValue", ui.autoConnectAccount->currentIndex()); setWidgetStates(); + // Mark as no changes made, we just loaded settings + setChangedState(false); } @@ -224,8 +226,10 @@ void CoreAccountSettingsPage::widgetHasChanged() bool CoreAccountSettingsPage::testHasChanged() { - if (ui.autoConnectAccount->currentIndex() != ui.autoConnectAccount->property("storedValue").toInt()) + if (ui.autoConnectAccount->currentIndex() != + ui.autoConnectAccount->property("storedValue").toInt()) { return true; + } if (*model() != *Client::coreAccountModel()) { return true; }