diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2015-12-02 14:32:03 -0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-12-02 14:32:03 -0800 |
commit | 8f33403e4f70e5785b145ae483ab16992ab68431 (patch) | |
tree | faa5b3b0decadb67cb2ef480bf08b605d8c7c3b9 /desktop-widgets/subsurfacewebservices.cpp | |
parent | 962341ae9f781e10a6276b9f7d81d9da72bd90f6 (diff) | |
download | subsurface-8f33403e4f70e5785b145ae483ab16992ab68431.tar.gz |
Fetch the Subsurface webservice userid if cloud credentials were given
This allows users to not have to worry about this userid anymore. Both the
mobile app and the desktop app can now derive the userid from the cloud
storage credentials.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'desktop-widgets/subsurfacewebservices.cpp')
-rw-r--r-- | desktop-widgets/subsurfacewebservices.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/desktop-widgets/subsurfacewebservices.cpp b/desktop-widgets/subsurfacewebservices.cpp index d66d3653b..a11949122 100644 --- a/desktop-widgets/subsurfacewebservices.cpp +++ b/desktop-widgets/subsurfacewebservices.cpp @@ -385,10 +385,18 @@ void WebServices::resetState() SubsurfaceWebServices::SubsurfaceWebServices(QWidget *parent, Qt::WindowFlags f) : WebServices(parent, f) { QSettings s; - if (!prefs.save_userid_local || !*prefs.userid) - ui.userID->setText(s.value("subsurface_webservice_uid").toString().toUpper()); - else - ui.userID->setText(prefs.userid); + + // figure out if we know (or can determine) the user's web service userid + QString userid(prefs.userid); + if (userid.isEmpty()) + userid = s.value("subsurface_webservice_uid").toString().toUpper(); + if (userid.isEmpty() && + !same_string(prefs.cloud_storage_email, "") && + !same_string(prefs.cloud_storage_password, "")) + userid = GpsLocation::instance()->getUserid(prefs.cloud_storage_email, prefs.cloud_storage_password); + + ui.userID->setText(userid); + hidePassword(); hideUpload(); ui.progressBar->setFormat(tr("Enter User ID and click Download")); |