Skip to content
  • Friedrich W. H. Kossebau's avatar
    Fix Plasma-QPA filedialog to show wrong directory with QFileDialog::selectUrl() · 7bbbd93c
    Friedrich W. H. Kossebau authored
    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
    7bbbd93c