Provide a QML UI to the new functionality
This commit is contained in:
parent
5b10d9632c
commit
b2d0d5fa48
2 changed files with 42 additions and 1 deletions
|
@ -29,6 +29,44 @@ FormCard.FormCardPage {
|
|||
}
|
||||
}
|
||||
|
||||
FormCard.FormHeader {
|
||||
title: i18nc("@title:group", "Backends")
|
||||
}
|
||||
|
||||
FormCard.FormCard {
|
||||
DBusProperty {
|
||||
id: linkProvidersProperty
|
||||
object: DaemonDbusInterface
|
||||
read: "linkProviders"
|
||||
defaultValue: []
|
||||
}
|
||||
|
||||
Repeater {
|
||||
model: linkProvidersProperty.value
|
||||
|
||||
FormCard.FormCheckDelegate {
|
||||
required property string modelData
|
||||
|
||||
readonly property string linkProviderId: modelData.split('|')[0]
|
||||
readonly property string displayName: switch (linkProviderId) {
|
||||
case 'BluetoothLinkProvider':
|
||||
return i18nc("@info KDE Connect provider name", "Bluetooth")
|
||||
case 'LoopbackLinkProvider':
|
||||
return i18nc("@info KDE Connect provider name", "Loopback")
|
||||
case 'LanLinkProvider':
|
||||
return i18nc("@info KDE Connect provider name", "WiFi Network")
|
||||
}
|
||||
|
||||
checked: modelData.split('|')[1] === 'enabled'
|
||||
text: displayName
|
||||
|
||||
onCheckedChanged: {
|
||||
DaemonDbusInterface.setLinkProviderState(linkProviderId, checked);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FormCard.FormCard {
|
||||
Layout.topMargin: Kirigami.Units.gridUnit
|
||||
|
||||
|
|
|
@ -33,7 +33,8 @@ DBusResponseWaiter::DBusResponseWaiter()
|
|||
m_registered << qRegisterMetaType<QDBusPendingReply<>>("QDBusPendingReply<>")
|
||||
<< qRegisterMetaType<QDBusPendingReply<QVariant>>("QDBusPendingReply<QVariant>")
|
||||
<< qRegisterMetaType<QDBusPendingReply<bool>>("QDBusPendingReply<bool>") << qRegisterMetaType<QDBusPendingReply<int>>("QDBusPendingReply<int>")
|
||||
<< qRegisterMetaType<QDBusPendingReply<QString>>("QDBusPendingReply<QString>");
|
||||
<< qRegisterMetaType<QDBusPendingReply<QString>>("QDBusPendingReply<QString>")
|
||||
<< qRegisterMetaType<QDBusPendingReply<QStringList>>("QDBusPendingReply<QStringList>");
|
||||
}
|
||||
|
||||
QVariant DBusResponseWaiter::waitForReply(QVariant variant) const
|
||||
|
@ -73,6 +74,8 @@ void DBusAsyncResponse::setPendingCall(QVariant variant)
|
|||
connect(watcher, &QDBusPendingCallWatcher::finished, watcher, &QObject::deleteLater);
|
||||
connect(&m_timeout, &QTimer::timeout, watcher, &QObject::deleteLater);
|
||||
m_timeout.start();
|
||||
} else {
|
||||
qWarning() << "error: extractPendingCall didn't work";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue