--Boundary-02=_V9Tr+ckmK4p3xeR Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Content-Description: signed data Content-Disposition: inline Hi, after many months I finally came up with something that I think might work.= A=20 few details are still not finished and I didn't think of integrating plugin= =20 selection yet, but I guess the ideas, that danimo helped me with, should wo= rk=20 out. Here's what I wrote down: KPrefsDialog using KCMs (outline): =2D--------------------------------- The program provides KCMs with their .desktop files installed in=20 $KDEDIR/share/services to make it possible for KTrader to handle them and/o= r=20 installed in $KDEDIR/share/applnk/Settings so they appear in KControl. When the preferences dialog is called kdelibs/kutils/kcmultidialog is used = to=20 embed the KCMs. The program doesn't have to know what KCMs to use but just= =20 asks KTrader for the modules for this program. The KCMultiDialog is constructed by the KPrefsDialog. This class searches f= or=20 the KCMs that need to be added. For notifying the right objects that the=20 configuration has changed a KPrefsDispatcher object would connect the dialo= g=20 and the objects. Optionally (or always?) I want to have only one preferences dialog open per= =20 application. If I open up the dialog and it's already present the existing= =20 dialog should be raised. This would only be possible over process boundarie= s=20 using DCOP, but could easily be done if e.g. Konqueror shows two instances= =20 that are in the same process. The .desktop file entries: =2D------------------------- Name, Comment, Icon, X-KDE-ModuleType, X-KDE-Library, X-KDE-FactoryName are= =20 used like for normal KControl KCMs. Type=3DService and ServiceTypes=3DKPrefsModule X-KDE-ParentApp is set to the application name this module belongs to. (e.g= =2E=20 KView part and plugins would specifiy "kview" while the kmailpart would als= o=20 specify "kmail" - the kontact case is a special one and is handled=20 different). X-KDE-PrefsParent is set to the internal name of the app/part/plugin this K= CM=20 belongs to. (e.g. "kview", "kviewviewer", "kviewpresenter" ...) How to define which KCM belongs to what apps: =2D-------------------------------------------- The KCMs .desktop file is installed as Type=3DService in=20 $KDEDIR/share/services/kprefs. By looking at the ServiceType (value=20 "KPrefsModule") we can find all KCMs. You can find all the KCMs belonging=20 especially to one application using KServiceGroup::childGroup( "appname" );= =20 In the case of Kontact you have different KParts providing the programs=20 functionality, but since the program knows the KParts it's using it can que= ry=20 for KCMs with the X-KDE-PrefsParent set to the according KParts. Construction of the Dialog: =2D-------------------------- KPrefsDialog constructs a KCMultiDialog and feeds it the KCModuleInfo objec= ts=20 that are created from a KTrader query. For an application like KView the=20 KPrefsDialog would ask the trader for "ServiceTypes=3DKPrefsModule" with th= e=20 constraint "X-KDE-ParentApp=3Dkview". The list of KService objects is then = used=20 to create KCModuleInfo objects. I'm in need of a way to tell the position of the KCM in the dialog. I want = it=20 to be possible to create a tree of pages in the KDialogBase. The groups()=20 method of KCModuleInfo is a good candidate for that. But so far the groups(= )=20 value was created by looking at the directory tree of the .desktop file. If= =20 the X-KDE-Groups field is set the groups() value is set to that. If you wan= t=20 to pass a list you need to separate the entries with a semicolon. The case where your only KTrader constraint is the X-KDE-ParentApp is the e= asy=20 one. But if you want to create a dialog for an app like Kontact your=20 constraint is "X-KDE-ParentApp=3Dkontact or X-KDE-PrefsParent=3Dkmailpart o= r=20 X-KDE-PrefsParent=3Dkorgpart" (I'd need to look at the KTrader syntax to wr= ite=20 a real one). =46or Konqueror the problem is again another one. I'd say the "Configure=20 Konqueror..." action should open up a dialog with the pages included like i= t=20 is currently. You wouldn't want to merge in the current KPart since that=20 would just confuse the user when the dialog changes without the user=20 requesting it explicitly. So we need a new Action to configure the current= =20 part (and its plugins). Optimally this Action is inserted automatically (I= =20 need to see if that is possible), or Konqueror needs to handle it (which is= =20 probably also not a bad idea). And another case: Say my KViewCanvas component (not a KPart BTW) would ship= =20 with a KCM. Then every program using the KImageViewer::Canvas interface wou= ld=20 like to be able to show the config dlg of the component it's using. Accordi= ng=20 to the Application this would either be merged into the main KPrefsDialog o= r=20 a special button to configure the canvas would open up a KPrefsDialog with= =20 the KCM of that component. So what I need is a ctor for KPrefsDialog to get= a=20 dialog for a list of X-KDE-PrefsParent entries. The problem: The program=20 doesn't know what component it's going to get when it asks for a=20 KImageViewer::Canvas so it doesn't know the name to use for the constraint. Dispatching =2D---------- To (perhaps/hopefully) solve above problem and to tell the relevant parts o= f=20 the program that their configuration has changed a dispatcher is needed. The dispatcher is a globally available object (either a singleton, KGlobal:= :=20 thingie or a child of KApplication) where the MainWin, KParts and Plugins=20 register with their instanceName and a slot to be called when the=20 configuration of one of their KCMs has been changed and applied. PS: There's a lot of code duplication in this area currently, but I've seen= =20 nothing so far that could solve my problems. I don't want to force my ideas= =20 on KDE - I want a solution for KView that helps other application developer= s,=20 too. I hope together we may find the right solution that's fits us all :-) =2D-=20 C'ya Matthias ________________________________________________________ Matthias Kretz (Germany) <>< http://Vir.homeip.net/ MatthiasKretz@gmx.net, kretz@kde.org, Matthias.Kretz@urz.uni-heidelberg.de --Boundary-02=_V9Tr+ckmK4p3xeR Content-Type: application/pgp-signature Content-Description: signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux) iD8DBQA+rT9Vyg4WnCj6OIoRAp2rAKDsOgAy+71ifsEpPdFYzj8/f+LeYQCgkvFV wMtK3k+9S77nlC1utKxmmV4= =UVr0 -----END PGP SIGNATURE----- --Boundary-02=_V9Tr+ckmK4p3xeR--