Focused button on save-before-quit dialog

Nicolás Alvarez nicolas.alvarez at gmail.com
Thu Aug 26 19:23:44 UTC 2010


When quitting KDevelop with modified files open, KDevelop shows a
dialog asking if you want to save the files first. The button selected
by default is "Save None", causing data loss if the user presses Space
or Enter when the dialog appears.

The code calls setDefaultButton(Ok), but this doesn't work as
expected. It means if the user presses Enter on the dialog, the button
activated will be "OK". However, if a button is *focused*, the Enter
key would activate the button that has focus instead. In this case,
the "default button" only applies if focus is on the document list
(the only control in the dialog apart from the buttons). Since Save
None is the button with focus when the dialog opens, that's what Enter
activates if user doesn't change focus.

To do the right thing, we should (also) call setButtonFocus when the
dialog is created.

However, Kate has "Cancel" as both default button and
initially-focused button, not "OK". It may be a good idea to do the
same, at least for consistency.

I also thought of leaving Ok as default button (to activate if Enter
pressed with list focused), and making Cancel the initial-focus
button, but I don't know if this difference may end up confusing for
users.

Thoughts?

-- 
Nicolas




More information about the KDevelop-devel mailing list