So this doesn't seem to work, if the return type is anything other than

QString or QStringList then it blows up with:
/home/rob/kde/src/kdeconnect-kde/kcm/kcm.cpp: In constructor ‘KdeConnectKcm::KdeConnectKcm(QObject*, const KPluginMetaData&, const QVariantList&)’:
/home/rob/kde/src/kdeconnect-kde/kcm/kcm.cpp:82:17: error: ‘class DaemonDbusInterface’ has no member named ‘linkProviders’
   82 |         daemon->linkProviders(),

even though the signatures are correct etc. No idea, I'll have
to fix this ultimately but I'll workaround it for now
This commit is contained in:
Rob Emery 2024-10-05 16:11:23 +01:00 committed by Carl Schwan
parent 0bb9c8e294
commit 5b5fac2d5d
No known key found for this signature in database
GPG key ID: 02325448204E452A
3 changed files with 16 additions and 15 deletions

View file

@ -147,22 +147,22 @@ QSet<LinkProvider *> Daemon::getLinkProviders() const
return d->m_linkProviders;
}
QStringList Daemon::linkProviders() const
QVector<QStringList> Daemon::linkProviders() const
{
/*
QString allStr = QStringLiteral("all");
QString enabledStr = QStringLiteral("enabled");
QMap<QString, QStringList> returnValue;
returnValue[allStr] = QStringList();
returnValue[enabledStr] = QStringList();
QMap<QString, QString> returnValue;
for (LinkProvider *a : std::as_const(d->m_linkProviders)) {
returnValue[allStr].append(a->name());
returnValue[allStr] += a->name();
// TODO add filtering by enabled config
returnValue[enabledStr].append(a->name());
returnValue[enabledStr] += a->name();
}
return returnValue[allStr];
return returnValue;*/
return QVector<QStringList>();
}
QStringList Daemon::devices(bool onlyReachable, bool onlyTrusted) const
{

View file

@ -64,7 +64,7 @@ public Q_SLOTS:
Q_SCRIPTABLE QMap<QString, QString> deviceNames(bool onlyReachable = false, bool onlyPaired = false) const;
Q_SCRIPTABLE QString deviceIdByName(const QString &name) const;
Q_SCRIPTABLE QStringList linkProviders() const;
Q_SCRIPTABLE QVector<QStringList> linkProviders() const;
Q_SCRIPTABLE virtual void sendSimpleNotification(const QString &eventId, const QString &title, const QString &text, const QString &iconName) = 0;
Q_SIGNALS:

View file

@ -111,13 +111,14 @@ KdeConnectKcm::KdeConnectKcm(QObject *parent, const KPluginMetaData &md, const Q
*/
setWhenAvailable(
daemon->linkProviders(),
[this](bool error, const QStringList linkProviders) {
for (int i = 0; i < linkProviders.size(); ++i) {
QString linkProvider = QString(linkProviders.at(i).constData());
[this](bool error, const QVector<QStringList> linkProviders) { /*
for (int i = 0; i < linkProviders[QStringLiteral("all")].size(); ++i) {
QString linkProvider = QString(linkProviders[QStringLiteral("all")].at(i).constData());
QListWidgetItem *linkProviderItem = new QListWidgetItem(linkProvider, kcmUi.linkProviders_list);
linkProviderItem->setCheckState(Qt::Checked);
kcmUi.linkProviders_list->addItem(linkProviderItem);
}
}*/
},
this);