aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mobile-widgets/qml/main.qml16
-rw-r--r--mobile-widgets/qmlmanager.cpp9
2 files changed, 16 insertions, 9 deletions
diff --git a/mobile-widgets/qml/main.qml b/mobile-widgets/qml/main.qml
index 931279b41..194391e9f 100644
--- a/mobile-widgets/qml/main.qml
+++ b/mobile-widgets/qml/main.qml
@@ -55,13 +55,17 @@ Kirigami.ApplicationWindow {
// notifications to show the notification text, but during initialization
// we instead dump the information into the textBlock below
if (initialized) {
- // make sure any old notification is hidden
- // hiding notifications is no longer supported????
- // hidePassiveNotification()
if (notificationText !== "") {
- // there's a risk that we have a >5 second gap in update events;
- // still, keep the timeout at 5s to avoid odd unchanging notifications
- showPassiveNotification(notificationText, 5000)
+ var actionEnd = notificationText.indexOf("]")
+ if (notificationText.startsWith("[") && actionEnd !== -1) {
+ // we have a notification text that starts with our special syntax to indication
+ // an action that the user can take (the actual action is always opening the context drawer
+ // so the action text should always be something that can then be found in the context drawer)
+ showPassiveNotification(notificationText.substring(actionEnd + 1), 5000, notificationText.substring(1,actionEnd),
+ function() { contextDrawer.open() })
+ } else {
+ showPassiveNotification(notificationText, 5000)
+ }
}
} else {
textBlock.text = textBlock.text + "\n" + notificationText
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");
}