diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2015-06-01 13:09:45 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-06-01 13:09:45 -0700 |
commit | d0b5f355ab9805d5f236d20b1b92ef6f71c1f9ad (patch) | |
tree | e85c6b442b553abbc6ec05ee881068d3bdd5f82e | |
parent | a0b455582df00f9a1faebf328d398384d003f180 (diff) | |
download | subsurface-d0b5f355ab9805d5f236d20b1b92ef6f71c1f9ad.tar.gz |
Move helper function to the appropriate file
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r-- | qt-ui/mainwindow.cpp | 15 | ||||
-rw-r--r-- | qthelper.cpp | 15 | ||||
-rw-r--r-- | qthelper.h | 2 |
3 files changed, 16 insertions, 16 deletions
diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp index 8630cfbb8..c0c65bd99 100644 --- a/qt-ui/mainwindow.cpp +++ b/qt-ui/mainwindow.cpp @@ -310,21 +310,6 @@ void MainWindow::on_actionSaveAs_triggered() file_save_as(); } -static int getCloudURL(QString &filename) -{ - QString email = QString(prefs.cloud_storage_email); - email.replace("@", "_at_"); - email.replace(QRegularExpression("[^a-zA-Z0-9._+-]"), ""); - if (email.isEmpty() || same_string(prefs.cloud_storage_password, "")) - return report_error("Please configure Cloud storage email and password in the preferences"); - if (email != prefs.cloud_storage_email_encoded) { - free(prefs.cloud_storage_email_encoded); - prefs.cloud_storage_email_encoded = strdup(qPrintable(email)); - } - filename = QString("https://cloud.subsurface-divelog.org/git/%1[%1]").arg(email); - return 0; -} - void MainWindow::on_actionCloudstorageopen_triggered() { if (!okToClose(tr("Please save or cancel the current dive edit before opening a new file."))) diff --git a/qthelper.cpp b/qthelper.cpp index baed6d29c..a85be003e 100644 --- a/qthelper.cpp +++ b/qthelper.cpp @@ -1020,3 +1020,18 @@ fraction_t string_to_fraction(const char *str) fraction.permille = rint(value * 10); return fraction; } + +int getCloudURL(QString &filename) +{ + QString email = QString(prefs.cloud_storage_email); + email.replace("@", "_at_"); + email.replace(QRegularExpression("[^a-zA-Z0-9._+-]"), ""); + if (email.isEmpty() || same_string(prefs.cloud_storage_password, "")) + return report_error("Please configure Cloud storage email and password in the preferences"); + if (email != prefs.cloud_storage_email_encoded) { + free(prefs.cloud_storage_email_encoded); + prefs.cloud_storage_email_encoded = strdup(qPrintable(email)); + } + filename = QString("https://cloud.subsurface-divelog.org/git/%1[%1]").arg(email); + return 0; +} diff --git a/qthelper.h b/qthelper.h index 310133f36..418c2eb31 100644 --- a/qthelper.h +++ b/qthelper.h @@ -32,5 +32,5 @@ depth_t string_to_depth(const char *str); pressure_t string_to_pressure(const char *str); volume_t string_to_volume(const char *str, pressure_t workp); fraction_t string_to_fraction(const char *str); - +int getCloudURL(QString &filename); #endif // QTHELPER_H |