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', {room: root.room, connection: root.connection}, { title: i18n("Room Settings") })
0048         }
0049     ]
0050 
0051     Loader {
0052         id: drawerItemLoader
0053         width: parent.width
0054         height: parent.height
0055         sourceComponent: roomInformation
0056     }
0057 
0058     Component {
0059         id: roomInformation
0060         RoomInformation {
0061             room: root.room
0062             connection: root.connection
0063         }
0064     }
0065 
0066     Component {
0067         id: roomMedia
0068         RoomMedia {
0069             currentRoom: root.room
0070             connection: root.connection
0071         }
0072     }
0073 
0074     footer: Kirigami.NavigationTabBar {
0075         id: navigationBar
0076         visible: !root.room.isSpace
0077         Kirigami.Theme.colorSet: Kirigami.Theme.Window
0078         Kirigami.Theme.inherit: false
0079 
0080         actions: [
0081             Kirigami.Action {
0082                 id: infoAction
0083                 text: i18n("Information")
0084                 icon.name: "documentinfo"
0085                 onTriggered: drawerItemLoader.sourceComponent = roomInformation
0086             },
0087             Kirigami.Action {
0088                 text: i18n("Media")
0089                 icon.name: "mail-attachment-symbollic"
0090                 onTriggered: drawerItemLoader.sourceComponent = roomMedia
0091             }
0092         ]
0093     }
0094 
0095     Connections {
0096         target: applicationWindow().pageStack
0097         onWideModeChanged: {
0098             if (applicationWindow().pageStack.wideMode) {
0099                 console.log("widemode pop")
0100                 applicationWindow().pageStack.pop()
0101             }
0102         }
0103     }
0104 
0105     onBackRequested: event => {
0106         event.accepted = true;
0107         applicationWindow().pageStack.pop()
0108     }
0109 }