generic: remove KDED/KCM compatility bits

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2016-04-21 20:56:30 +00:00
parent bd00cedf46
commit 8493b8a06e
9 changed files with 6 additions and 50 deletions

View file

@ -361,25 +361,11 @@ KDEDModule *Kded::loadModule(const KService::Ptr& s, bool onDemand)
}
}
KDEDModule *module = 0;
QString libname = "kded_"+s->library();
KPluginLoader loader(libname);
KPluginFactory *factory = loader.factory();
if (!factory) {
// kde3 compat
QString factoryName = s->property("X-KDE-FactoryName", QVariant::String).toString();
if (factoryName.isEmpty())
factoryName = s->library();
factoryName = "create_" + factoryName;
if (!module) {
kWarning() << "Could not load library" << libname << ". ["
<< loader.errorString() << "]";
}
} else {
// create the module
module = factory->create<KDEDModule>(this);
}
KDEDModule *module = factory->create<KDEDModule>(this);
if (module) {
module->setModuleName(obj);
m_modules.insert(obj, module);

View file

@ -98,8 +98,6 @@ Comment[x-test]=xxKDED Modulexx
Comment[zh_CN]=KDED
Comment[zh_HK]=KDED
Comment[zh_TW]=KDED
[PropertyDef::X-KDE-FactoryName]
Type=QString
[PropertyDef::X-KDE-DBus-ModuleName]
Type=QString
[PropertyDef::X-KDE-Kded-autoload]

View file

@ -68,10 +68,8 @@ namespace KAuth {
* \endcode
*
* The optional parameter "name_of_the_po_file" has to correspond with the messages target
* that containst the strings to be translated. Instead of using the library name for
* \p yourLibName you can also use another name which you specify in the desktop
* file with \p X-KDE-FactoryName. This is useful to have more than one factory
* in one lib.
* that containst the strings to be translated. You should use the library name for
* \p yourLibName.
*
* The constructor of the KCModule then looks like this:
* \code

View file

@ -91,10 +91,6 @@ Name[x-test]=xxKDE Configuration Modulexx
Name[zh_CN]=KDE
Name[zh_TW]=KDE
# the name of the method (with or without the init_ prefix) returning the factory object
[PropertyDef::X-KDE-FactoryName]
Type=QString
# a list of all components this KCM belongs to
[PropertyDef::X-KDE-ParentComponents]
Type=QStringList

View file

@ -131,8 +131,7 @@ void KCModuleInfo::Private::loadAll()
weight = tmp.isValid() ? tmp.toInt() : 100;
// factory handle
tmp = service->property("X-KDE-FactoryName", QVariant::String);
handle = tmp.isValid() ? tmp.toString() : lib;
handle = lib;
}

View file

@ -142,8 +142,7 @@ public:
QString library() const;
/**
* @return a handle (the contents of the X-KDE-FactoryName field if it exists,
* else the same as the library name)
* @return a handle, same as the library name
*/
QString handle() const;

View file

@ -89,25 +89,6 @@ KCModule* KCModuleLoader::loadModule(const KCModuleInfo& mod, ErrorReporting rep
if (module) {
return module;
}
//#ifndef NDEBUG
{
// get the create_ function
QLibrary lib(mod.library());
if (lib.load()) {
KCModule *(*create)(QWidget *, const char *);
QByteArray factorymethod("create_");
factorymethod += mod.handle().toLatin1();
create = reinterpret_cast<KCModule *(*)(QWidget *, const char*)>(lib.resolve(factorymethod));
if (create) {
return create(parent, mod.handle().toLatin1());
kFatal(1208) << "This module still uses a custom factory method (" << factorymethod << "). This is not supported anymore. Please fix the module.";
} else {
kWarning(1208) << "This module has no valid entry symbol at all. The reason could be that it's still using K_EXPORT_COMPONENT_FACTORY with a custom X-KDE-FactoryName which is not supported anymore";
}
lib.unload();
}
}
//#endif // NDEBUG
return reportError(report, error, QString(), parent);
}

View file

@ -52,7 +52,7 @@ namespace KCModuleLoader
None = 0,
/**
* the error report is shown instead of the
* KCModule that should have * been loaded
* KCModule that should have been loaded
*/
Inline = 1,
/**

View file

@ -59,7 +59,6 @@ namespace KSettings
ServiceTypes=KCModule
X-KDE-Library=myapppluginconfig
X-KDE-FactoryName=MyAppPluginConfigFactory
X-KDE-ParentApp=myapp
X-KDE-ParentComponents=myapp