Preferring krarc as a primarily chosen protocol for various archive formats
Closed, ResolvedPublic

Description

I've noticed that archives are sometimes opened e.g. with zip:/ and sometimes with kracr:/ protocol. In case of zip we cannot write into that archive. Are you also facing this issue?

In krservices.cpp we are using KProtocolManager::protocolForArchiveMimetype(mimetype) method to get proper archive protocol. This method returns sometimes this and sometimes that, because by installing krarc protocol there is more then one protocol available for archive mimetypes available. I propose to extend KIO package and add KProtocolManager::protocolsForArchiveMimetype(mimetype) - note the "s" - which would return QList<QString> of protocols and we at Krusader would choose the right one (krarc if available).

I'll append both diffs (KIO and krservices.cpp).

Is there a better way to face this issue or do you think this is a way to go? Thanks!

One more thing. If I want to replicate the issue, I need to restart Krusader between each test so it can rebuild the cache of available protocols. Building the cache is the volatile step in this scenario :).

asensi added a subscriber: asensi.May 3 2016, 9:08 PM

I've noticed that archives are sometimes opened e.g. with zip:/ and sometimes with kracr:/ protocol.

It happened to me in the past until a change was made, probably it was that change:

https://quickgit.kde.org/?p=krusader.git&a=commitdiff&h=bf41f85a39e6c80534efc925db18976c9543f069

It's worth investigating.

In case of zip we cannot write into that archive. Are you also facing this issue?

Yes, using krarc:/ I can write into that archive, but using zip:/ I can't.

In krservices.cpp we are using KProtocolManager::protocolForArchiveMimetype(mimetype) method to get proper archive protocol.
This method returns sometimes this and sometimes that, because by installing krarc protocol there is more than one protocol
available for archive mimetypes available. I propose to extend KIO package and add
KProtocolManager::protocolsForArchiveMimetype(mimetype) - note the "s" - which would return QList<QString> of protocols and
we at Krusader would choose the right one (krarc if available).

I'll append both diffs (KIO and krservices.cpp).

Is there a better way to face this issue or do you think this is a way to go? Thanks!

I think that it's a good way to start going, at least we'll get more information about this important subject, thanks!

Sorry for my late response. Thanks for your guidance and useful info. Based on mentioned quickgit link I've proposed and extended patch to KIO developers (https://git.reviewboard.kde.org/r/127912/) and created one more diff (D1611) for adding all supported krarc:/ archive mimetypes in defaults (Konfigurator->Protocols).

My opinion is we should push both diffs to Krusader. If user does not have preferred mimetypes set in his/her Krusader -> Protocols section, there would still be a preference of krarc:/ protocol when deciding how to open an archive.

If user does not have preferred mimetypes set in his/her Krusader -> Protocols section, there would still be a preference of krarc:/ protocol when deciding how to open an archive.

It looks like a good idea.

Hi!
There are good news about this. David Faure wrote that if krarc is preferred, then to find if krarc is available, it can be used: KProtocolInfo::isKnownProtocol("krarc")

David Faure also wrote:

To find which archive mimetypes "krarc" can support, hmm, there was no API for it, so I just added it. KProtocolInfo::archiveMimeTypes("krarc"), requires KF 5.23 (released next month).
See http://commits.kde.org/kio/a60c6c437067c9daa2b5bbe6638ba4080342dacf

Hi! Thanks! I know about this but I was too busy lately to continue with this issue. Hopefully today in the evening or during next week I will have more time:).

For now I just propose that we do D1611 with the new provided api (KProtocolInfo::archiveMimetypes).

But regarding D1528 I would change it this way: cache archive mimetypes of krarc in a QSet of QStrings (only once during Krusader run) and then check whether given mimetype is there. I try to write a new diffs today.

martinkostolny closed this task as Resolved.Jul 7 2016, 8:55 AM

I believe we can now mark this task as resolved.

gengisdave moved this task from In progress to Done on the Krusader board.Oct 10 2016, 8:47 PM