From d9bc25803d66915a45288787a3b90b1119db696e Mon Sep 17 00:00:00 2001 From: link2xt Date: Mon, 1 Mar 2021 00:24:46 +0300 Subject: chatlist: pin, unpin, archive and delete chats --- qml/ChatlistPage.qml | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/qml/ChatlistPage.qml b/qml/ChatlistPage.qml index a025015..7b7aeff 100644 --- a/qml/ChatlistPage.qml +++ b/qml/ChatlistPage.qml @@ -140,6 +140,41 @@ Kirigami.Page { visible: model.freshMsgCnt > 0 verticalAlignment: Text.AlignVCenter } + + MouseArea { + anchors.fill: parent + + acceptedButtons: Qt.LeftButton | Qt.RightButton + onClicked: { + if (mouse.button === Qt.RightButton) + contextMenu.popup() + } + onPressAndHold: { + if (mouse.source === Qt.MouseEventNotSynthesized) + contextMenu.popup() + } + + Menu { + id: contextMenu + + Action { + text: "Pin chat" + onTriggered: chatlistPage.context.setChatVisibility(model.chatId, 2) + } + Action { + text: "Unpin chat" + onTriggered: chatlistPage.context.setChatVisibility(model.chatId, 0) + } + Action { + text: "Archive chat" + onTriggered: chatlistPage.context.setChatVisibility(model.chatId, 1) + } + Action { + text: "Delete chat" + onTriggered: chatlistPage.context.deleteChat(model.chatId) + } + } + } } ScrollBar.vertical: ScrollBar {} -- cgit v1.2.3-70-g09d2