KUtils
#include <kpluginselector.h>
Classes | |
class | Private |
Public Types | |
enum | PluginLoadMethod { ReadConfigFile = 0, IgnoreConfigFile } |
Signals | |
void | changed (bool hasChanged) |
void | configCommitted (const QByteArray &componentName) |
Public Member Functions | |
KPluginSelector (QWidget *parent=0) | |
~KPluginSelector () | |
void | addPlugins (const QString &componentName, const QString &categoryName=QString(), const QString &categoryKey=QString(), KSharedConfig::Ptr config=KSharedConfig::Ptr()) |
void | addPlugins (const KComponentData &instance, const QString &categoryName=QString(), const QString &categoryKey=QString(), const KSharedConfig::Ptr &config=KSharedConfig::Ptr()) |
void | addPlugins (const QList< KPluginInfo > &pluginInfoList, PluginLoadMethod pluginLoadMethod=ReadConfigFile, const QString &categoryName=QString(), const QString &categoryKey=QString(), const KSharedConfig::Ptr &config=KSharedConfig::Ptr()) |
void | defaults () |
bool | isDefault () const |
void | load () |
void | save () |
void | updatePluginsState () |
Detailed Description
A widget to select what plugins to load and configure the plugins.
It shows the list of available plugins
Since the user needs a way to know what a specific plugin does every plugin sould install a desktop file containing a name, comment and category field. The category is useful for applications that can use different kinds of plugins like a playlist, skin or visualization
The location of these desktop files is the share/apps/<instancename>/<plugindir> directory. But if you need you may use a different directory
You can add plugins from different KConfig[group], by just calling all times you want addPlugins method with the correct parameters
Additionally, calls to constructor with same categoryName
, will add new items to the same category, even if plugins are from different categories
Definition at line 58 of file kpluginselector.h.
Member Enumeration Documentation
Enumerator | |
---|---|
ReadConfigFile | |
IgnoreConfigFile |
Definition at line 64 of file kpluginselector.h.
Constructor & Destructor Documentation
KPluginSelector::KPluginSelector | ( | QWidget * | parent = 0 | ) |
Create a new KPluginSelector.
Definition at line 247 of file kpluginselector.cpp.
KPluginSelector::~KPluginSelector | ( | ) |
Destructor.
Definition at line 286 of file kpluginselector.cpp.
Member Function Documentation
void KPluginSelector::addPlugins | ( | const QString & | componentName, |
const QString & | categoryName = QString() , |
||
const QString & | categoryKey = QString() , |
||
KSharedConfig::Ptr | config = KSharedConfig::Ptr() |
||
) |
Add a list of KParts plugins.
The information about the plugins will be loaded from the share/apps/<instancename>/kpartplugins directory
- Parameters
-
componentName The name of the KComponentData of the plugin's parent. categoryName The translated name of the category. This is the name that is shown in the title. If the category did exist before because of another call to addPlugins, then they will be shown in that category. If categoryName
is a new one, then a new category will be shown on the plugin window, and the list of plugins added to itcategoryKey When you have different categories of KParts plugins you distinguish between the plugins using the Category key in the .desktop file. Use this parameter to select only those KParts plugins with the Category key == categoryKey
. IfcategoryKey
is not set the Category key is ignored and all plugins are shown. Not match caseconfig The KConfig object that holds the state of the plugins being enabled or not. By default it should be componentData.config(). It is recommended to always pass a KConfig object if you use KSettings::PluginPage since you never know from where the page will be called (think global config app). For example KViewCanvas passes KConfig( "kviewcanvas" )
Definition at line 293 of file kpluginselector.cpp.
void KPluginSelector::addPlugins | ( | const KComponentData & | instance, |
const QString & | categoryName = QString() , |
||
const QString & | categoryKey = QString() , |
||
const KSharedConfig::Ptr & | config = KSharedConfig::Ptr() |
||
) |
Add a list of KParts plugins.
Convenience method for the one above. If not set explicitly, config
is set to componentData.config()
Definition at line 317 of file kpluginselector.cpp.
void KPluginSelector::addPlugins | ( | const QList< KPluginInfo > & | pluginInfoList, |
PluginLoadMethod | pluginLoadMethod = ReadConfigFile , |
||
const QString & | categoryName = QString() , |
||
const QString & | categoryKey = QString() , |
||
const KSharedConfig::Ptr & | config = KSharedConfig::Ptr() |
||
) |
Add a list of non-KParts plugins.
- Parameters
-
pluginInfoList A list of KPluginInfo objects containing the necessary information for the plugins you want to add to the list pluginLoadMethod If KPluginSelector will try to load the state of the plugin when loading the dialog from the configuration file or not. This is useful if for some reason you called the setPluginEnabled() for each plugin individually before loading the dialog, and don't want KPluginSelector to override them when loading categoryName The translated name of the category. This is the name that is shown in the title. If the category did exist before because of another call to addPlugins, then they will be shown in that category. If categoryName
is a new one, then a new category will be shown on the plugin window, and the list of plugins added to itcategoryKey When you have different categories of KParts plugins you distinguish between the plugins using the Category key in the .desktop file. Use this parameter to select only those KParts plugins with the Category key == categoryKey
. IfcategoryKey
is not set the Category key is ignored and all plugins are shown. Not match caseconfig The KConfig object that holds the state of the plugins being enabled or not. By default it will use KGlobal::config(). It is recommended to always pass a KConfig object if you use KSettings::PluginPage since you never know from where the page will be called (think global config app). For example KViewCanvas passes KConfig("kviewcanvas")
- Note
- All plugins that were set a config group using setConfig() method will load and save their information from there. For those that weren't any config object,
config
will be used
Definition at line 325 of file kpluginselector.cpp.
|
signal |
Tells you whether the configuration is changed or not.
|
signal |
Emitted after the config of an embedded KCM has been saved.
The argument is the name of the parent component that needs to reload its config
void KPluginSelector::defaults | ( | ) |
Change to applications defaults.
- See also
- isDefault()
Definition at line 366 of file kpluginselector.cpp.
bool KPluginSelector::isDefault | ( | ) | const |
Returns true if the plugin selector does not have any changes to application defaults.
- See also
- defaults()
- Since
- 4.3
Definition at line 377 of file kpluginselector.cpp.
void KPluginSelector::load | ( | ) |
Load the state of the plugins (selected or not) from the KPluginInfo objects.
Definition at line 341 of file kpluginselector.cpp.
void KPluginSelector::save | ( | ) |
Save the configuration.
Definition at line 353 of file kpluginselector.cpp.
void KPluginSelector::updatePluginsState | ( | ) |
Updates plugins state (enabled or not)
This method won't save anything on any configuration file. It will just be useful if you added plugins with the method:
To sum up, this method will update your plugins state depending if plugins are ticked or not on the KPluginSelector dialog, without saving anything anywhere
Definition at line 390 of file kpluginselector.cpp.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:50:35 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.