mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Add helper to delete dive from QML
Once again we make this save the changes to the local cache without being prompted. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
ae22b7cae0
commit
2772ab8764
2 changed files with 18 additions and 1 deletions
|
@ -606,11 +606,27 @@ void QMLManager::saveChanges()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
appendTextToLog("Dive saved.");
|
appendTextToLog("Updated dive list saved.");
|
||||||
set_filename(fileName.toUtf8().data(), true);
|
set_filename(fileName.toUtf8().data(), true);
|
||||||
mark_divelist_changed(false);
|
mark_divelist_changed(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QMLManager::deleteDive(int id)
|
||||||
|
{
|
||||||
|
struct dive *d = get_dive_by_uniq_id(id);
|
||||||
|
if (!d) {
|
||||||
|
qDebug() << "oops, trying to delete non-existing dive";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
DiveListModel::instance()->removeDiveById(id);
|
||||||
|
delete_single_dive(get_idx_by_uniq_id(id));
|
||||||
|
prefs.cloud_background_sync = false;
|
||||||
|
prefs.git_local_only = true;
|
||||||
|
saveChanges();
|
||||||
|
prefs.cloud_background_sync = true;
|
||||||
|
prefs.git_local_only = false;
|
||||||
|
}
|
||||||
|
|
||||||
QString QMLManager::addDive()
|
QString QMLManager::addDive()
|
||||||
{
|
{
|
||||||
appendTextToLog("Adding new dive.");
|
appendTextToLog("Adding new dive.");
|
||||||
|
|
|
@ -91,6 +91,7 @@ public slots:
|
||||||
QString startpressure, QString endpressure, QString gasmix);
|
QString startpressure, QString endpressure, QString gasmix);
|
||||||
|
|
||||||
void saveChanges();
|
void saveChanges();
|
||||||
|
void deleteDive(int id);
|
||||||
QString addDive();
|
QString addDive();
|
||||||
void addDiveAborted(int id);
|
void addDiveAborted(int id);
|
||||||
void applyGpsData();
|
void applyGpsData();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue