diff options
author | jan Iversen <jan@casacondor.com> | 2019-12-08 13:27:03 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2019-12-11 11:08:51 -0500 |
commit | 0a01072deb4bd6b5fe78daf7ed5713eaeb73254b (patch) | |
tree | d433b8312bfc59afdc58072d70115fea5aa723f6 /core | |
parent | 2949ea0fd95ecca6f6435b9aecce84f65de2987b (diff) | |
download | subsurface-0a01072deb4bd6b5fe78daf7ed5713eaeb73254b.tar.gz |
core/settings: extend qPrefCloudStorage with diveshare uid/private
Add diveshare/uid and diveshare/private to qPrefCloudStorage
to be used in Export.qml as well as diveshareexportdialog
Extending qPrefCloudStorage is more logical than adding QSettings
(and securing the same behaviour) outside qPref.
Signed-off-by: Jan Iversen <jan@casacondor.com>
Diffstat (limited to 'core')
-rw-r--r-- | core/settings/qPrefCloudStorage.cpp | 21 | ||||
-rw-r--r-- | core/settings/qPrefCloudStorage.h | 8 |
2 files changed, 29 insertions, 0 deletions
diff --git a/core/settings/qPrefCloudStorage.cpp b/core/settings/qPrefCloudStorage.cpp index 26a0787e6..675e379d6 100644 --- a/core/settings/qPrefCloudStorage.cpp +++ b/core/settings/qPrefCloudStorage.cpp @@ -77,3 +77,24 @@ HANDLE_PREFERENCE_INT(CloudStorage, "timeout", cloud_timeout); HANDLE_PREFERENCE_INT(CloudStorage, "cloud_verification_status", cloud_verification_status); HANDLE_PREFERENCE_BOOL(CloudStorage, "save_password_local", save_password_local); + + +QString qPrefCloudStorage::diveshare_uid() +{ + return qPrefPrivate::propValue(keyFromGroupAndName("", "diveshareExport/uid"), "").toString(); +} +void qPrefCloudStorage::set_diveshare_uid(const QString &value) +{ + qPrefPrivate::propSetValue(keyFromGroupAndName("", "diveshareExport/uid"), value, ""); + emit instance()->diveshare_uidChanged(value); +} + +bool qPrefCloudStorage::diveshare_private() +{ + return qPrefPrivate::propValue(keyFromGroupAndName("", "diveshareExport/private"), "").toBool(); +} +void qPrefCloudStorage::set_diveshare_private(bool value) +{ + qPrefPrivate::propSetValue(keyFromGroupAndName("", "diveshareExport/private"), value, false); + emit instance()->diveshare_privateChanged(value); +} diff --git a/core/settings/qPrefCloudStorage.h b/core/settings/qPrefCloudStorage.h index cafc0e60f..58aa3a175 100644 --- a/core/settings/qPrefCloudStorage.h +++ b/core/settings/qPrefCloudStorage.h @@ -17,6 +17,8 @@ class qPrefCloudStorage : public QObject { Q_PROPERTY(int cloud_verification_status READ cloud_verification_status WRITE set_cloud_verification_status NOTIFY cloud_verification_statusChanged) Q_PROPERTY(int cloud_timeout READ cloud_timeout WRITE set_cloud_timeout NOTIFY cloud_timeoutChanged) Q_PROPERTY(bool save_password_local READ save_password_local WRITE set_save_password_local NOTIFY save_password_localChanged) + Q_PROPERTY(QString diveshare_userid READ diveshare_uid WRITE set_diveshare_uid NOTIFY diveshare_uidChanged); + Q_PROPERTY(bool diveshare_private READ diveshare_private WRITE set_diveshare_private NOTIFY diveshare_privateChanged); public: static qPrefCloudStorage *instance(); @@ -46,6 +48,8 @@ public: static int cloud_timeout() { return prefs.cloud_timeout; } static int cloud_verification_status() { return prefs.cloud_verification_status; } static bool save_password_local() { return prefs.save_password_local; } + static QString diveshare_uid(); + static bool diveshare_private(); public slots: static void set_cloud_auto_sync(bool value); @@ -57,6 +61,8 @@ public slots: static void set_cloud_timeout(int value); static void set_cloud_verification_status(int value); static void set_save_password_local(bool value); + static void set_diveshare_uid(const QString &value); + static void set_diveshare_private(bool value); signals: void cloud_auto_syncChanged(bool value); @@ -68,6 +74,8 @@ signals: void cloud_timeoutChanged(int value); void cloud_verification_statusChanged(int value); void save_password_localChanged(bool value); + void diveshare_uidChanged(const QString &value); + void diveshare_privateChanged(bool value); private: qPrefCloudStorage() {} |