Warning, /network/kdeconnect-kde/app/qml/Main.qml is written in an unsupported language. File is not indexed.

0001 /*
0002  * SPDX-FileCopyrightText: 2015 Aleix Pol Gonzalez <aleixpol@kde.org>
0003  *
0004  * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0005  */
0006 
0007 import QtQuick
0008 import QtQuick.Controls as QQC2
0009 import QtQuick.Layouts
0010 import org.kde.kirigami as Kirigami
0011 import org.kde.kdeconnect
0012 
0013 Kirigami.ApplicationWindow {
0014     id: root
0015     property int columnWidth: Kirigami.Units.gridUnit * 13
0016     minimumWidth: Kirigami.Units.gridUnit * 15
0017     minimumHeight: Kirigami.Units.gridUnit * 15
0018     wideScreen: width > columnWidth * 5
0019     pageStack.globalToolBar.canContainHandles: true
0020     pageStack.globalToolBar.showNavigationButtons: applicationWindow().pageStack.currentIndex > 0 ? Kirigami.ApplicationHeaderStyle.ShowBackButton : 0
0021 
0022     globalDrawer: Kirigami.OverlayDrawer {
0023         id: drawer
0024         edge: Qt.application.layoutDirection === Qt.RightToLeft ? Qt.RightEdge : Qt.LeftEdge
0025         modal: Kirigami.Settings.isMobile || (applicationWindow().width < Kirigami.Units.gridUnit * 50 && !collapsed) // Only modal when not collapsed, otherwise collapsed won't show.
0026         width: Kirigami.Units.gridUnit * 16
0027         onModalChanged: drawerOpen = !modal
0028 
0029         Behavior on width {
0030             NumberAnimation {
0031                 duration: Kirigami.Units.longDuration
0032                 easing.type: Easing.InOutQuad
0033             }
0034         }
0035         Kirigami.Theme.colorSet: Kirigami.Theme.Window
0036 
0037         handleClosedIcon.source: modal ? null : "sidebar-expand-left"
0038         handleOpenIcon.source: modal ? null : "sidebar-collapse-left"
0039         handleVisible: modal
0040 
0041         leftPadding: 0
0042         rightPadding: 0
0043         topPadding: 0
0044         bottomPadding: 0
0045 
0046         contentItem: ColumnLayout {
0047             spacing: 0
0048 
0049             QQC2.ToolBar {
0050                 Layout.fillWidth: true
0051                 Layout.preferredHeight: pageStack.globalToolBar.preferredHeight
0052 
0053                 leftPadding: Kirigami.Units.largeSpacing
0054                 rightPadding: Kirigami.Units.largeSpacing
0055                 topPadding: Kirigami.Units.smallSpacing
0056                 bottomPadding: Kirigami.Units.smallSpacing
0057 
0058                 contentItem: Kirigami.Heading {
0059                     text: announcedNameProperty.value
0060                     elide: Qt.ElideRight
0061 
0062                     DBusProperty {
0063                         id: announcedNameProperty
0064                         object: DaemonDbusInterface
0065                         read: "announcedName"
0066                         defaultValue: ""
0067                     }
0068                 }
0069             }
0070 
0071             QQC2.ItemDelegate {
0072                 id: findDevicesAction
0073                 text: i18nd("kdeconnect-app", "Find devices...")
0074                 icon.name: "list-add"
0075                 checked: pageStack.currentItem && pageStack.currentItem.objectName == "FindDevices"
0076                 Layout.fillWidth: true
0077 
0078                 onClicked: {
0079                     root.pageStack.clear()
0080                     root.pageStack.push(Qt.resolvedUrl("FindDevicesPage.qml"));
0081                 }
0082             }
0083 
0084             Kirigami.Separator {
0085                 Layout.fillWidth: true
0086             }
0087 
0088             Repeater {
0089                 model: DevicesSortProxyModel {
0090                     sourceModel: DevicesModel {
0091                         displayFilter: DevicesModel.Paired | DevicesModel.Reachable
0092                     }
0093                 }
0094 
0095                 QQC2.ItemDelegate {
0096                     Layout.fillWidth: true
0097                     contentItem: Kirigami.IconTitleSubtitle {
0098                         icon.name: model.iconName
0099                         icon.width: Kirigami.Units.iconSizes.smallMedium
0100                         title: model.name
0101                         subtitle: model.toolTip
0102                     }
0103 
0104                     enabled: status & DevicesModel.Reachable
0105                     checked: pageStack.currentItem && pageStack.currentItem.currentDevice == device
0106                     onClicked: {
0107                         root.pageStack.clear()
0108                         root.pageStack.push(
0109                             Qt.resolvedUrl("DevicePage.qml"),
0110                             {currentDevice: device}
0111                         );
0112                     }
0113                 }
0114             }
0115 
0116             Item {
0117                 Layout.fillHeight: true
0118                 Layout.fillWidth: true
0119             }
0120 
0121             QQC2.ItemDelegate {
0122                 text: i18n("Settings")
0123                 icon.name: "settings-configure"
0124                 Layout.fillWidth: true
0125                 onClicked: pageStack.pushDialogLayer(Qt.resolvedUrl("Settings.qml"), {}, {
0126                     title: i18n("Settings"),
0127                 });
0128             }
0129         }
0130     }
0131 
0132     contextDrawer: Kirigami.ContextDrawer {
0133         id: contextDrawer
0134     }
0135 
0136     pageStack.initialPage: Qt.resolvedUrl("FindDevicesPage.qml")
0137 }