mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-19 14:25:27 +00:00
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:
parent
60bd4288c7
commit
60f4b37fab
3 changed files with 19 additions and 2 deletions
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 */
|
||||||
|
|
|
@ -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; }" : ""
|
||||||
|
|
Loading…
Add table
Reference in a new issue