aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt1
-rw-r--r--commands/CMakeLists.txt6
-rw-r--r--mobile-widgets/qmlmanager.cpp25
-rw-r--r--packaging/ios/Subsurface-mobile.pro12
4 files changed, 18 insertions, 26 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f032c6c45..cdc17066b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -314,6 +314,7 @@ if (SUBSURFACE_TARGET_EXECUTABLE MATCHES "MobileExecutable")
subsurface_mapwidget
subsurface_backend_shared
subsurface_models_mobile
+ subsurface_commands_mobile
subsurface_corelib
${SUBSURFACE_LINK_LIBRARIES}
)
diff --git a/commands/CMakeLists.txt b/commands/CMakeLists.txt
index dcf7f3892..6d6ee1d64 100644
--- a/commands/CMakeLists.txt
+++ b/commands/CMakeLists.txt
@@ -18,7 +18,7 @@ set(SUBSURFACE_GENERIC_COMMANDS_SRCS
if (SUBSURFACE_TARGET_EXECUTABLE MATCHES "DesktopExecutable")
add_library(subsurface_commands_desktop STATIC ${SUBSURFACE_GENERIC_COMMANDS_SRCS})
target_link_libraries(subsurface_commands_desktop ${QT_LIBRARIES})
-#elseif (SUBSURFACE_TARGET_EXECUTABLE MATCHES "MobileExecutable")
-# add_library(subsurface_commands_mobile STATIC ${SUBSURFACE_GENERIC_COMMANDS_SRCS})
-# target_link_libraries(subsurface_commands_mobile ${QT_LIBRARIES})
+elseif (SUBSURFACE_TARGET_EXECUTABLE MATCHES "MobileExecutable")
+ add_library(subsurface_commands_mobile STATIC ${SUBSURFACE_GENERIC_COMMANDS_SRCS})
+ target_link_libraries(subsurface_commands_mobile ${QT_LIBRARIES})
endif()
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();
}
diff --git a/packaging/ios/Subsurface-mobile.pro b/packaging/ios/Subsurface-mobile.pro
index cdd612880..b7bd121be 100644
--- a/packaging/ios/Subsurface-mobile.pro
+++ b/packaging/ios/Subsurface-mobile.pro
@@ -15,6 +15,12 @@ QTQUICK_COMPILER_SKIPPED_RESOURCES +=
SOURCES += ../../subsurface-mobile-main.cpp \
../../subsurface-helper.cpp \
../../map-widget/qmlmapwidgethelper.cpp \
+ ../../commands/command_base.cpp \
+ ../../commands/command.cpp \
+ ../../commands/command_divelist.cpp \
+ ../../commands/command_divesite.cpp \
+ ../../commands/command_edit.cpp \
+ ../../commands/command_edit_trip.cpp \
../../core/cloudstorage.cpp \
../../core/configuredivecomputerthreads.cpp \
../../core/devicedetails.cpp \
@@ -174,6 +180,12 @@ INCLUDEPATH += ../../../install-root/ios/include/ \
/usr/include/libxml2
HEADERS += \
+ ../../commands/command_base.h \
+ ../../commands/command.h \
+ ../../commands/command_divelist.h \
+ ../../commands/command_divesite.h \
+ ../../commands/command_edit.h \
+ ../../commands/command_edit_trip.h \
../../core/libdivecomputer.h \
../../core/cloudstorage.h \
../../core/configuredivecomputerthreads.h \