Index: kmobiletools/kmobiletools/engines/at_engine/at_engine.h
===================================================================
--- kmobiletools/kmobiletools/engines/at_engine/at_engine.h	(revision 782948)
+++ kmobiletools/kmobiletools/engines/at_engine/at_engine.h	(working copy)
@@ -133,17 +133,4 @@
     void foundDeviceData(FindDeviceDataJob*);
 };
 
-
-class AT_EngineFactory : public KLibFactory
-{
-   Q_OBJECT
-public:
-    AT_EngineFactory();
-    virtual ~AT_EngineFactory();
-    virtual AT_Engine* createObject( QObject *parent, const char *classname, const QStringList &args );
-
-private:
-};
-
-
 #endif
Index: kmobiletools/kmobiletools/engines/at_engine/at_engine.cpp
===================================================================
--- kmobiletools/kmobiletools/engines/at_engine/at_engine.cpp	(revision 782948)
+++ kmobiletools/kmobiletools/engines/at_engine/at_engine.cpp	(working copy)
@@ -78,23 +78,11 @@
         KMobileTools::Engine::queryClose();
 }
 
-K_EXPORT_COMPONENT_FACTORY( kmobiletools_at, AT_EngineFactory )
 
+K_PLUGIN_FACTORY( AT_EngineFactory, registerPlugin<AT_Engine>(); )
+K_EXPORT_PLUGIN( AT_EngineFactory("kmobiletools_at") )
 
-AT_EngineFactory::AT_EngineFactory()
-{
-}
-AT_EngineFactory::~AT_EngineFactory()
-{
-}
-AT_Engine *AT_EngineFactory::createObject(QObject *parent, const char * /*classname*/, const QStringList &/*args*/ )
-{
-    return new AT_Engine(parent); /// @TODO we have to specify engine name, perhaps in args
-}
 
-
-
-
 /*!
     \fn AT_Engine::probePhone()
  */
Index: kmobiletools/kmobiletools/engines/fake_engine/fakeengine.h
===================================================================
--- kmobiletools/kmobiletools/engines/fake_engine/fakeengine.h	(revision 782948)
+++ kmobiletools/kmobiletools/engines/fake_engine/fakeengine.h	(working copy)
@@ -163,13 +163,15 @@
 
 };
 
-class FakeEngineFactory : public KLibFactory
+class FakeEngineFactory : public KPluginFactory
 {
    Q_OBJECT
 public:
     FakeEngineFactory();
     virtual ~FakeEngineFactory();
-    virtual FakeEngine* createObject( QObject *parent, const char *classname, const QStringList &args );
+
+    vitual QObject *create(
+        const char *iface, QWidget *parentWidget, QObject *parent, const QVariantList &args, const QString &keyword );
 };
 
 #endif
Index: kmobiletools/kmobiletools/engines/fake_engine/fakeengine.cpp
===================================================================
--- kmobiletools/kmobiletools/engines/fake_engine/fakeengine.cpp	(revision 782948)
+++ kmobiletools/kmobiletools/engines/fake_engine/fakeengine.cpp	(working copy)
@@ -307,9 +307,10 @@
     status( QString( "Enqueued addressee \"%1\" to be removed." ).arg( addressee.name() ) );
 }
 
-K_EXPORT_COMPONENT_FACTORY( kmobiletools_fake, FakeEngineFactory )
+K_EXPORT_PLUGIN( FakeEngineFactory )
 
 FakeEngineFactory::FakeEngineFactory()
+ : KPluginFactory("kmobiletools_fake")
 {
 }
 
@@ -317,10 +318,13 @@
 {
 }
 
-FakeEngine *FakeEngineFactory::createObject(QObject *parent, const char *classname, const QStringList& args)
+QObject *FakeEngineFactory::create(
+  const char *iface, QWidget *parentWidget, QObject *parent, const QVariantList &args, const QString &keyword )
 {
-    Q_UNUSED(classname)
-    QString deviceName = args.at( 0 );
+    Q_UNUSED(iface)
+    Q_UNUSED(parentWidget)
+    Q_UNUSED(keyword)
+    QString deviceName = args.at( 0 ).toString();
     return new FakeEngine( parent, deviceName );
 }
 
