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
|
|
|
*/
|
|
|
|
|
2023-12-23 16:48:04 +00:00
|
|
|
import QtQuick
|
|
|
|
import QtQuick.Controls
|
|
|
|
import QtQuick.Layouts
|
|
|
|
import org.kde.kirigami as Kirigami
|
|
|
|
import org.kde.kdeconnect
|
2016-06-08 17:37:57 +01:00
|
|
|
|
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"
|
2023-07-22 18:58:18 +01:00
|
|
|
title: i18ndc("kdeconnect-app", "Title of the page listing the devices", "Devices")
|
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
|
|
|
|
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 {
|
2023-12-23 16:42:50 +00:00
|
|
|
|
|
|
|
width: ListView.view.width
|
|
|
|
|
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
|
|
|
}
|
2024-03-05 20:50:45 +00:00
|
|
|
Kirigami.PlaceholderMessage {
|
|
|
|
text: i18nd("kdeconnect-app", "No devices found")
|
2024-10-05 20:19:35 +01:00
|
|
|
icon.name: 'edit-none-symbolic'
|
2024-03-05 20:50:45 +00:00
|
|
|
anchors.centerIn: parent
|
|
|
|
visible: devices.count === 0
|
|
|
|
}
|
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
|
|
|
}
|
2023-11-14 22:48:56 +00:00
|
|
|
delegate: ItemDelegate {
|
|
|
|
id: delegate
|
|
|
|
icon.name: iconName
|
|
|
|
text: model.name
|
|
|
|
width: ListView.view.width
|
2019-10-15 19:19:40 +01:00
|
|
|
highlighted: false
|
2023-11-14 22:48:56 +00:00
|
|
|
|
|
|
|
contentItem: Kirigami.IconTitleSubtitle {
|
|
|
|
title: delegate.text
|
|
|
|
subtitle: toolTip
|
|
|
|
icon: icon.fromControlsIcon(delegate.icon)
|
|
|
|
}
|
|
|
|
|
2018-06-08 19:22:54 +01:00
|
|
|
onClicked: {
|
|
|
|
pageStack.push(
|
|
|
|
deviceComp,
|
|
|
|
{currentDevice: device}
|
|
|
|
);
|
2016-06-08 17:37:57 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|