diff options
Diffstat (limited to 'kio')
-rw-r--r-- | kio/kio/ktar.cpp | 14 | ||||
-rw-r--r-- | kio/kio/ktar.h | 5 |
2 files changed, 15 insertions, 4 deletions
diff --git a/kio/kio/ktar.cpp b/kio/kio/ktar.cpp index cf4bade20..e5173fdbc 100644 --- a/kio/kio/ktar.cpp +++ b/kio/kio/ktar.cpp @@ -101,6 +101,14 @@ KTar::KTar( const TQString& filename, const TQString & _mimetype ) if ( fourthByte == 4 ) mimetype = "application/x-zip"; } + else if ( firstByte == '\xFD' && secondByte == '7' && thirdByte == 'z' ) + { + unsigned char fourthByte = file.getch(); + unsigned char fifthByte = file.getch(); + unsigned char sixthByte = file.getch(); + if ( fourthByte == 'X' && fifthByte == 'Z' && sixthByte == 0x00 ) + mimetype = "application/x-xz"; + } } file.close(); } @@ -285,8 +293,10 @@ bool KTar::KTarPrivate::fillTempFile( const TQString & filename) { bool forced = false; if( "application/x-gzip" == mimetype - || "application/x-bzip2" == mimetype) - forced = true; + || "application/x-bzip2" == mimetype + || "application/x-lzma" == mimetype + || "application/x-xz" == mimetype) + forced = true; TQIODevice *filterDev = KFilterDev::deviceForFile( filename, mimetype, forced ); diff --git a/kio/kio/ktar.h b/kio/kio/ktar.h index 915cfed3a..95c52a32c 100644 --- a/kio/kio/ktar.h +++ b/kio/kio/ktar.h @@ -33,7 +33,7 @@ * A class for reading / writing (optionally compressed) tar archives. * * KTar allows you to read and write tar archives, including those - * that are compressed using gzip or bzip2. + * that are compressed using gzip, bzip2, or xz. * * @author Torben Weis <weis@kde.org>, David Faure <faure@kde.org> */ @@ -45,7 +45,8 @@ public: * using the compression filter associated to given mimetype. * * @param filename is a local path (e.g. "/home/weis/myfile.tgz") - * @param mimetype "application/x-gzip" or "application/x-bzip2" + * @param mimetype "application/x-gzip", "application/x-bzip2", + * or "application/x-xz" * Do not use application/x-tgz or similar - you only need to * specify the compression layer ! If the mimetype is omitted, it * will be determined from the filename. |