FileWidgets: Ignore Return events from KDirOperator
ClosedPublic

Authored by meven on Feb 17 2020, 12:12 PM.

Details

Summary

Activated event is used to handle key returns from KDirOperator.
Making a Return in the KDirOperator would cause a double treatment of the event :

  • first KDirOperator::activated for the activated event
  • second KDirOperator::activated for the KeyPressEvent Key_Return

BUG: 412737
FIXED-IN: 5.69

Test Plan
  • Open Kate
  • Ctrl+Maj + S, to save file as
  • type a file name
  • go to a directory using the arrows keys and return key

Before:
The dialog returns immediately with the file name in the opened directory.

After:
The directory is opened, the user can continue specifying path.

Diff Detail

Repository
R241 KIO
Branch
arcpatch-D27455
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 24569
Build 24587: arc lint + arc unit
meven created this revision.Feb 17 2020, 12:12 PM
Restricted Application added a project: Frameworks. · View Herald TranscriptFeb 17 2020, 12:12 PM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
meven requested review of this revision.Feb 17 2020, 12:12 PM
meven edited the summary of this revision. (Show Details)Feb 17 2020, 12:12 PM
meven added a reviewer: Frameworks.
meven edited the summary of this revision. (Show Details)Feb 17 2020, 12:17 PM
ngraham accepted this revision.Feb 18 2020, 4:09 AM

Nice, works for me.

This revision is now accepted and ready to land.Feb 18 2020, 4:09 AM
cfeck edited the summary of this revision. (Show Details)Mar 10 2020, 12:17 PM
meven added a comment.Mar 10 2020, 3:39 PM

Well I meant to do some checking, despite this works, it does not look nice.
Adding a test would be nice too.

meven updated this revision to Diff 78142.Mar 21 2020, 9:38 AM

Add event->accept()

meven added a comment.Mar 21 2020, 9:39 AM

I did some secondary review.
I'd like to add a test.

ahmadsamir added inline comments.
src/filewidgets/kfilewidget.cpp
1913 ↗(On Diff #78142)

I would combine the two if's (less nesting); and Qt::Key_Enter should be handled here too?

I tested this diff, and it seemed to work as expected.

meven updated this revision to Diff 79039.Apr 1 2020, 12:06 PM

Use a single if statement, handle for Qt::Key_Enter as well

dfaure accepted this revision.Apr 3 2020, 11:10 PM
This revision was automatically updated to reflect the committed changes.