2023-11-30 23:41:36 +00:00
|
|
|
/**
|
|
|
|
* SPDX-FileCopyrightText: 2014 Aleix Pol Gonzalez <aleixpol@kde.org>
|
2024-06-30 23:03:57 +01:00
|
|
|
* SPDX-FileCopyrightText: 2024 ivan tkachenko <me@ratijas.tk>
|
2023-11-30 23:41:36 +00:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
|
|
|
*/
|
|
|
|
|
2024-06-30 23:03:57 +01:00
|
|
|
pragma ComponentBehavior: Bound
|
|
|
|
|
2023-11-30 23:41:36 +00:00
|
|
|
import QtQuick
|
2024-06-30 23:03:57 +01:00
|
|
|
|
|
|
|
import org.kde.config as KConfig
|
|
|
|
import org.kde.kcmutils as KCMUtils
|
|
|
|
import org.kde.kdeconnect as KDEConnect
|
|
|
|
import org.kde.kquickcontrolsaddons as KQuickControlsAddons
|
2023-11-30 23:41:36 +00:00
|
|
|
import org.kde.plasma.core as PlasmaCore
|
|
|
|
import org.kde.plasma.plasmoid
|
|
|
|
|
2024-06-30 23:03:57 +01:00
|
|
|
PlasmoidItem {
|
2023-11-30 23:41:36 +00:00
|
|
|
id: root
|
|
|
|
|
2024-06-30 23:03:57 +01:00
|
|
|
readonly property bool inPanel: [
|
|
|
|
PlasmaCore.Types.TopEdge,
|
|
|
|
PlasmaCore.Types.RightEdge,
|
|
|
|
PlasmaCore.Types.BottomEdge,
|
|
|
|
PlasmaCore.Types.LeftEdge,
|
|
|
|
].includes(Plasmoid.location)
|
2023-11-30 23:41:36 +00:00
|
|
|
|
2024-06-30 23:03:57 +01:00
|
|
|
KDEConnect.DevicesModel {
|
|
|
|
id: connectedDeviceModel
|
|
|
|
displayFilter: KDEConnect.DevicesModel.Paired | KDEConnect.DevicesModel.Reachable
|
2023-11-30 23:41:36 +00:00
|
|
|
}
|
|
|
|
|
2024-06-30 23:03:57 +01:00
|
|
|
KDEConnect.DevicesModel {
|
2023-11-30 23:41:36 +00:00
|
|
|
id: pairedDeviceModel
|
2024-06-30 23:03:57 +01:00
|
|
|
displayFilter: KDEConnect.DevicesModel.Paired
|
2023-11-30 23:41:36 +00:00
|
|
|
}
|
|
|
|
|
2024-06-30 23:03:57 +01:00
|
|
|
Plasmoid.icon: inPanel
|
|
|
|
? "kdeconnect-tray-symbolic"
|
|
|
|
: "kdeconnect-tray"
|
2023-11-30 23:41:36 +00:00
|
|
|
|
2024-06-30 23:03:57 +01:00
|
|
|
Plasmoid.status: connectedDeviceModel.count > 0 ? PlasmaCore.Types.ActiveStatus : PlasmaCore.Types.PassiveStatus
|
2023-11-30 23:41:36 +00:00
|
|
|
|
|
|
|
fullRepresentation: FullRepresentation {
|
2024-06-30 23:03:57 +01:00
|
|
|
devicesModel: connectedDeviceModel
|
2023-11-30 23:41:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
compactRepresentation: CompactRepresentation {
|
2024-06-30 23:03:57 +01:00
|
|
|
plasmoidItem: root
|
2023-11-30 23:41:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
PlasmaCore.Action {
|
|
|
|
id: configureAction
|
2024-06-30 20:47:26 +01:00
|
|
|
text: i18n("KDE Connect Settings…")
|
2023-11-30 23:41:36 +00:00
|
|
|
icon.name: "configure"
|
2024-06-30 23:03:57 +01:00
|
|
|
visible: KConfig.KAuthorized.authorizeControlModule("kcm_kdeconnect")
|
|
|
|
onTriggered: checked => {
|
2023-11-30 23:41:36 +00:00
|
|
|
KCMUtils.KCMLauncher.openSystemSettings("kcm_kdeconnect");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component.onCompleted: {
|
|
|
|
Plasmoid.setInternalAction("configure", configureAction);
|
|
|
|
}
|
|
|
|
}
|