Add Presence.saved_status option
Controls how many previous status to keep saved in account menues, see previous commit.
This commit is contained in:
parent
3402a1d5f8
commit
86c0cb1bf2
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user