Add room bookmarking: bookmarks are always on top

Introduce a bookmark system for rooms:
a room bookmarked will always appear on top of every other
(for a given account).

Bookmarking can be done through context menu on targeted room
(as well as un-bookmarking) or through settings.json
(key roomBookmarkIDs) for permanent bookmark.
roomBookmarkIds is a {account_user_id: [room_id]} dict.
This commit is contained in:
koudja
2020-10-16 23:36:59 +02:00
committed by miruka
parent 38360b101a
commit 52b0bb18cb
6 changed files with 37 additions and 1 deletions

View File

@@ -63,7 +63,9 @@ HTile {
spacing: room.spacing
TitleLabel {
text: model.display_name || qsTr("Empty room")
text:
(model.bookmarked ? "\u2665 " : "") +
(model.display_name || qsTr("Empty room"))
color:
model.local_unreads ?
theme.mainPane.listView.room.unreadName :
@@ -150,6 +152,14 @@ HTile {
})
}
HMenuItem {
icon.name: model.bookmarked ? "bookmark-remove": "bookmark-add"
text: model.bookmarked ? qsTr("Remove bookmark"): qsTr("Bookmark")
onTriggered: py.callClientCoro(
model.for_account, "toggle_bookmark", [model.id]
)
}
HMenuItem {
icon.name: "copy-room-id"
text: qsTr("Copy room ID")