Handling of default button in KDialog broken

Allen Winter winter at kde.org
Fri Dec 19 15:46:41 GMT 2008

On Friday 04 July 2008 9:08:36 am Lubos Lunak wrote:
>  Hello,

Whatever happened to this patch?  Did you commit it?

>  could somebody please review the attached patch? It appears that KDialog
> has a bug with (not) setting the default button properly, which has been
> there since about forever.
>  A demo of this bug is the timeout dialog after you enable compositing for
> KWin. If compositing setup fails for any reason and all you get is e.g. a
> black screen, it's quite possible that instead of waiting those 10 seconds
> for the dialog to revert (about which you may not know if you can't see the
> dialog) you will start hitting "random" keys on the keyboard, say Enter or
> Space, and will actually confirm the dialog. Even though the default button
> is the cancel one.
>  The KDialog code has some function called setButtonFocus(), which however
> seems to be just a thin wrapper used for confusing things. Making a button
> default does not set focus to it, making it useless in many cases. It
> appears that e.g. KMessageBox works this around by explicitly later setting
> focus to the button (which however actually resets the button from being
> the default). I suggest the attached patch, which will normally make
> default buttons focused by default (and consistent with
> QMessageBox::setDefaultButton()).
>  Does somebody see a problem with it?

More information about the kde-core-devel mailing list