Fix Plasma-QPA filedialog to show wrong directory with QFileDialog::selectUrl()

Authored by kossebau on Dec 22 2016, 6:51 PM.

Description

Fix Plasma-QPA filedialog to show wrong directory with QFileDialog::selectUrl()

Summary:
QFileDialog does not set the initialDirectory option in codepaths from
QFileDialog::selectUrl(...) or QFileDialog::selectFile(...) when passing
the task on to the native widget. So KDEPlatformFileDialogHelper has to
make sure itself that info is kept.
Because KDEPlatformFileDialogHelper::initializeDialog() calls
setDirectory(options()->initialDirectory()); as intended, usually during
the show event. And by that it resets any otherwise wanted state of the
filewidget it had from previous setup calls via QFileDialog, and instead
to whatever value the initialDirectory option had before, usually the
working directory as set during initialization.

Test Plan:
New unit test kfiledialog_unittest testSelectUrl no longer fails with added
code, also behaves now as expected with code e.g. from KUrlRequester.

Reviewers: Plasma, Frameworks, dfaure

Reviewed By: Plasma, graesslin, dfaure

Subscribers: plasma-devel

Tags: Plasma

Differential Revision: https://phabricator.kde.org/D3796

Details