Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Network
KIO Extras
Commits
3953484c
Commit
3953484c
authored
Jul 07, 2021
by
Friedrich W. H. Kossebau
Browse files
filter KIO: add zstd support
parent
7de1119c
Pipeline
#69624
canceled with stage
Changes
5
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
doc/kioslave/CMakeLists.txt
View file @
3953484c
...
...
@@ -17,3 +17,6 @@ add_subdirectory(thumbnail)
if
(
KArchive_HAVE_LZMA
)
add_subdirectory
(
xz
)
endif
()
if
(
KArchive_HAVE_ZSTD
)
add_subdirectory
(
zstd
)
endif
()
doc/kioslave/zstd/CMakeLists.txt
0 → 100644
View file @
3953484c
########### install files ###############
kdoctools_create_handbook
(
index.docbook INSTALL_DESTINATION
${
KDE_INSTALL_DOCBUNDLEDIR
}
/en SUBDIR kioslave5/zstd
)
doc/kioslave/zstd/index.docbook
0 → 100644
View file @
3953484c
<?xml version="1.0" ?>
<!DOCTYPE article PUBLIC "-//KDE//DTD DocBook XML V4.5-Based Variant V1.1//EN"
"dtd/kdedbx45.dtd" [
<!ENTITY % addindex "IGNORE">
<!ENTITY % English "INCLUDE" >
<!-- change language only here -->
]>
<article
lang=
"&language;"
id=
"zstd"
>
<title>
zstd
</title>
<articleinfo>
<authorgroup>
<author><firstname>
Friedrich
</firstname><othername>
W. H.
</othername><surname>
Kossebau
</surname></author>
<!-- TRANS:ROLES_OF_TRANSLATORS -->
</authorgroup>
</articleinfo>
<para><command>
zstd
</command>
is a compression program.
</para>
<para>
The zstd kioslave is not directly usable, and is intended for use
as a filter. For example, the tar kioslave can filter a file through
the zstd kioslave, in order to display the contents of a
<literal
role=
"extension"
>
tar.zst
</literal>
file directly in a
&konqueror;
window.
</para>
<para>
If you click on a file compressed with a
<literal
role=
"extension"
>
zst
</literal>
extension in
&konqueror;
, this kioslave is
used to uncompress it and display it as a normal (uncompressed)
file.
</para>
<para>
If you are a developer, and would like to use the zstd filter, you
can find documentation on using kioslaves at
<ulink
url=
"http://techbase.kde.org"
>
http://techbase.kde.org
</ulink></para>
<para>
See the manual:
<ulink
url=
"man:/zstd"
>
zstd
</ulink>
.
</para>
</article>
filter/filter.cpp
View file @
3953484c
...
...
@@ -61,7 +61,10 @@ int kdemain( int argc, char ** argv)
FilterProtocol
::
FilterProtocol
(
const
QByteArray
&
protocol
,
const
QByteArray
&
pool
,
const
QByteArray
&
app
)
:
KIO
::
SlaveBase
(
protocol
,
pool
,
app
)
{
QString
mimetype
=
QString
::
fromLatin1
(
"application/x-"
)
+
QString
::
fromLatin1
(
protocol
);
const
QString
mimetype
=
(
protocol
==
"zstd"
)
?
QStringLiteral
(
"application/zstd"
)
:
QLatin1String
(
"application/x-"
)
+
QLatin1String
(
protocol
.
constData
());
#if KARCHIVE_VERSION >= QT_VERSION_CHECK(5, 85, 0)
filter
=
KCompressionDevice
::
filterForCompressionType
(
KCompressionDevice
::
compressionTypeForMimeType
(
mimetype
));
#else
...
...
@@ -140,7 +143,7 @@ void FilterProtocol::get(const QUrl& url)
const
QString
extension
=
QFileInfo
(
subURL
.
path
()).
suffix
();
QMimeDatabase
db
;
QMimeType
mime
;
if
(
extension
==
"gz"
||
extension
==
"bz"
||
extension
==
"bz2"
)
{
if
(
extension
==
"gz"
||
extension
==
"bz"
||
extension
==
"bz2"
||
extension
==
"zst"
)
{
QString
baseName
=
subURL
.
path
();
baseName
.
truncate
(
baseName
.
length
()
-
extension
.
length
()
-
1
/*the dot*/
);
qDebug
(
KIO_FILTER_DEBUG
)
<<
"baseName="
<<
baseName
;
...
...
filter/filter.json
View file @
3953484c
...
...
@@ -69,6 +69,20 @@
"protocol"
:
"xz"
,
"reading"
:
true
,
"source"
:
false
},
"zstd"
:
{
"Icon"
:
"package-x-generic"
,
"X-DocPath"
:
"kioslave5/zstd/index.html"
,
"archiveMimetype"
:
[
"application/zstd"
],
"determineMimetypeFromExtension"
:
true
,
"exec"
:
"kf5/kio/filter"
,
"input"
:
"stream"
,
"output"
:
"stream"
,
"protocol"
:
"zstd"
,
"reading"
:
true
,
"source"
:
false
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment