Cloud storage: only offer cloud storage related options when verified

If we don't have verified cloud credentials disable the menu options and
disallow the use of cloud storage as default data file.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2015-06-14 15:42:28 -07:00
parent 60bd4288c7
commit 60f4b37fab
3 changed files with 19 additions and 2 deletions

View file

@ -157,6 +157,8 @@ MainWindow::MainWindow() : QMainWindow(),
ui.menuFile->removeAction(ui.actionCloudstorageopen); ui.menuFile->removeAction(ui.actionCloudstorageopen);
ui.menuFile->removeAction(ui.actionCloudstoragesave); ui.menuFile->removeAction(ui.actionCloudstoragesave);
qDebug() << "disabled / made invisible the cloud storage stuff"; qDebug() << "disabled / made invisible the cloud storage stuff";
#else
enableDisableCloudActions();
#endif #endif
ui.mainErrorMessage->hide(); ui.mainErrorMessage->hide();
@ -204,6 +206,14 @@ MainWindow::~MainWindow()
m_Instance = NULL; m_Instance = NULL;
} }
void MainWindow::enableDisableCloudActions()
{
#ifdef USE_LIBGIT23_API
ui.actionCloudstorageopen->setEnabled(prefs.cloud_verification_status == CS_VERIFIED);
ui.actionCloudstoragesave->setEnabled(prefs.cloud_verification_status == CS_VERIFIED);
#endif
}
PlannerDetails *MainWindow::plannerDetails() const { PlannerDetails *MainWindow::plannerDetails() const {
return qobject_cast<PlannerDetails*>(applicationState["PlanDive"].bottomRight); return qobject_cast<PlannerDetails*>(applicationState["PlanDive"].bottomRight);
} }

View file

@ -94,6 +94,7 @@ public:
void showV2Dialog(); void showV2Dialog();
QUndoStack *undoStack; QUndoStack *undoStack;
NotificationWidget *getNotificationWidget(); NotificationWidget *getNotificationWidget();
void enableDisableCloudActions();
private private
slots: slots:
/* file menu action */ /* file menu action */

View file

@ -109,10 +109,16 @@ void PreferencesDialog::cloudPinNeeded()
ui.cloud_storage_pin->setVisible(prefs.cloud_verification_status == CS_NEED_TO_VERIFY); ui.cloud_storage_pin->setVisible(prefs.cloud_verification_status == CS_NEED_TO_VERIFY);
ui.cloud_storage_pin_label->setEnabled(prefs.cloud_verification_status == CS_NEED_TO_VERIFY); ui.cloud_storage_pin_label->setEnabled(prefs.cloud_verification_status == CS_NEED_TO_VERIFY);
ui.cloud_storage_pin_label->setVisible(prefs.cloud_verification_status == CS_NEED_TO_VERIFY); ui.cloud_storage_pin_label->setVisible(prefs.cloud_verification_status == CS_NEED_TO_VERIFY);
if (prefs.cloud_verification_status == CS_VERIFIED) if (prefs.cloud_verification_status == CS_VERIFIED) {
ui.cloudStorageGroupBox->setTitle(tr("Subsurface cloud storage (credentials verified)")); ui.cloudStorageGroupBox->setTitle(tr("Subsurface cloud storage (credentials verified)"));
else ui.cloudDefaultFile->setEnabled(true);
} else {
ui.cloudStorageGroupBox->setTitle(tr("Subsurface cloud storage")); ui.cloudStorageGroupBox->setTitle(tr("Subsurface cloud storage"));
if (ui.cloudDefaultFile->isChecked())
ui.noDefaultFile->setChecked(true);
ui.cloudDefaultFile->setEnabled(false);
}
MainWindow::instance()->enableDisableCloudActions();
} }
#define DANGER_GF (gf > 100) ? "* { color: red; }" : "" #define DANGER_GF (gf > 100) ? "* { color: red; }" : ""