summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--qt-mobile/qmlmanager.cpp18
-rw-r--r--qt-mobile/qmlmanager.h1
2 files changed, 18 insertions, 1 deletions
diff --git a/qt-mobile/qmlmanager.cpp b/qt-mobile/qmlmanager.cpp
index aa804d51a..663463b80 100644
--- a/qt-mobile/qmlmanager.cpp
+++ b/qt-mobile/qmlmanager.cpp
@@ -606,11 +606,27 @@ void QMLManager::saveChanges()
return;
}
- appendTextToLog("Dive saved.");
+ appendTextToLog("Updated dive list saved.");
set_filename(fileName.toUtf8().data(), true);
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()
{
appendTextToLog("Adding new dive.");
diff --git a/qt-mobile/qmlmanager.h b/qt-mobile/qmlmanager.h
index 433001a5a..fec29c13c 100644
--- a/qt-mobile/qmlmanager.h
+++ b/qt-mobile/qmlmanager.h
@@ -91,6 +91,7 @@ public slots:
QString startpressure, QString endpressure, QString gasmix);
void saveChanges();
+ void deleteDive(int id);
QString addDive();
void addDiveAborted(int id);
void applyGpsData();