Handling of default button in KDialog broken

Lubos Lunak l.lunak at suse.cz
Fri Dec 19 18:33:14 GMT 2008


On Friday 19 of December 2008, Allen Winter wrote:
> On Friday 04 July 2008 9:08:36 am Lubos Lunak wrote:
> >  Hello,
>
> Lubos,
>
> Whatever happened to this patch?  Did you commit it?

 No. If memory serves me well, I just fixed a related bug (r830903) and then 
just went the easy way and handled the focus explicitly like KMessageBox 
does.

> -Allen
>
> >  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?

-- 
Lubos Lunak
KDE developer
--------------------------------------------------------------
SUSE LINUX, s.r.o.   e-mail: l.lunak at suse.cz , l.lunak at kde.org
Lihovarska 1060/12   tel: +420 284 028 972
190 00 Prague 9      fax: +420 284 028 951
Czech Republic       http://www.suse.cz




More information about the kde-core-devel mailing list