Index: kmobiletools/kmobiletools/libkmobiletools/engine.cpp
===================================================================
--- kmobiletools/kmobiletools/libkmobiletools/engine.cpp	(revision 782948)
+++ kmobiletools/kmobiletools/libkmobiletools/engine.cpp	(working copy)
@@ -214,13 +214,14 @@
 Engine *Engine::load(const QString &libname, QObject *parent)
 {
     kDebug() <<"Engine::load(" << libname <<")";
-    KLibFactory *factory=KLibLoader::self()->factory(qPrintable(libname));
+    KPluginLoader loader(libname);
+    KPluginFactory *factory=loader.factory();
     if(!factory) {
-        kDebug() <<"Error loading library:" << KLibLoader::self()->lastErrorMessage();
+        kDebug() <<"Error loading library:" << loader.errorString();
         return NULL;
     }
-    Engine *ret=static_cast<KMobileTools::Engine *>(factory->create(parent, "KMobileTools::Engine" ) );
-    if(parent) ret->setObjectName(parent->objectName());
+    Engine *ret=factory->create<KMobileTools::Engine>(parent);
+    if(ret && parent) ret->setObjectName(parent->objectName());
     return ret;
 }
 
Index: kmobiletools/kmobiletools/libkmobiletools/deviceloader.cpp
===================================================================
--- kmobiletools/kmobiletools/libkmobiletools/deviceloader.cpp	(revision 782948)
+++ kmobiletools/kmobiletools/libkmobiletools/deviceloader.cpp	(working copy)
@@ -85,33 +85,31 @@
         return false;
 
     // check if a there's a suitable engine service in the list
