[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdelibs/kutils
From:       Kevin Ottens <ervin () kde ! org>
Date:       2010-11-04 8:25:17
Message-ID: 20101104082517.2BC61AC89B () svn ! kde ! org
[Download RAW message or body]

SVN commit 1192879 by ervin:

Remove deprecated symbols from the build (if KDE_NO_DEPRECATED is defined). And port \
the rest away from deprecated API.

 M  +12 -13    kcmoduleloader.cpp  
 M  +2 -0      kcmoduleloader.h  


--- trunk/KDE/kdelibs/kutils/kcmoduleloader.cpp #1192878:1192879
@@ -27,11 +27,11 @@
 #include <QtGui/QLabel>
 #include <QtGui/QLayout>
 
+#include <klibrary.h>
 #include <kpluginloader.h>
 #include <kdebug.h>
 #include <klocale.h>
 #include <kmessagebox.h>
-#include <klibloader.h>
 
 using namespace KCModuleLoader;
 
@@ -86,10 +86,11 @@
         foreach (const QString &arg, args) {
             args2 << arg;
         }
-        KCModule *module = KService::createInstance<KCModule>(mod.service(), parent, \
args2, &error); +        KCModule *module = \
mod.service()->createInstance<KCModule>(parent, args2, &error);  if (module) {
             return module;
         }
+#ifndef KDE_NO_DEPRECATED
         // might be using K_EXPORT_COMPONENT_FACTORY
         int error2 = 0;
         module = KService::createInstance<KCModule>(mod.service(), parent, args, \
&error2); @@ -98,22 +99,23 @@
             return module;
         }
         error += KLibLoader::errorString(error2);
+#endif
 //#ifndef NDEBUG
         {
             // get the create_ function
-            KLibrary *lib = KLibLoader::self()->library(mod.library());
-            if (lib) {
+            KLibrary 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->resolveFunction(factorymethod)); +                create = \
reinterpret_cast<KCModule *(*)(QWidget *, const \
char*)>(lib.resolveFunction(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();
+                lib.unload();
             }
         }
 //#endif // NDEBUG
@@ -137,15 +139,11 @@
 void KCModuleLoader::unloadModule(const KCModuleInfo &mod)
 {
   // get the library loader instance
-  KLibLoader *loader = KLibLoader::self();
-
-  // try to unload the library
-  QString libname("lib%1");
-  loader->unloadLibrary(libname.arg(mod.library()));
-
-  loader->unloadLibrary(mod.library());
+  KPluginLoader loader(mod.library());
+  loader.unload();
 }
 
+#ifndef KDE_NO_DEPRECATED
 void KCModuleLoader::showLastLoaderError(QWidget *parent)
 {
   KMessageBox::detailedError(parent,
@@ -158,6 +156,7 @@
        KLibLoader::self()->lastErrorMessage()));
 
 }
+#endif
 
 KCModule* KCModuleLoader::reportError( ErrorReporting report, const QString & text,
         const QString &details, QWidget * parent )
--- trunk/KDE/kdelibs/kutils/kcmoduleloader.h #1192878:1192879
@@ -99,7 +99,9 @@
      * @deprecated Use a constructor with ErrorReporting set to Dialog to show a
      * message box like this function did.
      */
+#ifndef KDE_NO_DEPRECATED
     KCMUTILS_EXPORT KDE_DEPRECATED void showLastLoaderError(QWidget *parent);
+#endif
 
     /**
      * Returns a KCModule containing the messages @p report and @p text.


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic