[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdenetwork/kopete/libkopete
From: Martijn Klingens <klingens () kde ! org>
Date: 2003-10-20 21:33:08
[Download RAW message or body]
CVS commit by mklingens:
Async loading of plugins in loadPlugin()
M +16 -2 kopetepluginmanager.cpp 1.19
M +21 -1 kopetepluginmanager.h 1.10
--- kdenetwork/kopete/libkopete/kopetepluginmanager.cpp #1.18:1.19
@@ -241,5 +241,5 @@ void KopetePluginManager::slotLoadNextPl
QString key = d->pluginsToLoad.pop();
- loadPlugin( key );
+ loadPluginInternal( key );
if ( !d->pluginsToLoad.isEmpty() )
@@ -247,5 +247,5 @@ void KopetePluginManager::slotLoadNextPl
}
-KopetePlugin *KopetePluginManager::loadPlugin( const QString &_pluginId )
+KopetePlugin * KopetePluginManager::loadPlugin( const QString &_pluginId, \
PluginLoadMode mode /* = LoadSync */ ) {
QString pluginId = _pluginId;
@@ -258,4 +258,18 @@ KopetePlugin *KopetePluginManager::loadP
}
+ if ( mode == LoadSync )
+ {
+ return loadPluginInternal( pluginId );
+ }
+ else
+ {
+ d->pluginsToLoad.push( pluginId );
+ QTimer::singleShot( 0, this, SLOT( slotLoadNextPlugin() ) );
+ return 0L;
+ }
+}
+
+KopetePlugin *KopetePluginManager::loadPluginInternal( const QString &pluginId )
+{
kdDebug( 14010 ) << k_funcinfo << pluginId << endl;
--- kdenetwork/kopete/libkopete/kopetepluginmanager.h #1.9:1.10
@@ -146,4 +146,11 @@ public:
bool setPluginEnabled( const QString &name, bool enabled = true );
+ /**
+ * Plugin loading mode. Used by @loadPlugin. Code that doesn't want to block
+ * the GUI and/or lot a lot of plugins at once should use Async loading.
+ * The default is sync loading.
+ */
+ enum PluginLoadMode { LoadSync, LoadAsync };
+
public slots:
/**
@@ -151,7 +158,11 @@ public slots:
* if one is already loaded in memory.
*
+ * If mode is set to Async, the plugin will be queued and loaded in
+ * the background. This method will return a null pointer. To get
+ * the loaded plugin you can track the @ref pluginLoaded() signal.
+ *
* See also @ref plugin().
*/
- KopetePlugin *loadPlugin( const QString &pluginName );
+ KopetePlugin * loadPlugin( const QString &pluginId, PluginLoadMode mode = \
LoadSync );
/**
@@ -198,4 +209,13 @@ private slots:
private:
+ /**
+ * @internal
+ *
+ * The internal method for loading plugins.
+ * Called by @ref loadPlugin directly or through the queue for async plugin
+ * loading.
+ */
+ KopetePlugin * loadPluginInternal( const QString &pluginId );
+
/**
* @internal
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic