summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--desktop-widgets/mainwindow.cpp13
-rw-r--r--desktop-widgets/mainwindow.h2
2 files changed, 9 insertions, 6 deletions
diff --git a/desktop-widgets/mainwindow.cpp b/desktop-widgets/mainwindow.cpp
index 05839824a..376d2e7f3 100644
--- a/desktop-widgets/mainwindow.cpp
+++ b/desktop-widgets/mainwindow.cpp
@@ -260,14 +260,11 @@ MainWindow::MainWindow() : QMainWindow(),
memset(&what, 0, sizeof(what));
updateManager = new UpdateManager(this);
- QAction *undoAction = Command::undoAction(this);
- QAction *redoAction = Command::redoAction(this);
+ undoAction = Command::undoAction(this);
+ redoAction = Command::redoAction(this);
undoAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Z));
redoAction->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_Z));
- QList<QAction*>undoRedoActions;
- undoRedoActions.append(undoAction);
- undoRedoActions.append(redoAction);
- ui.menu_Edit->addActions(undoRedoActions);
+ ui.menu_Edit->addActions({ undoAction, redoAction });
ReverseGeoLookupThread *geoLookup = ReverseGeoLookupThread::instance();
connect(geoLookup, SIGNAL(started()),information(), SLOT(disableGeoLookupEdition()));
@@ -1184,6 +1181,8 @@ void MainWindow::on_actionViewAll_triggered()
void MainWindow::enterEditState()
{
+ undoAction->setEnabled(false);
+ redoAction->setEnabled(false);
stateBeforeEdit = state;
if (state == VIEWALL || state == INFO_MAXIMIZED)
return;
@@ -1207,6 +1206,8 @@ void MainWindow::enterEditState()
void MainWindow::exitEditState()
{
+ undoAction->setEnabled(true);
+ redoAction->setEnabled(true);
if (stateBeforeEdit == state)
return;
enterState(stateBeforeEdit);
diff --git a/desktop-widgets/mainwindow.h b/desktop-widgets/mainwindow.h
index 113f0699c..2f2b91a83 100644
--- a/desktop-widgets/mainwindow.h
+++ b/desktop-widgets/mainwindow.h
@@ -185,6 +185,8 @@ private:
Ui::MainWindow ui;
QAction *actionNextDive;
QAction *actionPreviousDive;
+ QAction *undoAction;
+ QAction *redoAction;
#ifndef NO_USERMANUAL
UserManual *helpView;
#endif