aboutsummaryrefslogtreecommitdiffstats
path: root/desktop-widgets
diff options
context:
space:
mode:
authorGravatar jan Iversen <jan@casacondor.com>2019-12-09 11:47:59 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-12-11 12:36:43 -0500
commit2f680c1f765abcd0b25ceae46de2b4960f0d1b8d (patch)
treed0698bd89ec7964d56750b6027a98fa2aee3463a /desktop-widgets
parentfba3e5115a7ad6bf5d532459df5460a2201dcae8 (diff)
downloadsubsurface-2f680c1f765abcd0b25ceae46de2b4960f0d1b8d.tar.gz
desktop-widgets: use qPrefCloudStorage instead of QSettings
Use qPrefCloudStorage for divelogde_user/password to secure same handling as other settings, as well as same handling as used in shared uploadDiveLogsDE class Signed-off-by: Jan Iversen <jan@casacondor.com>
Diffstat (limited to 'desktop-widgets')
-rw-r--r--desktop-widgets/subsurfacewebservices.cpp19
1 files changed, 7 insertions, 12 deletions
diff --git a/desktop-widgets/subsurfacewebservices.cpp b/desktop-widgets/subsurfacewebservices.cpp
index d867ae9ba..9d2d01aca 100644
--- a/desktop-widgets/subsurfacewebservices.cpp
+++ b/desktop-widgets/subsurfacewebservices.cpp
@@ -16,11 +16,11 @@
#include "core/cloudstorage.h"
#include "core/subsurface-string.h"
#include "core/uploadDiveLogsDE.h"
+#include "core/settings/qPrefCloudStorage.h"
#include <QDir>
#include <QHttpMultiPart>
#include <QMessageBox>
-#include <QSettings>
#include <QXmlStreamReader>
#include <qdesktopservices.h>
#include <QShortcut>
@@ -291,9 +291,8 @@ DivelogsDeWebServices::DivelogsDeWebServices(QWidget *parent, Qt::WindowFlags f)
uploadMode(false)
{
// should DivelogDE user and pass be stored in the prefs struct or something?
- QSettings s;
- ui.userID->setText(s.value("divelogde_user").toString());
- ui.password->setText(s.value("divelogde_pass").toString());
+ ui.userID->setText(qPrefCloudStorage::divelogde_user());
+ ui.password->setText(qPrefCloudStorage::divelogde_pass());
ui.saveUidLocal->hide();
hideUpload();
QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), this);
@@ -304,10 +303,8 @@ DivelogsDeWebServices::DivelogsDeWebServices(QWidget *parent, Qt::WindowFlags f)
void DivelogsDeWebServices::startUpload()
{
- QSettings s;
- s.setValue("divelogde_user", ui.userID->text());
- s.setValue("divelogde_pass", ui.password->text());
- s.sync();
+ qPrefCloudStorage::set_divelogde_user(ui.userID->text());
+ qPrefCloudStorage::set_divelogde_pass(ui.password->text());
ui.status->setText(tr("Uploading dive list..."));
ui.progressBar->setRange(0, 0); // this makes the progressbar do an 'infinite spin'
@@ -530,10 +527,8 @@ void DivelogsDeWebServices::buttonClicked(QAbstractButton *button)
Command::importDives(&table, &trips, &sites, IMPORT_MERGE_ALL_TRIPS, QStringLiteral("divelogs.de"));
/* store last entered user/pass in config */
- QSettings s;
- s.setValue("divelogde_user", ui.userID->text());
- s.setValue("divelogde_pass", ui.password->text());
- s.sync();
+ qPrefCloudStorage::set_divelogde_user(ui.userID->text());
+ qPrefCloudStorage::set_divelogde_pass(ui.password->text());
hide();
close();
resetState();