Move helper function to the appropriate file

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2015-06-01 13:09:45 -07:00
parent a0b455582d
commit d0b5f355ab
3 changed files with 16 additions and 16 deletions

View file

@ -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.")))

View file

@ -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;
}

View file

@ -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