libkdepim
Komposer::PluginManager Class Reference
List of all members.Detailed Description
Definition at line 40 of file pluginmanager.h.
Public Types | |
enum | PluginLoadMode { LoadSync, LoadAsync } |
Public Slots | |
Plugin * | loadPlugin (const QString &pluginId, PluginLoadMode mode=LoadSync) |
void | loadAllPlugins () |
Signals | |
void | pluginLoaded (Plugin *plugin) |
void | allPluginsLoaded () |
Public Member Functions | |
PluginManager (QObject *) | |
~PluginManager () | |
QValueList< KPluginInfo * > | availablePlugins (const QString &category=QString::null) const |
QMap< KPluginInfo *, Plugin * > | loadedPlugins (const QString &category=QString::null) const |
Plugin * | plugin (const QString &pluginName) const |
QString | pluginName (const Plugin *plugin) const |
QString | pluginId (const Plugin *plugin) const |
bool | unloadPlugin (const QString &pluginName) |
QString | pluginIcon (const Plugin *plugin) const |
void | shutdown () |
bool | setPluginEnabled (const QString &name, bool enabled=true) |
Member Enumeration Documentation
Plugin loading mode.
Used by . 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.
Definition at line 148 of file pluginmanager.h.
Member Function Documentation
QValueList< KPluginInfo * > Komposer::PluginManager::availablePlugins | ( | const QString & | category = QString::null |
) | const |
Returns a list of all available plugins for the given category.
Currently there are two categories, "Plugins" and "Editors", but you can add your own categories if you want.
If you pass an empty string you get the complete list of ALL plugins.
You can query all information on the plugins through the KPluginInfo interface.
Definition at line 119 of file pluginmanager.cpp.
QMap< KPluginInfo *, Plugin * > Komposer::PluginManager::loadedPlugins | ( | const QString & | category = QString::null |
) | const |
Returns a list of all plugins that are actually loaded.
If you omit the category you get all, otherwise it's a filtered list. See also availablePlugins().
Definition at line 136 of file pluginmanager.cpp.
Plugin * Komposer::PluginManager::plugin | ( | const QString & | pluginName | ) | const |
Search by plugin name.
This is the key used as X-KDE-PluginInfo-Name in the .desktop file, e.g. "komposer_attachment"
- Returns:
- The Plugin object found by the search, or a null pointer if the plugin is not loaded.
Definition at line 405 of file pluginmanager.cpp.
QString Komposer::PluginManager::pluginName | ( | const Plugin * | plugin | ) | const |
Return the short user-visible name of the plugin.
If you want to have the internal name, use pluginId() instead.
- Returns:
- The name of the protocol, in the user's locale.
Definition at line 418 of file pluginmanager.cpp.
QString Komposer::PluginManager::pluginId | ( | const Plugin * | plugin | ) | const |
Return the internal name of the plugin.
You cannot display this name on the screen, it's used internally for passing around IDs. Use pluginName() for a string ready for display.
- Returns:
- The name of the protocol, in the user's locale.
Definition at line 431 of file pluginmanager.cpp.
bool Komposer::PluginManager::unloadPlugin | ( | const QString & | pluginName | ) |
QString Komposer::PluginManager::pluginIcon | ( | const Plugin * | plugin | ) | const |
Retrieve the name of the icon for a Plugin.
- Returns:
- An empty string if the given plugin is not loaded or the filename of the icon to use.
Definition at line 444 of file pluginmanager.cpp.
void Komposer::PluginManager::shutdown | ( | ) |
Shuts down the plugin manager on Komposer shutdown, but first unloads all plugins asynchronously.
After 3 seconds all plugins should be removed; what's still left by then is unloaded through a hard delete instead.
Note that this call also derefs the plugin manager from the event loop, so do NOT call this method when not terminating Komposer!
Definition at line 150 of file pluginmanager.cpp.
bool Komposer::PluginManager::setPluginEnabled | ( | const QString & | name, | |
bool | enabled = true | |||
) |
Enable a plugin.
This marks a plugin as enabled in the config file, so loadAll() can pick it up later.
This method does not actually load a plugin, it only edits the config file.
- Parameters:
-
name is the name of the plugin as it is listed in the .desktop file in the X-KDE-Library field.
Definition at line 470 of file pluginmanager.cpp.
Plugin * Komposer::PluginManager::loadPlugin | ( | const QString & | pluginId, | |
PluginLoadMode | mode = LoadSync | |||
) | [slot] |
Load a single plugin by plugin name.
Returns an existing plugin 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 pluginLoaded() signal.
See also plugin().
Definition at line 286 of file pluginmanager.cpp.
void Komposer::PluginManager::loadAllPlugins | ( | ) | [slot] |
Loads all the enabled plugins.
Also used to reread the config file when the configuration has changed.
Definition at line 224 of file pluginmanager.cpp.
void Komposer::PluginManager::pluginLoaded | ( | Plugin * | plugin | ) | [signal] |
Signals a new plugin has just been loaded.
void Komposer::PluginManager::allPluginsLoaded | ( | ) | [signal] |
All plugins have been loaded by the plugin manager.
This signal is emitted exactly ONCE, when the plugin manager has emptied its plugin queue for the first time. This means that if you call an async loadPlugin() before loadAllPlugins() this signal is probably emitted after the initial call completes, unless you are quick enough to fill the queue before it completes, which is a dangerous race you shouldn't count upon :)
The signal is delayed one event loop iteration through a singleShot timer, but that is not guaranteed to be enough for account instantiation. You may need an additional timer for it in the code if you want to programmatically act on it.
If you use the signal for enabling/disabling GUI objects there is little chance a user is able to activate them in the short while that's remaining, the slow part of the code is over now and the remaining processing time is neglectable for the user.
The documentation for this class was generated from the following files: