also implement the plugin version checks for the other plugin types

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=833940
This commit is contained in:
Dirk Mueller 2008-07-17 16:26:29 +00:00
parent 6675e4e222
commit 754b000b42
7 changed files with 26 additions and 8 deletions

View File

@ -94,7 +94,7 @@ kde4_add_library(plasma SHARED ${plasma_LIB_SRCS})
target_link_libraries(plasma ${KDE4_KIO_LIBS} ${KDE4_KFILE_LIBS} ${KDE4_KNEWSTUFF2_LIBS}
${QT_QTUITOOLS_LIBRARY} ${QT_QTWEBKIT_LIBRARY}
${KDE4_THREADWEAVER_LIBRARIES} ${KDE4_SOLID_LIBS})
${KDE4_THREADWEAVER_LIBRARIES} ${KDE4_SOLID_LIBS} ${X11_LIBRARIES})
if(QT_QTOPENGL_FOUND AND OPENGL_FOUND)
target_link_libraries(plasma ${QT_QTOPENGL_LIBRARY} ${OPENGL_gl_LIBRARY})

View File

@ -691,7 +691,12 @@ void AnimatorPrivate::init(Animator *q)
if (!offers.isEmpty()) {
QString error;
driver = offers.first()->createInstance<Plasma::AnimationDriver>(0, QVariantList(), &error);
KPluginLoader plugin(*offers.first());
if (Plasma::isPluginVersionCompatible(plugin.pluginVersion()))
driver = offers.first()->createInstance<Plasma::AnimationDriver>(0, QVariantList(), &error);
if (!driver) {
kDebug() << "Could not load requested animator " << offers.first() << ". Error given: " << error;
}

View File

@ -130,7 +130,11 @@ Plasma::DataEngine* DataEngineManager::loadEngine(const QString& name)
allArgs << offers.first()->storageId();
QString api = offers.first()->property("X-Plasma-API").toString();
if (api.isEmpty()) {
engine = offers.first()->createInstance<Plasma::DataEngine>(0, allArgs, &error);
if (offers.first()) {
KPluginLoader plugin(*offers.first());
if (Plasma::isPluginVersionCompatible(plugin.pluginVersion()))
engine = offers.first()->createInstance<Plasma::DataEngine>(0, allArgs, &error);
}
} else {
engine = new DataEngine(0, offers.first());
}

View File

@ -27,7 +27,7 @@
#include <KDE/KLocale>
#include <KDE/KSharedPtr>
#include <plasma/plasma_export.h>
#include <plasma/version.h>
class KConfigBase;
@ -266,7 +266,8 @@ private:
*/
#define K_EXPORT_PLASMA_PACKAGESTRUCTURE(libname, classname) \
K_PLUGIN_FACTORY(factory, registerPlugin<classname>();) \
K_EXPORT_PLUGIN(factory("plasma_packagestructure_" #libname))
K_EXPORT_PLUGIN(factory("plasma_packagestructure_" #libname)) \
K_EXPORT_PLUGIN_VERSION(PLASMA_VERSION)
} // Plasma namespace
#endif

View File

@ -252,7 +252,9 @@ public:
if (api.isEmpty()) {
QVariantList args;
args << service->storageId();
runner = service->createInstance<AbstractRunner>(q, args, &error);
if (Plasma::isPluginVersionCompatible(KPluginLoader(*service).pluginVersion())) {
runner = service->createInstance<AbstractRunner>(q, args, &error);
}
} else {
//kDebug() << "got a script runner known as" << api;
runner = new AbstractRunner(q, service->storageId());

View File

@ -31,6 +31,8 @@
#include "configxml.h"
#include "version.h"
namespace Plasma
{
@ -72,7 +74,10 @@ Service* Service::load(const QString &name, QObject *parent)
KService::Ptr offer = offers.first();
QString error;
QVariantList args;
Service* service = offer->createInstance<Plasma::Service>(parent, args, &error);
Service* service = 0;
if (Plasma::isPluginVersionCompatible(KPluginLoader(*offer).pluginVersion()))
service = offer->createInstance<Plasma::Service>(parent, args, &error);
if (!service) {
kDebug() << "Couldn't load Service \"" << name << "\"! reason given: " << error;

View File

@ -189,7 +189,8 @@ private:
*/
#define K_EXPORT_PLASMA_SERVICE(libname, classname) \
K_PLUGIN_FACTORY(factory, registerPlugin<classname>();) \
K_EXPORT_PLUGIN(factory("plasma_service_" #libname))
K_EXPORT_PLUGIN(factory("plasma_service_" #libname)) \
K_EXPORT_PLUGIN_VERSION(PLASMA_VERSION)
#endif // multiple inclusion guard