diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2018-01-07 11:12:48 +0100 |
---|---|---|
committer | Lubomir I. Ivanov <neolit123@gmail.com> | 2018-01-11 06:07:13 +0100 |
commit | e85ecdd9254a8bd222ccb2dfed7d3b3bb96c8294 (patch) | |
tree | 0483cdb3c5770ca75eeeb0cc2de787b0e7bdbd3c /mobile-widgets/qmlmanager.cpp | |
parent | 86ef9fce7517313570838ca8e853132876035611 (diff) | |
download | subsurface-e85ecdd9254a8bd222ccb2dfed7d3b3bb96c8294.tar.gz |
Introduce helper function empty_string()
There are ca. 50 constructs of the kind
same_string(s, "")
to test for empty or null strings. Replace them by the new helper
function empty_string().
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'mobile-widgets/qmlmanager.cpp')
-rw-r--r-- | mobile-widgets/qmlmanager.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp index 91c73752c..7b4b3fe71 100644 --- a/mobile-widgets/qmlmanager.cpp +++ b/mobile-widgets/qmlmanager.cpp @@ -309,7 +309,7 @@ void QMLManager::finishSetup() // but we need to make sure we stay the only ones accessing git storage alreadySaving = true; openLocalThenRemote(url); - } else if (!same_string(existing_filename, "") && credentialStatus() != CS_UNKNOWN) { + } else if (!empty_string(existing_filename) && credentialStatus() != CS_UNKNOWN) { setCredentialStatus(CS_NOCLOUD); saveCloudCredentials(); appendTextToLog(tr("working in no-cloud mode")); @@ -433,8 +433,8 @@ void QMLManager::checkCredentialsAndExecute(execute_function_type execute) { // if the cloud credentials are present, we should try to get the GPS Webservice ID // and (if we haven't done so) load the dive list - if (!same_string(prefs.cloud_storage_email, "") && - !same_string(prefs.cloud_storage_password, "")) { + if (!empty_string(prefs.cloud_storage_email) && + !empty_string(prefs.cloud_storage_password)) { setStartPageText(tr("Testing cloud credentials")); appendTextToLog("Have credentials, let's see if they are valid"); CloudStorageAuthenticate *csa = new CloudStorageAuthenticate(this); @@ -540,7 +540,7 @@ void QMLManager::retrieveUserid() setCredentialStatus(CS_VERIFIED); QString userid(prefs.userid); if (userid.isEmpty()) { - if (same_string(prefs.cloud_storage_email, "") || same_string(prefs.cloud_storage_password, "")) { + if (empty_string(prefs.cloud_storage_email) || empty_string(prefs.cloud_storage_password)) { appendTextToLog("cloud user name or password are empty, can't retrieve web user id"); revertToNoCloudIfNeeded(); return; @@ -1117,7 +1117,7 @@ void QMLManager::saveChangesLocal() { if (unsaved_changes()) { if (credentialStatus() == CS_NOCLOUD) { - if (same_string(existing_filename, "")) { + if (empty_string(existing_filename)) { char *filename = NOCLOUD_LOCALSTORAGE; if (git_create_local_repo(filename)) appendTextToLog(get_error_string()); @@ -1682,7 +1682,7 @@ QStringList QMLManager::cylinderInit() const int i = 0; for_each_dive (i, d) { for (int j = 0; j < MAX_CYLINDERS; j++) { - if (! same_string(d->cylinder[j].type.description, "")) + if (!empty_string(d->cylinder[j].type.description)) cylinders << d->cylinder[j].type.description; } } |