kdeconnect-kde/plasmoid/package/contents/ui/main.qml
Marco Martin 8fc0e78f93 port plasmoid to plasma6 api
Get rid of remaining Plasma Components2 usage,

Plasma api itself also changed, the root item is now ContainmentItem/PlasmoidItem, representations and tooltips are direct properties of them

frameworks/plasma-framework!778
2023-06-08 15:24:00 +02:00

52 lines
1.5 KiB
QML

/**
* SPDX-FileCopyrightText: 2014 Aleix Pol Gonzalez <aleixpol@kde.org>
*
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
*/
import QtQuick 2.1
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.plasmoid 2.0
import org.kde.kquickcontrolsaddons 2.0
import org.kde.kdeconnect 1.0
PlasmoidItem
{
DevicesModel {
id: connectDeviceModel
displayFilter: DevicesModel.Paired | DevicesModel.Reachable
}
DevicesModel {
id: pairedDeviceModel
displayFilter: DevicesModel.Paired
}
Binding {
target: plasmoid
property: "status"
value: (connectDeviceModel.count > 0) ? PlasmaCore.Types.ActiveStatus : PlasmaCore.Types.PassiveStatus
}
fullRepresentation: FullRepresentation {
devicesModel: connectDeviceModel
}
compactRepresentation: CompactRepresentation {
}
readonly property bool isConstrained: (plasmoid.formFactor == PlasmaCore.Types.Vertical || plasmoid.formFactor == PlasmaCore.Types.Horizontal)
preferredRepresentation: isConstrained ? Plasmoid.compactRepresentation : Plasmoid.fullRepresentation
function action_launchkcm() {
OpenConfig.openConfiguration()
}
Component.onCompleted: {
plasmoid.removeAction("configure");
if (KCMShell.authorize("kcm_kdeconnect.desktop").length > 0) {
plasmoid.setAction("launchkcm", i18n("KDE Connect Settings..."), "configure");
}
}
}