aboutsummaryrefslogtreecommitdiffstats
path: root/desktop-widgets
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2020-03-02 10:50:24 +0100
committerGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2020-04-07 00:13:35 +0200
commit3965ae2c89d30e424e52cb17cd6ecaf9e46ec0f0 (patch)
treedad70721d41cd9836cf2fc8d16a6b0a5e122e674 /desktop-widgets
parentfe926d35f421af4d671f53a794941e5f936bd14f (diff)
downloadsubsurface-3965ae2c89d30e424e52cb17cd6ecaf9e46ec0f0.tar.gz
desktop: move undo-disabling from enterEditState to disableShortcuts
When entering the edit state, we don't want the user to be able to undo/redo lest things become inconsistent. Since the only way to enter edit state is to edit the profile, we can simply use the disableShortcuts() function that is used by the profile when it goes into edit state. This has one desirable side-effect: Undo is now also disabled in the planner. Undo during planning likewise can lead to inconsistent state. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'desktop-widgets')
-rw-r--r--desktop-widgets/mainwindow.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/desktop-widgets/mainwindow.cpp b/desktop-widgets/mainwindow.cpp
index e1d87b7e6..bbeb61f70 100644
--- a/desktop-widgets/mainwindow.cpp
+++ b/desktop-widgets/mainwindow.cpp
@@ -710,6 +710,8 @@ void MainWindow::on_actionPrint_triggered()
void MainWindow::disableShortcuts(bool disablePaste)
{
+ undoAction->setEnabled(false);
+ redoAction->setEnabled(false);
ui.actionPreviousDC->setShortcut(QKeySequence());
ui.actionNextDC->setShortcut(QKeySequence());
ui.copy->setShortcut(QKeySequence());
@@ -719,6 +721,8 @@ void MainWindow::disableShortcuts(bool disablePaste)
void MainWindow::enableShortcuts()
{
+ undoAction->setEnabled(true);
+ redoAction->setEnabled(true);
ui.actionPreviousDC->setShortcut(Qt::Key_Left);
ui.actionNextDC->setShortcut(Qt::Key_Right);
ui.copy->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_C));
@@ -1090,8 +1094,6 @@ void MainWindow::on_actionViewAll_triggered()
void MainWindow::enterEditState()
{
- undoAction->setEnabled(false);
- redoAction->setEnabled(false);
stateBeforeEdit = state;
if (state == VIEWALL || state == INFO_MAXIMIZED)
return;
@@ -1115,8 +1117,6 @@ void MainWindow::enterEditState()
void MainWindow::exitEditState()
{
- undoAction->setEnabled(true);
- redoAction->setEnabled(true);
if (stateBeforeEdit == state)
return;
enterState(stateBeforeEdit);