Index: kaddressbook/xxportmanager.cpp
===================================================================
--- kaddressbook/xxportmanager.cpp	(revision 782948)
+++ kaddressbook/xxportmanager.cpp	(working copy)
@@ -122,18 +122,14 @@
 
   const KService::List plugins = KServiceTypeTrader::self()->query( "KAddressBook/XXPort",
     QString( "[X-KDE-KAddressBook-XXPortPluginVersion] == %1" ).arg( KAB_XXPORT_PLUGIN_VERSION ) );
-  KService::List::ConstIterator it;
-  for ( it = plugins.begin(); it != plugins.end(); ++it ) {
-    if ( !(*it)->hasServiceType( "KAddressBook/XXPort" ) )
-      continue;
-
-    KLibFactory *factory = KLibLoader::self()->factory( (*it)->library().toLatin1() );
+  foreach ( KService::Ptr pluginService, plugins ) {
+    KPluginFactory *factory = KPluginLoader( *pluginService ).factory();
     if ( !factory ) {
       kDebug(5720) <<"XXPortManager::loadExtensions(): Factory creation failed";
       continue;
     }
 
-    KAB::XXPortFactory *xxportFactory = static_cast<KAB::XXPortFactory*>( factory );
+    KAB::XXPortFactory *xxportFactory = dynamic_cast<KAB::XXPortFactory*>( factory );
 
     if ( !xxportFactory ) {
       kDebug(5720) <<"XXPortManager::loadExtensions(): Cast failed";
Index: kaddressbook/interfaces/extensionwidget.h
===================================================================
--- kaddressbook/interfaces/extensionwidget.h	(revision 782948)
+++ kaddressbook/interfaces/extensionwidget.h	(working copy)
@@ -26,7 +26,7 @@
 
 #include "kaddressbook_export.h"
 #include <kabc/addressbook.h>
-#include <klibloader.h>
+#include <KPluginFactory>
 #include <QtGui/QWidget>
 
 #define KAB_EXTENSIONWIDGET_PLUGIN_VERSION 1
@@ -87,7 +87,7 @@
     ExtensionWidgetPrivate *d;
 };
 
-class KABINTERFACES_EXPORT ExtensionFactory : public KLibFactory
+class KABINTERFACES_EXPORT ExtensionFactory : public KPluginFactory
 {
   public:
     virtual ExtensionWidget *extension( KAB::Core *core, QWidget *parent ) = 0;
@@ -104,12 +104,6 @@
       widget.
      */
     virtual QString identifier() const = 0;
-
-  protected:
-    virtual QObject* createObject( QObject*, const char*, const QStringList & )
-    {
-      return 0;
-    }
 };
 
 }
Index: kaddressbook/interfaces/xxport.h
===================================================================
--- kaddressbook/interfaces/xxport.h	(revision 782948)
+++ kaddressbook/interfaces/xxport.h	(working copy)
@@ -29,7 +29,7 @@
 #include "kaddressbook_export.h"
 #include <kabc/addressbook.h>
 #include <kabc/addresseelist.h>
-#include <klibloader.h>
+#include <KPluginFactory>
 #include <kxmlguiclient.h>
 
 #define KAB_XXPORT_PLUGIN_VERSION 1
@@ -41,23 +41,21 @@
   @libname	filename of the shared library, e.g. kaddrbk_bookmark_xxport
   @XXPortClass	the import/export class - derived from the XXPort class
   @catalog	catalog file to search for translation lookup (NULL if no catalog needed)
-  @see: K_EXPORT_COMPONENT_FACTORY()
+  @see: K_EXPORT_PLUGIN()
  */
 #define K_EXPORT_KADDRESSBOOK_XXFILTER_CATALOG( libname, XXPortClass, catalog ) \
- class KDE_NO_EXPORT localXXPortFactory : public KAB::XXPortFactory { \
-	KAB::XXPort *xxportObject( KABC::AddressBook *ab, QWidget *parent, const char *name ) \
-	 { const char *cat = catalog; \
-	   if (cat) KGlobal::locale()->insertCatalog(cat); \
-	   return new XXPortClass( ab, parent, name ); \
-         } \
- }; \
- K_EXPORT_COMPONENT_FACTORY( libname, localXXPortFactory )
+class KDE_NO_EXPORT LocalXXPortFactory : public KPluginFactory { \
+    public: LocalXXPortFactory() : KPluginFactory(#libname, catalog) {} \
+      KAB::XXPort *xxportObject( KABC::AddressBook *ab, QWidget *parent, const char *name ) \
+      { return new XXPortClass( ab, parent, name ); } \
+}; \
+K_EXPORT_PLUGIN( LocalXXPortFactory )
 
 /**
   K_EXPORT_KADDRESSBOOK_XXFILTER() creates the stub for a KAddressbook import/export filter.
   @libname	filename of the shared library, e.g. kaddrbk_bookmark_xxport
   @XXPortClass	the import/export class - derived from the XXPort class
-  @see: K_EXPORT_COMPONENT_FACTORY()
+  @see: K_EXPORT_PLUGIN()
  */
 #define K_EXPORT_KADDRESSBOOK_XXFILTER( libname, XXPortClass ) \
 	K_EXPORT_KADDRESSBOOK_XXFILTER_CATALOG( libname, XXPortClass, NULL )
@@ -159,18 +157,20 @@
     XXPortPrivate *d;
 };
 
-class XXPortFactory : public KLibFactory
+class XXPortFactory : public KPluginFactory
 {
   public:
     virtual XXPort *xxportObject( KABC::AddressBook *ab, QWidget *parent,
                                   const char *name = 0 ) = 0;
 
   protected:
+/*
+  //virtual QObject *KPluginFactory::create(const char *iface, QWidget *parentWidget, QObject *parent, const QVariantList &args, const QString &keyword)
     virtual QObject* createObject( QObject*, const char*,
                                    const QStringList & )
     {
       return 0;
-    }
+    }*/
 };
 
 
Index: kaddressbook/interfaces/contacteditorwidget.h
===================================================================
--- kaddressbook/interfaces/contacteditorwidget.h	(revision 782948)
+++ kaddressbook/interfaces/contacteditorwidget.h	(working copy)
@@ -26,7 +26,7 @@
 
 #include "kaddressbook_export.h"
 #include <kabc/addressbook.h>
-#include <klibloader.h>
+#include <KPluginFactory>
 
 #include <QtGui/QWidget>
 #include <QtCore/QList>
@@ -114,7 +114,7 @@
     ContactEditorWidgetPrivate *d;
 };
 
-class ContactEditorWidgetFactory : public KLibFactory
+class ContactEditorWidgetFactory : public KPluginFactory
 {
   public:
     virtual ContactEditorWidget *createWidget( KABC::AddressBook *ab, QWidget *parent ) = 0;
@@ -131,10 +131,10 @@
     virtual QString pageIdentifier() const = 0;
 
   protected:
-    virtual QObject* createObject( QObject*, const char*, const QStringList & )
+/*    virtual QObject* createObject( QObject*, const char*, const QStringList & )
     {
       return 0;
-    }
+    }*/
 };
 
 }
Index: kaddressbook/kaddressbook_part.h
===================================================================
--- kaddressbook/kaddressbook_part.h	(revision 782948)
+++ kaddressbook/kaddressbook_part.h	(working copy)
@@ -36,7 +36,7 @@
   Q_OBJECT
 
   public:
-    KAddressbookPart( QWidget *parentWidget, QObject *parent, const QStringList& );
+    KAddressbookPart( QWidget *parentWidget, QObject *parent, const QVariantList& );
     virtual ~KAddressbookPart();
 
     static KAboutData *createAboutData();
Index: kaddressbook/extensionmanager.cpp
===================================================================
--- kaddressbook/extensionmanager.cpp	(revision 782948)
+++ kaddressbook/extensionmanager.cpp	(working copy)
@@ -225,9 +225,8 @@
   const KService::List plugins = KServiceTypeTrader::self()->query( "KAddressBook/Extension",
     QString( "[X-KDE-KAddressBook-ExtensionPluginVersion] == %1" ).arg( KAB_EXTENSIONWIDGET_PLUGIN_VERSION ) );
 
-  KService::List::ConstIterator it;
-  for ( it = plugins.begin(); it != plugins.end(); ++it ) {
-    KLibFactory *factory = KLibLoader::self()->factory( (*it)->library().toLatin1() );
+  foreach ( KService::Ptr pluginService, plugins ) {
+    KPluginFactory *factory = KPluginLoader( *pluginService ).factory();
     if ( !factory ) {
       kDebug(5720) <<"ExtensionManager::loadExtensions(): Factory creation failed";
       continue;
@@ -244,7 +243,7 @@
     if ( wdg ) {
       mSplitter->addWidget( wdg );
       if ( wdg->identifier() == "distribution_list_editor_ng" )
-          mSplitter->moveToFirst( wdg );
+          mSplitter->insertWidget( 0, wdg );
       wdg->setVisible( false );
       connect( wdg, SIGNAL( modified( const KABC::Addressee::List& ) ),
                SIGNAL( modified( const KABC::Addressee::List& ) ) );
Index: kaddressbook/kaddressbookview.h
===================================================================
--- kaddressbook/kaddressbookview.h	(revision 782948)
+++ kaddressbook/kaddressbookview.h	(working copy)
@@ -30,7 +30,7 @@
 #include "filter.h"
 #include "viewconfigurewidget.h"
 #include <kabc/field.h>
-#include <klibloader.h>
+#include <KPluginFactory>
 
 #include <QStringList>
 #include <QWidget>
@@ -271,7 +271,7 @@
     QWidget *mViewWidget;
 };
 
-class KADDRESSBOOK_EXPORT ViewFactory : public KLibFactory
+class KADDRESSBOOK_EXPORT ViewFactory : public KPluginFactory
 {
   public:
     virtual KAddressBookView *view( KAB::Core *core, QWidget *parent ) = 0;
@@ -301,10 +301,10 @@
                                                   QWidget *parent );
 
   protected:
-    virtual QObject* createObject( QObject*, const char*, const QStringList & )
+/*    virtual QObject* createObject( QObject*, const char*, const QStringList & )
     {
       return 0;
-    }
+    }*/
 };
 
 #endif
Index: kaddressbook/geowidget.cpp
===================================================================
--- kaddressbook/geowidget.cpp	(revision 782948)
+++ kaddressbook/geowidget.cpp	(working copy)
@@ -593,7 +593,8 @@
   p.drawEllipse( x, y, 4, 4 );
 
   p.end();
-  bitBlt( this, 0, 0, &pm );
+  QPainter thisPainter(this);
+  thisPainter.drawPixmap( 0, 0, pm );
 }
 
 #include "geowidget.moc"
Index: kaddressbook/kaddressbook_export.h
===================================================================
--- kaddressbook/kaddressbook_export.h	(revision 782948)
+++ kaddressbook/kaddressbook_export.h	(working copy)
@@ -24,7 +24,7 @@
 #include <kdemacros.h>
 
 #ifndef KADDRESSBOOK_EXPORT
-# if defined(MAKE_KADDRESSBOOK_LIB)
+# if defined(MAKE_KADDRESSBOOKPRIVATE_LIB)
    /* We are building this library */
 #  define KADDRESSBOOK_EXPORT KDE_EXPORT
 # else
Index: kaddressbook/contacteditorwidgetmanager.cpp
===================================================================
--- kaddressbook/contacteditorwidgetmanager.cpp	(revision 782948)
+++ kaddressbook/contacteditorwidgetmanager.cpp	(working copy)
@@ -80,16 +80,15 @@
   const KService::List plugins = KServiceTypeTrader::self()->query( "KAddressBook/ContactEditorWidget",
     QString( "[X-KDE-KAddressBook-CEWPluginVersion] == %1" ).arg( KAB_CEW_PLUGIN_VERSION ) );
 
-  KService::List::ConstIterator it;
-  for ( it = plugins.begin(); it != plugins.end(); ++it ) {
-    KLibFactory *factory = KLibLoader::self()->factory( (*it)->library().toLatin1() );
+  foreach ( KService::Ptr pluginService, plugins ) {
+    KPluginFactory *factory = KPluginLoader( *pluginService ).factory();
     if ( !factory ) {
       kDebug(5720) <<"ContactEditorWidgetManager::reload(): Factory creation failed";
       continue;
     }
 
     KAB::ContactEditorWidgetFactory *pageFactory =
-                          static_cast<KAB::ContactEditorWidgetFactory*>( factory );
+                          dynamic_cast<KAB::ContactEditorWidgetFactory*>( factory );
 
     if ( !pageFactory ) {
       kDebug(5720) <<"ContactEditorWidgetManager::reload(): Cast failed";
Index: kaddressbook/kaddressbook_part.cpp
===================================================================
--- kaddressbook/kaddressbook_part.cpp	(revision 782948)
+++ kaddressbook/kaddressbook_part.cpp	(working copy)
@@ -39,11 +39,11 @@
 
 #include "kaddressbook_part.h"
 
-typedef KParts::GenericFactory< KAddressbookPart > KAddressbookFactory;
-K_EXPORT_COMPONENT_FACTORY( kaddressbookpart, KAddressbookFactory )
+K_PLUGIN_FACTORY(KAddressbookFactory, registerPlugin<KAddressbookPart>();)
+K_EXPORT_PLUGIN(KAddressbookFactory( "kaddressbookpart" ))
 
 KAddressbookPart::KAddressbookPart( QWidget *parentWidget, QObject *parent,
-                                    const QStringList & )
+                                    const QVariantList & )
   : KParts::ReadOnlyPart( parent )
 {
   setComponentData( KAddressbookFactory::componentData() );
Index: kaddressbook/CMakeLists.txt
===================================================================
--- kaddressbook/CMakeLists.txt	(revision 782948)
+++ kaddressbook/CMakeLists.txt	(working copy)
@@ -72,7 +72,7 @@
 kde4_add_executable(kaddressbook_bin ${kaddressbook_bin_SRCS})
 set_target_properties(kaddressbook_bin PROPERTIES OUTPUT_NAME kaddressbook)
 
-kdepim4_link_unique_libraries(kaddressbook_bin  kaddressbook ${KDE4_KHTML_LIBS})
+kdepim4_link_unique_libraries(kaddressbook_bin  kaddressbookprivate ${KDE4_KHTML_LIBS})
 
 install(TARGETS kaddressbook_bin  DESTINATION ${BIN_INSTALL_DIR} )
 
@@ -88,7 +88,7 @@
 
 
 
-kdepim4_link_unique_libraries(kaddressbookpart  ${KDE4_KIO_LIBS} kaddressbook )
+kdepim4_link_unique_libraries(kaddressbookpart  ${KDE4_KIO_LIBS} kaddressbookprivate )
 
 install(TARGETS kaddressbookpart  DESTINATION ${PLUGIN_INSTALL_DIR})
 
@@ -147,12 +147,12 @@
 
 QT4_ADD_DBUS_INTERFACE(kaddressbook_LIB_SRCS org.kde.KAddressbook.Core.xml kaddressbookcore_interface )
 
-kde4_add_library(kaddressbook SHARED ${kaddressbook_LIB_SRCS})
+kde4_add_library(kaddressbookprivate SHARED ${kaddressbook_LIB_SRCS})
 
-kdepim4_link_unique_libraries(kaddressbook  ${KDE4_SYNDICATION_LIBS} kdepim ${KDE4_KCAL_LIBS} kabc_file_core ${KDE4_KIO_LIBS} ${KDE4_KUTILS_LIBS} ${KDE4_PHONON_LIBS} kabinterfaces kabcommon )
+kdepim4_link_unique_libraries(kaddressbookprivate  ${KDE4_SYNDICATION_LIBS} kdepim ${KDE4_KCAL_LIBS} kabc_file_core ${KDE4_KIO_LIBS} ${KDE4_KUTILS_LIBS} ${KDE4_PHONON_LIBS} kabinterfaces kabcommon )
 
-set_target_properties(kaddressbook PROPERTIES VERSION ${GENERIC_LIB_VERSION} SOVERSION ${GENERIC_LIB_SOVERSION} )
-install(TARGETS kaddressbook  DESTINATION ${LIB_INSTALL_DIR})
+set_target_properties(kaddressbookprivate PROPERTIES VERSION ${GENERIC_LIB_VERSION} SOVERSION ${GENERIC_LIB_SOVERSION} )
+install(TARGETS kaddressbookprivate DESTINATION ${LIB_INSTALL_DIR})
 
 
 ########### install files ###############
Index: kaddressbook/viewmanager.cpp
===================================================================
--- kaddressbook/viewmanager.cpp	(revision 782948)
+++ kaddressbook/viewmanager.cpp	(working copy)
@@ -400,19 +400,14 @@
 {
   const KService::List plugins = KServiceTypeTrader::self()->query( "KAddressBook/View",
     QString( "[X-KDE-KAddressBook-ViewPluginVersion] == %1" ).arg(  KAB_VIEW_PLUGIN_VERSION ) );
-  KService::List::ConstIterator it;
-  for ( it = plugins.begin(); it != plugins.end(); ++it ) {
-    if ( !(*it)->hasServiceType( "KAddressBook/View" ) )
-      continue;
-
-    KLibFactory *factory = KLibLoader::self()->factory( (*it)->library().toLatin1() );
-
+  foreach ( KService::Ptr pluginService, plugins ) {
+    KPluginFactory *factory = KPluginLoader( *pluginService ).factory();
     if ( !factory ) {
       kDebug(5720) <<"ViewManager::createViewFactories(): Factory creation failed";
       continue;
     }
 
-    ViewFactory *viewFactory = static_cast<ViewFactory*>( factory );
+    ViewFactory *viewFactory = dynamic_cast<ViewFactory*>( factory );
 
     if ( !viewFactory ) {
       kDebug(5720) <<"ViewManager::createViewFactories(): Cast failed";
