kdeconnect-kde/plasmoid/package/contents/ui/main.qml

67 lines
1.8 KiB
QML
Raw Normal View History

/**
* 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>
*
* 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
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
import org.kde.plasma.core as PlasmaCore
import org.kde.plasma.plasmoid
2024-06-30 23:03:57 +01:00
PlasmoidItem {
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)
2024-06-30 23:03:57 +01:00
KDEConnect.DevicesModel {
id: connectedDeviceModel
displayFilter: KDEConnect.DevicesModel.Paired | KDEConnect.DevicesModel.Reachable
}
2024-06-30 23:03:57 +01:00
KDEConnect.DevicesModel {
id: pairedDeviceModel
2024-06-30 23:03:57 +01:00
displayFilter: KDEConnect.DevicesModel.Paired
}
2024-06-30 23:03:57 +01:00
Plasmoid.icon: inPanel
? "kdeconnect-tray-symbolic"
: "kdeconnect-tray"
2024-06-30 23:03:57 +01:00
Plasmoid.status: connectedDeviceModel.count > 0 ? PlasmaCore.Types.ActiveStatus : PlasmaCore.Types.PassiveStatus
fullRepresentation: FullRepresentation {
2024-06-30 23:03:57 +01:00
devicesModel: connectedDeviceModel
}
compactRepresentation: CompactRepresentation {
2024-06-30 23:03:57 +01:00
plasmoidItem: root
}
PlasmaCore.Action {
id: configureAction
text: i18n("KDE Connect Settings…")
icon.name: "configure"
2024-06-30 23:03:57 +01:00
visible: KConfig.KAuthorized.authorizeControlModule("kcm_kdeconnect")
onTriggered: checked => {
KCMUtils.KCMLauncher.openSystemSettings("kcm_kdeconnect");
}
}
Component.onCompleted: {
Plasmoid.setInternalAction("configure", configureAction);
}
}