diff options
Diffstat (limited to 'qml')
-rw-r--r-- | qml/ChatPage.qml | 2 | ||||
-rw-r--r-- | qml/ChatlistItem.qml | 55 | ||||
-rw-r--r-- | qml/ChatlistPage.qml | 3 |
3 files changed, 40 insertions, 20 deletions
diff --git a/qml/ChatPage.qml b/qml/ChatPage.qml index b830bc0..667e01d 100644 --- a/qml/ChatPage.qml +++ b/qml/ChatPage.qml @@ -56,6 +56,8 @@ Kirigami.ScrollablePage { function onIncomingMessage(accountId, chatId, msgId) { updateMessagelist(); console.log("Incoming message for chat " + chatId); + if(!chat.muted || chatId != 0 || chatId != root.chatId) + chat.notifyNewMess(); } function onMessagesChanged(accountId, chatId, msgId) { diff --git a/qml/ChatlistItem.qml b/qml/ChatlistItem.qml index 6e37331..f0db86d 100644 --- a/qml/ChatlistItem.qml +++ b/qml/ChatlistItem.qml @@ -14,8 +14,10 @@ Kirigami.AbstractListItem { property string avatarSource property string username property int freshMsgCnt + property int visibility property bool isContactRequest property bool isPinned + property bool isMuted RowLayout { Kirigami.Avatar { @@ -34,6 +36,16 @@ Kirigami.AbstractListItem { Menu { id: contextMenu + + Action { + text: !root.isMuted ? "Mute chat" : "Unmute chat" + onTriggered: { + if (!root.isMuted) + root.context.setChatMuteDuration(root.chatId, -1) + else + root.context.setChatMuteDuration(root.chatId, 0) + } + } Action { text: "Block chat" @@ -46,23 +58,13 @@ Kirigami.AbstractListItem { Action { icon.name: "pin" - text: "Pin chat" - onTriggered: root.context.setChatVisibility(root.chatId, 2) - } - - Action { - text: "Unpin chat" - onTriggered: root.context.setChatVisibility(root.chatId, 0) + text: !root.isPinned ? "Pin chat" : "Unpin chat" + onTriggered: !root.isPinned ? root.context.setChatVisibility(root.chatId, 2) : root.context.setChatVisibility(root.chatId, 0) } Action { - text: "Archive chat" - onTriggered: root.context.setChatVisibility(root.chatId, 1) - } - - Action { - text: "Unarchive chat" - onTriggered: root.context.setChatVisibility(root.chatId, 0) + text: root.visibility != 1 ? "Archive chat" : "Unarchive chat" + onTriggered: root.visibility != 1 ? root.context.setChatVisibility(root.chatId, 1) : root.context.setChatVisibility(root.chatId, 0) } Action { @@ -111,13 +113,26 @@ Kirigami.AbstractListItem { } - // Pinned message badge - Label { + // Twemoji + // Copyright 2020 Twitter, Inc and other contributors. + // Muted chat badge + Image { + visible: root.isMuted + source: "qrc:/res/muted_48x48.png" + sourceSize.width: 24 + sourceSize.height: 24 + Layout.bottomMargin: 13 + } + + // Twemoji + // Copyright 2020 Twitter, Inc and other contributors. + // Pinned chat badge + Image { visible: root.isPinned - text: "📌" - font.pixelSize: 20 - rightPadding: 15 - bottomPadding: 15 + source: "qrc:/res/pin_48x48.png" + sourceSize.width: 24 + sourceSize.height: 24 + Layout.bottomMargin: 13 } } diff --git a/qml/ChatlistPage.qml b/qml/ChatlistPage.qml index d7e66ae..713113a 100644 --- a/qml/ChatlistPage.qml +++ b/qml/ChatlistPage.qml @@ -63,6 +63,7 @@ Kirigami.ScrollablePage { "avatarSource": profileImage ? "file:" + profileImage : "", "chatName": chat.name, "freshMsgCnt": chatlistPage.context.getFreshMsgCnt(chatId), + "isMuted" : chat.muted, "isContactRequest": chat.isContactRequest, "visibility": chat.visibility }; @@ -149,6 +150,8 @@ Kirigami.ScrollablePage { username: model.username freshMsgCnt: model.freshMsgCnt isContactRequest: model.isContactRequest + isMuted: model.isMuted + visibility: model.visibility isPinned: model.visibility == 2 width: chatlist.width onClicked: chatClicked(model.chatId) |