Add new protocol for 7z archives
ClosedPublic

Authored by nhiga on Sep 5 2019, 12:08 PM.

Details

Summary

This patch adds a new protocol, sevenz, for 7z archives by utilizing K7Zip. Previously, users have to install Krusader to use its krarc protocol to navigate a 7z archive using Dolphin.

Depends on D23780
Depends on D23490

Test Plan

Compile and install KIO with D23490 and D23780 applied.

(If Krusader is installed, change krarc to sevenz in the URL bar if necessary.)

Test using Dolphin:
Enable "Open archives as folder" in Dolphin, then open and browse a 7z archive using the sevenz protocol.

Test using Gwenview:
View a 7z archive containing photos. Browse and view images inside the archive.

Diff Detail

Repository
R320 KIO Extras
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
nhiga created this revision.Sep 5 2019, 12:08 PM
Restricted Application added a project: Dolphin. · View Herald TranscriptSep 5 2019, 12:08 PM
Restricted Application added a subscriber: kfm-devel. · View Herald Transcript
nhiga requested review of this revision.Sep 5 2019, 12:08 PM
nhiga added a comment.EditedSep 5 2019, 12:19 PM

Notes:

  1. I am not sure whether it is needed to include k7zip.h in archive/kio_archivebase.cpp.
  2. It can take some time to load the 7z archive using this new protocol.
ngraham added a subscriber: ngraham.Sep 5 2019, 1:40 PM

Probably best to submit the KIO patch first.

meven accepted this revision.Sep 5 2019, 1:41 PM
meven added a subscriber: meven.

Probably best to submit the KIO patch first.

D23490 has been accepted already.

Tested with D23490 and without krusader installed, opens 7zip archive in dolphin.

Works like a charm.

This revision is now accepted and ready to land.Sep 5 2019, 1:41 PM

Does it work when the older KIO is installed?

meven added a comment.Sep 5 2019, 2:15 PM

Does it work when the older KIO is installed?

Yes, I have tested it.

archive/sevenz.protocol
4

Was it possible to use 7zip as protocol, it would probably be more user intuitive.

meven requested changes to this revision.Sep 5 2019, 2:17 PM
This revision now requires changes to proceed.Sep 5 2019, 2:17 PM
nhiga added a comment.Sep 5 2019, 2:30 PM

@meven

There is a weird bug if I name the protocol as "7z" or "7zip":

  1. If I double click on the 7z file, Dolphin gives the "invalid protocol" error.
  2. If I try to manually enter the URL in Dolphin, i.e. 7z:/tmp/bar.7z or 7zip:/tmp/bar.7z, it does not work too - it is somehow being treated as a host (hostname) instead of a protocol.

I suspect that a KIO protocol should not have a name that starts with a number, otherwise there will be bugs.

@meven

There is a weird bug if I name the protocol as "7z" or "7zip":

  1. If I double click on the 7z file, Dolphin gives the "invalid protocol" error.
  2. If I try to manually enter the URL in Dolphin, i.e. 7z:/tmp/bar.7z or 7zip:/tmp/bar.7z, it does not work too - it is somehow being treated as a host (hostname) instead of a protocol.

    I suspect that a KIO protocol should not have a name that starts with a number, otherwise there will be bugs.

Sounds like we should fix that.

meven accepted this revision.Sep 7 2019, 9:37 PM

7zip:/ is in fact not correct because this would make the url scheme 7zip, but a url scheme must begin with a letter .
That's too bad URL aren't not more flexible.

This revision is now accepted and ready to land.Sep 7 2019, 9:37 PM
nhiga edited the test plan for this revision. (Show Details)Sep 8 2019, 1:43 AM
ngraham accepted this revision.Sep 8 2019, 10:36 PM
ngraham added reviewers: dfaure, pino, cfeck.

Yeah, I agree that the name is not 100% ideal, but honestly that's an implementation detail that shouldn't block this. The code and functionality look sound!

This revision was automatically updated to reflect the committed changes.