mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
Cloud-storage: consistently don't save empty file on desktop version
Make the behavior consistent: Don't save an empty file to the cloud, neither on selection of "Save to cloud" nor on "Save". The latter was not the case. It was a bit hard to trigger: Open cloud, delete all dives, save. Fixes #1228 Reported-by: Jan Iversen <jani@apache.org> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
826c01d0a0
commit
9b4728c7a9
1 changed files with 13 additions and 3 deletions
|
@ -610,13 +610,21 @@ void MainWindow::on_actionCloudstorageopen_triggered()
|
|||
refreshDisplay();
|
||||
}
|
||||
|
||||
// Return whether saving to cloud is OK. If it isn't, show an error return false.
|
||||
static bool saveToCloudOK()
|
||||
{
|
||||
if (!dive_table.nr) {
|
||||
report_error(qPrintable(QObject::tr("Don't save an empty log to the cloud")));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void MainWindow::on_actionCloudstoragesave_triggered()
|
||||
{
|
||||
QString filename;
|
||||
if (!dive_table.nr) {
|
||||
report_error(qPrintable(tr("Don't save an empty log to the cloud")));
|
||||
if (!saveToCloudOK())
|
||||
return;
|
||||
}
|
||||
if (getCloudURL(filename))
|
||||
return;
|
||||
|
||||
|
@ -1725,6 +1733,8 @@ int MainWindow::file_save(void)
|
|||
return file_save_as();
|
||||
|
||||
is_cloud = (strncmp(existing_filename, "http", 4) == 0);
|
||||
if (is_cloud && !saveToCloudOK())
|
||||
return -1;
|
||||
|
||||
if (information()->isEditing())
|
||||
information()->acceptChanges();
|
||||
|
|
Loading…
Reference in a new issue