Warning, /network/neochat/src/qml/RoomDrawerPage.qml is written in an unsupported language. File is not indexed.

0001 // SPDX-FileCopyrightText: 2023 James Graham <james.h.graham@protonmail.com>
0002 // SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0003 
0004 import QtQuick
0005 import QtQuick.Layouts
0006 
0007 import org.kde.kirigami as Kirigami
0008 import org.kde.kitemmodels
0009 
0010 import org.kde.neochat
0011 
0012 /**
0013  * @brief Page for holding a room drawer component.
0014  *
0015  * This the companion component to RoomDrawer and is designed to be used on mobile
0016  * where we want the room drawer to be pushed as a page as thin drawer doesn't
0017  * look good.
0018  *
0019  * @sa RoomDrawer
0020  */
0021 Kirigami.Page {
0022     id: root
0023 
0024     /**
0025      * @brief The current room that user is viewing.
0026      */
0027     readonly property NeoChatRoom room: RoomManager.currentRoom
0028     required property NeoChatConnection connection
0029 
0030     title: drawerItemLoader.item ? drawerItemLoader.item.title : ""
0031 
0032     topPadding: 0
0033     bottomPadding: 0
0034     leftPadding: 0
0035     rightPadding: 0
0036 
0037     Kirigami.Theme.colorSet: Kirigami.Theme.View
0038     Kirigami.Theme.inherit: false
0039 
0040     Component.onCompleted: infoAction.toggle()
0041 
0042     actions: [
0043         Kirigami.Action {
0044             displayHint: Kirigami.DisplayHint.IconOnly
0045             text: i18n("Settings")
0046             icon.name: "settings-configure"
0047             onTriggered: applicationWindow().pageStack.pushDialogLayer('qrc:/org/kde/neochat/qml/Categories.qml', {
0048                 room: root.room,
0049                 connection: root.connection
0050             }, {
0051                 title: i18n("Room Settings")
0052             })
0053         }
0054     ]
0055 
0056     Loader {
0057         id: drawerItemLoader
0058         width: parent.width
0059         height: parent.height
0060         sourceComponent: roomInformation
0061     }
0062 
0063     Component {
0064         id: roomInformation
0065         RoomInformation {
0066             room: root.room
0067             connection: root.connection
0068         }
0069     }
0070 
0071     Component {
0072         id: roomMedia
0073         RoomMedia {
0074             currentRoom: root.room
0075             connection: root.connection
0076         }
0077     }
0078 
0079     footer: Kirigami.NavigationTabBar {
0080         id: navigationBar
0081         visible: !root.room.isSpace
0082         Kirigami.Theme.colorSet: Kirigami.Theme.Window
0083         Kirigami.Theme.inherit: false
0084 
0085         actions: [
0086             Kirigami.Action {
0087                 id: infoAction
0088                 text: i18n("Information")
0089                 icon.name: "documentinfo"
0090                 onTriggered: drawerItemLoader.sourceComponent = roomInformation
0091             },
0092             Kirigami.Action {
0093                 text: i18n("Media")
0094                 icon.name: "mail-attachment-symbollic"
0095                 onTriggered: drawerItemLoader.sourceComponent = roomMedia
0096             }
0097         ]
0098     }
0099 
0100     Connections {
0101         target: applicationWindow().pageStack
0102         onWideModeChanged: {
0103             if (applicationWindow().pageStack.wideMode) {
0104                 console.log("widemode pop");
0105                 applicationWindow().pageStack.pop();
0106             }
0107         }
0108     }
0109 
0110     onBackRequested: event => {
0111         event.accepted = true;
0112         applicationWindow().pageStack.pop();
0113     }
0114 }