Improve handling of supported mimetypes
ClosedPublic

Authored by rthomsen on Mar 14 2016, 8:44 PM.

Details

Summary

Move mimetype-handling functions to own file (mimetypes.cpp). In MainWindow::openArchive() set filter using QFileDialog::setMimeTypeFilters() instead of using QFileDialog::setNameFilters().

This fixes sorting of filters in "Open Archive" dialog with KF 5.20.0. Frameworkintegration 5.20.0 broke this sorting due to commit 415ad2ed48356c3065c937813888fa1bd2742789.

Diff Detail

Repository
R36 Ark
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
rthomsen updated this revision to Diff 2774.Mar 14 2016, 8:44 PM
rthomsen retitled this revision from to Improve handling of supported mimetypes.
rthomsen updated this object.
rthomsen edited the test plan for this revision. (Show Details)
rthomsen added a reviewer: elvisangelaccio.
rthomsen set the repository for this revision to R36 Ark.
rthomsen added a project: Ark.
Restricted Application added a subscriber: kde-utils-devel. · View Herald TranscriptMar 14 2016, 8:44 PM
rthomsen updated this object.Mar 15 2016, 10:28 AM
elvisangelaccio requested changes to this revision.Mar 15 2016, 10:59 AM
elvisangelaccio edited edge metadata.

I don't get the "All supported archives" filter. Is that normal?

Another thing, I would also move the determineMimeType() function from archive_kerfuffle.cpp to this new source file :)

app/extractHereDndPlugin.cpp
30

Unnecessary include

kerfuffle/mimetypes.cpp
29

Move also the static findExecutables() function in this new file, so that you don't need to include this header here.

55

This will add duplicate mimetypes in the list (even though they are discarded later thanks to the QMap). Better to leave the local supported variable as QSet, then you can just return sortByComment(supported) at the end of the function.

70

const QSet &...
(see above)

83

foreach (key, map.keyList()) ?

less verbose :)

kerfuffle/mimetypes.h
36

Please add a doxygen comment, explaining that this function returns a list sorted by comment.

This revision now requires changes to proceed.Mar 15 2016, 10:59 AM

I don't get the "All supported archives" filter. Is that normal?

"All supported archives/types" filter is important in an Open dialog to be able to see all file types that the program supports. Previously, we had to construct it ourselves, but now QFileDialog::setMimeFilters() does it for us automatically.

I don't get the "All supported archives" filter. Is that normal?

"All supported archives/types" filter is important in an Open dialog to be able to see all file types that the program supports. Previously, we had to construct it ourselves, but now QFileDialog::setMimeFilters() does it for us automatically.

I don't have it in the open dialog (7z is the first filter). Maybe because I'm still with frameworkintegration 5.19?

rthomsen updated this revision to Diff 2788.Mar 15 2016, 8:44 PM
rthomsen edited edge metadata.

Incorporate Elvis' suggestions.

elvisangelaccio requested changes to this revision.Mar 15 2016, 9:49 PM
elvisangelaccio edited edge metadata.
elvisangelaccio added inline comments.
kerfuffle/archive_kerfuffle.cpp
39

You can drop this include.

kerfuffle/mimetypes.h
37

Issue still valid :p

This revision now requires changes to proceed.Mar 15 2016, 9:49 PM
rthomsen added inline comments.Mar 16 2016, 10:18 AM
kerfuffle/mimetypes.h
37

Would you mind adding the doxygen comments after I've pushed this diff? I have no idea how the syntax is...

kerfuffle/mimetypes.h
37

Ok, no problem :)

kerfuffle/mimetypes.h
37

Even better, I'll write it here. Just add the following comment:

/**
 * @return A list with the supported read-only mimetypes, alphabetically sorted according to their comment.
 */
rthomsen updated this revision to Diff 2808.Mar 16 2016, 4:29 PM
rthomsen edited edge metadata.

Incorporate Elvis' suggestions.

rthomsen marked 11 inline comments as done.Mar 16 2016, 4:30 PM
rthomsen updated this revision to Diff 2811.Mar 16 2016, 6:34 PM
rthomsen edited edge metadata.

Move findExecutables() to mimetypes.cpp.

elvisangelaccio accepted this revision.Mar 16 2016, 6:36 PM
elvisangelaccio edited edge metadata.
This revision is now accepted and ready to land.Mar 16 2016, 6:36 PM
This revision was automatically updated to reflect the committed changes.