Review Request: Fix keyboard navigation into folders in KFileDialog

Will Stephenson wstephenson at kde.org
Mon Mar 29 17:57:35 BST 2010


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://reviewboard.kde.org/r/3435/
-----------------------------------------------------------

Review request for kdelibs, Andreas Pakulat and Rafael Fernández López.


Summary
-------

This patch solves the problem that the Enter/Return keys cannot be used when saving files to navigate into a folder in KFileDialog.  What happens is that the navigation in KDirOperator works, but the key event is also caught by the KFileDialog itself and passed to KDialog, oking the dialog.  Cursoring over a file in the KDirOperator populates the location widget, so a filename is provided and the dialog is valid.

This patch consumes the Enter/Return key event in a new KDirOperator::keyPressEvent(QKeyEvent*).  This change should be sufficient to solve the problem, but past changes to the code have made the control flow complex and different when loading and when saving files.  Without the Enter/Return key press event reaching KDialog, the user cannot save a file by selecting it and pressing Enter.

This is for 2 reasons: 

1) r891277 by ereslibre in KFileWidget::_k_fileSelected() prevents the KDirOperator::fileSelected() signal from invoking slotOk(), to "give the user a chance to amend the filename after selecting a file".

2) r895027 by ereslibre suppresses the KDirOperator::fileSelected() signal from being emitted when the isSaving flag is set on KDirOperator, when an item is activated, in order to respect KDE's double-click/single-click activate policy.  This is redundant because QAbstractItemView::activated() is controlled by KStyle according to KDE click policy (http://apaku.wordpress.com/2008/06/23/itemviews-with-kde-styles-adhere-to-kde-settings/). 

Since the behaviour change in 2) to KDirOperator::fileSelected() was masked by the propagated Enter/Return, is redundant for its goal, and was undocumented, the patch removes it.

The additional chance to amend the filename behaviour is inconsistent with single click policy and gives different behaviour in between load and save mode, but is useful since no select/deselect buttons appear on hover in KDirOperator's views yet, so I have kept that and improved it by focusing the location widget after a file item is activated.


Diffs
-----

  trunk/KDE/kdelibs/kfile/kdiroperator.h 1107918 
  trunk/KDE/kdelibs/kfile/kdiroperator.cpp 1107918 
  trunk/KDE/kdelibs/kfile/kfilewidget.cpp 1107918 

Diff: http://reviewboard.kde.org/r/3435/diff


Testing
-------

kfiledialogtest run with single click mouse, double click mouse, and keyboard navigation

make test in kdelibs/kfile and kdelibs/kio/kfile


Thanks,

Will





More information about the kde-core-devel mailing list