2018-10-30 20:01:13 +00:00
|
|
|
/**
|
2020-08-17 10:48:10 +01:00
|
|
|
* SPDX-FileCopyrightText: 2018 Aleix Pol Gonzalez <aleixpol@kde.org>
|
|
|
|
* SPDX-FileCopyrightText: 2018 Nicolas Fella <nicolas.fella@gmx.de>
|
|
|
|
* SPDX-FileCopyrightText: 2018 Simon Redman <simon@ergotech.com>
|
2018-10-30 20:01:13 +00: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
|
2018-10-30 20:01:13 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
import QtQuick 2.1
|
2019-12-19 22:18:11 +00:00
|
|
|
import org.kde.kirigami 2.6 as Kirigami
|
2018-10-30 20:01:13 +00:00
|
|
|
import org.kde.kdeconnect 1.0
|
2022-02-09 03:47:36 +00:00
|
|
|
import org.kde.kdeconnect.sms 1.0
|
2023-09-13 15:45:15 +01:00
|
|
|
import org.kde.kirigamiaddons.formcard 1.0 as FormCard
|
2018-10-30 20:01:13 +00:00
|
|
|
|
|
|
|
Kirigami.ApplicationWindow
|
|
|
|
{
|
|
|
|
id: root
|
|
|
|
visible: true
|
|
|
|
width: 800
|
|
|
|
height: 600
|
|
|
|
|
2022-05-12 19:34:24 +01:00
|
|
|
property alias devicesCount : instantiator.count
|
2022-02-09 03:47:36 +00:00
|
|
|
|
2022-05-12 19:34:24 +01:00
|
|
|
property var deviceActions : []
|
|
|
|
|
2022-02-09 03:47:36 +00:00
|
|
|
Component {
|
|
|
|
id: deviceActionComponent
|
|
|
|
Kirigami.Action {
|
2022-05-12 19:34:24 +01:00
|
|
|
required property string deviceId
|
|
|
|
required property string name
|
|
|
|
|
|
|
|
text: name
|
|
|
|
|
2022-02-09 03:47:36 +00:00
|
|
|
onTriggered: {
|
2022-05-30 21:29:17 +01:00
|
|
|
AppData.deviceId = deviceId
|
2022-02-09 03:47:36 +00:00
|
|
|
}
|
2022-05-30 21:29:17 +01:00
|
|
|
icon.name: AppData.deviceId === deviceId ? "checkmark" : ""
|
2022-02-09 03:47:36 +00:00
|
|
|
}
|
2022-05-12 19:34:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
Instantiator {
|
|
|
|
id: instantiator
|
|
|
|
|
2023-01-23 17:31:44 +00:00
|
|
|
model: DevicesPluginFilterProxyModel {
|
2022-05-12 19:34:24 +01:00
|
|
|
id: devicesModel
|
2023-01-23 17:31:44 +00:00
|
|
|
pluginFilter: "kdeconnect_sms"
|
2022-05-12 19:34:24 +01:00
|
|
|
sourceModel: DevicesModel { displayFilter: DevicesModel.Paired | DevicesModel.Reachable }
|
|
|
|
}
|
|
|
|
|
|
|
|
onObjectAdded: (idx, obj) => {
|
|
|
|
root.deviceActions.push(obj)
|
|
|
|
root.globalDrawer.actions[0].children = root.deviceActions
|
|
|
|
|
2022-05-30 21:29:17 +01:00
|
|
|
if (!AppData.deviceId) {
|
|
|
|
AppData.deviceId = obj.deviceId
|
2022-02-09 03:47:36 +00:00
|
|
|
}
|
|
|
|
}
|
2022-05-12 19:34:24 +01:00
|
|
|
|
|
|
|
onObjectRemoved: (idx, obj) => {
|
|
|
|
root.deviceActions.splice(idx, 1)
|
|
|
|
root.globalDrawer.actions[0].children = root.deviceActions
|
2022-02-09 03:47:36 +00:00
|
|
|
}
|
2022-05-12 19:34:24 +01:00
|
|
|
|
|
|
|
delegate: deviceActionComponent
|
2022-02-09 03:47:36 +00:00
|
|
|
}
|
|
|
|
|
2018-10-30 20:01:13 +00:00
|
|
|
pageStack.initialPage: ConversationList {
|
2019-12-21 07:59:36 +00:00
|
|
|
title: i18nd("kdeconnect-sms", "KDE Connect SMS")
|
2022-02-09 03:47:36 +00:00
|
|
|
devicesCount: root.devicesCount;
|
2018-10-30 20:01:13 +00:00
|
|
|
}
|
2019-12-19 22:18:11 +00:00
|
|
|
|
|
|
|
Component {
|
|
|
|
id: aboutPageComponent
|
2023-09-13 15:45:15 +01:00
|
|
|
FormCard.AboutPage {
|
|
|
|
aboutData: About
|
|
|
|
}
|
2019-12-19 22:18:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
globalDrawer: Kirigami.GlobalDrawer {
|
|
|
|
|
|
|
|
isMenu: true
|
|
|
|
|
|
|
|
actions: [
|
2022-02-09 03:47:36 +00:00
|
|
|
Kirigami.Action {
|
|
|
|
text: i18nd("kdeconnect-sms", "Devices")
|
|
|
|
icon.name: "phone"
|
|
|
|
visible: devicesCount > 1
|
|
|
|
},
|
|
|
|
Kirigami.Action {
|
|
|
|
text: i18nd("kdeconnect-sms", "Refresh")
|
|
|
|
icon.name: "view-refresh"
|
|
|
|
enabled: devicesCount > 0
|
|
|
|
onTriggered: {
|
|
|
|
pageStack.initialPage.conversationListModel.refresh();
|
|
|
|
}
|
|
|
|
},
|
2019-12-19 22:18:11 +00:00
|
|
|
Kirigami.Action {
|
2021-06-10 19:33:28 +01:00
|
|
|
text: i18nd("kdeconnect-sms", "About")
|
2019-12-19 22:18:11 +00:00
|
|
|
icon.name: "help-about"
|
|
|
|
onTriggered: {
|
2021-06-10 19:33:28 +01:00
|
|
|
if (applicationWindow().pageStack.layers.depth < 2) {
|
2023-09-13 15:45:15 +01:00
|
|
|
applicationWindow().pageStack.layers.push(aboutPageComponent)
|
2021-06-10 19:33:28 +01:00
|
|
|
}
|
2019-12-19 22:18:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
2018-10-30 20:01:13 +00:00
|
|
|
}
|