diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2015-11-10 13:45:13 -0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-11-10 13:45:13 -0800 |
commit | 111a153295dd50822dfe84da7b45ba06cac7bc84 (patch) | |
tree | 1154c0a2c60eab42f087ad4749c058e53bf2cb58 /desktop-widgets | |
parent | 77d7e773b913378486399d292cc21c4329387578 (diff) | |
download | subsurface-111a153295dd50822dfe84da7b45ba06cac7bc84.tar.gz |
Preferences: correctly hook up the signals to enable/disable cloud storage
This way the menu state matches the actual verification state again.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'desktop-widgets')
-rw-r--r-- | desktop-widgets/mainwindow.cpp | 3 | ||||
-rw-r--r-- | desktop-widgets/preferences/abstractpreferenceswidget.h | 5 | ||||
-rw-r--r-- | desktop-widgets/preferences/preferences_network.cpp | 5 | ||||
-rw-r--r-- | desktop-widgets/preferences/preferencesdialog.cpp | 3 |
4 files changed, 11 insertions, 5 deletions
diff --git a/desktop-widgets/mainwindow.cpp b/desktop-widgets/mainwindow.cpp index 41d0fd592..d31a2379f 100644 --- a/desktop-widgets/mainwindow.cpp +++ b/desktop-widgets/mainwindow.cpp @@ -1244,6 +1244,9 @@ void MainWindow::readSettings() } QNetworkProxy::setApplicationProxy(proxy); + // now make sure that the cloud menu items are enabled IFF cloud account is verified + enableDisableCloudActions(); + #if !defined(SUBSURFACE_MOBILE) loadRecentFiles(&s); if (firstRun) { diff --git a/desktop-widgets/preferences/abstractpreferenceswidget.h b/desktop-widgets/preferences/abstractpreferenceswidget.h index 2f607c4c9..89abc5080 100644 --- a/desktop-widgets/preferences/abstractpreferenceswidget.h +++ b/desktop-widgets/preferences/abstractpreferenceswidget.h @@ -19,9 +19,12 @@ public: /* gets the values from the interface and set in the preferences object. */ virtual void syncSettings() = 0; +signals: + void settingsChanged(); + private: QIcon _icon; QString _name; float _positionHeight; }; -#endif
\ No newline at end of file +#endif diff --git a/desktop-widgets/preferences/preferences_network.cpp b/desktop-widgets/preferences/preferences_network.cpp index d812f4ab1..cbdeebe8b 100644 --- a/desktop-widgets/preferences/preferences_network.cpp +++ b/desktop-widgets/preferences/preferences_network.cpp @@ -96,7 +96,7 @@ void PreferencesNetwork::syncSettings() report_error(qPrintable(tr("Cloud storage email and password can only consist of letters, numbers, and '.', '-', '_', and '+'."))); } else { CloudStorageAuthenticate *cloudAuth = new CloudStorageAuthenticate(this); - connect(cloudAuth, SIGNAL(finishedAuthenticate()), this, SLOT(cloudPinNeeded())); + connect(cloudAuth, &CloudStorageAuthenticate::finishedAuthenticate, this, &PreferencesNetwork::cloudPinNeeded); cloudAuth->backend(email, password); } } @@ -146,8 +146,7 @@ void PreferencesNetwork::cloudPinNeeded() } else { ui->cloudStorageGroupBox->setTitle(tr("Subsurface cloud storage")); } - //TODO: Do not call mainWindow here. Verify things on SettingsChanged. - //MainWindow::instance()->enableDisableCloudActions(); + emit settingsChanged(); } void PreferencesNetwork::proxyType_changed(int idx) diff --git a/desktop-widgets/preferences/preferencesdialog.cpp b/desktop-widgets/preferences/preferencesdialog.cpp index 6885469c5..141bc1c65 100644 --- a/desktop-widgets/preferences/preferencesdialog.cpp +++ b/desktop-widgets/preferences/preferencesdialog.cpp @@ -27,7 +27,7 @@ PreferencesDialog* PreferencesDialog::instance() void PreferencesDialog::emitSettingsChanged() { - emit settingsChanged(); + emit settingsChanged(); } PreferencesDialog::PreferencesDialog() @@ -121,6 +121,7 @@ void PreferencesDialog::refreshPages() void PreferencesDialog::applyRequested(bool closeIt) { Q_FOREACH(AbstractPreferencesWidget *page, pages) { + connect(page, &AbstractPreferencesWidget::settingsChanged, this, &PreferencesDialog::settingsChanged, Qt::UniqueConnection); page->syncSettings(); } emit settingsChanged(); |