Port from KFileDialog to QFileDialog.

Authored by dfaure on Nov 23 2019, 1:36 AM.



Tricky because of the embedded widget for save options.
Reused the solution found in kuickshow.

Since QFileDialog implements overwrite checking, kill all
the custom code for doing the same.

Test Plan

Save as (new file), save as (existing file)

Diff Detail

No Linters Available
No Unit Test Coverage
Build Status
Buildable 19083
Build 19101: arc lint + arc unit
dfaure requested review of this revision.Nov 23 2019, 1:36 AM
dfaure created this revision.
tcanabrava accepted this revision.Dec 6 2019, 12:41 PM

Tested and works.

This revision is now accepted and ready to land.Dec 6 2019, 12:41 PM
dfaure closed this revision.Dec 6 2019, 9:19 PM
cfeck added a subscriber: cfeck.Dec 19 2019, 9:34 PM
cfeck added inline comments.

Is there hope that Qt could be tricked into supporting native file dialogs that allow Qt widgets as extensions? I am not really happy with the pure Qt save dialog. It lacks all the bookmarks from the Places panel.

broulik added inline comments.Dec 20 2019, 7:05 PM

Ouch, this "not use native dialog" is a *severe* usability regression. At first I thought it was a bug that it was using the Qt dialog.

There's no editable address bar, there's no places panel, the mime type detection based on input filename (e.g. if I input ".jpg" it should switch to save as JPEG).

I took this solution from kuickshow (using lxr), but clearly that must be less often used than kolourpaint :)

From previous discussions I think the best thing to do is to split this out of the filedialog. Either asking in a separate dialog afterwards, or turning this into global settings in the app config dialog. What's preferred?

I fiddle with the quality selector for JPEG regularly. However, given it prompts "saving in this format might lose information" afterwards usually, having a dialog with that warning and the controls coming after the save dialog wouldn't be too bad.

However for PNGs I am not sure I want it asking about color depth every time - maybe we could represent that using different mine types? Have PNG (24 bit), PNG (8 bit) etc as additional fake mime types if that's possible?

I just again accidentally saved something as JPG instead of PNG because typing "foo.png" doesn't automatically switch file type in Qt's dialog.. can we please get this thing back? :(

cfeck added a comment.Jan 13 2020, 9:26 PM

It doesn't automatically append extension either.

If we cannot upstream our features to Qt, we need to keep our classes. We can move them back from kdelibs4support into supported frameworks.

I'd rather move the settings out of the filedialog. It's just not a portable solution.

I'm not sure about fake mimetypes though, that would mean 5 (not 3) PNG subtypes, too easy to select the wrong one (especially if you don't know much about color depths). At least currently you can ignore the combo and keep the sensible default.

How about we just have a separate dialog afterwards? Much like OpenOffice has a whole PDF settings dialog (which I completely ignore every time).
We *could* have a dontshow checkbox, not sure.

pino added a subscriber: pino.Jan 13 2020, 10:51 PM

Shouldn't KFileCustomDialog be used instead?

Wow, I had no idea that class existed. Thanks for the tip, I'm porting it now.

dfaure added a comment.EditedJan 13 2020, 11:28 PM

Done at D26645