summaryrefslogtreecommitdiffstats
path: root/mobile-widgets/qmlmanager.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2021-01-17 13:34:21 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2021-01-19 12:42:47 -0800
commit126329ab7c1b4062a4ba72c7cbac4ee703d65e3c (patch)
tree8730d1c916140cacf827797cbc741df5c98928dd /mobile-widgets/qmlmanager.cpp
parente1cb36843742e3ad901c5eac8cdeb007f406ed66 (diff)
downloadsubsurface-126329ab7c1b4062a4ba72c7cbac4ee703d65e3c.tar.gz
mobile/UI: add button to change notification
This is fun... with just a tiny bit of 'magic text parsing' we can allow the backend code to add a button to the notification that will open the context menu that will make it super obvious to the user how they can undo an operation. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'mobile-widgets/qmlmanager.cpp')
-rw-r--r--mobile-widgets/qmlmanager.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp
index 001edcb09..fddc61d3a 100644
--- a/mobile-widgets/qmlmanager.cpp
+++ b/mobile-widgets/qmlmanager.cpp
@@ -1407,11 +1407,14 @@ void QMLManager::saveChangesLocal(bool fromUndo)
Command::setClean();
updateHaveLocalChanges(true);
// provide a useful undo/redo notification
- QString msgFormat = tr("Changes saved:'%1'. %2 possible via context menu");
+ // NOTE: the QML UI interprets a leading '[action]' (where only the two brackets are checked for)
+ // as an indication to use the text between those two brackets as the label of a button that
+ // can be used to open the context menu
+ QString msgFormat = tr("[%1]Changes saved:'%2'.\n%1 possible via context menu");
if (fromUndo)
- setNotificationText(msgFormat.arg(tr("Undo: %1").arg(getRedoText())).arg(tr("Redo")));
+ setNotificationText(msgFormat.arg(tr("Redo")).arg(tr("Undo: %1").arg(getRedoText())));
else
- setNotificationText(msgFormat.arg(getUndoText()).arg(tr("Undo")));
+ setNotificationText(msgFormat.arg(tr("Undo")).arg(getUndoText()));
} else {
appendTextToLog("local save requested with no unsaved changes");
}