diff --git a/src/config/settings.py b/src/config/settings.py index 88e2bb4a..87d06942 100644 --- a/src/config/settings.py +++ b/src/config/settings.py @@ -49,6 +49,10 @@ class Presence: # This currently only works on Linux X11. auto_away_after: int = 60 * 10 + # Number of previously set status messages to keep saved. Available for + # quick access in the context menu when right-clicking an account. + saved_status: int = 5 + class Notifications: # Default global notification level when starting the application. # Allows muting (i.e. preventing desktop bubbles, sounds and flashes) diff --git a/src/gui/MainPane/AccountContextMenu.qml b/src/gui/MainPane/AccountContextMenu.qml index 57332cdf..de854ad3 100644 --- a/src/gui/MainPane/AccountContextMenu.qml +++ b/src/gui/MainPane/AccountContextMenu.qml @@ -20,6 +20,14 @@ HMenu { py.callClientCoro(userId, "set_presence", [presence, statusMsg]) } + function resizeStatusList() { + if (statusRepeater.count <= window.settings.Presence.saved_status) + return + + statusRepeater.items.length = window.settings.Presence.saved_status + statusRepeater.itemsChanged() + } + function statusFieldApply(newStatus=null) { if (newStatus === null) newStatus = statusField.editText.trim() @@ -28,7 +36,7 @@ HMenu { if (existing !== -1) statusRepeater.items.splice(existing, 1) statusRepeater.items.unshift(newStatus) - statusRepeater.items.length = Math.min(statusRepeater.count, 5) + resizeStatusList() statusRepeater.itemsChanged() window.saveState(statusRepeater) } @@ -38,6 +46,7 @@ HMenu { } onOpened: statusField.forceActiveFocus() + Component.onCompleted: resizeStatusList() HLabeledItem { id: statusMsgLabel