class KCModule


Module kdeui
Namespace
Class KCModule
Inherits QWidget
The base class for configuration modules.

Configuration modules are realized as plugins that are loaded only when needed.

The module in principle is a simple widget displaying the item to be changed. The module has a very small interface.

All the necessary glue logic and the GUI bells and whistles are provided by the control center and must not concern the module author.

To write a config module, you have to create a library that contains at one factory function like this:

#include 

typedef KGenericFactory YourKCModuleFactory; K_EXPORT_COMPONENT_FACTORY( yourLibName, YourKCModuleFactory("name_of_the_po_file") );

The parameter "name_of_the_po_file" has to correspond with the messages target that you created in your Makefile.am. Instead of using the library name for yourLibName you can also use another name which you specify in the desktop file with X-KDE-FactoryName. This is useful to have more than one factory in one lib.

The constructor of the KCModule then looks like this:

YourKCModule.YourKCModule( QWidget* parent )
: KCModule( YourKCModuleFactory.componentData(), parent )
{
KAboutData *about = new KAboutData(
, 0, ki18n( "..." ),
KDE_VERSION_STRING, KLocalizedString(), KAboutData.License_GPL,
ki18n( "Copyright 2006 ..." ) );
about->addAuthor( ki18n(...) );
setAboutData( about );
.
.
.
}

If you want to make the KCModule available only conditionally (i.e. show in the list of available modules only if some test succeeds) then you can use Hidden in the .desktop file. An example:

Hidden[$e]=$(if test -e /dev/js*; then echo "false"; else echo "true"; fi)
The example executes the given code in a shell and uses the stdout output for the Hidden value (so it's either Hidden=true or Hidden=false).

See http://developer.kde.org/documentation/other/kcm_howto.html for more detailed documentation.

Author Matthias Hoelzer-Kluepfel



enums

enum details

methods