Using string serialisation to workaround the weird build failure if

I make the return type anything more complex
This commit is contained in:
Rob Emery 2024-10-05 17:17:08 +01:00 committed by Carl Schwan
parent cc2dc39f92
commit e97461937c
No known key found for this signature in database
GPG key ID: 02325448204E452A
2 changed files with 23 additions and 34 deletions

View file

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

View file

@ -93,32 +93,27 @@ KdeConnectKcm::KdeConnectKcm(QObject *parent, const KPluginMetaData &md, const Q
} }
}, },
this); this);
/*
setWhenAvailable(
daemon->linkProviders(),
[this](bool error, const 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::Unchecked);
if(linkProviders[QStringLiteral("enabled")].contains(linkProvider)){
linkProviderItem->setCheckState(Qt::Checked);
}
kcmUi.linkProviders_list->addItem(linkProviderItem);
}
},
this);
*/
setWhenAvailable( setWhenAvailable(
daemon->linkProviders(), daemon->linkProviders(),
[this](bool error, const QStringList linkProviders) { /* [this](bool error, const QStringList linkProviders) {
for (int i = 0; i < linkProviders[QStringLiteral("all")].size(); ++i) { kcmUi.linkProviders_list->clear();
QString linkProvider = QString(linkProviders[QStringLiteral("all")].at(i).constData()); for (int i = 0; i < linkProviders.size(); ++i) {
QListWidgetItem *linkProviderItem = new QListWidgetItem(linkProvider, kcmUi.linkProviders_list); QStringList linkProvider = linkProviders.at(i).split(QStringLiteral("|"));
linkProviderItem->setCheckState(Qt::Checked);
kcmUi.linkProviders_list->addItem(linkProviderItem);
}*/
QString providerName = linkProvider.at(0);
QString providerStatus = linkProvider.at(1);
QListWidgetItem *linkProviderItem = new QListWidgetItem(providerName, kcmUi.linkProviders_list);
if (providerStatus.compare(QStringLiteral("enabled")) == 0) {
linkProviderItem->setCheckState(Qt::Checked);
} else {
linkProviderItem->setCheckState(Qt::Unchecked);
}
kcmUi.linkProviders_list->addItem(linkProviderItem);
}
}, },
this); this);