Fix QFileDialog not remembering the last visited directory.

Authored by dfaure on Jul 28 2018, 11:27 AM.



This regression (compared to kdelibs4's direct KFileDialog usage) came
from the fact that QFileDialog's lastVisited() only gets updated if
the helper emits directoryEntered.

So QFileDialog was setting the current dir as startDir every single
time, overriding's KFileWidget's own logic for reusing the last dir

Test Plan

QFileDialog::getOpenFileName(this, i18n("Select file"));
twice in a row, from the same process.

Diff Detail

R135 Integration for Qt applications in Plasma
No Linters Available
No Unit Test Coverage
Build Status
Buildable 1392
Build 1410: arc lint + arc unit
dfaure created this revision.Jul 28 2018, 11:27 AM
Restricted Application added a project: Plasma. · View Herald TranscriptJul 28 2018, 11:27 AM
dfaure requested review of this revision.Jul 28 2018, 11:27 AM
dfaure updated this revision to Diff 38682.Jul 28 2018, 8:16 PM

Add unittest (which fails without this fix)

apol added a subscriber: apol.Jul 30 2018, 12:04 AM
apol added inline comments.

I'm not sure I understand the comment. Is it like a TODO?

anthonyfieroni added inline comments.Jul 30 2018, 4:45 AM

It works without comment, i think these connections are not needed.

dfaure added inline comments.Jul 30 2018, 7:47 AM

Yes for this problem my patch is enough, but I was surprised to find that those signals were not connected. Yes it's a TODO, but unrelated to this bug.

apol added a comment.Jul 31 2018, 12:57 AM

+1 from me on the patch.
I'd prefer without the comment and just have it investigated, I'm not sure the comment will help.

dfaure updated this revision to Diff 38826.Jul 31 2018, 7:45 AM

Remove TODO comment. Although I can say it would have definitely helped me when investigating this bug...

ngraham accepted this revision.Aug 20 2018, 11:38 AM
ngraham added a subscriber: ngraham.

+1, this fixes a really annoying issue I had in LibreOffice ( and doesn't seem to regress the location behavior at all.

This revision is now accepted and ready to land.Aug 20 2018, 11:38 AM
dfaure closed this revision.Aug 20 2018, 11:51 AM

FWIW this works fine for me on the 5.12 branch; might be nice to get it there too for LTS users.