[PATCH] Reverting changes when Cancel is pressed in KConfigDialog

Constantin Berzan exit3219 at gmail.com
Wed Jul 18 18:56:15 BST 2007


Hello again,
I've discovered that if a KConfigDialog-based dialog is displayed again after 
being closed, its widgets are not reset to those in the configuration. Also, 
there seems to be no way to reset them through the public interface.
Here's some example code:

//reuse it if it's been opened before
KConfigDialog *dialog = KConfigDialog::exists("settings");
if(!dialog)
{
	//create the dialog and add some pages...
}
dialog->exec();

Let's say I have a checkbox which is checked initially. I open the 
configuration dialog, and uncheck the checkbox. I don't click Apply. Then I 
change my mind and want to revert the change. Since there is no Reset button, 
I naturally expect that closing the dialog with the Cancel button and opening 
it again would show the checkbox checked, as it is in the configuration. 
However this does not happen, and the checkbox remains unchecked.

To address the issue I connect the cancelClicked() signal to the 
updateWidgets() slot of the KConfigDialog object and its underlying 
KConfigManager object(s). (see attached patch)

If there's something I don't understand correctly and this would not be the 
desired behaviour, please let me know. If noone speaks against it, I will 
commit this tomorrow.

-- 
http://ascending.wordpress.com/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kconfdialog.cpp-patch
Type: text/x-diff
Size: 959 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20070718/ab25cbf7/attachment.diff>


More information about the kde-core-devel mailing list