summaryrefslogtreecommitdiffstats
path: root/mobile-widgets/qmlmanager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'mobile-widgets/qmlmanager.cpp')
-rw-r--r--mobile-widgets/qmlmanager.cpp25
1 files changed, 2 insertions, 23 deletions
diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp
index 81f203bdb..3e3fb7a0c 100644
--- a/mobile-widgets/qmlmanager.cpp
+++ b/mobile-widgets/qmlmanager.cpp
@@ -49,7 +49,7 @@
#include "core/worldmap-save.h"
#include "core/uploadDiveLogsDE.h"
#include "core/uploadDiveShare.h"
-
+#include "commands/command.h"
QMLManager *QMLManager::m_instance = NULL;
bool noCloudToCloud = false;
@@ -1429,28 +1429,7 @@ void QMLManager::deleteDive(int id)
appendTextToLog("trying to delete non-existing dive");
return;
}
- // create the storage for the deleted dive and trip (if applicable)
- if (!deletedDive)
- deletedDive = alloc_dive();
- copy_dive(d, deletedDive);
- if (!deletedTrip) {
- deletedTrip = alloc_trip();
- } else {
- free(deletedTrip->location);
- free(deletedTrip->notes);
- memset(deletedTrip, 0, sizeof(struct dive_trip));
- }
- // if this is the last dive in that trip, remember the trip as well
- if (d->divetrip && d->divetrip->dives.nr == 1) {
- *deletedTrip = *d->divetrip;
- deletedTrip->location = copy_string(d->divetrip->location);
- deletedTrip->notes = copy_string(d->divetrip->notes);
- deletedTrip->dives.nr = 0;
- deletedDive->divetrip = deletedTrip;
- }
- DiveListModel::instance()->removeDiveById(id);
- delete_single_dive(get_idx_by_uniq_id(id));
- DiveListModel::instance()->resetInternalData();
+ Command::deleteDive(QVector<dive *>{ d });
changesNeedSaving();
}