Warning, /network/kdeconnect-kde/smsapp/qml/Main.qml is written in an unsupported language. File is not indexed.
0001 /** 0002 * SPDX-FileCopyrightText: 2018 Aleix Pol Gonzalez <aleixpol@kde.org> 0003 * SPDX-FileCopyrightText: 2018 Nicolas Fella <nicolas.fella@gmx.de> 0004 * SPDX-FileCopyrightText: 2018 Simon Redman <simon@ergotech.com> 0005 * 0006 * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0007 */ 0008 0009 import QtQuick 0010 import org.kde.kirigami as Kirigami 0011 import org.kde.kdeconnect 0012 import org.kde.kdeconnect.sms 0013 import org.kde.kirigamiaddons.formcard as FormCard 0014 0015 Kirigami.ApplicationWindow 0016 { 0017 id: root 0018 visible: true 0019 width: 800 0020 height: 600 0021 0022 property alias devicesCount : instantiator.count 0023 0024 property var deviceActions : [] 0025 0026 Component { 0027 id: deviceActionComponent 0028 Kirigami.Action { 0029 required property string deviceId 0030 required property string name 0031 0032 text: name 0033 0034 onTriggered: { 0035 AppData.deviceId = deviceId 0036 } 0037 icon.name: AppData.deviceId === deviceId ? "checkmark" : "" 0038 } 0039 } 0040 0041 Instantiator { 0042 id: instantiator 0043 0044 model: DevicesPluginFilterProxyModel { 0045 id: devicesModel 0046 pluginFilter: "kdeconnect_sms" 0047 sourceModel: DevicesModel { displayFilter: DevicesModel.Paired | DevicesModel.Reachable } 0048 } 0049 0050 onObjectAdded: (idx, obj) => { 0051 root.deviceActions.push(obj) 0052 root.globalDrawer.actions[0].children = root.deviceActions 0053 0054 if (!AppData.deviceId) { 0055 AppData.deviceId = obj.deviceId 0056 } 0057 } 0058 0059 onObjectRemoved: (idx, obj) => { 0060 root.deviceActions.splice(idx, 1) 0061 root.globalDrawer.actions[0].children = root.deviceActions 0062 } 0063 0064 delegate: deviceActionComponent 0065 } 0066 0067 pageStack.initialPage: ConversationList { 0068 title: i18nd("kdeconnect-sms", "KDE Connect SMS") 0069 devicesCount: root.devicesCount; 0070 } 0071 0072 Component { 0073 id: aboutPageComponent 0074 FormCard.AboutPage { 0075 aboutData: About 0076 } 0077 } 0078 0079 globalDrawer: Kirigami.GlobalDrawer { 0080 0081 isMenu: true 0082 0083 actions: [ 0084 Kirigami.Action { 0085 text: i18nd("kdeconnect-sms", "Devices") 0086 icon.name: "phone" 0087 visible: devicesCount > 1 0088 }, 0089 Kirigami.Action { 0090 text: i18nd("kdeconnect-sms", "Refresh") 0091 icon.name: "view-refresh" 0092 enabled: devicesCount > 0 0093 onTriggered: { 0094 pageStack.initialPage.conversationListModel.refresh(); 0095 } 0096 }, 0097 Kirigami.Action { 0098 text: i18nd("kdeconnect-sms", "About") 0099 icon.name: "help-about" 0100 onTriggered: { 0101 if (applicationWindow().pageStack.layers.depth < 2) { 0102 applicationWindow().pageStack.layers.push(aboutPageComponent) 0103 } 0104 } 0105 } 0106 ] 0107 } 0108 0109 }