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

List:       kde-commits
Subject:    branches/work/komo/kdelibs/kutils
From:       Marc Mutz <mutz () kde ! org>
Date:       2010-12-06 16:55:52
Message-ID: 20101206165552.31CDCAC8A5 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1204292 by mutz:

KCModuleProxy: allow to create one from an existing KCModule

 M  +10 -0     kcmoduleproxy.cpp  
 M  +12 -0     kcmoduleproxy.h  
 M  +5 -2      kcmoduleproxy_p.h  


--- branches/work/komo/kdelibs/kutils/kcmoduleproxy.cpp #1204291:1204292
@@ -107,7 +107,12 @@
 	   * or, it was an random application which had picked that name */
 		kDebug(711) << "Module not already loaded, loading module " << \
modInfo.moduleName() << " from library " << modInfo.library() << " using symbol " << \
modInfo.handle();  
+                if ( preloaded ) {
+                    kcm = preloaded;
+                    preloaded = 0;
+                } else {
 		kcm = KCModuleLoader::loadModule( modInfo, KCModuleLoader::Inline, parent, args );
+                }
 
         QObject::connect(kcm, SIGNAL(changed(bool)), parent, \
                SLOT(_k_moduleChanged(bool)));
         QObject::connect(kcm, SIGNAL(destroyed()), parent, \
SLOT(_k_moduleDestroyed())); @@ -266,6 +271,11 @@
     d_ptr->q_ptr = this;
 }
 
+KCModuleProxy::KCModuleProxy( const KCModuleInfo& info, KCModule * module, QWidget * \
parent ) +    : QWidget(parent), d_ptr(new KCModuleProxyPrivate(this, info, \
QStringList(), module)) +{
+    d_ptr->q_ptr = this;
+}
 
 void KCModuleProxy::load()
 {
--- branches/work/komo/kdelibs/kutils/kcmoduleproxy.h #1204291:1204292
@@ -105,6 +105,18 @@
 			const QStringList& args = QStringList() );
 
 	/**
+	 * Constructs a KCModuleProxy from the already existing KCModule \a module.
+         * Use this if the KCModule you want to load isn't a plugin.
+         *
+         * @since 4.6
+	 *
+	 * @param info The KCModuleInfo to take additional information for the module from.
+         * @param module The KCModule
+	 * @param parent the parent QWidget.
+	 */
+	explicit KCModuleProxy( const KCModuleInfo& info, KCModule* module, QWidget* parent \
= 0 ); +
+	/**
 	 * Default destructor
 	 */
 	~KCModuleProxy();
--- branches/work/komo/kdelibs/kutils/kcmoduleproxy_p.h #1204291:1204292
@@ -29,8 +29,8 @@
 {
     Q_DECLARE_PUBLIC(KCModuleProxy)
     protected:
-        KCModuleProxyPrivate(KCModuleProxy *_parent, const KCModuleInfo &info, const \
                QStringList &_args)
-            : args(_args), kcm(0), topLayout(0), rootInfo(0), modInfo(info),
+    KCModuleProxyPrivate(KCModuleProxy *_parent, const KCModuleInfo &info, const \
QStringList &_args, KCModule *module=0 ) +        : args(_args), kcm(0), \
preloaded(module), topLayout(0), rootInfo(0), modInfo(info),  changed(false), \
bogusOccupier(false), parent(_parent)  {
         }
@@ -39,9 +39,11 @@
         {
             delete rootInfo; // Delete before embedWidget!
             delete kcm;
+            delete preloaded;
         }
 
         void loadModule();
+        void connectModule();
 
         /**
          * Makes sure the proper variables is set and signals are emitted.
@@ -62,6 +64,7 @@
 
         QStringList args;
         KCModule *kcm;
+        KCModule *preloaded;
         QVBoxLayout *topLayout; /* Contains QScrollView view, and root stuff */
         QLabel *rootInfo;
         QString dbusService;


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

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