Added support for xz archives. This resolve bug 2516.

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
feat/lzip-support
Michele Calgaro 8 years ago
parent 76ca48c43d
commit 50e51d1622

@ -125,6 +125,8 @@ KIso::KIso( const TQString& filename, const TQString & _mimetype )
mimetype = "application/x-gzip";
else if ( mimetype == "application/x-tbz" ) // that's a bzipped2 tar file, so ask for bz2 filter
mimetype = "application/x-bzip2";
else if ( mimetype == "application/x-txz" ) // that's a xzipped tar file, so ask for xz filter
mimetype = "application/x-xz";
else
{
// Something else. Check if it's not really gzip though (e.g. for KOffice docs)
@ -144,6 +146,14 @@ KIso::KIso( const TQString& filename, const TQString & _mimetype )
if ( fourthByte == 4 )
mimetype = "application/x-zip";
}
else if ( firstByte == 0xfd && 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 == 0)
mimetype = "application/x-xz";
}
}
}
forced = false;
@ -160,8 +170,8 @@ void KIso::prepareDevice( const TQString & filename,
setDevice( new QFileHack( filename ) );
else
{
if( "application/x-gzip" == mimetype
|| "application/x-bzip2" == mimetype)
if("application/x-gzip" == mimetype || "application/x-bzip2" == mimetype ||
"application/x-xz" == mimetype)
forced = true;
TQIODevice *dev = KFilterDev::deviceForFile( filename, mimetype, forced );

@ -313,7 +313,7 @@ void tdeio_krarcProtocol::get(const KURL& url, int tries ){
KMimeType::Ptr mt = KMimeType::findByURL( arcTempDir+file, 0, false /* NOT local URL */ );
emit mimeType( mt->name() );
proc << getCmd << convertName( arcFile->url().path() )+" ";
if( arcType != "gzip" && arcType != "bzip2" ) proc << convertFileName( file );
if( arcType != "gzip" && arcType != "bzip2" && arcType != "xz") proc << convertFileName( file );
connect(&proc,TQT_SIGNAL(receivedStdout(TDEProcess*,char*,int)),
this,TQT_SLOT(receivedData(TDEProcess*,char*,int)) );
}
@ -323,7 +323,8 @@ void tdeio_krarcProtocol::get(const KURL& url, int tries ){
proc.start(TDEProcess::Block,TDEProcess::AllOutput);
if( !extArcReady && !decompressToFile ) {
if( !proc.normalExit() || !checkStatus( proc.exitStatus() ) || ( arcType != "bzip2" && expectedSize != decompressedLen ) ) {
if( !proc.normalExit() || !checkStatus( proc.exitStatus() ) ||
( arcType != "bzip2" && arcType != "xz" && expectedSize != decompressedLen ) ) {
if( encrypted && tries ) {
invalidatePassword();
get( url, tries - 1 );
@ -678,6 +679,8 @@ bool tdeio_krarcProtocol::setArcFile(const KURL& url){
arcType = "bzip2";
else if( arcType == "tgz" )
arcType = "gzip";
else if( arcType == "txz" )
arcType = "xz";
if( arcType.isEmpty() ) {
arcType = arcFile->mimetype();
@ -704,7 +707,7 @@ bool tdeio_krarcProtocol::initDirDict(const KURL&url, bool forced){
KrShellProcess proc;
KTempFile temp( TQString(), "tmp" );
temp.setAutoDelete(true);
if( arcType != "bzip2" ){
if (arcType != "bzip2" && arcType != "xz") {
if( arcType == "rpm" )
proc << listCmd << convertName( arcPath ) <<" > " << temp.name();
else
@ -736,7 +739,7 @@ bool tdeio_krarcProtocol::initDirDict(const KURL&url, bool forced){
root->append(entry);
if( arcType == "bzip2" ){
if (arcType == "bzip2" || arcType == "xz"){
KRDEBUG("Got me here...");
parseLine(0,"",temp.file());
return true;
@ -1158,6 +1161,14 @@ void tdeio_krarcProtocol::parseLine(int lineNo, TQString line, TQFile*) {
// full name
fullName = nextWord(line,'\n');
}
if (arcType == "xz") {
fullName = arcFile->name();
if (fullName.endsWith("xz")) {
fullName.truncate(fullName.length() - 3);
}
mode = arcFile->mode();
size = arcFile->size();
}
if( fullName.right(1) == "/" ) fullName = fullName.left(fullName.length()-1);
if( !fullName.startsWith("/") ) fullName = "/"+fullName;
@ -1356,8 +1367,14 @@ bool tdeio_krarcProtocol::initArcParameters() {
delCmd += "-p'"+password+"' ";
}
}
}
else {
} else if (arcType == "xz") {
cmd = fullPathName("xz");
listCmd = fullPathName("xz");
getCmd = fullPathName("xz") + "-dc";
copyCmd = TQString();
delCmd = TQString();
putCmd = TQString();
} else {
cmd = TQString();
listCmd = TQString();
getCmd = TQString();
@ -1383,7 +1400,7 @@ bool tdeio_krarcProtocol::checkStatus( int exitCode ) {
return exitCode == 0 || exitCode == 1;
else if( arcType == "ace" || arcType == "bzip2" || arcType == "lha" || arcType == "rpm" || arcType == "arj" )
return exitCode == 0;
else if( arcType == "gzip" )
else if( arcType == "gzip"|| arcType == "xz" )
return exitCode == 0 || exitCode == 2;
else
return exitCode == 0;
@ -1404,7 +1421,8 @@ TQString tdeio_krarcProtocol::detectArchive( bool &encrypted, TQString fileName
{"bzip2",0, "\x42\x5a\x68\x39\x31" },
{"gzip", 0, "\x1f\x8b"},
{"deb", 0, "!<arch>\ndebian-binary " },
{"7z", 0, "7z\xbc\xaf\x27\x1c" } };
{"7z", 0, "7z\xbc\xaf\x27\x1c" },
{"xz", 0, "\xfd7zXZ\x00"} };
static int autoDetectElems = sizeof( autoDetectParams ) / sizeof( AutoDetectParams );
encrypted = false;
@ -1545,6 +1563,16 @@ TQString tdeio_krarcProtocol::detectArchive( bool &encrypted, TQString fileName
}
}
}
if (fileName.endsWith(".tar.xz"))
{
return "txz";
}
else if (fileName.endsWith(".xz"))
{
return "xz";
}
return TQString();
}

@ -63,11 +63,13 @@ PackGUI::PackGUI(TQString defaultName, TQString defaultPath, int noOfFiles, TQSt
if (PS("tar")) typeData->insertItem("tar");
if (PS("tar") && PS("gzip")) typeData->insertItem("tar.gz");
if (PS("tar") && PS("bzip2")) typeData->insertItem("tar.bz2");
if (PS("tar") && PS("xz")) typeData->insertItem("tar.xz");
if (PS("zip")) typeData->insertItem("zip");
if (PS("rar")) typeData->insertItem("rar");
if (PS("lha")) typeData->insertItem("lha");
if (PS("arj")) typeData->insertItem("arj");
if (PS("7z")) typeData->insertItem("7z");
if (PS("xz")) typeData->insertItem("xz");
// set the last used packer as the top one
TQString tmp=krConfig->readEntry("lastUsedPacker",TQString());
if (tmp!=TQString()) {

@ -66,10 +66,11 @@ KgArchives::KgArchives( bool first, TQWidget* parent, const char* name ) :
{"Archives","Do UnAce", _DoUnAce, i18n( "Ace" ), false, ""},
{"Archives","Do Lha", _DoLha, i18n( "Lha" ), false, ""},
{"Archives","Do DEB", _DoDEB, i18n( "Deb" ), false, ""},
{"Archives","Do 7z", _Do7z, i18n( "7zip" ), false, ""}
{"Archives","Do 7z", _Do7z, i18n( "7zip" ), false, ""},
{"Archives","Do Xz", _DoXz, i18n( "Xz" ), false, ""}
};
cbs = createCheckBoxGroup( 3, 0, packers, 11, generalGrp );
cbs = createCheckBoxGroup( 3, 0, packers, 12, generalGrp );
generalGrid->addWidget( cbs, 1, 0 );
addLabel( generalGrid, 2, 0, i18n( "The archives that are \"greyed-out\" were unavailable on your\nsystem last time Krusader checked. If you wish Krusader to\nsearch again, click the 'Auto Configure' button." ),
@ -133,6 +134,7 @@ void KgArchives::disableNonExistingPackers()
cbs->find( "Do Unarj" )->setEnabled(PS("unarj") || PS("arj") );
cbs->find( "Do DEB" )->setEnabled(PS("dpkg") && PS("tar") );
cbs->find( "Do 7z" )->setEnabled( PS("7z") );
cbs->find( "Do Xz" )->setEnabled(PS("xz"));
krConfig->setGroup( "Archives" );
krConfig->writeEntry( "Supported Packers", lst );

@ -93,6 +93,7 @@ KgDependencies::KgDependencies( bool first, TQWidget* parent, const char* name
addApplication( "unrar", archGrid1,11, packers_tab, PAGE_PACKERS );
addApplication( "unzip", archGrid1,12, packers_tab, PAGE_PACKERS );
addApplication( "zip", archGrid1,13, packers_tab, PAGE_PACKERS );
addApplication( "xz", archGrid1,14, packers_tab, PAGE_PACKERS );
// ---------------------------- CHECKSUM TAB -------------------------------------
TQWidget *checksum_tab = new TQWidget( tabWidget, "tab_4" );

@ -132,6 +132,7 @@ TQFrame *line2 = createLine( generalGrp, "line2" );
defaultAtomicExtensions += ".tar.gz";
defaultAtomicExtensions += ".tar.bz2";
defaultAtomicExtensions += ".moc.cpp";
defaultAtomicExtensions += ".tar.xz";
listBox = createListBox( "Look&Feel", "Atomic Extensions",
defaultAtomicExtensions, vbox2, true, false );

@ -51,10 +51,11 @@ TQString KgProtocols::defaultKrarcMimes = "application/x-7z,application/x-7z-com
"application/x-lha,application/x-lha-compressed,"
"application/x-rar,application/x-rar-compressed,"
"application/x-rpm,"
"application/x-xz,"
"application/x-zip,application/x-zip-compressed";
TQString KgProtocols::defaultTarMimes = "application/x-tar,application/x-tarz,"
TQString KgProtocols::defaultTarMimes = "application/x-tar,application/x-tarz,"
"application/x-compressed-tar,"
"application/x-tbz,application/x-tgz";
"application/x-tbz,application/x-tgz,application/x-txz";
KgProtocols::KgProtocols( bool first, TQWidget* parent, const char* name ) :
KonfiguratorPage( first, parent, name )

@ -99,20 +99,21 @@ KrArchiverResultTable::KrArchiverResultTable(TQWidget* parent)
{
_supported = KRarcHandler::supportedPackers(); // get list of available packers
Archiver* tar = new Archiver("tar", "http://www.gnu.org", PS("tar"), true, true);
Archiver* gzip = new Archiver("gzip", "http://www.gnu.org", PS("gzip"), true, true);
Archiver* bzip2 = new Archiver("bzip2", "http://www.gnu.org", PS("bzip2"), true, true);
Archiver* lha = new Archiver("lha", "http://www.gnu.org", PS("lha"), true, true);
Archiver* zip = new Archiver("zip", "http://www.info-zip.org", PS("zip"), true, false);
Archiver* unzip = new Archiver("unzip", "http://www.info-zip.org", PS("unzip"), false, true);
Archiver* arj = new Archiver("arj", "http://www.arjsoftware.com", PS("arj"), true, true);
Archiver* unarj = new Archiver("unarj", "http://www.arjsoftware.com", PS("unarj"), false, true);
Archiver* unace = new Archiver("unace", "http://www.winace.com", PS("unace"), false, true);
Archiver* rar = new Archiver("rar", "http://www.rarsoft.com", PS("rar"), true, true);
Archiver* unrar = new Archiver("unrar", "http://www.rarsoft.com", PS("unrar"), false, true);
Archiver* rpm = new Archiver("rpm", "http://www.gnu.org", PS("rpm"), false, true);
Archiver* dpkg = new Archiver("dpkg", "http://www.dpkg.org", PS("dpkg"), false, true);
Archiver* _7z = new Archiver("7z", "http://www.7-zip.org", PS("7z"), true, true);
Archiver* tar = new Archiver("tar", "http://www.gnu.org", PS("tar"), true, true);
Archiver* gzip = new Archiver("gzip", "http://www.gnu.org", PS("gzip"), true, true);
Archiver* bzip2 = new Archiver("bzip2", "http://www.gnu.org", PS("bzip2"), true, true);
Archiver* lha = new Archiver("lha", "http://www.gnu.org", PS("lha"), true, true);
Archiver* zip = new Archiver("zip", "http://www.info-zip.org", PS("zip"), true, false);
Archiver* unzip = new Archiver("unzip", "http://www.info-zip.org", PS("unzip"), false, true);
Archiver* arj = new Archiver("arj", "http://www.arjsoftware.com", PS("arj"), true, true);
Archiver* unarj = new Archiver("unarj", "http://www.arjsoftware.com", PS("unarj"), false, true);
Archiver* unace = new Archiver("unace", "http://www.winace.com", PS("unace"), false, true);
Archiver* rar = new Archiver("rar", "http://www.rarsoft.com", PS("rar"), true, true);
Archiver* unrar = new Archiver("unrar", "http://www.rarsoft.com", PS("unrar"), false, true);
Archiver* rpm = new Archiver("rpm", "http://www.gnu.org", PS("rpm"), false, true);
Archiver* dpkg = new Archiver("dpkg", "http://www.dpkg.org", PS("dpkg"), false, true);
Archiver* _7z = new Archiver("7z", "http://www.7-zip.org", PS("7z"), true, true);
Archiver* xz = new Archiver("xz", "http://www.tukaani.org/xz", PS("xz"), true, true);
// Special case: arj can unpack, but unarj is prefered
if(PS("arj") && PS("unarj"))
@ -149,6 +150,7 @@ KrArchiverResultTable::KrArchiverResultTable(TQWidget* parent)
addRow(rpm, _grid);
addRow(dpkg, _grid);
addRow(_7z, _grid);
addRow(xz, _grid);
delete tar;
delete gzip;
@ -164,6 +166,7 @@ KrArchiverResultTable::KrArchiverResultTable(TQWidget* parent)
delete rpm;
delete dpkg;
delete _7z;
delete xz;
}
KrArchiverResultTable::~KrArchiverResultTable()

@ -1319,6 +1319,7 @@ void KrBriefView::initProperties() {
defaultAtomicExtensions += ".tar.gz";
defaultAtomicExtensions += ".tar.bz2";
defaultAtomicExtensions += ".moc.cpp";
defaultAtomicExtensions += ".tar.xz";
TQStringList atomicExtensions = krConfig->readListEntry("Atomic Extensions", defaultAtomicExtensions);
for (TQStringList::iterator i = atomicExtensions.begin(); i != atomicExtensions.end(); )
{

@ -1414,6 +1414,7 @@ void KrDetailedView::initProperties() {
defaultAtomicExtensions += ".tar.gz";
defaultAtomicExtensions += ".tar.bz2";
defaultAtomicExtensions += ".moc.cpp";
defaultAtomicExtensions += ".tar.xz";
TQStringList atomicExtensions = krConfig->readListEntry("Atomic Extensions", defaultAtomicExtensions);
for (TQStringList::iterator i = atomicExtensions.begin(); i != atomicExtensions.end(); )
{

@ -12,6 +12,7 @@ TQString atomicExtensions[] = {
".tar.gz",
".tar.bz2",
".moc.cpp"
".tar.xz",
};
KrViewItem::KrViewItem(vfile *vf, const KrViewProperties* properties):

@ -721,7 +721,6 @@ void ListPanelFunc::execute( TQString& name ) {
dirUp();
return ;
}
vfile *vf = files() ->vfs_search( name );
if ( vf == 0 )
return ;
@ -729,7 +728,6 @@ void ListPanelFunc::execute( TQString& name ) {
KURL origin = files() ->vfs_getOrigin();
TQString protocol = origin.isLocalFile() ? KrServices::registerdProtocol( vf->vfile_getMime() ) : "";
if ( protocol == "tar" || protocol == "krarc" ) {
bool encrypted;
TQString type = KRarcHandler::getType( encrypted, vf->vfile_getUrl().path(), vf->vfile_getMime(), false );

@ -46,7 +46,7 @@
#include "../krservices.h"
#include "../Dialogs/krpleasewait.h"
static TQStringList arcProtocols = TQStringList::split(";", "tar;bzip;bzip2;gzip;krarc;zip");
static TQStringList arcProtocols = TQStringList::split(";", "tar;bzip;bzip2;gzip;krarc;zip;xz");
TDEWallet::Wallet * KRarcHandler::wallet = 0;
@ -69,6 +69,7 @@ TQStringList KRarcHandler::supportedPackers() {
if ( KrServices::cmdExist( "dpkg" ) ) packers.append( "dpkg" );
if ( KrServices::cmdExist( "7z" ) || KrServices::cmdExist( "7za" ) ) packers.append( "7z" );
if ( KrServices::cmdExist( "rpm" ) && KrServices::cmdExist( "rpm2cpio" ) ) packers.append( "rpm" );
if ( KrServices::cmdExist( "xz" ) ) packers.append( "xz" );
// kdDebug() << "Supported Packers:" << endl;
//TQStringList::Iterator it;
//for( it = packers.begin(); it != packers.end(); ++it )
@ -90,6 +91,8 @@ bool KRarcHandler::arcSupported( TQString type ) {
return true;
else if ( type == "-tgz" && lst.contains( "tar" ) )
return true;
else if ( type == "-txz" && lst.contains( "tar" ) )
return true;
else if ( type == "tarz" && lst.contains( "tar" ) )
return true;
else if ( type == "gzip" && lst.contains( "gzip" ) )
@ -110,7 +113,9 @@ bool KRarcHandler::arcSupported( TQString type ) {
return true;
else if ( type == "-deb" && ( lst.contains( "dpkg" ) && lst.contains( "tar" ) ) )
return true;
else if ( type == "-7z" && lst.contains( "7z" ) )
else if ( type == "-7z" && lst.contains( "7z" ) )
return true;
else if ( type == "-xz" && lst.contains( "xz" ) )
return true;
// not supported : (
return false;
@ -123,19 +128,21 @@ bool KRarcHandler::arcHandled( TQString type ) {
krConfig->setGroup( "Archives" );
if ( ( type == "-tgz" && krConfig->readBoolEntry( "Do GZip" , _DoGZip ) ) ||
( type == "tarz" && krConfig->readBoolEntry( "Do GZip" , _DoGZip ) ) ||
( type == "-tar" && krConfig->readBoolEntry( "Do Tar" , _DoTar ) ) ||
( type == "-tar" && krConfig->readBoolEntry( "Do Tar" , _DoTar ) ) ||
( type == "-tbz" && krConfig->readBoolEntry( "Do BZip2", _DoBZip2 ) ) ||
( type == "-txz" && krConfig->readBoolEntry( "Do Xz" , _DoXz ) ) ||
( type == "gzip" && krConfig->readBoolEntry( "Do GZip" , _DoGZip ) ) ||
( type == "zip2" && krConfig->readBoolEntry( "Do BZip2", _DoBZip2 ) ) ||
( type == "-zip" && krConfig->readBoolEntry( "Do UnZip", _DoUnZip ) ) ||
( type == "-lha" && krConfig->readBoolEntry( "Do Lha", _DoUnZip ) ) ||
( type == "-lha" && krConfig->readBoolEntry( "Do Lha" , _DoUnZip ) ) ||
( type == "-rar" && krConfig->readBoolEntry( "Do UnRar", _DoUnRar ) ) ||
( type == "-arj" && krConfig->readBoolEntry( "Do UnArj", _DoUnarj ) ) ||
( type == "-ace" && krConfig->readBoolEntry( "Do UnAce", _DoUnAce ) ) ||
( type == "cpio" && krConfig->readBoolEntry( "Do RPM" , _DoRPM ) ) ||
( type == "-rpm" && krConfig->readBoolEntry( "Do RPM" , _DoRPM ) ) ||
( type == "-deb" && krConfig->readBoolEntry( "Do DEB" , _DoDEB ) ) ||
( type == "-7z" && krConfig->readBoolEntry( "Do 7z" , _Do7z ) ) )
( type == "cpio" && krConfig->readBoolEntry( "Do RPM" , _DoRPM ) ) ||
( type == "-rpm" && krConfig->readBoolEntry( "Do RPM" , _DoRPM ) ) ||
( type == "-deb" && krConfig->readBoolEntry( "Do DEB" , _DoDEB ) ) ||
( type == "-7z" && krConfig->readBoolEntry( "Do 7z" , _Do7z ) ) ||
( type == "-xz" && krConfig->readBoolEntry( "Do Xz" , _DoXz ) ) )
return true;
else
return false;
@ -148,8 +155,8 @@ long KRarcHandler::arcFileCount( TQString archive, TQString type, TQString passw
// first check if supported
if ( !arcSupported( type ) ) return 0;
// bzip an gzip archive contains only one file
if ( type == "zip2" || type == "gzip" ) return 1L;
// bzip, gzip and xz archives contain only one file
if ( type == "zip2" || type == "gzip" || type == "-xz") return 1L;
// set the right lister to do the job
TQString lister;
@ -159,6 +166,7 @@ long KRarcHandler::arcFileCount( TQString archive, TQString type, TQString passw
else if ( type == "-tgz" ) lister = KrServices::fullPathName( "tar" ) + " -tvzf";
else if ( type == "tarz" ) lister = KrServices::fullPathName( "tar" ) + " -tvzf";
else if ( type == "-tbz" ) lister = KrServices::fullPathName( "tar" ) + " -tjvf";
else if ( type == "-txz" ) lister = KrServices::fullPathName( "tar" ) + " -tJvf";
else if ( type == "-lha" ) lister = KrServices::fullPathName( "lha" ) + " l";
else if ( type == "-rar" ) lister = KrServices::fullPathName( KrServices::cmdExist( "rar" ) ? "rar" : "unrar" ) + " l -v";
else if ( type == "-ace" ) lister = KrServices::fullPathName( "unace" ) + " l";
@ -171,6 +179,7 @@ long KRarcHandler::arcFileCount( TQString archive, TQString type, TQString passw
else if ( type == "-rpm" ) lister = KrServices::fullPathName( "rpm" ) + " --dump -lpq";
else if ( type == "-deb" ) lister = KrServices::fullPathName( "dpkg" ) + " -c";
else if ( type == "-7z" ) lister = KrServices::fullPathName( "7z" ) + " -y l";
else if ( type == "-xz" ) lister = KrServices::fullPathName( "xz" ) + " -l";
else return 0L;
if ( !password.isNull() ) {
@ -241,6 +250,7 @@ bool KRarcHandler::unpack( TQString archive, TQString type, TQString password, T
else if ( type == "-tgz" ) packer = KrServices::fullPathName( "tar" ) + " -xvzf";
else if ( type == "tarz" ) packer = KrServices::fullPathName( "tar" ) + " -xvzf";
else if ( type == "-tbz" ) packer = KrServices::fullPathName( "tar" ) + " -xjvf";
else if ( type == "-txz" ) packer = KrServices::fullPathName( "tar" ) + " -xJvf";
else if ( type == "gzip" ) packer = KrServices::fullPathName( "gzip" ) + " -cd";
else if ( type == "zip2" ) packer = KrServices::fullPathName( "bzip2" ) + " -cdk";
else if ( type == "-lha" ) packer = KrServices::fullPathName( "lha" ) + " xf";
@ -250,6 +260,7 @@ bool KRarcHandler::unpack( TQString archive, TQString type, TQString password, T
KrServices::fullPathName( "arj" ) + " -y -v x" :
KrServices::fullPathName( "unarj" ) + " x";
else if ( type == "-7z" ) packer = KrServices::fullPathName( "7z" ) + " -y x";
else if ( type == "-xz" ) packer = KrServices::fullPathName( "xz" ) + " -cdk";
else if ( type == "-rpm" ) {
TQString tempDir = locateLocal("tmp",TQString());
@ -354,6 +365,7 @@ bool KRarcHandler::test( TQString archive, TQString type, TQString password, lon
else if ( type == "-tgz" ) packer = KrServices::fullPathName( "tar" ) + " -tvzf";
else if ( type == "tarz" ) packer = KrServices::fullPathName( "tar" ) + " -tvzf";
else if ( type == "-tbz" ) packer = KrServices::fullPathName( "tar" ) + " -tjvf";
else if ( type == "-txz" ) packer = KrServices::fullPathName( "tar" ) + " -tJvf";
else if ( type == "gzip" ) packer = KrServices::fullPathName( "gzip" ) + " -tv";
else if ( type == "zip2" ) packer = KrServices::fullPathName( "bzip2" ) + " -tv";
else if ( type == "-rar" ) packer = KrServices::fullPathName( KrServices::cmdExist( "rar" ) ? "rar" : "unrar" ) + " t";
@ -362,6 +374,7 @@ bool KRarcHandler::test( TQString archive, TQString type, TQString password, lon
else if ( type == "-arj" ) packer = KrServices::fullPathName( KrServices::cmdExist( "arj" ) ? "arj" : "unarj" ) + " t";
else if ( type == "cpio" ) packer = KrServices::fullPathName( "cpio" ) + " --only-verify-crc -tvF" ;
else if ( type == "-7z" ) packer = KrServices::fullPathName( "7z" ) + " -y t";
else if ( type == "-xz" ) packer = KrServices::fullPathName( "xz" ) + " -tv";
else return false;
if ( !password.isNull() ) {
@ -411,10 +424,12 @@ bool KRarcHandler::pack( TQStringList fileNames, TQString type, TQString dest, l
else if ( type == "tar" ) { packer = KrServices::fullPathName( "tar" ) + " -cvf"; type = "-tar"; }
else if ( type == "tar.gz" ) { packer = KrServices::fullPathName( "tar" ) + " -cvzf"; type = "-tgz"; }
else if ( type == "tar.bz2" ) { packer = KrServices::fullPathName( "tar" ) + " -cvjf"; type = "-tbz"; }
else if ( type == "tar.xz" ) { packer = KrServices::fullPathName( "tar" ) + " -cvJf"; type = "-txz"; }
else if ( type == "rar" ) { packer = KrServices::fullPathName( "rar" ) + " -r a"; type = "-rar"; }
else if ( type == "lha" ) { packer = KrServices::fullPathName( "lha" ) + " a"; type = "-lha"; }
else if ( type == "arj" ) { packer = KrServices::fullPathName( "arj" ) + " -r -y a"; type = "-arj"; }
else if ( type == "7z" ) { packer = KrServices::fullPathName( "7z" ) + " -y a"; type = "-7z"; }
else if ( type == "xz" ) { packer = KrServices::fullPathName( "xz" ) + " -z"; type = "-xz"; }
else return false;
TQString password = TQString();
@ -473,6 +488,10 @@ bool KRarcHandler::pack( TQStringList fileNames, TQString type, TQString dest, l
static const int sevenZipLevels[] = { 0, 1, 2, 4, 5, 6, 7, 8, 9 };
packer += TQString( " -mx%1" ).arg( sevenZipLevels[ level ] );
}
else if( type == "-xz" ) {
static const int xzLevels[] = { 0, 1, 2, 4, 5, 6, 7, 8, 9 };
packer += TQString( " -%1" ).arg( xzLevels[ level ] );
}
}
if( extraProps.count( "CommandLineSwitches" ) > 0 )
@ -590,8 +609,14 @@ TQString KRarcHandler::getType( bool &encrypted, TQString fileName, TQString mim
else
result = "-" + result;
if( result.endsWith( "-7z" ) )
if (result.endsWith("-7z"))
{
result = "-7z";
}
if (result.endsWith("-xz"))
{
result = "-xz";
}
return result.right( 4 );
}
@ -602,9 +627,9 @@ bool KRarcHandler::checkStatus( TQString type, int exitCode ) {
return exitCode == 0 || exitCode == 1;
else if( type == "-ace" || type == "zip2" || type == "-lha" || type == "-rpm" || type == "cpio" ||
type == "-tar" || type == "tarz" || type == "-tbz" || type == "-tgz" || type == "-arj" ||
type == "-deb" )
type == "-deb" || type == "-txz" || type == "-xz")
return exitCode == 0;
else if( type == "gzip" )
else if (type == "gzip" || type == "-xz")
return exitCode == 0 || exitCode == 2;
else
return exitCode == 0;
@ -625,7 +650,8 @@ TQString KRarcHandler::detectArchive( bool &encrypted, TQString fileName, bool c
{"bzip2",0, "\x42\x5a\x68\x39\x31" },
{"gzip", 0, "\x1f\x8b"},
{"deb", 0, "!<arch>\ndebian-binary " },
{"7z", 0, "7z\xbc\xaf\x27\x1c" } };
{"7z", 0, "7z\xbc\xaf\x27\x1c" },
{"xz", 0, "\xfd7zXZ\x00" } };
static int autoDetectElems = sizeof( autoDetectParams ) / sizeof( AutoDetectParams );
encrypted = false;
@ -749,6 +775,16 @@ TQString KRarcHandler::detectArchive( bool &encrypted, TQString fileName, bool c
}
}
}
if (fileName.endsWith(".tar.xz"))
{
return "txz";
}
else if (fileName.endsWith(".xz"))
{
return "xz";
}
return TQString();
}

@ -189,8 +189,10 @@
#define _DoDEB true
// Do Lha /////////////
#define _DoLha true
// Do 7z ///////////// ====> new
// Do 7z ////////////// ====> new
#define _Do7z true
// Do Xz //////////////
#define _DoXz true
// Allow Move Into Archive //
#define _MoveIntoArchive false
// Test Archives //////

@ -459,6 +459,21 @@ bool Krusader::versionControl() {
}
config->writeEntry( "Version", VERSION );
config->writeEntry( FIRST_RUN, false);
// Check whether Krusader is run for the first time under a new TDE version.
TQString lastVersion = config->readEntry("Last version");
if (lastVersion != TDE_VERSION_STRING)
{
config->writeEntry("Last version", TDE_VERSION_STRING);
if (!retval)
{
KMessageBox::information(krApp, i18n( "<qt><b>Welcome to Krusader!</b><p>As this is your first run "
"under TDE " TDE_VERSION_STRING ", your machine will now be checked for external applications updates. "
"Then the Konfigurator will be launched where you can customize Krusader to your needs.</p></qt>" ) );
}
retval = true;
}
config->sync();
return retval;
}

Loading…
Cancel
Save