diff --git a/TODO.md b/TODO.md index 83308ec5..44be0469 100644 --- a/TODO.md +++ b/TODO.md @@ -17,6 +17,8 @@ - When qml syntax highlighting supports ES6 string interpolation, use them - Fixes + - Restore previous focus after right click + - Reloading config files (cache) - Run import in thread and AsyncClient.olm functions, they block async loop - Handle import keys errors diff --git a/src/icons/light-thin/room-leave.svg b/src/icons/light-thin/room-leave.svg new file mode 100644 index 00000000..56e6478d --- /dev/null +++ b/src/icons/light-thin/room-leave.svg @@ -0,0 +1,66 @@ + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/src/qml/Base/HMenu.qml b/src/qml/Base/HMenu.qml index b9632a8e..75595cbc 100644 --- a/src/qml/Base/HMenu.qml +++ b/src/qml/Base/HMenu.qml @@ -2,4 +2,28 @@ import QtQuick 2.12 import QtQuick.Controls 2.12 Menu { + id: menu + padding: theme.controls.menu.borderWidth + + implicitWidth: { + let result = 0 + let leftPadding = 0 + let rightPadding = 0 + + for (let i = 0; i < count; ++i) { + let item = itemAt(i) + result = Math.max(item.contentItem.implicitWidth, result) + leftPadding = Math.max(item.leftPadding, leftPadding) + rightPadding = Math.max(item.rightPadding, rightPadding) + } + return Math.min( + result + leftPadding + rightPadding, theme.minimumSupportedWidth + ) + } + + background: HRectangle { + color: "transparent" + border.color: theme.controls.menu.border + border.width: theme.controls.menu.borderWidth + } } diff --git a/src/qml/Base/HMenuItem.qml b/src/qml/Base/HMenuItem.qml index 0aafb816..9d2b6cb7 100644 --- a/src/qml/Base/HMenuItem.qml +++ b/src/qml/Base/HMenuItem.qml @@ -4,10 +4,10 @@ import QtQuick.Controls 2.12 MenuItem { id: menuItem spacing: theme.spacing - leftPadding: spacing / 1.5 - rightPadding: spacing / 1.5 - topPadding: spacing / 2 - bottomPadding: spacing / 2 + leftPadding: spacing + rightPadding: spacing + topPadding: spacing / 1.5 + bottomPadding: spacing / 1.5 readonly property alias iconItem: contentItem.icon @@ -23,5 +23,6 @@ MenuItem { id: contentItem button: menuItem buttonTheme: theme.controls.menuItem + label.horizontalAlignment: Label.AlignLeft } } diff --git a/src/qml/SidePane/DelegateRoom.qml b/src/qml/SidePane/DelegateRoom.qml index 1e2ea1f9..4440700a 100644 --- a/src/qml/SidePane/DelegateRoom.qml +++ b/src/qml/SidePane/DelegateRoom.qml @@ -78,7 +78,8 @@ HTileDelegate { contextMenu: HMenu { HMenuItem { - text: invited ? qsTr("&Decline invite") : qsTr("&Leave") + icon.name: invited ? "invite-decline" : "room-leave" + text: invited ? qsTr("Decline invite") : qsTr("Leave") onTriggered: py.callClientCoro( model.user_id, "room_leave", [model.data.room_id] ) diff --git a/src/themes/Default.qpl b/src/themes/Default.qpl index 04f573fa..7eb818ce 100644 --- a/src/themes/Default.qpl +++ b/src/themes/Default.qpl @@ -96,6 +96,10 @@ controls: color pressedOverlay: hsluv(0, 0, 50, 0.6) color checkedOverlay: colors.accentBackground + menu: + color border: "black" + real borderWidth: 2 + menuItem: color background: controls.button.background color text: controls.button.text