KAutoConfigDialog

Benjamin Meyer ben at meyerhome.net
Tue Apr 15 21:17:51 BST 2003


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

With the whole discusion about the Apply button needs to be disabled my post 
about creating KAutoConfigDialog I guess was lost in the traffic.  This past 
weekend I put together KAutoConfigDialog.  I created KAutoConfig to handle 
the setting/resetting/saving of settings in a dialog, and now 
KAutoConfigDialog compliments that handling by enabling and disabling of 
buttons, creation of the dialog, and deletion of the widgets.  Not only will 
the Apply button be disabled, but so will the Default button.  And when you 
are playing with the settings and put them back to the default values or 
original values the appropriate button will then become disabled again.

Most importantly it allows the everage application to write even less code 
then before rather then adding code to each application.  I have migrated 
several applications from KAutoConfig to KAutoConfigDialog already.  KTron is 
an excellent example of how with only nine lines of code it can bring up the  
dialog: 

/**
 * Show Settings dialog.
 */
void KTron::showSettings(){
  if(KAutoConfigDialog::showDialog("settings"))
    return;
  
  KAutoConfigDialog *dialog = new KAutoConfigDialog(this, "settings");
  dialog->addWidget(new General(0, "General"), i18n("General"), "General", 
"package_settings");
  dialog->addWidget(new Ai(0, "Ai"), i18n("Ai"), "Game", "package_system");
  dialog->addWidget(new Appearance(0, "Appearance"), i18n("Appearance"), 
"Game", "style");
  connect(dialog, SIGNAL(settingsChanged()), tron, SLOT(loadSettings()));
  connect(dialog, SIGNAL(settingsChanged()), this, SLOT(readSettings()));
  dialog->doneSetup();
}

I have attached the classes for others to look at.  They arn't all that much.  
They arn't suppost to replace all of the functionality of KDialogBase, but 
just enough so the average application can bring up it settings dialog.  I 
have this class in use in more then two applications and it is usefull in 
most applications.  Are there any major objections to moving it into kdeui?

- -Benjamin Meyer
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE+nGjz1rZ3LTw38vIRAidmAKCj4uCu5SCbW+TtXunvFS33ghHgrgCfWpkh
+IvE3d/IJ3b3Xr3GQFXHa1I=
=tQTB
-----END PGP SIGNATURE-----
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kautoconfigdialog.cpp
Type: text/x-c++src
Size: 3165 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20030415/401d2ab4/attachment.cpp>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kautoconfigdialog.h
Type: text/x-chdr
Size: 4760 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20030415/401d2ab4/attachment.h>


More information about the kde-core-devel mailing list