KConfigureDialog (finally with code)

Matthias Kretz kretz at kde.org
Sat Aug 16 18:04:33 BST 2003


[sorry for the garbled text, saving in drafts folder of KMail did that - and I 
don't feel like writing it again]

Hi,

I've been telling this list of the configuration dialog merging stuff befor=
e...
Now I've finally implemented most of the things I proposed. I'd like to get=
 it into CVS as soon as possible so that KView and Kontact may begin using =
it.

Short summary:
KConfigureDialog is simple class to be used in your application with only t=
wo lines of code :-)
m_dlg =3D new KConfigureDialog( this );
m_dlg->show();

The configuration dialog then looks for all KCModules with X-KDE-ParentApp =
set to the application's instance name and embeds them into the KCMultiDial=
og. This works using KTrader - not the KControl directories.

If you have some special needs (think Kontact) there's another ctor:
m_dlg =3D new KConfigureDialog( QStringList::split( ";", "kmailpart;knodepa=
rt;knotespart;korganizerpart", this );

The dialog then merges all KCMs with X-KDE-ParentApp set to the app's insta=
nce name + all the KCMs with X-KDE-KCDParents=3D{kmailpart,knodepart,knotesp=
art,korganizerpart}.

A special plugin configuration page is in the works that shows the plugins =
KCM(s) on that page so that the user (hopefully) understands the connection=
 between the plugins config and the plugin being activated.

I've seen several apps installing KCMs into KControl, but I don't believe t=
he configuration of applications belongs into KControl - even for Konqueror=
=2E Though the framework would make it easy to open up all KCMs from all ap=
plications (if anybody would want to do that) and configure all apps in one=
 central place - might be nice for admins to create a default config, thoug=
h...

Ah forgot one thing: Your app wants to know when the user changed the confi=
g in the dialog. That's what KCDDispatcher can do for you. Every part of yo=
ur application (I'm missing the right terminology here), like KParts::MainW=
indow, KParts and Plugins have there own independent config and need to be =
informed. This is what you have to do:
KCDDispatcher::self()->registerInstance( instance()->instanceName(), this, =
SLOT( readSettings() ) );

Though I think the need for KCDDispatcher might go away if KPrefs goes into=
 kdelibs. Because the KCMs are loaded inprocess and therefor the KPrefs obj=
ect could be the same for the app and the KCMs.

-- 
C'ya
        Matthias
________________________________________________________
Matthias Kretz (Germany)                          <><
http://Vir.homeip.net/
MatthiasKretz at gmx.net, kretz at kde.org,
Matthias.Kretz at urz.uni-heidelberg.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kcd.patch
Type: text/x-diff
Size: 32253 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20030816/8445dcc4/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: signature
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20030816/8445dcc4/attachment.sig>


More information about the kde-core-devel mailing list