From 430f5b77c583e5c29a5299740763ddfc9a098570 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Sat, 30 Jul 2016 13:09:31 -0700 Subject: Add menu entry to remove the offline state If an attempt to contact the cloud storage fails, Subsurface switches into offline mode. This allows us to go back online again. Signed-off-by: Dirk Hohndel --- desktop-widgets/mainwindow.cpp | 13 +++++++++++-- desktop-widgets/mainwindow.h | 1 + desktop-widgets/mainwindow.ui | 10 ++++++++-- 3 files changed, 20 insertions(+), 4 deletions(-) (limited to 'desktop-widgets') diff --git a/desktop-widgets/mainwindow.cpp b/desktop-widgets/mainwindow.cpp index 22c57e2fc..868545600 100644 --- a/desktop-widgets/mainwindow.cpp +++ b/desktop-widgets/mainwindow.cpp @@ -387,6 +387,7 @@ void MainWindow::enableDisableCloudActions() { ui.actionCloudstorageopen->setEnabled(prefs.cloud_verification_status == CS_VERIFIED); ui.actionCloudstoragesave->setEnabled(prefs.cloud_verification_status == CS_VERIFIED); + ui.actionTake_cloud_storage_online->setEnabled(prefs.cloud_verification_status == CS_VERIFIED && prefs.git_local_only); } PlannerDetails *MainWindow::plannerDetails() const { @@ -595,6 +596,12 @@ void MainWindow::on_actionCloudstoragesave_triggered() mark_divelist_changed(false); } +void MainWindow::on_actionTake_cloud_storage_online_triggered() +{ + prefs.git_local_only = false; + ui.actionTake_cloud_storage_online->setEnabled(false); +} + void learnImageDirs(QStringList dirnames) { QList > futures; @@ -1681,10 +1688,12 @@ QString MainWindow::displayedFilename(QString fullFilename) if (fullFilename.contains(prefs.cloud_git_url)) { QString email = fileName.left(fileName.indexOf('[')); - if (prefs.git_local_only) + if (prefs.git_local_only) { + ui.actionTake_cloud_storage_online->setEnabled(true); return tr("[local cache for] %1").arg(email); - else + } else { return tr("[cloud storage for] %1").arg(email); + } } else { return fileName; } diff --git a/desktop-widgets/mainwindow.h b/desktop-widgets/mainwindow.h index 0a53405e8..e7f8f28c4 100644 --- a/desktop-widgets/mainwindow.h +++ b/desktop-widgets/mainwindow.h @@ -106,6 +106,7 @@ slots: void on_actionClose_triggered(); void on_actionCloudstorageopen_triggered(); void on_actionCloudstoragesave_triggered(); + void on_actionTake_cloud_storage_online_triggered(); void on_actionPrint_triggered(); void on_actionPreferences_triggered(); void on_actionQuit_triggered(); diff --git a/desktop-widgets/mainwindow.ui b/desktop-widgets/mainwindow.ui index 85f034692..cba3d8503 100644 --- a/desktop-widgets/mainwindow.ui +++ b/desktop-widgets/mainwindow.ui @@ -62,10 +62,11 @@ - - + + + @@ -745,6 +746,11 @@ Add GPS location here + + + Take cloud storage online + + -- cgit v1.2.3-70-g09d2