Focused button on save-before-quit dialog

Christoph Cullmann cullmann at absint.de
Thu Aug 26 19:56:50 UTC 2010


On Thursday 26 August 2010 21:41:04 Aleix Pol wrote:
> 2010/8/26 Nicolás Alvarez <nicolas.alvarez at gmail.com>
> 
> > 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
> > 
> > --
> > KDevelop-devel mailing list
> > KDevelop-devel at kdevelop.org
> > https://barney.cs.uni-potsdam.de/mailman/listinfo/kdevelop-devel
> 
> Hi Nicolás!
> I just tried it and by default I get the "Save Modified" button selected
> (when i press enter/space it gets selected), maybe it's a bug in different
> KDialog revisions?
> 
> On what Kate does, I'm not sure what do they think but IMO save is a good
> default. I don't see a reason to have something else, in the end if you
> didn't want to save you can always revert, and if you didn't commit... then
> you should have :P. (in kdevelop's case most time files will be versioned,
> probably not in Kate).
"Cancel" as default does prevent users from loose their work.
If they just click the default button, nothing happens, if they want to either 
overwrite their files on disk or loose their work, they need to decide.

I think that is a much more sane default, you can't assume everything is 
versioned and even then, you might loose hours of work, if you just overwrite 
your local changes by accident ;)

Greetings
Christoph




More information about the KDevelop-devel mailing list