fix crash and simplify code
reviewed by Albert Vaca
This commit is contained in:
parent
6a379e9227
commit
b9c427a316
1 changed files with 5 additions and 5 deletions
10
kcm/kcm.cpp
10
kcm/kcm.cpp
|
@ -215,21 +215,21 @@ void KdeConnectKcm::deviceSelected(const QModelIndex& current)
|
|||
connect(currentDevice,SIGNAL(pairingFailed(QString)),
|
||||
this, SLOT(pairingFailed(QString)));
|
||||
|
||||
QList<KPluginInfo> pluginInfo = KPluginInfo::fromMetaData(KPluginLoader::findPlugins("kdeconnect/"));
|
||||
const QList<KPluginInfo> pluginInfo = KPluginInfo::fromMetaData(KPluginLoader::findPlugins("kdeconnect/"));
|
||||
QList<KPluginInfo> availablePluginInfo;
|
||||
QList<KPluginInfo> missingPluginInfo;
|
||||
|
||||
QStringList missingPluginNames = currentDevice->unsupportedPlugins();
|
||||
for (auto it = pluginInfo.begin(), itEnd = pluginInfo.end(); it!=itEnd; ) {
|
||||
for (auto it = pluginInfo.cbegin(), itEnd = pluginInfo.cend(); it!=itEnd; ++it) {
|
||||
if (missingPluginNames.contains(it->pluginName())) {
|
||||
missingPluginInfo.append(*it);
|
||||
it = pluginInfo.erase(it);
|
||||
} else {
|
||||
++it;
|
||||
availablePluginInfo.append(*it);
|
||||
}
|
||||
}
|
||||
|
||||
KSharedConfigPtr deviceConfig = KSharedConfig::openConfig(currentDevice->pluginsConfigFile());
|
||||
kcmUi->pluginSelector->addPlugins(pluginInfo, KPluginSelector::ReadConfigFile, i18n("Available plugins"), QString(), deviceConfig);
|
||||
kcmUi->pluginSelector->addPlugins(availablePluginInfo, KPluginSelector::ReadConfigFile, i18n("Available plugins"), QString(), deviceConfig);
|
||||
kcmUi->pluginSelector->addPlugins(missingPluginInfo, KPluginSelector::ReadConfigFile, i18n("Plugins unsupported by the device"), QString(), deviceConfig);
|
||||
|
||||
connect(kcmUi->pluginSelector, SIGNAL(changed(bool)),
|
||||
|
|
Loading…
Reference in a new issue