Commit f3e66c24 authored by Natsumi Higa's avatar Natsumi Higa Committed by Nate Graham
Browse files

Add new protocol for 7z archives

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.

Reviewers: meven, ngraham, dfaure, pino, cfeck

Reviewed By: meven, ngraham

Subscribers: ltoscano, meven, ngraham, kfm-devel, kde-frameworks-devel

Tags: #frameworks, #dolphin

Differential Revision: https://phabricator.kde.org/D23730
parent b4617c17
......@@ -71,4 +71,4 @@ add_library(kio_archive MODULE kio_archive.cpp kio_archive_debug.cpp)
target_link_libraries(kio_archive KF5::KIOCore KF5::Archive kioarchive Qt5::Network)
set_target_properties(kio_archive PROPERTIES OUTPUT_NAME "archive")
install(TARGETS kio_archive DESTINATION ${KDE_INSTALL_PLUGINDIR}/kf5/kio)
install(FILES tar.protocol ar.protocol zip.protocol DESTINATION ${KDE_INSTALL_KSERVICES5DIR})
install(FILES tar.protocol ar.protocol zip.protocol sevenz.protocol DESTINATION ${KDE_INSTALL_KSERVICES5DIR})
......@@ -25,6 +25,7 @@
#include <kar.h>
#include <ktar.h>
#include <kzip.h>
#include <k7zip.h>
#include "kio_archive_debug.h"
......@@ -63,8 +64,8 @@ ArchiveProtocol::ArchiveProtocol( const QByteArray &proto, const QByteArray &poo
KArchive *ArchiveProtocol::createArchive( const QString & proto, const QString & archiveFile )
{
if ( proto == "ar" ) {
qCDebug(KIO_ARCHIVE_LOG) << "Opening KAr on " << archiveFile;
return new KAr( archiveFile );
qCDebug(KIO_ARCHIVE_LOG) << "Opening KAr on " << archiveFile;
return new KAr( archiveFile );
}
else if ( proto == "tar" ) {
qCDebug(KIO_ARCHIVE_LOG) << "Opening KTar on " << archiveFile;
......@@ -73,6 +74,10 @@ KArchive *ArchiveProtocol::createArchive( const QString & proto, const QString &
else if ( proto == "zip" ) {
qCDebug(KIO_ARCHIVE_LOG) << "Opening KZip on " << archiveFile;
return new KZip( archiveFile );
}
else if ( proto == "sevenz" ) {
qCDebug(KIO_ARCHIVE_LOG) << "Opening K7Zip on " << archiveFile;
return new K7Zip( archiveFile );
} else {
qCWarning(KIO_ARCHIVE_LOG) << "Protocol" << proto << "not supported by this IOSlave" ;
return nullptr;
......
......@@ -32,6 +32,7 @@
#include <ktar.h>
#include <kzip.h>
#include <kar.h>
#include <k7zip.h>
#include <kio/global.h>
#include <kio_archive_debug.h>
#include <kuser.h>
......
[Protocol]
exec=kf5/kio/archive
protocol=sevenz
archiveMimetype=application/x-7z-compressed
input=filesystem
output=filesystem
listing=Name,Type,Size,Date,Access,Owner,Group,Link
reading=true
source=true
Icon=package-x-generic
Class=:local
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment