summaryrefslogtreecommitdiffstats
path: root/qt-ui/locationinformation.cpp
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2015-08-31 22:01:25 -0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-08-31 18:43:52 -0700
commit2da439f34c525c8f096a55674902f6bc7d4a23b4 (patch)
treeacd46024b9c582f04b4007ea928452704c31cfc5 /qt-ui/locationinformation.cpp
parent1ef20ee5d8b13a5413ec5aabf16aaa1f1bdd65fd (diff)
downloadsubsurface-2da439f34c525c8f096a55674902f6bc7d4a23b4.tar.gz
Correctly refresh dive site list
And also show a warning to the user saying that that action is non-cancelable. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/locationinformation.cpp')
-rw-r--r--qt-ui/locationinformation.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/qt-ui/locationinformation.cpp b/qt-ui/locationinformation.cpp
index 9e2821ceb..1c650156f 100644
--- a/qt-ui/locationinformation.cpp
+++ b/qt-ui/locationinformation.cpp
@@ -11,6 +11,7 @@
#include <QDebug>
#include <QShowEvent>
#include <QItemSelectionModel>
+#include <qmessagebox.h>
#include <cstdlib>
LocationInformationWidget::LocationInformationWidget(QWidget *parent) : QGroupBox(parent), modified(false)
@@ -64,13 +65,22 @@ bool LocationInformationWidget::eventFilter(QObject*, QEvent *ev)
}
void LocationInformationWidget::mergeSelectedDiveSites() {
+ if (QMessageBox::warning(MainWindow::instance(), tr("Merging dive sites"),
+ tr("You are about to merge dive sites, you can't undo that action \n Are you sure you want to continue?"),
+ QMessageBox::Ok, QMessageBox::Cancel) != QMessageBox::Ok)
+ return;
+
QModelIndexList selection = ui.diveSiteListView->selectionModel()->selectedIndexes();
uint32_t *selected_dive_sites = (uint32_t*) malloc(sizeof(u_int32_t) * selection.count());
int i = 0;
Q_FOREACH(const QModelIndex& idx, selection) {
selected_dive_sites[i] = (uint32_t) idx.data(LocationInformationModel::UUID_ROLE).toInt();
+ i++;
}
merge_dive_sites(displayed_dive_site.uuid, selected_dive_sites, i);
+ LocationInformationModel::instance()->update();
+ QSortFilterProxyModel *m = (QSortFilterProxyModel *) ui.diveSiteListView->model();
+ m->invalidate();
free(selected_dive_sites);
}