Save button on menu calls InfoWidget save

When editing a dive and clicking save button on menu bar, it saved
dive information but didn't mark dive as not being edited anymore.
For closing file, user should always click on the save button on
the bottom of the page and then saving it.
Now when clicking save button on menu bar, it will call the
accept_changes before saving to disk.

Signed-off-by: exhora <exhora.tat@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Taiane Ramos 2013-11-23 00:40:48 -02:00 committed by Dirk Hohndel
parent a6b35141e4
commit 450fd9c7bd

View file

@ -721,6 +721,10 @@ void MainWindow::file_save_as(void)
filename = QFileDialog::getSaveFileName(this, tr("Save File as"), default_filename,
tr("Subsurface XML files (*.ssrf *.xml *.XML)"));
if (!filename.isNull() && !filename.isEmpty()) {
if(ui.InfoWidget->isEditing())
ui.InfoWidget->acceptChanges();
save_dives(filename.toUtf8().data());
set_filename(filename.toUtf8().data(), TRUE);
setTitle(MWTF_FILENAME);
@ -735,6 +739,9 @@ void MainWindow::file_save(void)
if (!existing_filename)
return file_save_as();
if(ui.InfoWidget->isEditing())
ui.InfoWidget->acceptChanges();
current_default = prefs.default_filename;
if (strcmp(existing_filename, current_default) == 0) {
/* if we are using the default filename the directory