summaryrefslogtreecommitdiffstats
path: root/profile-widget
diff options
context:
space:
mode:
Diffstat (limited to 'profile-widget')
-rw-r--r--profile-widget/profilewidget2.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/profile-widget/profilewidget2.cpp b/profile-widget/profilewidget2.cpp
index 793c6d950..79b70d719 100644
--- a/profile-widget/profilewidget2.cpp
+++ b/profile-widget/profilewidget2.cpp
@@ -23,6 +23,7 @@
#include "desktop-widgets/diveplanner.h"
#include "desktop-widgets/simplewidgets.h"
#include "desktop-widgets/divepicturewidget.h"
+#include "desktop-widgets/undocommands.h"
#include "desktop-widgets/mainwindow.h"
#include "core/qthelper.h"
#include "core/gettextfromc.h"
@@ -1675,16 +1676,19 @@ void ProfileWidget2::addSetpointChange()
void ProfileWidget2::splitDive()
{
+#ifndef SUBSURFACE_MOBILE
+ // Make sure that this is an actual dive and we're not in add mode
+ dive *d = get_dive_by_uniq_id(displayed_dive.id);
+ if (!d)
+ return;
QAction *action = qobject_cast<QAction *>(sender());
QPointF scenePos = mapToScene(mapFromGlobal(action->data().toPoint()));
duration_t time;
- time.seconds = lrint(timeAxis->valueAt((scenePos)));
- split_dive_at_time(&displayed_dive, time);
+ time.seconds = lrint(timeAxis->valueAt(scenePos));
+ UndoSplitDives *undoCommand = new UndoSplitDives(d, time);
+ MainWindow::instance()->undoStack->push(undoCommand);
emit updateDiveInfo(false);
- mark_divelist_changed(true);
- replot();
- MainWindow::instance()->refreshProfile();
- MainWindow::instance()->refreshDisplay();
+#endif
}
void ProfileWidget2::changeGas()