From 56dcbd9588fa3b7d70a4b639b71cb18e1c462067 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Wed, 13 Mar 2019 20:58:25 +0100 Subject: Undo: implement undo of dive site addition Implement a dive site addition undo command and connect it to the add dive site button. The added dive site has a default name ("new dive site"). Signed-off-by: Berthold Stoeger --- desktop-widgets/tab-widgets/TabDiveSite.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'desktop-widgets/tab-widgets/TabDiveSite.cpp') diff --git a/desktop-widgets/tab-widgets/TabDiveSite.cpp b/desktop-widgets/tab-widgets/TabDiveSite.cpp index 5e2831c93..648df6395 100644 --- a/desktop-widgets/tab-widgets/TabDiveSite.cpp +++ b/desktop-widgets/tab-widgets/TabDiveSite.cpp @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0 #include "TabDiveSite.h" #include "qt-models/divelocationmodel.h" +#include "desktop-widgets/command.h" #include @@ -16,6 +17,8 @@ TabDiveSite::TabDiveSite(QWidget *parent) : TabBase(parent) // Show only the first few columns for (int i = LocationInformationModel::COORDS; i < LocationInformationModel::COLUMNS; ++i) ui.diveSites->view()->setColumnHidden(i, true); + + connect(ui.diveSites, &TableView::addButtonClicked, this, &TabDiveSite::add); } void TabDiveSite::updateData() @@ -25,3 +28,8 @@ void TabDiveSite::updateData() void TabDiveSite::clear() { } + +void TabDiveSite::add() +{ + Command::addDiveSite(tr("New dive site")); +} -- cgit v1.2.3-70-g09d2