2016-06-08 17:37:57 +01:00
|
|
|
/*
|
2020-08-17 10:48:10 +01:00
|
|
|
* SPDX-FileCopyrightText: 2016 Aleix Pol Gonzalez <aleixpol@kde.org>
|
2016-06-08 17:37:57 +01:00
|
|
|
*
|
2020-08-17 10:48:10 +01:00
|
|
|
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
2016-06-08 17:37:57 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
import QtQuick 2.2
|
2018-06-08 00:58:50 +01:00
|
|
|
import QtQuick.Controls 2.3
|
2016-06-08 17:37:57 +01:00
|
|
|
import QtQuick.Layouts 1.1
|
2020-05-01 23:18:22 +01:00
|
|
|
import org.kde.kirigami 2.12 as Kirigami
|
2016-06-08 17:37:57 +01:00
|
|
|
import org.kde.kdeconnect 1.0
|
|
|
|
|
2018-06-08 19:22:54 +01:00
|
|
|
Kirigami.ScrollablePage
|
2016-06-08 17:37:57 +01:00
|
|
|
{
|
2020-08-07 11:56:47 +01:00
|
|
|
id: root
|
|
|
|
|
2018-04-27 23:25:05 +01:00
|
|
|
Component {
|
|
|
|
id: deviceComp
|
|
|
|
DevicePage {}
|
|
|
|
}
|
|
|
|
|
2016-08-21 17:45:49 +01:00
|
|
|
objectName: "FindDevices"
|
2019-12-21 07:59:36 +00:00
|
|
|
title: i18nd("kdeconnect-app", "Pair")
|
2020-08-07 11:56:47 +01:00
|
|
|
supportsRefreshing: true
|
|
|
|
|
|
|
|
onRefreshingChanged: {
|
|
|
|
DaemonDbusInterface.forceOnNetworkChange()
|
|
|
|
refreshResetTimer.start()
|
|
|
|
}
|
|
|
|
|
|
|
|
Timer {
|
|
|
|
id: refreshResetTimer
|
|
|
|
interval: 1000
|
|
|
|
onTriggered: root.refreshing = false
|
|
|
|
}
|
2018-09-27 17:16:22 +01:00
|
|
|
|
2020-05-01 23:18:22 +01:00
|
|
|
Kirigami.PlaceholderMessage {
|
2019-12-21 07:59:36 +00:00
|
|
|
text: i18nd("kdeconnect-app", "No devices found")
|
2018-09-27 17:16:22 +01:00
|
|
|
anchors.centerIn: parent
|
|
|
|
visible: devices.count === 0
|
|
|
|
}
|
|
|
|
|
2018-06-08 19:22:54 +01:00
|
|
|
ListView {
|
2018-09-27 17:16:22 +01:00
|
|
|
id: devices
|
2018-06-08 19:22:54 +01:00
|
|
|
section {
|
|
|
|
property: "status"
|
2020-02-06 15:43:44 +00:00
|
|
|
delegate: Kirigami.ListSectionHeader {
|
2018-06-08 19:22:54 +01:00
|
|
|
text: switch (parseInt(section))
|
|
|
|
{
|
|
|
|
case DevicesModel.Paired:
|
2019-12-21 07:59:36 +00:00
|
|
|
return i18nd("kdeconnect-app", "Remembered")
|
2018-06-08 19:22:54 +01:00
|
|
|
case DevicesModel.Reachable:
|
2019-12-21 07:59:36 +00:00
|
|
|
return i18nd("kdeconnect-app", "Available")
|
2018-06-08 19:22:54 +01:00
|
|
|
case (DevicesModel.Reachable | DevicesModel.Paired):
|
2019-12-21 07:59:36 +00:00
|
|
|
return i18nd("kdeconnect-app", "Connected")
|
2016-06-08 17:37:57 +01:00
|
|
|
}
|
|
|
|
}
|
2018-06-08 19:22:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
model: DevicesSortProxyModel {
|
2018-11-26 21:08:42 +00:00
|
|
|
sourceModel: DevicesModel {}
|
2018-06-08 19:22:54 +01:00
|
|
|
}
|
|
|
|
delegate: Kirigami.BasicListItem {
|
|
|
|
icon: iconName
|
2019-02-08 16:40:47 +00:00
|
|
|
iconColor: "transparent"
|
2020-07-17 00:05:22 +01:00
|
|
|
label: display
|
|
|
|
subtitle: toolTip
|
2019-10-15 19:19:40 +01:00
|
|
|
highlighted: false
|
2018-06-08 19:22:54 +01:00
|
|
|
onClicked: {
|
|
|
|
pageStack.push(
|
|
|
|
deviceComp,
|
|
|
|
{currentDevice: device}
|
|
|
|
);
|
2016-06-08 17:37:57 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|