In KDE's dynamic library system, the library factory plays a crucial rule. The init_libraryname() function always returns a pointer to a KLibFactory instance. Whenever a program needs a special action by the conduit, it calls the createObject of the KLibFactory to get an appropriate object. Furthermore, the conduit factory initializes the about dialog of the conduit.
The factories of all conduits are very similar, so you best just copy the .h and .cc file of an existing conduit for your conduit. All you need to do is to change the copyright notices for the about dialog, and change the class names of the ConduitAction and ConduitSetup to your own class names. Also, the factory is a good place to define the strings for the config settings' entries to the config file. If you define them like:
class MALConduitFactory : public KLibFactory
{
...
public:
static const char *configSetting1() {return fConfigSetting1;};
private:
static const char *fConfigSetting1;
} ;
and in the .cc file
const char*MALConduitFactory::fConfigSetting1="NameOfSetting";you can use them as MALConduitFactory::configSetting1() in both the configuration dialog and the sync routine without running the risk of misspelling them.
Everything else in the factory can stay as it is.
Here is an example of the malsync's factory: Source code of mal-factory.h Source code of mal-factory.cc