From 68691c9d6d05ba28c8e0e8c837dcd32bb2eec42c Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Wed, 11 Feb 2015 13:58:23 -0200 Subject: Accept / Cancel location edit Make it possible to cancel or accept the location edit and get back to the mainwindow default state. Signed-off-by: Tomaz Canabrava Signed-off-by: Dirk Hohndel --- qt-ui/simplewidgets.cpp | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'qt-ui/simplewidgets.cpp') diff --git a/qt-ui/simplewidgets.cpp b/qt-ui/simplewidgets.cpp index 98d9bcf9f..63ec4b4fa 100644 --- a/qt-ui/simplewidgets.cpp +++ b/qt-ui/simplewidgets.cpp @@ -6,6 +6,7 @@ #include #include #include +#include #include "file.h" #include "mainwindow.h" @@ -646,7 +647,34 @@ void MultiFilter::closeFilter() MultiFilterSortModel::instance()->clearFilter(); hide(); } +#include +#include -LocationInformationWidget::LocationInformationWidget(QWidget *parent) : QGroupBox(parent) { +LocationInformationWidget::LocationInformationWidget(QWidget *parent) : QGroupBox(parent) +{ ui.setupUi(this); + ui.diveSiteMessage->setText("You are editing the Dive Site"); + ui.diveSiteMessage->setCloseButtonVisible(false); + + QAction *action = new QAction(tr("Apply changes"), this); + connect(action, SIGNAL(triggered(bool)), this, SLOT(acceptChanges())); + ui.diveSiteMessage->addAction(action); + + action = new QAction(tr("Discard changes"), this); + connect(action, SIGNAL(triggered(bool)), this, SLOT(rejectChanges())); + ui.diveSiteMessage->addAction(action); +} + +void LocationInformationWidget::acceptChanges() +{ + emit informationManagementEnded(); +} + +void LocationInformationWidget::rejectChanges() +{ + emit informationManagementEnded(); +} + +void LocationInformationWidget::showEvent(QShowEvent *ev) { + ui.diveSiteMessage->setCloseButtonVisible(false); } -- cgit v1.2.3-70-g09d2