summaryrefslogtreecommitdiffstats
path: root/desktop-widgets/tab-widgets
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2019-03-19 19:52:54 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-04-12 18:19:07 +0300
commit8858bfa1f8cf30cc4eb070fb6e709f7051e61241 (patch)
tree02c40484ff879ce3bba48085c6fab2809cef43ea /desktop-widgets/tab-widgets
parentfde80eeaa5f4ee4150f9292c5783eb790b0fcb96 (diff)
downloadsubsurface-8858bfa1f8cf30cc4eb070fb6e709f7051e61241.tar.gz
Dive site: implement purge of unused dive sites
Add a "purge unused dive sites" button to the dive site list. Connect it to a new PurgeUnusedDiveSites command. Implementation was trivial: simply copy the DeleteDiveSites command. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'desktop-widgets/tab-widgets')
-rw-r--r--desktop-widgets/tab-widgets/TabDiveSite.cpp5
-rw-r--r--desktop-widgets/tab-widgets/TabDiveSite.h1
-rw-r--r--desktop-widgets/tab-widgets/TabDiveSite.ui7
3 files changed, 13 insertions, 0 deletions
diff --git a/desktop-widgets/tab-widgets/TabDiveSite.cpp b/desktop-widgets/tab-widgets/TabDiveSite.cpp
index f021f73dc..dc0b6be67 100644
--- a/desktop-widgets/tab-widgets/TabDiveSite.cpp
+++ b/desktop-widgets/tab-widgets/TabDiveSite.cpp
@@ -69,3 +69,8 @@ void TabDiveSite::diveSiteChanged(struct dive_site *ds, int field)
QModelIndex localIdx = model.mapFromSource(globalIdx);
ui.diveSites->view()->scrollTo(localIdx);
}
+
+void TabDiveSite::on_purgeUnused_clicked()
+{
+ Command::purgeUnusedDiveSites();
+}
diff --git a/desktop-widgets/tab-widgets/TabDiveSite.h b/desktop-widgets/tab-widgets/TabDiveSite.h
index a31b1629d..b9c07ed69 100644
--- a/desktop-widgets/tab-widgets/TabDiveSite.h
+++ b/desktop-widgets/tab-widgets/TabDiveSite.h
@@ -16,6 +16,7 @@ private slots:
void add();
void diveSiteAdded(struct dive_site *, int idx);
void diveSiteChanged(struct dive_site *ds, int field);
+ void on_purgeUnused_clicked();
private:
Ui::TabDiveSite ui;
DiveSiteSortedModel model;
diff --git a/desktop-widgets/tab-widgets/TabDiveSite.ui b/desktop-widgets/tab-widgets/TabDiveSite.ui
index 1d52555e3..b536f101a 100644
--- a/desktop-widgets/tab-widgets/TabDiveSite.ui
+++ b/desktop-widgets/tab-widgets/TabDiveSite.ui
@@ -15,6 +15,13 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
+ <widget class="QToolButton" name="purgeUnused">
+ <property name="text">
+ <string>Purge unused dive sites</string>
+ </property>
+ </widget>
+ </item>
+ <item>
<widget class="TableView" name="diveSites" native="true"/>
</item>
</layout>