1060c1a81a
We have a few places that open the KCM, with different arguments. Centralize the implementation in one place. This makes it easier to switch to invoking systemsettings5 in the future (once https://invent.kde.org/plasma/systemsettings/-/merge_requests/11 is in). It also makes sure the relevant device is selected when clicking on a pairing notification. The function is exposed to DBus for the Plasmoid and potential third-party users. CCBUG: 425660
52 lines
1.5 KiB
QML
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
|
|
|
|
Item
|
|
{
|
|
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
|
|
}
|
|
|
|
Plasmoid.fullRepresentation: FullRepresentation {
|
|
devicesModel: connectDeviceModel
|
|
}
|
|
|
|
Plasmoid.compactRepresentation: CompactRepresentation {
|
|
}
|
|
|
|
readonly property bool isConstrained: (plasmoid.formFactor == PlasmaCore.Types.Vertical || plasmoid.formFactor == PlasmaCore.Types.Horizontal)
|
|
|
|
Plasmoid.preferredRepresentation: isConstrained ? Plasmoid.compactRepresentation : Plasmoid.fullRepresentation
|
|
|
|
function action_launchkcm() {
|
|
DaemonDbusInterface.openConfiguration()
|
|
}
|
|
|
|
Component.onCompleted: {
|
|
plasmoid.removeAction("configure");
|
|
if (KCMShell.authorize("kcm_kdeconnect.desktop").length > 0) {
|
|
plasmoid.setAction("launchkcm", i18n("KDE Connect Settings..."), "configure");
|
|
}
|
|
}
|
|
}
|