diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-08-17 17:54:01 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-08-17 17:54:01 +0000 |
commit | ffcb34f4b88f6e3974d45d6c2b91d68ef051e917 (patch) | |
tree | 1a6600dbc6bec53f99c295038ccc2550ac010be0 /kio | |
parent | 54241a1f0a21c7433f8dd2fa0410b93d38cce520 (diff) | |
download | tdelibs-ffcb34f4b88f6e3974d45d6c2b91d68ef051e917.tar.gz tdelibs-ffcb34f4b88f6e3974d45d6c2b91d68ef051e917.zip |
Preliminary xzip/LZMA support
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdelibs@1164814 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
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. |