From 355c2e1ff8df5f4f7a398c6a48155605bd7b2927 Mon Sep 17 00:00:00 2001 From: Rob Emery Date: Sat, 5 Oct 2024 17:40:41 +0100 Subject: [PATCH] Wiring this up to send through, looks like the array is empty for some reason that I'm not seeing at a glance at current --- core/daemon.cpp | 9 +++++++++ core/daemon.h | 3 +++ kcm/kcm.cpp | 10 ++++++++++ 3 files changed, 22 insertions(+) diff --git a/core/daemon.cpp b/core/daemon.cpp index e3d49bd6d..e91eefa28 100644 --- a/core/daemon.cpp +++ b/core/daemon.cpp @@ -158,6 +158,15 @@ QStringList Daemon::linkProviders() const } return returnValue; } + +void Daemon::setProviderStatus(const QStringList &providerStatus) +{ + qCDebug(KDECONNECT_CORE) << "setProviderStatus called" << providerStatus; + for (const auto &i : providerStatus) { + qCDebug(KDECONNECT_CORE) << "setProviderstatus with: " << i; + } +} + QStringList Daemon::devices(bool onlyReachable, bool onlyTrusted) const { QStringList ret; diff --git a/core/daemon.h b/core/daemon.h index b7dfdc7b0..d84d04a9f 100644 --- a/core/daemon.h +++ b/core/daemon.h @@ -64,7 +64,10 @@ public Q_SLOTS: Q_SCRIPTABLE QMap deviceNames(bool onlyReachable = false, bool onlyPaired = false) const; Q_SCRIPTABLE QString deviceIdByName(const QString &name) const; + Q_SCRIPTABLE QStringList linkProviders() const; + Q_SCRIPTABLE void setProviderStatus(const QStringList &providerStatus); + Q_SCRIPTABLE virtual void sendSimpleNotification(const QString &eventId, const QString &title, const QString &text, const QString &iconName) = 0; Q_SIGNALS: diff --git a/kcm/kcm.cpp b/kcm/kcm.cpp index 5658a928e..48893e6b1 100644 --- a/kcm/kcm.cpp +++ b/kcm/kcm.cpp @@ -184,6 +184,16 @@ KdeConnectKcm::~KdeConnectKcm() void KdeConnectKcm::refresh() { + QStringList providerStatus; + + for (int i = 0; i < kcmUi.linkProviders_list->count(); ++i) { + QListWidgetItem *item = kcmUi.linkProviders_list->item(i); + QString providerStatus = item->checkState() == Qt::Checked ? QStringLiteral("enabled") : QStringLiteral("disabled"); + QString line = item->text() + QStringLiteral("|") + providerStatus; + providerStatus.append(line); + } + + daemon->setProviderStatus(providerStatus); daemon->forceOnNetworkChange(); }