From 83b7ac0aba5b566df8200daa0a0ec98ee14e66ad Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Sat, 12 Oct 2013 01:54:08 +0200 Subject: [PATCH] Add missing const on the plugin loader --- kded/plugins/pluginloader.cpp | 15 +++++++-------- kded/plugins/pluginloader.h | 6 +++--- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/kded/plugins/pluginloader.cpp b/kded/plugins/pluginloader.cpp index ce7729aba..f6ce89cc2 100644 --- a/kded/plugins/pluginloader.cpp +++ b/kded/plugins/pluginloader.cpp @@ -37,19 +37,19 @@ PluginLoader* PluginLoader::instance() PluginLoader::PluginLoader() { KService::List offers = KServiceTypeTrader::self()->query("KdeConnect/Plugin"); - for(KService::List::const_iterator iter = offers.begin(); iter < offers.end(); ++iter) { + for(KService::List::const_iterator iter = offers.constBegin(); iter != offers.constEnd(); ++iter) { KService::Ptr service = *iter; plugins[service->library()] = service; } } -QStringList PluginLoader::getPluginList() +QStringList PluginLoader::getPluginList() const { return plugins.keys(); } -KPluginInfo PluginLoader::getPluginInfo(const QString& name) { - +KPluginInfo PluginLoader::getPluginInfo(const QString& name) const +{ KService::Ptr service = plugins[name]; if (!service) { qDebug() << "Plugin unknown" << name; @@ -59,8 +59,8 @@ KPluginInfo PluginLoader::getPluginInfo(const QString& name) { return KPluginInfo(service); } -KdeConnectPlugin* PluginLoader::instantiatePluginForDevice(const QString& name, Device* device) { - +KdeConnectPlugin* PluginLoader::instantiatePluginForDevice(const QString& name, Device* device) const +{ KService::Ptr service = plugins[name]; if (!service) { qDebug() << "Plugin unknown" << name; @@ -73,8 +73,7 @@ KdeConnectPlugin* PluginLoader::instantiatePluginForDevice(const QString& name, return NULL; } - QVariant deviceVariant; - deviceVariant.setValue(device); + QVariant deviceVariant = QVariant::fromValue(device); //FIXME: create return NULL QObject *plugin = factory->create(device, QVariantList() << deviceVariant); diff --git a/kded/plugins/pluginloader.h b/kded/plugins/pluginloader.h index 0fe87b8e0..32652e53f 100644 --- a/kded/plugins/pluginloader.h +++ b/kded/plugins/pluginloader.h @@ -38,9 +38,9 @@ class PluginLoader public: static PluginLoader* instance(); - QStringList getPluginList(); - KPluginInfo getPluginInfo(const QString& name); - KdeConnectPlugin* instantiatePluginForDevice(const QString& name, Device* device); + QStringList getPluginList() const; + KPluginInfo getPluginInfo(const QString& name) const; + KdeConnectPlugin* instantiatePluginForDevice(const QString& name, Device* device) const; private: PluginLoader();