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

0001 /*
0002  * SPDX-FileCopyrightText: 2016 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
0009 import QtQuick.Layouts
0010 import org.kde.kirigami as Kirigami
0011 import org.kde.kdeconnect
0012 
0013 Kirigami.ScrollablePage
0014 {
0015     id: root
0016 
0017     Component {
0018         id: deviceComp
0019         DevicePage {}
0020     }
0021 
0022     objectName: "FindDevices"
0023     title: i18ndc("kdeconnect-app", "Title of the page listing the devices", "Devices")
0024     supportsRefreshing: true
0025 
0026     onRefreshingChanged: {
0027         DaemonDbusInterface.forceOnNetworkChange()
0028         refreshResetTimer.start()
0029     }
0030 
0031     Timer {
0032         id: refreshResetTimer
0033         interval: 1000
0034         onTriggered: root.refreshing = false
0035     }
0036 
0037     Kirigami.PlaceholderMessage {
0038         text: i18nd("kdeconnect-app", "No devices found")
0039         anchors.centerIn: parent
0040         visible: devices.count === 0
0041     }
0042 
0043     ListView {
0044         id: devices
0045         section {
0046             property: "status"
0047             delegate: Kirigami.ListSectionHeader {
0048 
0049                 width: ListView.view.width
0050 
0051                 text: switch (parseInt(section))
0052                 {
0053                     case DevicesModel.Paired:
0054                         return i18nd("kdeconnect-app", "Remembered")
0055                     case DevicesModel.Reachable:
0056                         return i18nd("kdeconnect-app", "Available")
0057                     case (DevicesModel.Reachable | DevicesModel.Paired):
0058                         return i18nd("kdeconnect-app", "Connected")
0059                 }
0060             }
0061         }
0062 
0063         model: DevicesSortProxyModel {
0064             sourceModel: DevicesModel {}
0065         }
0066         delegate: ItemDelegate {
0067             id: delegate
0068             icon.name: iconName
0069             icon.color: "transparent"
0070             text: model.name
0071             width: ListView.view.width
0072             highlighted: false
0073 
0074             contentItem: Kirigami.IconTitleSubtitle {
0075                 title: delegate.text
0076                 subtitle: toolTip
0077                 icon: icon.fromControlsIcon(delegate.icon)
0078             }
0079 
0080             onClicked: {
0081                 pageStack.push(
0082                     deviceComp,
0083                     {currentDevice: device}
0084                 );
0085             }
0086         }
0087     }
0088 }