From 2936a854df9f1a1202fda08cd71773a95c727603 Mon Sep 17 00:00:00 2001 From: link2xt Date: Sat, 2 Oct 2021 23:30:45 +0000 Subject: Fix QML code style Mostly qmlformat, also rename root "id"s. --- qml/ChatlistItem.qml | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) (limited to 'qml/ChatlistItem.qml') diff --git a/qml/ChatlistItem.qml b/qml/ChatlistItem.qml index 284f9d2..d087f4b 100644 --- a/qml/ChatlistItem.qml +++ b/qml/ChatlistItem.qml @@ -1,11 +1,10 @@ +import DeltaChat 1.0 +import QtQml.Models 2.1 import QtQuick 2.12 import QtQuick.Controls 2.12 import QtQuick.Layouts 1.12 -import QtQml.Models 2.1 import org.kde.kirigami 2.13 as Kirigami -import DeltaChat 1.0 - Kirigami.AbstractListItem { id: root @@ -23,12 +22,14 @@ Kirigami.AbstractListItem { source: root.avatarSource name: root.chatName color: root.context.getChat(root.chatId).getColor() + MouseArea { anchors.fill: parent acceptedButtons: Qt.RightButton onClicked: { if (mouse.button === Qt.RightButton) - contextMenu.popup() + contextMenu.popup(); + } Menu { @@ -39,25 +40,32 @@ Kirigami.AbstractListItem { text: "Pin chat" onTriggered: root.context.setChatVisibility(root.chatId, 2) } + Action { text: "Unpin chat" onTriggered: 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) } + Action { icon.name: "delete" text: "Delete chat" onTriggered: root.context.deleteChat(root.chatId) } + } + } + } ColumnLayout { @@ -68,28 +76,29 @@ Kirigami.AbstractListItem { font.weight: Font.Bold Layout.fillWidth: true } + Label { text: root.username font: Kirigami.Theme.smallFont Layout.fillWidth: true } + } Label { text: root.isContactRequest ? "NEW" : root.freshMsgCnt visible: root.freshMsgCnt > 0 || root.isContactRequest - // Align label in the center of a badge. verticalAlignment: Text.AlignVCenter horizontalAlignment: Text.AlignHCenter - // Make sure badge is not too narrow. Layout.minimumWidth: height background: Rectangle { - color: Kirigami.Theme.alternateBackgroundColor - radius: 0.25 * height + color: Kirigami.Theme.alternateBackgroundColor + radius: 0.25 * height } + } // "Pinned" badge @@ -99,11 +108,15 @@ Kirigami.AbstractListItem { width: Kirigami.Units.gridUnit height: Kirigami.Units.gridUnit radius: 0.25 * height - Kirigami.Icon { + + Kirigami.Icon { source: "pin" height: Kirigami.Units.gridUnit width: Kirigami.Units.gridUnit } + } + } + } -- cgit v1.2.3-70-g09d2