-    int serviceNumber = 0;
-    bool engineFound = false;
-    for( ; serviceNumber < d->m_engineOffers.size(); serviceNumber++ ) {
-        if( d->m_engineOffers.at( serviceNumber )->name() == engineName ) {
-            engineFound = true;
+    KService::Ptr engineService;
+    foreach( KService::Ptr engineOffer, d->m_engineOffers ) {
+        if( engineOffer->name() == engineName ) {
+            engineService = engineOffer;
             break;
         }
     }
 
     // no suitable engine available?
-    if( !engineFound )
+    if( engineService.isNull() )
         return false;
 
     // try to load the engine
-    QStringList argDeviceName( deviceName );
 
-	// get a reference to the service
-	const KService& engineService = *d->m_engineOffers.at( serviceNumber ).constData();
-	KPluginLoader pluginLoader( engineService );
-
 	// create the engine instance
-	KMobileTools::EngineXP* engine = pluginLoader.factory()->create<KMobileTools::EngineXP>((QObject*)0, argDeviceName );
+    KPluginFactory *factory = KPluginLoader pluginLoader( *engineService ).factory();
+    if( !factory )
+        return false;
+    QStringList argDeviceName( deviceName );
+	KMobileTools::EngineXP* engine = factory->create<KMobileTools::EngineXP>((QObject*)0, argDeviceName );
     if( !engine )
         return false;
 
     // retrieve information about the engine
-    d->m_engineInformation.insert( deviceName, KPluginInfo( d->m_engineOffers.at( serviceNumber ) ) );
+    d->m_engineInformation.insert( deviceName, KPluginInfo( engineService ) );
 
     d->m_loadedDevices.insert( deviceName, engine );
     emit deviceLoaded( deviceName );
Index: kmobiletools/kmobiletools/libkmobiletools/serviceloader.cpp
===================================================================
--- kmobiletools/kmobiletools/libkmobiletools/serviceloader.cpp	(revision 782948)
+++ kmobiletools/kmobiletools/libkmobiletools/serviceloader.cpp	(working copy)
@@ -86,27 +86,28 @@
         return;
 
     // iterate over the services and look which one we can use
-    KMobileTools::CoreService* service;
     QStringList deviceNameList;
     deviceNameList << deviceName;
-    for( int i=0; i<serviceOffers.size(); i++ ) {
-		// get a reference to the service
-		const KService& coreService = *serviceOffers.at( i ).constData();
-		KPluginLoader pluginLoader( coreService );
-
-		QObject* serviceObject = pluginLoader.factory()->create<KMobileTools::CoreService>((QObject*)0, deviceNameList );
+    foreach( KService::Ptr coreService, serviceOffers ) {
+        // get a reference to the service
+        KPluginFactory *factory = KPluginLoader( *coreService ).factory();
+        if( !factory )
+            continue;
+		QObject* serviceObject = factory->create<KMobileTools::CoreService>((QObject*)0, deviceNameList );
         if( !serviceObject )
             continue;
 
-        service = qobject_cast<KMobileTools::CoreService*>( serviceObject );
+        KMobileTools::CoreService* service = qobject_cast<KMobileTools::CoreService*>( serviceObject );
         if( !service )
             continue;
 
         bool fulfillsRequirements = true;
         QStringList requirements = service->requires();
-        for( int j=0; j<requirements.size(); j++ ) {
-            if( !engine->implements( requirements.at(i) ) )
+        foreach( const QString& requirement, requirements ) {
+            if( !engine->implements( requirement ) ) {
                 fulfillsRequirements = false;
+                break;
+            }
         }
 
         // service fulfills our requirements
Index: kmobiletools/kmobiletools/mainpart/kmobiletools_mainpart.cpp
===================================================================
--- kmobiletools/kmobiletools/mainpart/kmobiletools_mainpart.cpp	(revision 782948)
+++ kmobiletools/kmobiletools/mainpart/kmobiletools_mainpart.cpp	(working copy)
@@ -81,8 +81,8 @@
 #include "jobqueueview/jobqueueview.h"
 #include "jobqueueview/jobitem.h"
 
-typedef KParts::GenericFactory<kmobiletoolsMainPart> kmobiletoolsMainPartFactory;
-K_EXPORT_COMPONENT_FACTORY( kmobiletoolsmainpart, kmobiletoolsMainPartFactory )
+K_PLUGIN_FACTORY( kmobiletoolsMainPartFactory, registerPlugin<kmobiletoolsMainPart>(); )
+K_EXPORT_PLUGIN( kmobiletoolsMainPartFactory )
 
 KAboutData *kmobiletoolsMainPart::createAboutData()
 {
Index: kmobiletools/kmobiletools/mainpart/services/addressbook/addressbook.cpp
===================================================================
--- kmobiletools/kmobiletools/mainpart/services/addressbook/addressbook.cpp	(revision 782948)
+++ kmobiletools/kmobiletools/mainpart/services/addressbook/addressbook.cpp	(working copy)
@@ -319,9 +319,10 @@
     }
 }
 
-K_EXPORT_COMPONENT_FACTORY( libkmtaddressbook_service, AddressbookFactory )
+K_EXPORT_PLUGIN( AddressbookFactory )
 
 AddressbookFactory::AddressbookFactory()
+ : KPluginFactory("libkmtaddressbook_service")
 {
 }
 
@@ -329,9 +330,12 @@
 {
 }
 
-Addressbook *AddressbookFactory::createObject(QObject *parent, const char *classname, const QStringList& args)
+QObject *AddressbookFactory::create(
+  const char *iface, QWidget *parentWidget, QObject *parent, const QVariantList &args, const QString &keyword )
 {
-    Q_UNUSED(classname)
+    Q_UNUSED(iface)
+    Q_UNUSED(parentWidget)
+    Q_UNUSED(keyword)
     QStringList arguments( args );
     return new Addressbook( parent, arguments.at(0) );
 }
Index: kmobiletools/kmobiletools/mainpart/services/addressbook/addressbook.h
===================================================================
--- kmobiletools/kmobiletools/mainpart/services/addressbook/addressbook.h	(revision 782948)
+++ kmobiletools/kmobiletools/mainpart/services/addressbook/addressbook.h	(working copy)
@@ -155,13 +155,14 @@
     QAction* m_deleteContact;
 };
 
-class AddressbookFactory : public KLibFactory
+class AddressbookFactory : public KPluginFactory
 {
    Q_OBJECT
 public:
     AddressbookFactory();
     virtual ~AddressbookFactory();
-    virtual Addressbook* createObject( QObject *parent, const char *classname, const QStringList &args );
+    virtual QObject *create(
+        const char *iface, QWidget *parentWidget, QObject *parent, const QVariantList &args, const QString &keyword );
 };
 
 #endif
Index: kitchensync/src/part.cpp
===================================================================
--- kitchensync/src/part.cpp	(revision 782948)
+++ kitchensync/src/part.cpp	(working copy)
@@ -26,11 +26,11 @@
 
 #include "part.h"
 
-typedef KParts::GenericFactory< KitchenSyncPart > KitchenSyncFactory;
-K_EXPORT_COMPONENT_FACTORY( kitchensyncpart, KitchenSyncFactory )
+K_PLUGIN_FACTORY(KitchenSyncFactory, registerPlugin<KitchenSyncPart>();)
+K_EXPORT_PLUGIN(KitchenSyncFactory( "kitchensyncpart" ))
 
 KitchenSyncPart::KitchenSyncPart( QWidget *parentWidget, QObject *parent,
-                                  const QStringList &list )
+                                  const QVariantList &list )
   : KParts::ReadOnlyPart( parent )
 {
   Q_UNUSED( list );
Index: kitchensync/src/part.h
===================================================================
--- kitchensync/src/part.h	(revision 782948)
+++ kitchensync/src/part.h	(working copy)
@@ -33,7 +33,7 @@
 
   public:
     KitchenSyncPart( QWidget *parentWidget, QObject *parent,
-                     const QStringList &list );
+                     const QVariantList &list );
     virtual ~KitchenSyncPart();
 
     static KAboutData *createAboutData();
