From 4926488d498e5703dca848ad137388888f8caba8 Mon Sep 17 00:00:00 2001 From: Tobias Fella Date: Fri, 5 Jan 2024 17:58:02 +0100 Subject: [PATCH] Move notifications button to space drawer. Since this means that the space drawer can no longer be hidden when there are no spaces, also make it less empty by adding a button for creating new spaces. More things will come in the future. BUG: 479051 --- src/qml/AvatarTabButton.qml | 2 +- src/qml/RoomListPage.qml | 18 ------------- src/qml/SpaceDrawer.qml | 52 ++++++++++++++++++++++++++++++++----- 3 files changed, 46 insertions(+), 26 deletions(-) diff --git a/src/qml/AvatarTabButton.qml b/src/qml/AvatarTabButton.qml index f2f131f7f..067714147 100644 --- a/src/qml/AvatarTabButton.qml +++ b/src/qml/AvatarTabButton.qml @@ -13,7 +13,7 @@ import org.kde.kirigamiaddons.labs.components as KirigamiComponents Delegates.RoundedItemDelegate { id: root - required property url source + property url source signal contextMenuRequested() signal selected() diff --git a/src/qml/RoomListPage.qml b/src/qml/RoomListPage.qml index 15b181de9..fa8826fcf 100644 --- a/src/qml/RoomListPage.qml +++ b/src/qml/RoomListPage.qml @@ -129,24 +129,6 @@ Kirigami.Page { topMargin: Math.round(Kirigami.Units.smallSpacing / 2) - KirigamiComponents.FloatingButton { - icon.name: "notifications" - text: i18n("View notifications") - anchors.right: parent.right - anchors.rightMargin: Kirigami.Units.largeSpacing - anchors.bottom: parent.bottom - anchors.bottomMargin: Kirigami.Units.largeSpacing - width: Kirigami.Units.gridUnit * 2 - height: width - visible: !root.collapsed - QQC2.ToolTip.text: text - QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay - QQC2.ToolTip.visible: hovered - onClicked: pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/NotificationsView.qml", {connection: root.connection}, { - title: i18nc("@title", "Notifications") - }); - } - header: QQC2.ItemDelegate { width: visible ? ListView.view.width : 0 height: visible ? Kirigami.Units.gridUnit * 2 : 0 diff --git a/src/qml/SpaceDrawer.qml b/src/qml/SpaceDrawer.qml index 7b784f6ab..1bed19a5f 100644 --- a/src/qml/SpaceDrawer.qml +++ b/src/qml/SpaceDrawer.qml @@ -14,8 +14,6 @@ QQC2.Control { id: root readonly property real pinnedWidth: Kirigami.Units.gridUnit * 6 - property bool drawerEnabled: true - required property NeoChatConnection connection leftPadding: 0 @@ -27,7 +25,6 @@ QQC2.Control { contentItem: Loader { id: sidebarColumn - active: root.drawerEnabled z: 0 sourceComponent: ColumnLayout { @@ -52,6 +49,30 @@ QQC2.Control { width: scrollView.width spacing: 0 + AvatarTabButton { + id: notificationsButton + + Layout.fillWidth: true + Layout.preferredHeight: width - Kirigami.Units.smallSpacing + Layout.maximumHeight: width - Kirigami.Units.smallSpacing + Layout.topMargin: Kirigami.Units.smallSpacing / 2 + Layout.bottomMargin: Kirigami.Units.smallSpacing / 2 + text: i18n("View notifications") + contentItem: Kirigami.Icon { + source: "notifications" + } + + onClicked: pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/NotificationsView.qml", {connection: root.connection}, { + title: i18nc("@title", "Notifications") + }); + } + + Kirigami.Separator { + Layout.fillWidth: true + Layout.leftMargin: Kirigami.Units.smallSpacing + Layout.rightMargin: Kirigami.Units.smallSpacing + } + AvatarTabButton { id: allRoomButton @@ -61,8 +82,6 @@ QQC2.Control { Layout.topMargin: Kirigami.Units.smallSpacing / 2 text: i18n("All Rooms") - source: "globe" - contentItem: Kirigami.Icon { source: "globe" } @@ -78,12 +97,10 @@ QQC2.Control { } } onCountChanged: { - root.enabled = count > 0 if (!root.connection.room(root.selectedSpaceId)) { root.selectedSpaceId = "" } } - Component.onCompleted: root.enabled = count > 0 delegate: AvatarTabButton { id: spaceDelegate @@ -105,6 +122,27 @@ QQC2.Control { onContextMenuRequested: root.createContextMenu(currentRoom) } } + + Kirigami.Separator { + Layout.fillWidth: true + Layout.topMargin: Kirigami.Units.smallSpacing / 2 + Layout.bottomMargin: Kirigami.Units.smallSpacing / 2 + Layout.leftMargin: Kirigami.Units.smallSpacing + Layout.rightMargin: Kirigami.Units.smallSpacing + } + + AvatarTabButton { + Layout.fillWidth: true + Layout.preferredHeight: width - Kirigami.Units.smallSpacing + Layout.maximumHeight: width - Kirigami.Units.smallSpacing + + text: i18n("Create a space") + contentItem: Kirigami.Icon { + source: "list-add" + } + onClicked: pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/CreateRoomDialog.qml", {connection: root.connection, isSpace: true, title: i18nc("@title", "Create a Space")}, {title: i18nc("@title", "Create a Space")}) + + } } } }