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
This commit is contained in:
Tobias Fella
2024-01-05 17:58:02 +01:00
parent dcc1935150
commit 4926488d49
3 changed files with 46 additions and 26 deletions

View File

@@ -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()

View File

@@ -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

View File

@@ -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")})
}
}
}
}