Oops fixed crash introduced in previous commit

This commit is contained in:
Albert Vaca 2013-08-13 06:03:12 +02:00
parent ac7f4d0618
commit 8c3056a286
4 changed files with 21 additions and 6 deletions

View file

@ -76,8 +76,8 @@ void Device::reloadPlugins()
foreach (const QString& pluginName, loader->getPluginList()) {
const QString value = pluginStates.value(pluginName + QString::fromLatin1("Enabled"), QString());
KPluginInfo plugininfo(pluginName);
bool enabled = (value.isNull() ? plugininfo.isPluginEnabledByDefault() : QVariant(value).toBool());
KPluginInfo info = loader->getPluginInfo(pluginName);
bool enabled = (value.isNull() ? info.isPluginEnabledByDefault() : QVariant(value).toBool());
qDebug() << pluginName << "enabled:" << enabled;

View file

@ -58,6 +58,7 @@ public:
void removeLink(DeviceLink*);
Q_SCRIPTABLE QStringList availableLinks() const;
Q_SCRIPTABLE bool trusted() const { return m_paired; }
Q_SCRIPTABLE bool paired() const { return m_paired; }
Q_SCRIPTABLE bool reachable() const { return !m_deviceLinks.empty(); }

View file

@ -47,11 +47,22 @@ QStringList PluginLoader::getPluginList()
return plugins.keys();
}
KdeConnectPlugin* PluginLoader::instantiatePluginForDevice(QString id, Device* device) {
KPluginInfo PluginLoader::getPluginInfo(const QString& name) {
KService::Ptr service = plugins[id];
KService::Ptr service = plugins[name];
if (!service) {
qDebug() << "Plugin unknown" << id;
qDebug() << "Plugin unknown" << name;
return KPluginInfo();
}
return KPluginInfo(service);
}
KdeConnectPlugin* PluginLoader::instantiatePluginForDevice(const QString& name, Device* device) {
KService::Ptr service = plugins[name];
if (!service) {
qDebug() << "Plugin unknown" << name;
return NULL;
}

View file

@ -27,6 +27,7 @@
#include <KPluginFactory>
#include <KService>
#include <KPluginInfo>
class Device;
class KdeConnectPlugin;
@ -36,8 +37,10 @@ class PluginLoader
public:
static PluginLoader* instance();
KdeConnectPlugin* instantiatePluginForDevice(QString name, Device* device);
QStringList getPluginList();
KPluginInfo getPluginInfo(const QString& name);
KdeConnectPlugin* instantiatePluginForDevice(const QString& name, Device* device);
private:
PluginLoader();