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

View file

@ -93,32 +93,27 @@ KdeConnectKcm::KdeConnectKcm(QObject *parent, const KPluginMetaData &md, const Q
}
},
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(
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::Checked);
kcmUi.linkProviders_list->addItem(linkProviderItem);
}*/
kcmUi.linkProviders_list->clear();
for (int i = 0; i < linkProviders.size(); ++i) {
QStringList linkProvider = linkProviders.at(i).split(QStringLiteral("|"));
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);