lxqt / lxqt-qtplugin

LXQt Qt platform integration plugin
https://lxqt.github.io
GNU Lesser General Public License v2.1
24 stars 14 forks source link

LXQt file dialog #23

Closed PCMan closed 6 years ago

PCMan commented 6 years ago

This implement the feature discussed here. https://github.com/lxde/pcmanfm-qt/issues/551#event-1187260629

tsujan commented 6 years ago

It also needs to remember the chosen view and have filtering. Maybe all these could be implemented later.

EDIT: I was too hasty; they should be added before merging.

tsujan commented 6 years ago

With the proposed changes, name filters are shown but without being elided when necessary:

filedialog

Also, filter has no effect and save dialog doesn't put the file name in the line-edit.

tsujan commented 6 years ago

OK, I can't add a commit yet because many things are missing; waiting until the gaps are filled.

PCMan commented 6 years ago

@tsujan what's missing? BTW, I found that this does not compatible with older version of Qt 5. I'll work on this.

luis-pereira commented 6 years ago

@PCMan Proabably related with QString QFileDialotg:::selectedMimeTypeFilter() It's only present since 5.9.

tsujan commented 6 years ago

@PCMan I usually have the latest stable Qt (5.9.1 for now). There are many things missing. My happiness was just about seeing the new, feature-rich dialog instead of the default one; otherwise, the former isn't usable in its current form.

(1) As the above screenshot shows, the list of extensions isn't elided (that may be because I changed your code a little). (2) The extension list is just there without doing anything; files aren't filtered according to it. (3) When a name is typed in the name line-edit, no selection list pops up (in contrast to the default dialog); actually, there's no filtering. (4) The save dialog is terrible because the "save" name doesn't appear in its line-edit. (5) Auto-selection is annoying and interferes with the real job but there's no way to disable it. (6) No setting is remembered.

Apart from that, as far as I saw the code, some functions and/or variables aren't used anywhere. So, I thought this should be a preliminary sketch on which you would work later. Anyhow -- and sorry if my emphasis sounds annoying -- this shouldn't be merged in its current state, IMHO.

If the missing parts are added, I'll gladly work on it to remove bugs and/or add features.

tsujan commented 6 years ago

@luis-pereira Fm::FileDialog is a QDialog, not a QFileDialog. It doesn't have selectMimeTypeFilter. Of course, we should add it.

tsujan commented 6 years ago

With some changes to this and https://github.com/lxde/libfm-qt/pull/112, the type filtering and that super wide combo can be fixed:

filter

Will try to fix other important things one by one...

luis-pereira commented 6 years ago

Fm::FileDialog is a QDialog, not a QFileDialog. It doesn't have selectMimeTypeFilter. Of course, we should add it

@tsujan You probably misread my comment. I said selectedMimeTypeFilter not selectMimeTypeFilter. By looking at your commit https://github.com/lxde/lxqt-qtplugin/pull/23/commits/54a5a332c39fb1fa491cf73ae9279ec57840bb8b, you already realized the difference.

tsujan commented 6 years ago

@luis-pereira You're tight. Sorry! My mind was occupied by possibilities and I misread your comment.

PCMan commented 6 years ago

@tsujan for incompatible parts, just add

if QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)

 ... Qt 5.9 specific code here

endif

rather than comment it out. Otherwise it won't work well for newer Qt versions.

tsujan commented 6 years ago

@PCMan Yes, I know but thanks for mentioning!

I've succeeded in fixing several issues and adding some necessary features (offline). Still other issues were found when I started to use the dialog. I'll add commits for fixes and other things and will tell everyone when this is ready for use.

tsujan commented 6 years ago

KDE file dialog can also remember the view mode regardless of the poor options Qt provides. I tested with a small "menu button" at the top right corner of the dialog for saving the view mode. If there's no objection, I might add a separate PR for it later.

PCMan commented 6 years ago

If there are no objections, I'm going to merge this PR.

tsujan commented 6 years ago

Please do so!

tsujan commented 6 years ago

I might just add a PR for remembering the view later.

stefonarch commented 6 years ago

Am I missing something? Recompiled libfm-qt, qtplugin and even pcmanfm-qt but I never see the new dialog.

tsujan commented 6 years ago

@stefonarch This is the order of compilation and installation:

(1) libfm-qt; (2) pcmanfm-qt (might crash without recompilation but I'm not sure); (2) lxqt-qtplugin.

After that, use a Qt app with open-file or save-file dialog (like QupZilla) and try to open/save something.

tsujan commented 6 years ago

BTW, if you used FeatherPad for testing, install its latest git version and check the new setting "Native file dialog" in Preferences.

stefonarch commented 6 years ago

Thanks, now solved, the culprit was a badly updated lxqt-qtplugin folder. Nice work!

PS: Small bug: Translations are not picked up for right click menu ( open|copy|paste ecc) and in the left panel "devices" "places"

tsujan commented 6 years ago

PS: Small bug: Translations are not picked up for right click menu ( open|copy|paste ecc) and in the left panel "devices" "places"

Please open an issue for that!

agaida commented 6 years ago

@stefonarch - are there translations yet?

tsujan commented 6 years ago

@agaida File dialog should use the existing translations. So, https://github.com/lxde/lxqt/issues/1338 is a bug.

tsujan commented 6 years ago

Of course, its strings need translation but the context menu, for example, is just called by it.