diff options
-rw-r--r-- | iso/kiso.cpp | 26 | ||||
-rw-r--r-- | krArc/krarc.cpp | 374 | ||||
-rw-r--r-- | krusader/Dialogs/packgui.cpp | 6 | ||||
-rw-r--r-- | krusader/Konfigurator/kgarchives.cpp | 10 | ||||
-rw-r--r-- | krusader/Konfigurator/kgdependencies.cpp | 3 | ||||
-rw-r--r-- | krusader/Konfigurator/kggeneral.cpp | 9 | ||||
-rw-r--r-- | krusader/Konfigurator/kgprotocols.cpp | 113 | ||||
-rw-r--r-- | krusader/Konfigurator/krresulttable.cpp | 31 | ||||
-rw-r--r-- | krusader/Panel/krbriefview.cpp | 79 | ||||
-rw-r--r-- | krusader/Panel/krdetailedview.cpp | 107 | ||||
-rw-r--r-- | krusader/Panel/krviewitem.cpp | 21 | ||||
-rwxr-xr-x | krusader/Panel/panelfunc.cpp | 76 | ||||
-rw-r--r-- | krusader/VFS/krarchandler.cpp | 160 | ||||
-rw-r--r-- | krusader/defaults.h | 136 | ||||
-rw-r--r-- | krusader/krusader.cpp | 85 |
15 files changed, 669 insertions, 567 deletions
diff --git a/iso/kiso.cpp b/iso/kiso.cpp index 2074211..1e8f192 100644 --- a/iso/kiso.cpp +++ b/iso/kiso.cpp @@ -16,7 +16,7 @@ ***************************************************************************/ /* This file is heavily based on ktar.cpp from tdelibs (c) David Faure */ - + #include <stdio.h> #include <stdlib.h> #include <time.h> @@ -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 ); @@ -294,7 +304,7 @@ void KIso::addBoot(struct el_torito_boot_descriptor* bootdesc) { boot_entry *be; TQString path; KIsoFile *entry; - + entry=new KIsoFile( this, "Catalog", dirent->permissions() & ~S_IFDIR, dirent->date(), dirent->adate(), dirent->cdate(), dirent->user(), dirent->group(), TQString(), @@ -326,7 +336,7 @@ void KIso::readParams() TDEConfig *config; config = new TDEConfig("tdeio_isorc"); - + showhidden=config->readBoolEntry("showhidden",false); showrr=config->readBoolEntry("showrr",true); delete config; @@ -372,7 +382,7 @@ bool KIso::openArchive( int mode ) if (trackno==0) trackno=1; for (i=0;i<trackno;i++) { - c_b=1;c_i=1;c_j=1; + c_b=1;c_i=1;c_j=1; root=rootDir(); if (trackno>1) { path=TQString(); @@ -396,11 +406,11 @@ bool KIso::openArchive( int mode ) if ( !memcmp(EL_TORITO_ID,bootdesc->system_id,ISODCL(8,39)) ) { path="El Torito Boot"; if (c_b>1) path += " (" + TQString::number(c_b) + ")"; - + dirent = new KIsoDirectory( this, path, access | S_IFDIR, buf.st_mtime, buf.st_atime, buf.st_ctime, uid, gid, TQString() ); root->addEntry(dirent); - + addBoot(bootdesc); c_b++; } diff --git a/krArc/krarc.cpp b/krArc/krarc.cpp index b07029c..5c4ea3f 100644 --- a/krArc/krarc.cpp +++ b/krArc/krarc.cpp @@ -62,29 +62,29 @@ extern "C" { int kdemain( int argc, char **argv ){ TDEInstance instance( "tdeio_krarc" ); - + if (argc != 4) { kdWarning() << "Usage: tdeio_krarc protocol domain-socket1 domain-socket2" << endl; exit(-1); } - + tdeio_krarcProtocol slave(argv[2], argv[3]); slave.dispatchLoop(); - + return 0; } -} // extern "C" +} // extern "C" tdeio_krarcProtocol::tdeio_krarcProtocol(const TQCString &pool_socket, const TQCString &app_socket) : SlaveBase("tdeio_krarc", pool_socket, app_socket), archiveChanged(true), arcFile(0L),extArcReady(false), password(TQString()) { - + krConfig = new TDEConfig( "krusaderrc" ); krConfig->setGroup( "Dependencies" ); - + dirDict.setAutoDelete(true); - + arcTempDir = locateLocal("tmp",TQString()); TQString dirName = "krArc"+TQDateTime::currentDateTime().toString(Qt::ISODate); dirName.replace(TQRegExp(":"),"_"); @@ -106,66 +106,66 @@ void tdeio_krarcProtocol::receivedData(TDEProcess*,char* buf,int len){ d.setRawData(buf,len); data(d); d.resetRawData(buf,len); - processedSize(len); + processedSize(len); decompressedLen += len; } void tdeio_krarcProtocol::mkdir(const KURL& url,int permissions){ KRDEBUG(url.path()); - + if( !setArcFile( url ) ) { error(ERR_CANNOT_ENTER_DIRECTORY,url.path()); return; } - if( newArchiveURL && !initDirDict(url) ){ + if( newArchiveURL && !initDirDict(url) ){ error(ERR_CANNOT_ENTER_DIRECTORY,url.path()); return; } - + if( putCmd.isEmpty() ){ error(ERR_UNSUPPORTED_ACTION, i18n("Creating directories is not supported with %1 archives").arg(arcType) ); return; } - + if( arcType == "arj" || arcType == "lha" ) { TQString arcDir = url.path().mid(arcFile->url().path().length()); if( arcDir.right(1) != "/") arcDir = arcDir+"/"; - + if( dirDict.find( arcDir ) == 0 ) addNewDir( arcDir ); finished(); return; } - + //TQString tmpDir = arcTempDir+url.path(); TQString arcDir = findArcDirectory(url); TQString tmpDir = arcTempDir + arcDir.mid(1) + url.path().mid(url.path().findRev("/")+1); if( tmpDir.right(1) != "/" ) tmpDir = tmpDir+"/"; - + if( permissions == -1 ) permissions = 0777; //set default permissions for( unsigned int i=arcTempDir.length();i<tmpDir.length(); i=tmpDir.find("/",i+1)){ ::mkdir(tmpDir.left(i).local8Bit(),permissions); } - + if( tmpDir.endsWith( "/" ) ) tmpDir.truncate( tmpDir.length() - 1 ); - + // pack the directory KrShellProcess proc; proc << putCmd << convertName( arcFile->url().path() ) + " " << convertFileName( tmpDir.mid(arcTempDir.length()) ); infoMessage(i18n("Creating %1 ...").arg( url.fileName() ) ); TQDir::setCurrent(arcTempDir); proc.start(TDEProcess::Block,TDEProcess::AllOutput); - + // delete the temp directory TQDir().rmdir(arcTempDir); - + if( !proc.normalExit() || !checkStatus( proc.exitStatus() ) ) { error(ERR_COULD_NOT_WRITE,url.path() + "\n\n" + proc.getErrorMsg() ); return; } - + // force a refresh of archive information initDirDict(url,true); finished(); @@ -177,24 +177,24 @@ void tdeio_krarcProtocol::put(const KURL& url,int permissions,bool overwrite,boo error(ERR_CANNOT_ENTER_DIRECTORY,url.path()); return; } - if( newArchiveURL && !initDirDict(url) ){ + if( newArchiveURL && !initDirDict(url) ){ error(ERR_CANNOT_ENTER_DIRECTORY,url.path()); return; } - + if( putCmd.isEmpty() ){ error(ERR_UNSUPPORTED_ACTION, i18n("Writing to %1 archives is not supported").arg(arcType) ); return; - } + } if( !overwrite && findFileEntry(url) ){ error( ERR_FILE_ALREADY_EXIST,url.path() ); return; } - + TQString arcDir = findArcDirectory(url); TQString tmpFile = arcTempDir + arcDir.mid(1) + url.path().mid(url.path().findRev("/")+1); - + TQString tmpDir = arcTempDir+arcDir.mid(1)+"/"; for( unsigned int i=arcTempDir.length();i<tmpDir.length(); i=tmpDir.find("/",i+1)){ TQDir("/").mkdir(tmpDir.left(i)); @@ -211,7 +211,7 @@ void tdeio_krarcProtocol::put(const KURL& url,int permissions,bool overwrite,boo initialMode = permissions | S_IWUSR | S_IRUSR; else initialMode = 0666; - + fd = KDE_open(tmpFile.local8Bit(), O_CREAT | O_TRUNC | O_WRONLY, initialMode); } TQByteArray buffer; @@ -247,21 +247,21 @@ void tdeio_krarcProtocol::get(const KURL& url ){ void tdeio_krarcProtocol::get(const KURL& url, int tries ){ bool decompressToFile = false; KRDEBUG(url.path()); - + if( !setArcFile( url ) ) { error(ERR_CANNOT_ENTER_DIRECTORY,url.path()); return; } - if( newArchiveURL && !initDirDict(url) ){ + if( newArchiveURL && !initDirDict(url) ){ error(ERR_CANNOT_ENTER_DIRECTORY,url.path()); return; } - + if( getCmd.isEmpty() ){ error(ERR_UNSUPPORTED_ACTION, i18n("Retrieving data from %1 archives is not supported").arg(arcType) ); return; - } + } UDSEntry* entry = findFileEntry(url); if( !entry ){ error(TDEIO::ERR_DOES_NOT_EXIST,url.path()); @@ -303,7 +303,7 @@ void tdeio_krarcProtocol::get(const KURL& url, int tries ){ } else if( arcType == "arj" || arcType == "ace" || arcType == "7z" ) { proc << getCmd << convertName( arcFile->url().path(-1) )+ " " << convertFileName( file ); if( arcType == "ace" && TQFile( "/dev/ptmx" ).exists() ) // Don't remove, unace crashes if missing!!! - proc << "<" << "/dev/ptmx"; + proc << "<" << "/dev/ptmx"; file = url.fileName(); decompressToFile = true; } else { @@ -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)) ); } @@ -321,9 +321,10 @@ void tdeio_krarcProtocol::get(const KURL& url, int tries ){ // change the working directory to our arcTempDir TQDir::setCurrent(arcTempDir); proc.start(TDEProcess::Block,TDEProcess::AllOutput); - - if( !extArcReady && !decompressToFile ) { - if( !proc.normalExit() || !checkStatus( proc.exitStatus() ) || ( arcType != "bzip2" && expectedSize != decompressedLen ) ) { + + if( !extArcReady && !decompressToFile ) { + if( !proc.normalExit() || !checkStatus( proc.exitStatus() ) || + ( arcType != "bzip2" && arcType != "xz" && expectedSize != decompressedLen ) ) { if( encrypted && tries ) { invalidatePassword(); get( url, tries - 1 ); @@ -373,9 +374,9 @@ void tdeio_krarcProtocol::get(const KURL& url, int tries ){ // This is mandatory in all slaves (for KRun/BrowserRun to work). KMimeType::Ptr mt = KMimeType::findByURL( arcTempDir+file, buff.st_mode, true /* local URL */ ); emit mimeType( mt->name() ); - + TDEIO::filesize_t processed_size = 0; - + TQString resumeOffset = metaData("resume"); if ( !resumeOffset.isEmpty() ){ bool ok; @@ -387,9 +388,9 @@ void tdeio_krarcProtocol::get(const KURL& url, int tries ){ } } } - + totalSize( buff.st_size ); - + char buffer[ MAX_IPC_SIZE ]; TQByteArray array; while( 1 ){ @@ -403,19 +404,19 @@ void tdeio_krarcProtocol::get(const KURL& url, int tries ){ } if (n == 0) break; // Finished - + array.setRawData(buffer, n); data( array ); array.resetRawData(buffer, n); - + processed_size += n; } - + data( TQByteArray() ); close( fd ); processedSize( buff.st_size ); finished(); - + if( decompressToFile ) TQFile(arcTempDir+file).remove(); return; @@ -427,16 +428,16 @@ void tdeio_krarcProtocol::get(const KURL& url, int tries ){ void tdeio_krarcProtocol::del(KURL const & url, bool isFile){ KRDEBUG(url.path()); - + if( !setArcFile( url ) ) { error(ERR_CANNOT_ENTER_DIRECTORY,url.path()); return; } - if( newArchiveURL && !initDirDict(url) ){ + if( newArchiveURL && !initDirDict(url) ){ error(ERR_CANNOT_ENTER_DIRECTORY,url.path()); return; } - + if( delCmd.isEmpty() ){ error(ERR_UNSUPPORTED_ACTION, i18n("Deleting files from %1 archives is not supported").arg(arcType) ); @@ -448,7 +449,7 @@ void tdeio_krarcProtocol::del(KURL const & url, bool isFile){ return; } } - + TQString file = url.path().mid(arcFile->url().path().length()+1); if( !isFile && file.right(1) != "/" ) { if(arcType == "zip") file = file + "/"; @@ -466,25 +467,25 @@ void tdeio_krarcProtocol::del(KURL const & url, bool isFile){ finished(); } -void tdeio_krarcProtocol::stat( const KURL & url ){ +void tdeio_krarcProtocol::stat( const KURL & url ){ KRDEBUG(url.path()); if( !setArcFile( url ) ) { error(ERR_CANNOT_ENTER_DIRECTORY,url.path()); return; } - if( newArchiveURL && !initDirDict(url) ){ + if( newArchiveURL && !initDirDict(url) ){ error(ERR_CANNOT_ENTER_DIRECTORY,url.path()); return; } - + if( listCmd.isEmpty() ){ error(ERR_UNSUPPORTED_ACTION, i18n("Accessing files is not supported with the %1 archives").arg(arcType) ); return; - } + } TQString path = url.path(-1); KURL newUrl = url; - + // but treat the archive itself as the archive root if( path == arcFile->url().path(-1) ){ newUrl.setPath(path+"/"); @@ -508,49 +509,49 @@ void tdeio_krarcProtocol::stat( const KURL & url ){ void tdeio_krarcProtocol::copy (const KURL &url, const KURL &dest, int, bool overwrite) { KRDEBUG(url.path()); - + // KDE HACK: opening the password dlg in copy causes error for the COPY, and further problems // that's why encrypted files are not allowed to copy if( !encrypted && dest.isLocalFile() ) do { if( url.fileName() != dest.fileName() ) break; - + //the file exists and we don't want to overwrite if ((!overwrite) && ( TQFile( dest.path() ).exists() ) ) { error(ERR_FILE_ALREADY_EXIST, TQFile::encodeName(dest.path()) ); return; }; - + if( !setArcFile( url ) ) { error(ERR_CANNOT_ENTER_DIRECTORY,url.path()); return; } - if( newArchiveURL && !initDirDict(url) ){ + if( newArchiveURL && !initDirDict(url) ){ error(ERR_CANNOT_ENTER_DIRECTORY,url.path()); return; } - + UDSEntry* entry = findFileEntry(url); if( copyCmd.isEmpty() || !entry ) break; - + TQString file = url.path().mid(arcFile->url().path().length()+1); - + TQString destDir = dest.path( -1 ); if( !TQDir( destDir ).exists() ) { int ndx = destDir.findRev( '/' ); if( ndx != -1 ) destDir.truncate( ndx+1 ); } - + TQDir::setCurrent( destDir.local8Bit() ); - + KrShellProcess proc; proc << copyCmd << convertName( arcFile->url().path(-1) )+" " << convertFileName( file ); if( arcType == "ace" && TQFile( "/dev/ptmx" ).exists() ) // Don't remove, unace crashes if missing!!! - proc << "<" << "/dev/ptmx"; - + proc << "<" << "/dev/ptmx"; + infoMessage(i18n("Unpacking %1 ...").arg( url.fileName() ) ); proc.start(TDEProcess::Block, TDEProcess::AllOutput); if( !proc.normalExit() || !checkStatus( proc.exitStatus() ) ) { @@ -561,13 +562,13 @@ void tdeio_krarcProtocol::copy (const KURL &url, const KURL &dest, int, bool ove error( TDEIO::ERR_COULD_NOT_WRITE, dest.path(-1) ); return; } - + processedSize( KFileItem(*entry,url).size() ); finished(); TQDir::setCurrent( "/" ); /* for being able to umount devices after copying*/ return; }while( 0 ); - + error( ERR_UNSUPPORTED_ACTION, unsupportedActionErrorString(mProtocol, CMD_COPY)); } @@ -581,10 +582,10 @@ void tdeio_krarcProtocol::listDir(const KURL& url){ error(ERR_UNSUPPORTED_ACTION, i18n("Listing directories is not supported for %1 archives").arg(arcType) ); return; - } + } TQString path = url.path(); if( path.right(1) != "/" ) path = path+"/"; - + // it might be a real dir ! if( TQFileInfo(path).exists() ){ if( TQFileInfo(path).isDir() ){ @@ -597,14 +598,14 @@ void tdeio_krarcProtocol::listDir(const KURL& url){ } return; } - if( !initDirDict(url) ){ + if( !initDirDict(url) ){ error( ERR_CANNOT_ENTER_DIRECTORY, url.path()); return; } TQString arcDir = path.mid(arcFile->url().path().length()); arcDir.truncate(arcDir.findRev("/")); if(arcDir.right(1) != "/") arcDir = arcDir+"/"; - + UDSEntryList* dirList = dirDict.find(arcDir); if( dirList == 0 ){ error(ERR_CANNOT_ENTER_DIRECTORY,url.path()); @@ -622,7 +623,7 @@ bool tdeio_krarcProtocol::setArcFile(const KURL& url){ newArchiveURL = true; // is the file already set ? if( arcFile && arcFile->url().path(-1) == path.left(arcFile->url().path(-1).length()) ){ - newArchiveURL = false; + newArchiveURL = false; // Has it changed ? KFileItem* newArcFile = new KFileItem(arcFile->url(),TQString(),arcFile->mode()); if( !newArcFile->cmp( *arcFile ) ){ @@ -659,34 +660,36 @@ bool tdeio_krarcProtocol::setArcFile(const KURL& url){ return false; // file not found } } - - /* FIX: file change can only be detected if the timestamp between the two consequent - changes is more than 1s. If the archive is continuously changing (check: move files - inside the archive), krarc may erronously think, that the archive file is unchanged, + + /* FIX: file change can only be detected if the timestamp between the two consequent + changes is more than 1s. If the archive is continuously changing (check: move files + inside the archive), krarc may erronously think, that the archive file is unchanged, because the timestamp is the same as the previous one. This situation can only occur if the modification time equals with the current time. While this condition is true, - we can say, that the archive is changing, so content reread is always necessary + we can say, that the archive is changing, so content reread is always necessary during that period. */ if( archiveChanging ) archiveChanged = true; archiveChanging = ( currTime == arcFile->time( UDS_MODIFICATION_TIME ) ); - + arcPath = arcFile->url().path(-1); arcType = detectArchive( encrypted, arcPath ); - + if( arcType == "tbz" ) arcType = "bzip2"; else if( arcType == "tgz" ) arcType = "gzip"; - + else if( arcType == "txz" ) + arcType = "xz"; + if( arcType.isEmpty() ) { arcType = arcFile->mimetype(); arcType = arcType.mid(arcType.findRev("-")+1); - + if( arcType == "jar" ) arcType = "zip"; } - + return initArcParameters(); } @@ -696,18 +699,18 @@ bool tdeio_krarcProtocol::initDirDict(const KURL&url, bool forced){ // no need to rescan the archive if it's not changed if( !archiveChanged && !forced ) return true; extArcReady = false; - + if( !setArcFile( url ) ) return false; /* if the archive was changed refresh the file information */ - + // write the temp file 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 + else proc << listCmd << convertName( arcFile->url().path(-1) ) <<" > " << temp.name(); if( arcType == "ace" && TQFile( "/dev/ptmx" ).exists() ) // Don't remove, unace crashes if missing!!! proc << "<" << "/dev/ptmx"; @@ -716,7 +719,7 @@ bool tdeio_krarcProtocol::initDirDict(const KURL&url, bool forced){ } // clear the dir dictionary dirDict.clear(); - + // add the "/" directory UDSEntryList* root = new UDSEntryList(); dirDict.insert("/",root); @@ -733,20 +736,20 @@ bool tdeio_krarcProtocol::initDirDict(const KURL&url, bool forced){ atom.m_uds = UDS_ACCESS; atom.m_long = mode & 07777; // keep permissions only entry.append( atom ); - + root->append(entry); - - if( arcType == "bzip2" ){ + + if (arcType == "bzip2" || arcType == "xz"){ KRDEBUG("Got me here..."); parseLine(0,"",temp.file()); return true; } - + // parse the temp file temp.file()->open(IO_ReadOnly); char buf[1000]; TQString line; - + int lineNo = 0; bool invalidLine = false; // the rar list is started with a ------ line. @@ -755,7 +758,7 @@ bool tdeio_krarcProtocol::initDirDict(const KURL&url, bool forced){ line = TQString::fromLocal8Bit(buf); if( line.startsWith("----------") ) break; } - } + } while(temp.file()->readLine(buf,1000) != -1) { line = TQString::fromLocal8Bit(buf); if( arcType == "rar" ) { @@ -802,7 +805,7 @@ bool tdeio_krarcProtocol::initDirDict(const KURL&url, bool forced){ } // close and delete our file temp.file()->close(); - + archiveChanged = false; return true; } @@ -810,21 +813,21 @@ bool tdeio_krarcProtocol::initDirDict(const KURL&url, bool forced){ TQString tdeio_krarcProtocol::findArcDirectory(const KURL& url){ TQString path = url.path(); if( path.right(1) == "/" ) path.truncate(path.length()-1); - + if( !initDirDict(url) ){ return TQString(); } TQString arcDir = path.mid(arcFile->url().path().length()); arcDir.truncate(arcDir.findRev("/")); if(arcDir.right(1) != "/") arcDir = arcDir+"/"; - + return arcDir; } UDSEntry* tdeio_krarcProtocol::findFileEntry(const KURL& url){ TQString arcDir = findArcDirectory(url); if( arcDir.isEmpty() ) return 0; - + UDSEntryList* dirList = dirDict.find(arcDir); if( !dirList ){ return 0; @@ -835,10 +838,10 @@ UDSEntry* tdeio_krarcProtocol::findFileEntry(const KURL& url){ if( name.right(1) == "/" ) name.truncate(name.length()-1); name = name.mid(name.findRev("/")+1); } - + UDSEntryList::iterator entry; UDSEntry::iterator atom; - + for ( entry = dirList->begin(); entry != dirList->end(); ++entry ){ for( atom = (*entry).begin(); atom != (*entry).end(); ++atom ){ if( (*atom).m_uds == UDS_NAME ){ @@ -877,54 +880,54 @@ mode_t tdeio_krarcProtocol::parsePermString(TQString perm){ if(perm[7] != '-') mode |= S_IROTH; if(perm[8] != '-') mode |= S_IWOTH; if(perm[9] != '-') mode |= S_IXOTH; - + return mode; } UDSEntryList* tdeio_krarcProtocol::addNewDir(TQString path){ UDSEntryList* dir; - + // check if the current dir exists dir = dirDict.find(path); if(dir != 0) return dir; // dir exists- return it ! - + // set dir to the parent dir dir = addNewDir(path.left(path.findRev("/",-2)+1)); - + // add a new entry in the parent dir TQString name = path.mid(path.findRev("/",-2)+1); name = name.left(name.length()-1); - + UDSEntry entry; UDSAtom atom; atom.m_uds = UDS_NAME; atom.m_str = name; entry.append(atom); - + mode_t mode = parsePermString("drwxr-xr-x"); - + atom.m_uds = UDS_FILE_TYPE; atom.m_long = mode & S_IFMT; // keep file type only entry.append( atom ); - + atom.m_uds = UDS_ACCESS; atom.m_long = mode & 07777; // keep permissions only entry.append( atom ); - + atom.m_uds = UDS_SIZE; atom.m_long = 0; entry.append( atom ); - + atom.m_uds = UDS_MODIFICATION_TIME; atom.m_long = arcFile->time(UDS_MODIFICATION_TIME); entry.append( atom ); - + dir->append(entry); - + // create a new directory entry and add it.. dir = new UDSEntryList(); dirDict.insert(path,dir); - + return dir; } @@ -932,7 +935,7 @@ void tdeio_krarcProtocol::parseLine(int lineNo, TQString line, TQFile*) { UDSEntryList* dir; UDSEntry entry; UDSAtom atom; - + TQString owner = TQString(); TQString group = TQString(); TQString symlinkDest = TQString(); @@ -941,7 +944,7 @@ void tdeio_krarcProtocol::parseLine(int lineNo, TQString line, TQFile*) { size_t size = 0; time_t time = ::time(0); TQString fullName = TQString(); - + if(arcType == "zip"){ // permissions perm = nextWord(line); @@ -958,8 +961,8 @@ void tdeio_krarcProtocol::parseLine(int lineNo, TQString line, TQFile*) { time = TQDateTime(qdate,qtime).toTime_t(); // full name fullName = nextWord(line,'\n'); - - if(perm.length() != 10) + + if(perm.length() != 10) perm = (perm.at(0)=='d' || fullName.endsWith( "/" )) ? "drwxr-xr-x" : "-rw-r--r--" ; mode = parsePermString(perm); } @@ -977,22 +980,22 @@ void tdeio_krarcProtocol::parseLine(int lineNo, TQString line, TQFile*) { TQDate qdate( year, d.mid(3,2).toInt(), d.mid(0,2).toInt() ); TQString t = nextWord(line); TQTime qtime(t.mid(0,2).toInt(),t.mid(3,2).toInt(),0); - time = TQDateTime(qdate,qtime).toTime_t(); + time = TQDateTime(qdate,qtime).toTime_t(); // permissions perm = nextWord(line); - + if( perm.length() == 7 ) // windows rar permission format { bool isDir = ( perm.at(1).lower() == 'd' ); bool isReadOnly = ( perm.at(2).lower() == 'r' ); - + perm = isDir ? "drwxr-xr-x" : "-rw-r--r--"; - + if( isReadOnly ) perm.at( 2 ) = '-'; - } - - if(perm.length() != 10) perm = (perm.at(0)=='d')? "drwxr-xr-x" : "-rw-r--r--" ; + } + + if(perm.length() != 10) perm = (perm.at(0)=='d')? "drwxr-xr-x" : "-rw-r--r--" ; mode = parsePermString(perm); } if(arcType == "arj"){ @@ -1012,7 +1015,7 @@ void tdeio_krarcProtocol::parseLine(int lineNo, TQString line, TQFile*) { TQDate qdate( year, d.mid(3,2).toInt(), d.mid(6,2).toInt() ); TQString t = nextWord(line); TQTime qtime(t.mid(0,2).toInt(),t.mid(3,2).toInt(),0); - time = TQDateTime(qdate,qtime).toTime_t(); + time = TQDateTime(qdate,qtime).toTime_t(); // permissions perm = nextWord(line); if(perm.length() != 10) perm = (perm.at(0)=='d')? "drwxr-xr-x" : "-rw-r--r--" ; @@ -1076,15 +1079,15 @@ void tdeio_krarcProtocol::parseLine(int lineNo, TQString line, TQFile*) { int year = TQDate::currentDate().year(); TQString third = nextWord(line); TQTime qtime; - + if( third.contains(":" ) ) qtime = TQTime::fromString( third ); else year = third.toInt(); - + TQDate qdate(year, month, day ); - - time = TQDateTime(qdate, qtime).toTime_t(); + + time = TQDateTime(qdate, qtime).toTime_t(); // full name fullName = nextWord(line,'\n'); } @@ -1096,7 +1099,7 @@ void tdeio_krarcProtocol::parseLine(int lineNo, TQString line, TQFile*) { TQDate qdate( year, d.mid(3,2).toInt(), d.mid(0,2).toInt() ); TQString t = nextWord(line); TQTime qtime(t.mid(0,2).toInt(),t.mid(3,2).toInt(),0); - time = TQDateTime(qdate,qtime).toTime_t(); + time = TQDateTime(qdate,qtime).toTime_t(); // ignore the next field nextWord(line); // size @@ -1138,7 +1141,7 @@ void tdeio_krarcProtocol::parseLine(int lineNo, TQString line, TQFile*) { TQString t = nextWord(line); TQTime qtime(t.mid(0,2).toInt(),t.mid(3,2).toInt(),t.mid(6,2).toInt() ); time = TQDateTime(qdate,qtime).toTime_t(); - + // permissions perm = nextWord(line); bool isDir = ( perm.at(0).lower() == 'd' ); @@ -1146,18 +1149,26 @@ void tdeio_krarcProtocol::parseLine(int lineNo, TQString line, TQFile*) { perm = isDir ? "drwxr-xr-x" : "-rw-r--r--"; if( isReadOnly ) perm.at( 2 ) = '-'; - + mode = parsePermString(perm); - + // size size = nextWord(line).toLong(); - + // ignore the next 15 characters line = line.mid( 15 ); - + // 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; @@ -1200,7 +1211,7 @@ void tdeio_krarcProtocol::parseLine(int lineNo, TQString line, TQFile*) { // try to overwrite an existing entry UDSEntryList::iterator entryIt; UDSEntry::iterator atomIt; - + for ( entryIt = dir->begin(); entryIt != dir->end(); ++entryIt ) for( atomIt = (*entryIt).begin(); atomIt != (*entryIt).end(); ++atomIt ) if( (*atomIt).m_uds == UDS_NAME ) @@ -1220,7 +1231,7 @@ void tdeio_krarcProtocol::parseLine(int lineNo, TQString line, TQFile*) { return; // there is alreay an entry for this directory } } - + // multi volume archives can add a file twice, use only one UDSEntryList::iterator dirEntryIt; UDSEntry::iterator dirAtomIt; @@ -1228,19 +1239,19 @@ void tdeio_krarcProtocol::parseLine(int lineNo, TQString line, TQFile*) { for( dirAtomIt = (*dirEntryIt).begin(); dirAtomIt != (*dirEntryIt).end(); ++dirAtomIt ) if( (*dirAtomIt).m_uds == UDS_NAME && (*dirAtomIt).m_str == name ) return; - + dir->append(entry); } bool tdeio_krarcProtocol::initArcParameters() { KRDEBUG("arcType: "<<arcType); - + if(arcType == "zip"){ cmd = fullPathName( "unzip" ); listCmd = fullPathName( "unzip" ) + " -ZTs-z-t-h "; getCmd = fullPathName( "unzip" ) + " -p "; copyCmd = fullPathName( "unzip" ) + " -jo "; - + if( TDEStandardDirs::findExe( "zip" ).isEmpty() ) { delCmd = TQString(); putCmd = TQString(); @@ -1248,7 +1259,7 @@ bool tdeio_krarcProtocol::initArcParameters() { delCmd = fullPathName( "zip" ) + " -d "; putCmd = fullPathName( "zip" ) + " -ry "; } - + if( !getPassword().isEmpty() ) { getCmd += "-P '"+password+"' "; copyCmd += "-P '"+password+"' "; @@ -1336,12 +1347,12 @@ bool tdeio_krarcProtocol::initArcParameters() { getCmd = fullPathName("tar")+" xvf "; copyCmd = TQString(); delCmd = TQString(); - putCmd = TQString(); + putCmd = TQString(); } else if (arcType == "7z") { cmd = fullPathName( "7z" ); if( TDEStandardDirs::findExe(cmd).isEmpty() ) cmd = fullPathName( "7za" ); - + listCmd = cmd + " l -y "; getCmd = cmd + " e -y "; copyCmd = cmd + " e -y "; @@ -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(); @@ -1378,12 +1395,12 @@ bool tdeio_krarcProtocol::initArcParameters() { bool tdeio_krarcProtocol::checkStatus( int exitCode ) { KRDEBUG( exitCode ); - + if( arcType == "zip" || arcType == "rar" || arcType == "7z" ) 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,25 +1421,26 @@ 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; - + TQFile arcFile( fileName ); if ( arcFile.open( IO_ReadOnly ) ) { char buffer[ 1024 ]; long sizeMax = arcFile.readBlock( buffer, sizeof( buffer ) ); arcFile.close(); - + for( int i=0; i < autoDetectElems; i++ ) { TQString detectionString = autoDetectParams[ i ].detectionString; int location = autoDetectParams[ i ].location; - + int endPtr = detectionString.length() + location; if( endPtr > sizeMax ) continue; - + unsigned int j=0; for(; j != detectionString.length(); j++ ) { if( detectionString[ j ] == '?' ) @@ -1430,7 +1448,7 @@ TQString tdeio_krarcProtocol::detectArchive( bool &encrypted, TQString fileName if( buffer[ location + j ] != detectionString[ j ] ) break; } - + if( j == detectionString.length() ) { TQString type = autoDetectParams[ i ].type; if( type == "bzip2" || type == "gzip" ) { @@ -1465,7 +1483,7 @@ TQString tdeio_krarcProtocol::detectArchive( bool &encrypted, TQString fileName long headerSize = ((unsigned char *)buffer)[ offset+5 ] + 256*((unsigned char *)buffer)[ offset+6 ]; bool isDir = (buffer[ offset+7 ] == '\0' ) && (buffer[ offset+8 ] == '\0' ) && (buffer[ offset+9 ] == '\0' ) && (buffer[ offset+10 ] == '\0' ); - + if( buffer[ offset + 2 ] != (char)0x74 ) break; if( !isDir ) { @@ -1485,7 +1503,7 @@ TQString tdeio_krarcProtocol::detectArchive( bool &encrypted, TQString fileName long headerSize = ((unsigned char *)buffer)[ offset+2 ] + 256*((unsigned char *)buffer)[ offset+3 ] + 4; bool isDir = (buffer[ offset+11 ] == '\0' ) && (buffer[ offset+12 ] == '\0' ) && (buffer[ offset+13 ] == '\0' ) && (buffer[ offset+14 ] == '\0' ); - + if( buffer[ offset + 4 ] != (char)0x01 ) break; if( !isDir ) { @@ -1507,17 +1525,17 @@ TQString tdeio_krarcProtocol::detectArchive( bool &encrypted, TQString fileName return type; } } - + TQString testCmd = tester + " t -y "; lastData = encryptedArchPath = ""; - + KrShellProcess proc; proc << testCmd << convertName( fileName ); connect( &proc, TQT_SIGNAL( receivedStdout(TDEProcess*,char*,int) ), this, TQT_SLOT( checkOutputForPassword( TDEProcess*,char*,int ) ) ); proc.start(TDEProcess::Block,TDEProcess::AllOutput); encrypted = this->encrypted; - + if( encrypted ) encryptedArchPath = fileName; } @@ -1525,7 +1543,7 @@ TQString tdeio_krarcProtocol::detectArchive( bool &encrypted, TQString fileName return type; } } - + if( sizeMax >= 512 ) { /* checking if it's a tar file */ unsigned checksum = 32*8; @@ -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(); } @@ -1553,9 +1581,9 @@ void tdeio_krarcProtocol::checkOutputForPassword( TDEProcess *proc,char *buf,int d.setRawData(buf,len); TQString data = TQString( d ); d.resetRawData(buf,len); - + TQString checkable = lastData + data; - + TQStringList lines = TQStringList::split( '\n', checkable ); lastData = lines[ lines.count() - 1 ]; for( unsigned i=0; i != lines.count(); i++ ) { @@ -1565,7 +1593,7 @@ void tdeio_krarcProtocol::checkOutputForPassword( TDEProcess *proc,char *buf,int line.truncate( ndx ); if( line.isEmpty() ) continue; - + if( line.contains( "password" ) && line.contains( "enter" ) ) { KRDEBUG( "Encrypted 7z archive found!" ); encrypted = true; @@ -1576,10 +1604,10 @@ void tdeio_krarcProtocol::checkOutputForPassword( TDEProcess *proc,char *buf,int void tdeio_krarcProtocol::invalidatePassword() { KRDEBUG( arcFile->url().path(-1) + "/" ); - + if( !encrypted ) return; - + TDEIO::AuthInfo authInfo; authInfo.caption= i18n( "Krarc Password Dialog" ); authInfo.username= "archive"; @@ -1590,20 +1618,20 @@ void tdeio_krarcProtocol::invalidatePassword() { authInfo.url = KURL::fromPathOrURL( "/" ); authInfo.url.setHost( fileName /*.replace('/','_')*/ ); authInfo.url.setProtocol( "krarc" ); - + password = TQString(); - + cacheAuthentication( authInfo ); } TQString tdeio_krarcProtocol::getPassword() { KRDEBUG( encrypted ); - + if( !password.isNull() ) return password; if( !encrypted ) return (password = "" ); - + TDEIO::AuthInfo authInfo; authInfo.caption= i18n( "Krarc Password Dialog" ); authInfo.username= "archive"; @@ -1614,19 +1642,19 @@ TQString tdeio_krarcProtocol::getPassword() { authInfo.url = KURL::fromPathOrURL( "/" ); authInfo.url.setHost( fileName /*.replace('/','_')*/ ); authInfo.url.setProtocol( "krarc" ); - + if( checkCachedAuthentication( authInfo ) && !authInfo.password.isNull() ) { KRDEBUG( authInfo.password ); return ( password = authInfo.password ); } - + authInfo.password = TQString(); - + if ( openPassDlg( authInfo, i18n("Accessing the file requires password.") ) && !authInfo.password.isNull() ) { KRDEBUG( authInfo.password ); return ( password = authInfo.password ); } - + KRDEBUG( password ); return password; } @@ -1652,12 +1680,12 @@ TQString tdeio_krarcProtocol::convertName( TQString name ) { return escape( name ); } -TQString tdeio_krarcProtocol::escape( TQString name ) { +TQString tdeio_krarcProtocol::escape( TQString name ) { const TQString evilstuff = "\\\"'`()[]{}!?;$&<>| "; // stuff that should get escaped - + for ( unsigned int i = 0; i < evilstuff.length(); ++i ) name.replace( evilstuff[ i ], (TQString("\\") + evilstuff[ i ]) ); - + return name; } diff --git a/krusader/Dialogs/packgui.cpp b/krusader/Dialogs/packgui.cpp index e57af8e..e479060 100644 --- a/krusader/Dialogs/packgui.cpp +++ b/krusader/Dialogs/packgui.cpp @@ -5,10 +5,10 @@ e-mail : [email protected] web site : http://krusader.sourceforge.net --------------------------------------------------------------------------- - Description + Description *************************************************************************** - A + A db dD d8888b. db db .d8888. .d8b. d8888b. d88888b d8888b. 88 ,8P' 88 `8D 88 88 88' YP d8' `8b 88 `8D 88' 88 `8D @@ -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()) { diff --git a/krusader/Konfigurator/kgarchives.cpp b/krusader/Konfigurator/kgarchives.cpp index a4ea958..f31d719 100644 --- a/krusader/Konfigurator/kgarchives.cpp +++ b/krusader/Konfigurator/kgarchives.cpp @@ -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." ), @@ -81,7 +82,7 @@ KgArchives::KgArchives( bool first, TQWidget* parent, const char* name ) : createSpacer( hbox, "spacer2" ); generalGrid->addWidget( hbox, 3, 0 ); connect( btnAutoConfigure, TQT_SIGNAL( clicked() ), this, TQT_SLOT( slotAutoConfigure() ) ); - + kgArchivesLayout->addWidget( generalGrp, 0 ,0 ); // ------------------------ FINE-TUNING GROUPBOX -------------------------------- @@ -101,7 +102,7 @@ KgArchives::KgArchives( bool first, TQWidget* parent, const char* name ) : fineTuneGrid->addWidget( finetunes, 1, 0 ); kgArchivesLayout->addWidget( fineTuneGrp, 1 ,0 ); - + if( first ) slotAutoConfigure(); @@ -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 ); diff --git a/krusader/Konfigurator/kgdependencies.cpp b/krusader/Konfigurator/kgdependencies.cpp index 839b721..25da574 100644 --- a/krusader/Konfigurator/kgdependencies.cpp +++ b/krusader/Konfigurator/kgdependencies.cpp @@ -56,7 +56,7 @@ KgDependencies::KgDependencies( bool first, TQWidget* parent, const char* name pathsGrid->setSpacing( 6 ); pathsGrid->setMargin( 11 ); pathsGrid->setAlignment( TQt::AlignTop ); - + addApplication( "df", pathsGrid, 0, general_tab, PAGE_GENERAL ); addApplication( "eject", pathsGrid, 1, general_tab, PAGE_GENERAL ); addApplication( "tdesu", pathsGrid, 2, general_tab, PAGE_GENERAL ); @@ -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" ); diff --git a/krusader/Konfigurator/kggeneral.cpp b/krusader/Konfigurator/kggeneral.cpp index ba0429c..f2a9f36 100644 --- a/krusader/Konfigurator/kggeneral.cpp +++ b/krusader/Konfigurator/kggeneral.cpp @@ -44,7 +44,7 @@ KgGeneral::KgGeneral( bool first, TQWidget* parent, const char* name ) : KonfiguratorPage( first, parent, name ) { -if( first ) +if( first ) slotFindTools(); TQGridLayout *kgGeneralLayout = new TQGridLayout( parent ); @@ -91,11 +91,11 @@ TQFrame *line2 = createLine( generalGrp, "line2" ); TQVBox * vbox = new TQVBox( hbox2 ); new TQLabel( i18n("Default viewer mode:"), vbox); - + KONFIGURATOR_NAME_VALUE_TIP viewMode[] = // name value tooltip {{ i18n( "Generic mode" ), "generic", i18n( "Use the system's default viewer" ) }, - { i18n( "Text mode" ), "text", i18n( "View the file in text-only mode" ) }, + { i18n( "Text mode" ), "text", i18n( "View the file in text-only mode" ) }, { i18n( "Hex mode" ), "hex", i18n( "View the file in hex-mode (better for binary files)" ) } }; createRadioButtonGroup( "General", "Default Viewer Mode", "generic", 0, 3, viewMode, 3, vbox, "myRadio2", false ); @@ -132,8 +132,9 @@ TQFrame *line2 = createLine( generalGrp, "line2" ); defaultAtomicExtensions += ".tar.gz"; defaultAtomicExtensions += ".tar.bz2"; defaultAtomicExtensions += ".moc.cpp"; + defaultAtomicExtensions += ".tar.xz"; - listBox = createListBox( "Look&Feel", "Atomic Extensions", + listBox = createListBox( "Look&Feel", "Atomic Extensions", defaultAtomicExtensions, vbox2, true, false ); TQFrame *line3 = createLine( generalGrp, "line3" ); diff --git a/krusader/Konfigurator/kgprotocols.cpp b/krusader/Konfigurator/kgprotocols.cpp index 2a5439e..fb3cd9f 100644 --- a/krusader/Konfigurator/kgprotocols.cpp +++ b/krusader/Konfigurator/kgprotocols.cpp @@ -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 ) @@ -63,22 +64,22 @@ KgProtocols::KgProtocols( bool first, TQWidget* parent, const char* name ) : KgProtocolsLayout->setSpacing( 6 ); // -------------------------- LINK VIEW ---------------------------------- - - TQGroupBox *linkGrp = createFrame( i18n( "Links" ), parent, "linkGrp" ); + + TQGroupBox *linkGrp = createFrame( i18n( "Links" ), parent, "linkGrp" ); TQGridLayout *linkGrid = createGridLayout( linkGrp->layout() ); - + linkList = new TQListView( linkGrp, "linkList" ); linkList->addColumn( i18n( "Defined Links" ) ); linkList->header()->setStretchEnabled( true, 0 ); linkList->setRootIsDecorated( true ); - + linkGrid->addWidget( linkList, 0, 0 ); KgProtocolsLayout->addMultiCellWidget( linkGrp, 0 ,1, 0, 0 ); // -------------------------- BUTTONS ---------------------------------- TQVBox *vbox1 = new TQVBox( parent, "vbox1" ) ; - + addSpacer( vbox1 ); btnAddProtocol = new TQPushButton( vbox1, "btnAddProtocolButton" ); btnAddProtocol->setPixmap( krLoader->loadIcon( "1leftarrow", TDEIcon::Small ) ); @@ -87,11 +88,11 @@ KgProtocols::KgProtocols( bool first, TQWidget* parent, const char* name ) : btnRemoveProtocol->setPixmap( krLoader->loadIcon( "1rightarrow", TDEIcon::Small ) ); TQWhatsThis::add( btnRemoveProtocol, i18n( "Remove protocol from the link list." ) ); addSpacer( vbox1 ); - + KgProtocolsLayout->addWidget( vbox1, 0 ,1 ); TQVBox *vbox2 = new TQVBox( parent, "vbox2" ) ; - + addSpacer( vbox2 ); btnAddMime = new TQPushButton( vbox2, "btnAddMimeButton" ); btnAddMime->setPixmap( krLoader->loadIcon( "1leftarrow", TDEIcon::Small ) ); @@ -100,14 +101,14 @@ KgProtocols::KgProtocols( bool first, TQWidget* parent, const char* name ) : btnRemoveMime->setPixmap( krLoader->loadIcon( "1rightarrow", TDEIcon::Small ) ); TQWhatsThis::add( btnRemoveMime, i18n( "Remove mime from the link list." ) ); addSpacer( vbox2 ); - + KgProtocolsLayout->addWidget( vbox2, 1 ,1 ); - + // -------------------------- PROTOCOLS LISTBOX ---------------------------------- - TQGroupBox *protocolGrp = createFrame( i18n( "Protocols" ), parent, "protocolGrp" ); + TQGroupBox *protocolGrp = createFrame( i18n( "Protocols" ), parent, "protocolGrp" ); TQGridLayout *protocolGrid = createGridLayout( protocolGrp->layout() ); - + protocolList = new TQListBox( protocolGrp, "protocolList" ); loadListCapableProtocols(); protocolGrid->addWidget( protocolList, 0, 0 ); @@ -116,17 +117,17 @@ KgProtocols::KgProtocols( bool first, TQWidget* parent, const char* name ) : // -------------------------- MIMES LISTBOX ---------------------------------- - TQGroupBox *mimeGrp = createFrame( i18n( "Mimes" ), parent, "mimeGrp" ); + TQGroupBox *mimeGrp = createFrame( i18n( "Mimes" ), parent, "mimeGrp" ); TQGridLayout *mimeGrid = createGridLayout( mimeGrp->layout() ); - + mimeList = new TQListBox( mimeGrp, "protocolList" ); loadMimes(); mimeGrid->addWidget( mimeList, 0, 0 ); KgProtocolsLayout->addWidget( mimeGrp, 1 ,2 ); - - // -------------------------- CONNECT TABLE ---------------------------------- - + + // -------------------------- CONNECT TABLE ---------------------------------- + connect( protocolList, TQT_SIGNAL( selectionChanged() ), this, TQT_SLOT( slotDisableButtons() ) ); connect( linkList, TQT_SIGNAL( selectionChanged() ), this, TQT_SLOT( slotDisableButtons() ) ); connect( mimeList, TQT_SIGNAL( selectionChanged() ), this, TQT_SLOT( slotDisableButtons() ) ); @@ -135,11 +136,11 @@ KgProtocols::KgProtocols( bool first, TQWidget* parent, const char* name ) : connect( btnRemoveProtocol, TQT_SIGNAL( clicked() ) , this, TQT_SLOT( slotRemoveProtocol() ) ); connect( btnAddMime, TQT_SIGNAL( clicked() ) , this, TQT_SLOT( slotAddMime() ) ); connect( btnRemoveMime, TQT_SIGNAL( clicked() ) , this, TQT_SLOT( slotRemoveMime() ) ); - + loadInitialValues(); slotDisableButtons(); } - + TQWidget* KgProtocols::addSpacer( TQWidget *parent, const char *widgetName ) { TQWidget *widget = new TQWidget( parent, widgetName ); @@ -153,8 +154,8 @@ void KgProtocols::loadListCapableProtocols() { TQStringList protocols = KProtocolInfo::protocols(); protocols.sort(); - - for ( TQStringList::Iterator it = protocols.begin(); it != protocols.end();) + + for ( TQStringList::Iterator it = protocols.begin(); it != protocols.end();) { if( !KProtocolInfo::supportsListing( *it ) ) { @@ -169,10 +170,10 @@ void KgProtocols::loadListCapableProtocols() void KgProtocols::loadMimes() { KMimeType::List mimes = KMimeType::allMimeTypes(); - + for( TQValueListIterator<KMimeType::Ptr> it = mimes.begin(); it != mimes.end(); it++ ) mimeList->insertItem( (*it)->name() ); - + mimeList->sort(); } @@ -184,7 +185,7 @@ void KgProtocols::slotDisableButtons() btnRemoveProtocol->setEnabled( isProtocolSelected ); btnAddMime->setEnabled( listViewItem != 0 && mimeList->selectedItem() != 0 ); btnRemoveMime->setEnabled( listViewItem == 0 ? false : listViewItem->parent() != 0 ); - + if( linkList->currentItem() == 0 && linkList->firstChild() != 0 ) linkList->setCurrentItem( linkList->firstChild() ); if( linkList->selectedItem() == 0 && linkList->currentItem() != 0 ) @@ -210,7 +211,7 @@ void KgProtocols::addProtocol( TQString name, bool changeCurrent ) protocolList->removeItem( protocolList->index( item ) ); TQListViewItem *listViewItem = new TQListViewItem( linkList, name ); listViewItem->setPixmap( 0, krLoader->loadIcon( "application-x-executable", TDEIcon::Small ) ); - + if( changeCurrent ) linkList->setCurrentItem( listViewItem ); } @@ -234,7 +235,7 @@ void KgProtocols::removeProtocol( TQString name ) { while( item->childCount() != 0 ) removeMime( item->firstChild()->text( 0 ) ); - + linkList->takeItem( item ); protocolList->insertItem( name ); protocolList->sort(); @@ -249,7 +250,7 @@ void KgProtocols::slotAddMime() TQListViewItem *itemToAdd = linkList->currentItem(); if( itemToAdd->parent() ) itemToAdd = itemToAdd->parent(); - + addMime( item->text(), itemToAdd->text( 0 ) ); slotDisableButtons(); emit sigChanged(); @@ -260,7 +261,7 @@ void KgProtocols::addMime( TQString name, TQString protocol ) { TQListBoxItem *item = mimeList->findItem( name, ExactMatch ); TQListViewItem *currentListItem = linkList->findItem( protocol, 0 ); - + if( item && currentListItem && currentListItem->parent() == 0 ) { mimeList->removeItem( mimeList->index( item ) ); @@ -284,7 +285,7 @@ void KgProtocols::slotRemoveMime() void KgProtocols::removeMime( TQString name ) { TQListViewItem *currentMimeItem = linkList->findItem( name, 0 ); - + if( currentMimeItem && currentMimeItem->parent() != 0 ) { mimeList->insertItem( currentMimeItem->text( 0 ) ); @@ -297,20 +298,20 @@ void KgProtocols::loadInitialValues() { while( linkList->childCount() != 0 ) removeProtocol( linkList->firstChild()->text( 0 ) ); - + krConfig->setGroup( "Protocols" ); TQStringList protList = krConfig->readListEntry( "Handled Protocols" ); - - for( TQStringList::Iterator it = protList.begin(); it != protList.end(); it++ ) + + for( TQStringList::Iterator it = protList.begin(); it != protList.end(); it++ ) { addProtocol( *it ); - + TQStringList mimes = krConfig->readListEntry( TQString( "Mimes For %1" ).arg( *it ) ); - + for( TQStringList::Iterator it2 = mimes.begin(); it2 != mimes.end(); it2++ ) addMime( *it2, *it ); } - + if( linkList->firstChild() != 0 ) linkList->setCurrentItem( linkList->firstChild() ); slotDisableButtons(); @@ -320,22 +321,22 @@ void KgProtocols::setDefaults() { while( linkList->childCount() != 0 ) removeProtocol( linkList->firstChild()->text( 0 ) ); - + addProtocol( "iso" ); addMime( "application/x-iso", "iso" ); - + addProtocol( "krarc" ); TQStringList krarcMimes = TQStringList::split( ',', defaultKrarcMimes ); for( TQStringList::Iterator it = krarcMimes.begin(); it != krarcMimes.end(); it++ ) addMime( *it, "krarc" ); - + addProtocol( "tar" ); TQStringList tarMimes = TQStringList::split( ',', defaultTarMimes ); for( TQStringList::Iterator it = tarMimes.begin(); it != tarMimes.end(); it++ ) addMime( *it, "tar" ); - + slotDisableButtons(); - + if( isChanged() ) emit sigChanged(); } @@ -344,18 +345,18 @@ bool KgProtocols::isChanged() { krConfig->setGroup( "Protocols" ); TQStringList protList = krConfig->readListEntry( "Handled Protocols" ); - + if( (int)protList.count() != linkList->childCount() ) return true; - + TQListViewItem *item = linkList->firstChild(); while( item ) { if( !protList.contains( item->text( 0 ) ) ) return true; - + TQStringList mimes = krConfig->readListEntry( TQString( "Mimes For %1" ).arg( item->text( 0 ) ) ); - + if( (int)mimes.count() != item->childCount() ) return true; TQListViewItem *childs = item->firstChild(); @@ -365,24 +366,24 @@ bool KgProtocols::isChanged() return true; childs = childs->nextSibling(); } - + item = item->nextSibling(); } - + return false; } bool KgProtocols::apply() { krConfig->setGroup( "Protocols" ); - + TQStringList protocolList; - + TQListViewItem *item = linkList->firstChild(); while( item ) { protocolList.append( item->text( 0 ) ); - + TQStringList mimes; TQListViewItem *childs = item->firstChild(); while( childs ) @@ -391,15 +392,15 @@ bool KgProtocols::apply() childs = childs->nextSibling(); } krConfig->writeEntry( TQString( "Mimes For %1" ).arg( item->text( 0 ) ), mimes ); - + item = item->nextSibling(); - } + } krConfig->writeEntry( "Handled Protocols", protocolList ); - krConfig->sync(); - + krConfig->sync(); + KrServices::clearProtocolCache(); - - emit sigChanged(); + + emit sigChanged(); return false; } diff --git a/krusader/Konfigurator/krresulttable.cpp b/krusader/Konfigurator/krresulttable.cpp index cc1ed23..0ab4280 100644 --- a/krusader/Konfigurator/krresulttable.cpp +++ b/krusader/Konfigurator/krresulttable.cpp @@ -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() diff --git a/krusader/Panel/krbriefview.cpp b/krusader/Panel/krbriefview.cpp index e2d3131..571fc44 100644 --- a/krusader/Panel/krbriefview.cpp +++ b/krusader/Panel/krbriefview.cpp @@ -42,7 +42,7 @@ YP YD 88 YD ~Y8888P' `8888Y' YP YP Y8888D' Y88888P 88 YD #include <tqtooltip.h> #define CANCEL_TWO_CLICK_RENAME {singleClicked = false;renameTimer.stop();} -#define PROPS static_cast<KrBriefViewProperties*>(_properties) +#define PROPS static_cast<KrBriefViewProperties*>(_properties) #define MAX_COLS 5 #define VF getVfile() @@ -69,9 +69,9 @@ void KrBriefViewToolTip::maybeTip( const TQPoint &pos ) if ( !item ) return; - + int width = TQFontMetrics( view->font() ).width( item->text() ) + 4; - + TQRect r = item->rect(); r.setTopLeft( view->contentsToViewport( r.topLeft() ) ); if( width > item->textRect().width() ) @@ -92,7 +92,7 @@ KrBriefView::KrBriefView( TQHeader * headerIn, TQWidget *parent, bool &left, TDE void KrBriefView::setup() { lastSwushPosition = 0; - + // use the {} so that TDEConfigGroupSaver will work correctly! TDEConfigGroupSaver grpSvr( _config, "Look&Feel" ); setFont( _config->readFontEntry( "Filelist Font", _FilelistFont ) ); @@ -119,7 +119,7 @@ void KrBriefView::setup() { // add whatever columns are needed to the listview krConfig->setGroup( nameInTDEConfig() ); - + // determine basic settings for the view setAcceptDrops( true ); setItemsMovable( false ); @@ -131,7 +131,7 @@ void KrBriefView::setup() { // allow in-place renaming - connect( this, TQT_SIGNAL( itemRenamed ( TQIconViewItem * ) ), + connect( this, TQT_SIGNAL( itemRenamed ( TQIconViewItem * ) ), this, TQT_SLOT( inplaceRenameFinished( TQIconViewItem * ) ) ); connect( &renameTimer, TQT_SIGNAL( timeout() ), this, TQT_SLOT( renameCurrentItem() ) ); connect( &contextMenuTimer, TQT_SIGNAL (timeout()), this, TQT_SLOT (showContextMenu())); @@ -144,7 +144,7 @@ void KrBriefView::setup() { CANCEL_TWO_CLICK_RENAME; - // setting the header + // setting the header while( header->count() ) header->removeLabel( 0 ); @@ -440,12 +440,12 @@ void KrBriefView::contentsMousePressEvent( TQMouseEvent * e ) { pressedItem = 0; e = transformMouseEvent( e ); - + TQIconViewItem * oldCurrent = currentItem(); TQIconViewItem *newCurrent = findItem( e->pos() ); if (e->button() == Qt::RightButton) { - if (KrSelectionMode::getSelectionHandler()->rightButtonSelects() || + if (KrSelectionMode::getSelectionHandler()->rightButtonSelects() || (((e->state() & ShiftButton) || (e->state() & ControlButton))) && KrSelectionMode::getSelectionHandler()->shiftCtrlRightButtonSelects()) { if (KrSelectionMode::getSelectionHandler()->rightButtonPreservesSelection() && !(e->state() & ShiftButton) @@ -504,7 +504,7 @@ void KrBriefView::contentsMousePressEvent( TQMouseEvent * e ) { if (e->button() == Qt::LeftButton) { dragStartPos = e->pos(); - if (KrSelectionMode::getSelectionHandler()->leftButtonSelects() || + if (KrSelectionMode::getSelectionHandler()->leftButtonSelects() || (((e->state() & ShiftButton) || (e->state() & ControlButton))) && KrSelectionMode::getSelectionHandler()->shiftCtrlLeftButtonSelects()) { @@ -582,10 +582,10 @@ void KrBriefView::contentsMousePressEvent( TQMouseEvent * e ) { if( e->state() & ShiftButton ) callDefaultHandler = false; } - + if (selectionChanged) updateView(); // don't call triggerUpdate directly! - + if (callDefaultHandler) { dragStartPos = TQPoint( -1, -1 ); @@ -631,11 +631,11 @@ void KrBriefView::contentsMousePressEvent( TQMouseEvent * e ) { void KrBriefView::contentsMouseReleaseEvent( TQMouseEvent * e ) { if (e->button() == Qt::RightButton) contextMenuTimer.stop(); - + e = transformMouseEvent( e ); - + TDEIconView::contentsMouseReleaseEvent( e ); - + if( pressedItem ) { TQPoint vp = contentsToViewport( e->pos() ); TQIconViewItem *newCurrent = findItem( e->pos() ); @@ -665,8 +665,8 @@ void KrBriefView::contentsMouseMoveEvent ( TQMouseEvent * e ) { if ( dragStartPos != TQPoint( -1, -1 ) && e->state() & Qt::LeftButton && ( dragStartPos - e->pos() ).manhattanLength() > TQApplication::startDragDistance() ) startDrag(); - if (KrSelectionMode::getSelectionHandler()->rightButtonPreservesSelection() - && KrSelectionMode::getSelectionHandler()->rightButtonSelects() + if (KrSelectionMode::getSelectionHandler()->rightButtonPreservesSelection() + && KrSelectionMode::getSelectionHandler()->rightButtonSelects() && KrSelectionMode::getSelectionHandler()->showContextMenu() >= 0 && e->state() == Qt::RightButton) { TQIconViewItem *newItem = findItem( e->pos() ); @@ -754,7 +754,7 @@ void KrBriefView::contentsDropEvent( TQDropEvent * e ) { _currDragItem = 0; op()->emitGotDrop(e); e->ignore(); - TDEIconView::contentsDropEvent( e ); + TDEIconView::contentsDropEvent( e ); } void KrBriefView::contentsDragMoveEvent( TQDragMoveEvent * e ) { @@ -763,7 +763,7 @@ void KrBriefView::contentsDragMoveEvent( TQDragMoveEvent * e ) { _currDragItem = getKrViewItemAt( e->pos() ); if( _currDragItem && !_currDragItem->VF->vfile_isDir() ) _currDragItem = 0; - + TDEIconView::contentsDragMoveEvent( e ); if( _currDragItem != oldDragItem ) @@ -1031,7 +1031,7 @@ void KrBriefView::keyPressEvent( TQKeyEvent * e ) { case Key_Delete : // kill file SLOTS->deleteFiles( e->state() == ShiftButton || e->state() == ControlButton ); - + break ; case Key_Insert : { { @@ -1093,7 +1093,7 @@ void KrBriefView::keyPressEvent( TQKeyEvent * e ) { ( e->key() >= Key_0 && e->key() <= Key_9 ) || ( e->key() == Key_Backspace ) || ( e->key() == Key_Down ) || - ( e->key() == Key_Period ) ) */{ + ( e->key() == Key_Period ) ) */{ // are we doing quicksearch? if not, send keys to panel //if ( _config->readBoolEntry( "Do Quicksearch", _DoQuicksearch ) ) { // are we using krusader's classic quicksearch, or wincmd style? @@ -1142,7 +1142,7 @@ void KrBriefView::renameCurrentItem() { TQString newName, fileName; // handle inplace renaming, if possible - + KrBriefViewItem *it = static_cast<KrBriefViewItem*>(getCurrentKrViewItem()); if ( it ) fileName = it->name(); @@ -1157,7 +1157,7 @@ void KrBriefView::renameCurrentItem() { /* TODO: TDEConfigGroupSaver svr(krConfig,"Look&Feel"); if (!krConfig->readBoolEntry("Rename Selects Extension", true)) { - if (it->hasExtension() && !it->VF->vfile_isDir() ) + if (it->hasExtension() && !it->VF->vfile_isDir() ) renameLineEdit()->setSelection(0, it->name().findRev(it->extension())-1); }*/ } @@ -1226,7 +1226,7 @@ void KrBriefView::slotMouseClicked( int button, TQIconViewItem * item, const TQP void KrBriefView::refreshColors() { krConfig->setGroup("Colors"); - bool kdeDefault = krConfig->readBoolEntry("KDE Default"); + bool kdeDefault = krConfig->readBoolEntry("KDE Default"); if ( !kdeDefault ) { // KDE default is not choosen: set the background color (as this paints the empty areas) and the alternate color bool isActive = hasFocus(); @@ -1289,7 +1289,7 @@ bool KrBriefView::eventFilter( TQObject * watched, TQEvent * e ) void KrBriefView::makeItemVisible( const KrViewItem *item ) { // tqApp->processEvents(); // Please don't remove the comment. Causes crash if it is inserted! - ensureItemVisible( (TQIconViewItem *)( static_cast<const KrBriefViewItem*>( item ) ) ); + ensureItemVisible( (TQIconViewItem *)( static_cast<const KrBriefViewItem*>( item ) ) ); } void KrBriefView::initOperator() { @@ -1307,18 +1307,19 @@ void KrBriefView::initProperties() { _properties->displayIcons = _config->readBoolEntry( "With Icons", _WithIcons ); bool dirsByNameAlways = _config->readBoolEntry("Always sort dirs by name", false); _properties->sortMode = static_cast<KrViewProperties::SortSpec>( KrViewProperties::Name | - KrViewProperties::Descending | KrViewProperties::DirsFirst | + KrViewProperties::Descending | KrViewProperties::DirsFirst | (dirsByNameAlways ? KrViewProperties::AlwaysSortDirsByName : 0) ); if ( !_config->readBoolEntry( "Case Sensative Sort", _CaseSensativeSort ) ) _properties->sortMode = static_cast<KrViewProperties::SortSpec>( _properties->sortMode | KrViewProperties::IgnoreCase ); _properties->humanReadableSize = krConfig->readBoolEntry("Human Readable Size", _HumanReadableSize); _properties->localeAwareCompareIsCaseSensitive = TQString( "a" ).localeAwareCompare( "B" ) > 0; // see KDE bug #40131 - + TQStringList defaultAtomicExtensions; 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(); ) { @@ -1334,7 +1335,7 @@ void KrBriefView::initProperties() { ++i; } _properties->atomicExtensions = atomicExtensions; - + _config->setGroup( nameInTDEConfig() ); PROPS->numberOfColumns = _config->readNumEntry( "Number Of Brief Columns", _NumberOfBriefColumns ); if( PROPS->numberOfColumns < 1 ) @@ -1347,7 +1348,7 @@ void KrBriefView::setColumnNr() { TDEPopupMenu popup( this ); popup.insertTitle( i18n("Columns")); - + int COL_ID = 14700; for( int i=1; i <= MAX_COLS; i++ ) @@ -1355,11 +1356,11 @@ void KrBriefView::setColumnNr() popup.insertItem( TQString( "%1" ).arg( i ), COL_ID + i ); popup.setItemChecked( COL_ID + i, PROPS->numberOfColumns == i ); } - + int result=popup.exec(TQCursor::pos()); krConfig->setGroup( nameInTDEConfig() ); - + if( result > COL_ID && result <= COL_ID + MAX_COLS ) { krConfig->writeEntry( "Number Of Brief Columns", result - COL_ID ); @@ -1370,7 +1371,7 @@ void KrBriefView::setColumnNr() void KrBriefView::sortOrderChanged() { ensureItemVisible(currentItem()); - + if( !_focused ) op()->emitNeedFocus(); @@ -1400,14 +1401,14 @@ TQMouseEvent * KrBriefView::transformMouseEvent( TQMouseEvent * e ) { if( findItem( e->pos() ) != 0 ) return e; - + TQIconViewItem *closestItem = 0; int mouseX = e->pos().x(), mouseY = e->pos().y(); int closestDelta = 0x7FFFFFFF; - + int minX = ( mouseX / gridX() ) * gridX(); int maxX = minX + gridX(); - + TQIconViewItem *current = firstItem(); while( current ) { @@ -1422,7 +1423,7 @@ TQMouseEvent * KrBriefView::transformMouseEvent( TQMouseEvent * e ) } current = current->nextItem(); } - + if( closestItem != 0 ) { if( mouseX - closestItem->x() > gridX() ) @@ -1430,7 +1431,7 @@ TQMouseEvent * KrBriefView::transformMouseEvent( TQMouseEvent * e ) else if( mouseY - closestItem->y() > closestItem->height() ) closestItem = 0; } - + if( closestItem != 0 ) { TQRect rec = closestItem->textRect( false ); @@ -1449,12 +1450,12 @@ TQMouseEvent * KrBriefView::transformMouseEvent( TQMouseEvent * e ) glPos = TQPoint( mouseX - e->pos().x() + e->globalPos().x(), mouseY - e->pos().y() + e->globalPos().y() ); } - + if( mouseEvent ) delete mouseEvent; return mouseEvent = new TQMouseEvent( e->type(), newPos, glPos, e->button(), e->state() ); } - + return e; } diff --git a/krusader/Panel/krdetailedview.cpp b/krusader/Panel/krdetailedview.cpp index 59dd1d8..c3db5b9 100644 --- a/krusader/Panel/krdetailedview.cpp +++ b/krusader/Panel/krdetailedview.cpp @@ -59,28 +59,28 @@ YP YD 88 YD ~Y8888P' `8888Y' YP YP Y8888D' Y88888P 88 YD // Group name: KrDetailedView // // Ext Column -#define _ExtColumn true +#define _ExtColumn true // Mime Column -#define _MimeColumn false +#define _MimeColumn false // Size Column -#define _SizeColumn true +#define _SizeColumn true // DateTime Column -#define _DateTimeColumn true +#define _DateTimeColumn true // Perm Column -#define _PermColumn false +#define _PermColumn false // KrPerm Column -#define _KrPermColumn true +#define _KrPermColumn true // Owner Column -#define _OwnerColumn false +#define _OwnerColumn false // Group Column -#define _GroupColumn false +#define _GroupColumn false // Do Quicksearch -#define _DoQuicksearch true +#define _DoQuicksearch true ////////////////////////////////////////////////////////////////////////// #define CANCEL_TWO_CLICK_RENAME {singleClicked = false;renameTimer.stop();} #define COLUMN(X) static_cast<KrDetailedViewProperties*>(_properties)->column[ KrDetailedViewProperties::X ] -#define PROPS static_cast<KrDetailedViewProperties*>(_properties) +#define PROPS static_cast<KrDetailedViewProperties*>(_properties) #define VF getVfile() #define COLUMN_POPUP_IDS 91 @@ -140,7 +140,7 @@ void KrDetailedView::setup() { // add whatever columns are needed to the listview krConfig->setGroup( nameInTDEConfig() ); - + newColumn( KrDetailedViewProperties::Name ); // we always have a name setColumnWidthMode( COLUMN(Name), TQListView::Manual ); if ( _config->readBoolEntry( "Ext Column", _ExtColumn ) ) { @@ -186,7 +186,7 @@ void KrDetailedView::setup() { setColumnWidthMode( COLUMN(Group), TQListView::Manual ); setColumnWidth( COLUMN(Group), TQFontMetrics( font() ).width( 'X' ) * 6 ); } - + // determine basic settings for the listview setAcceptDrops( true ); setDragEnabled( true ); @@ -205,7 +205,7 @@ void KrDetailedView::setup() { header()->installEventFilter( this ); renameLineEdit()->installEventFilter( this ); - + // allow in-place renaming connect( renameLineEdit(), TQT_SIGNAL( done( TQListViewItem *, int ) ), this, TQT_SLOT( inplaceRenameFinished( TQListViewItem*, int ) ) ); @@ -235,7 +235,7 @@ void KrDetailedView::newColumn( KrDetailedViewProperties::ColumnType type ) { } if ( max >= KrDetailedViewProperties::MAX_COLUMNS ) perror( "KrDetailedView::newColumn() - too many columns" ); - + PROPS->column[type] = max; addColumn( ColumnName[type], -1 ); } @@ -535,7 +535,7 @@ void KrDetailedView::contentsMousePressEvent( TQMouseEvent * e ) { TQListViewItem *newCurrent = itemAt( contentsToViewport( e->pos() ) ); if (e->button() == Qt::RightButton) { - if (KrSelectionMode::getSelectionHandler()->rightButtonSelects() || + if (KrSelectionMode::getSelectionHandler()->rightButtonSelects() || (((e->state() & ShiftButton) || (e->state() & ControlButton))) && KrSelectionMode::getSelectionHandler()->shiftCtrlRightButtonSelects()) { if (KrSelectionMode::getSelectionHandler()->rightButtonPreservesSelection() && !(e->state() & ShiftButton) @@ -594,7 +594,7 @@ void KrDetailedView::contentsMousePressEvent( TQMouseEvent * e ) { if (e->button() == Qt::LeftButton) { dragStartPos = e->pos(); - if (KrSelectionMode::getSelectionHandler()->leftButtonSelects() || + if (KrSelectionMode::getSelectionHandler()->leftButtonSelects() || (((e->state() & ShiftButton) || (e->state() & ControlButton))) && KrSelectionMode::getSelectionHandler()->shiftCtrlLeftButtonSelects()) { @@ -667,10 +667,10 @@ void KrDetailedView::contentsMousePressEvent( TQMouseEvent * e ) { callDefaultHandler = false; } } - + if (selectionChanged) updateView(); // don't call triggerUpdate directly! - + // TQListViewItem * i = itemAt( contentsToViewport( e->pos() ) ); if (callDefaultHandler) { @@ -745,8 +745,8 @@ void KrDetailedView::contentsMouseMoveEvent ( TQMouseEvent * e ) { if ( dragStartPos != TQPoint( -1, -1 ) && e->state() & Qt::LeftButton && ( dragStartPos - e->pos() ).manhattanLength() > TQApplication::startDragDistance() ) startDrag(); - if (KrSelectionMode::getSelectionHandler()->rightButtonPreservesSelection() - && KrSelectionMode::getSelectionHandler()->rightButtonSelects() + if (KrSelectionMode::getSelectionHandler()->rightButtonPreservesSelection() + && KrSelectionMode::getSelectionHandler()->rightButtonSelects() && KrSelectionMode::getSelectionHandler()->showContextMenu() >= 0 && e->state() == Qt::RightButton) { TQListViewItem *newItem = itemAt( contentsToViewport( e->pos() ) ); @@ -852,7 +852,7 @@ void KrDetailedView::contentsDragMoveEvent( TQDragMoveEvent * e ) { _currDragItem = getKrViewItemAt(contentsToViewport(e->pos())); if( _currDragItem && !_currDragItem->VF->vfile_isDir() ) _currDragItem = 0; - + TDEListView::contentsDragMoveEvent( e ); } @@ -1022,7 +1022,7 @@ void KrDetailedView::keyPressEvent( TQKeyEvent * e ) { TQString tmp = i->name(); op()->emitExecuted(tmp); // thereby emulating a chdir } else if( i->VF->vfile_getUrl().isLocalFile() ) { - bool encrypted; + bool encrypted; KURL url = i->VF->vfile_getUrl(); TQString mime = ((vfile *)(i->VF))->vfile_getMime(); TQString type = KRarcHandler::getType( encrypted, url.path(), mime, false ); @@ -1061,7 +1061,7 @@ void KrDetailedView::keyPressEvent( TQKeyEvent * e ) { #endif*/ case Key_Delete : // kill file SLOTS->deleteFiles( e->state() == ShiftButton || e->state() == ControlButton ); - + break ; case Key_Insert : { if (KrSelectionMode::getSelectionHandler()->insertMovesDown()) @@ -1071,7 +1071,7 @@ void KrDetailedView::keyPressEvent( TQKeyEvent * e ) { TQKeyEvent ev = TQKeyEvent( TQKeyEvent::KeyPress, Key_Space, 0, 0 ); TDEListView::keyPressEvent( & ev ); } - break ; + break ; } case Key_Space : { KrDetailedViewItem * viewItem = static_cast<KrDetailedViewItem *> ( getCurrentKrViewItem() ); @@ -1083,9 +1083,9 @@ void KrDetailedView::keyPressEvent( TQKeyEvent * e ) { } else TDEListView::keyPressEvent( e ); - break ; + break ; } - if ( viewItem->VF->vfile_isDir() && viewItem->VF->vfile_getSize() <= 0 && + if ( viewItem->VF->vfile_isDir() && viewItem->VF->vfile_getSize() <= 0 && KrSelectionMode::getSelectionHandler()->spaceCalculatesDiskSpace()) { // // NOTE: this is buggy incase somewhere down in the folder we're calculating, @@ -1130,7 +1130,7 @@ mark: if (KrSelectionMode::getSelectionHandler()->spaceMovesDown()) ( e->key() >= Key_0 && e->key() <= Key_9 ) || ( e->key() == Key_Backspace ) || ( e->key() == Key_Down ) || - ( e->key() == Key_Period ) ) */{ + ( e->key() == Key_Period ) ) */{ // are we doing quicksearch? if not, send keys to panel //if ( _config->readBoolEntry( "Do Quicksearch", _DoQuicksearch ) ) { // are we using krusader's classic quicksearch, or wincmd style? @@ -1192,7 +1192,7 @@ void KrDetailedView::renameCurrentItem() { TQString newName, fileName; // handle inplace renaming, if possible - + KrDetailedViewItem *it = static_cast<KrDetailedViewItem*>(getCurrentKrViewItem()); if ( it ) fileName = it->name(); @@ -1214,7 +1214,7 @@ void KrDetailedView::renameCurrentItem() { // if applicable, select only the name without extension TDEConfigGroupSaver svr(krConfig,"Look&Feel"); if (!krConfig->readBoolEntry("Rename Selects Extension", true)) { - if (it->hasExtension() && !it->VF->vfile_isDir() ) + if (it->hasExtension() && !it->VF->vfile_isDir() ) renameLineEdit()->setSelection(0, it->name().findRev(it->extension())-1); } // signal will be emited when renaming is done, and finalization @@ -1234,10 +1234,10 @@ void KrDetailedView::inplaceRenameFinished( TQListViewItem * it, int ) { krOut << "Major failure at inplaceRenameFinished(): item is null" << endl; return; } - + if( COLUMN( Extention ) != -1 && !currentlyRenamedItem ) return; /* does the event filter restored the original state? */ - + // check if the item was indeed renamed bool restoreView = false; if ( it->text( COLUMN( Name ) ) != static_cast<KrDetailedViewItem*>( it ) ->name() ) { // was renamed @@ -1249,7 +1249,7 @@ void KrDetailedView::inplaceRenameFinished( TQListViewItem * it, int ) { #if 0 if ( COLUMN( Extention ) != -1 && restoreView ) { // nothing happened, restore the view (if needed) #endif - + TQString ext, name = static_cast<KrDetailedViewItem*>( it ) ->name(); if ( !static_cast<KrDetailedViewItem*>( it ) ->VF->vfile_isDir() && COLUMN( Extention ) != -1 ) { ext = static_cast<KrDetailedViewItem*>( it ) ->extension(); @@ -1263,7 +1263,7 @@ void KrDetailedView::inplaceRenameFinished( TQListViewItem * it, int ) { #endif setFocus(); - + currentlyRenamedItem = 0; } @@ -1318,8 +1318,8 @@ void KrDetailedView::slotMouseClicked( int button, TQListViewItem * item, const void KrDetailedView::refreshColors() { krConfig->setGroup("Colors"); - bool kdeDefault = krConfig->readBoolEntry("KDE Default"); - bool alternateBackgroundEnabled = krConfig->readBoolEntry("Enable Alternate Background"); + bool kdeDefault = krConfig->readBoolEntry("KDE Default"); + bool alternateBackgroundEnabled = krConfig->readBoolEntry("Enable Alternate Background"); if ( !kdeDefault ) { // KDE default is not choosen: set the background color (as this paints the empty areas) and the alternate color bool isActive = hasFocus(); @@ -1364,7 +1364,7 @@ bool KrDetailedView::eventFilter( TQObject * watched, TQEvent * e ) for( TQListViewItem *it = firstChild(); it; it = it->nextSibling() ) if( it == currentlyRenamedItem ) { - if ( it->text( COLUMN( Name ) ) == dynamic_cast<KrDetailedViewItem*>( it ) ->name() && COLUMN( Extention ) != -1 ) + if ( it->text( COLUMN( Name ) ) == dynamic_cast<KrDetailedViewItem*>( it ) ->name() && COLUMN( Extention ) != -1 ) inplaceRenameFinished( it, COLUMN( Name ) ); break; } @@ -1385,7 +1385,7 @@ bool KrDetailedView::eventFilter( TQObject * watched, TQEvent * e ) void KrDetailedView::makeItemVisible( const KrViewItem *item ) { // tqApp->processEvents(); // Please don't remove the comment. Causes crash if it is inserted! - ensureItemVisible( static_cast<const KrDetailedViewItem*>( item ) ); + ensureItemVisible( static_cast<const KrDetailedViewItem*>( item ) ); } void KrDetailedView::initOperator() { @@ -1396,13 +1396,13 @@ void KrDetailedView::initOperator() { void KrDetailedView::initProperties() { _properties = new KrDetailedViewProperties; - TDEConfigGroupSaver grpSvr( _config, "Look&Feel" ); + TDEConfigGroupSaver grpSvr( _config, "Look&Feel" ); for (int i=0; i<KrDetailedViewProperties::MAX_COLUMNS;++i) - PROPS->column[i]=-1; + PROPS->column[i]=-1; PROPS->displayIcons = _config->readBoolEntry( "With Icons", _WithIcons ); bool dirsByNameAlways = _config->readBoolEntry("Always sort dirs by name", false); PROPS->sortMode = static_cast<KrViewProperties::SortSpec>( KrViewProperties::Name | - KrViewProperties::Descending | KrViewProperties::DirsFirst | + KrViewProperties::Descending | KrViewProperties::DirsFirst | (dirsByNameAlways ? KrViewProperties::AlwaysSortDirsByName : 0) ); PROPS->numericPermissions = _config->readBoolEntry("Numeric permissions", _NumericPermissions); if ( !_config->readBoolEntry( "Case Sensative Sort", _CaseSensativeSort ) ) @@ -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(); ) { @@ -1435,9 +1436,9 @@ void KrDetailedView::selectColumns() { TDEPopupMenu popup( this ); popup.insertTitle( i18n("Columns")); - + bool refresh = false; - + bool hasExtention = COLUMN( Extention ) != -1; bool hasMime = COLUMN( Mime ) != -1; bool hasSize = COLUMN( Size ) != -1; @@ -1446,7 +1447,7 @@ void KrDetailedView::selectColumns() bool hasKrPerms = COLUMN( KrPermissions ) != -1; bool hasOwner = COLUMN( Owner ) != -1; bool hasGroup = COLUMN( Group ) != -1; - + popup.insertItem( i18n( "Ext" ), COLUMN_POPUP_IDS + KrDetailedViewProperties::Extention ); popup.setItemChecked( COLUMN_POPUP_IDS + KrDetailedViewProperties::Extention, hasExtention ); @@ -1463,18 +1464,18 @@ void KrDetailedView::selectColumns() popup.setItemChecked( COLUMN_POPUP_IDS + KrDetailedViewProperties::Permissions, hasPerms ); popup.insertItem( i18n( "rwx" ), COLUMN_POPUP_IDS + KrDetailedViewProperties::KrPermissions ); - popup.setItemChecked( COLUMN_POPUP_IDS + KrDetailedViewProperties::KrPermissions, hasKrPerms ); + popup.setItemChecked( COLUMN_POPUP_IDS + KrDetailedViewProperties::KrPermissions, hasKrPerms ); popup.insertItem( i18n( "Owner" ), COLUMN_POPUP_IDS + KrDetailedViewProperties::Owner ); - popup.setItemChecked( COLUMN_POPUP_IDS + KrDetailedViewProperties::Owner, hasOwner ); + popup.setItemChecked( COLUMN_POPUP_IDS + KrDetailedViewProperties::Owner, hasOwner ); popup.insertItem( i18n( "Group" ), COLUMN_POPUP_IDS + KrDetailedViewProperties::Group ); - popup.setItemChecked( COLUMN_POPUP_IDS + KrDetailedViewProperties::Group, hasGroup ); - + popup.setItemChecked( COLUMN_POPUP_IDS + KrDetailedViewProperties::Group, hasGroup ); + int result=popup.exec(TQCursor::pos()); krConfig->setGroup( nameInTDEConfig() ); - + switch( result - COLUMN_POPUP_IDS ) { case KrDetailedViewProperties::Extention: @@ -1510,7 +1511,7 @@ void KrDetailedView::selectColumns() refresh = true; break; } - + if( refresh ) { PanelManager *p = ACTIVE_PANEL->view == this ? ACTIVE_MNG : OTHER_MNG; @@ -1523,7 +1524,7 @@ void KrDetailedView::sortOrderChanged(int) { } void KrDetailedView::updateView() { - triggerUpdate(); + triggerUpdate(); op()->emitSelectionChanged(); } @@ -1564,7 +1565,7 @@ void KrDetailedView::slotSortOrderChanged(int col) { sp = KrViewProperties::Group; break; default: tqFatal("slotSortOrderChanged: unknown column"); } - if (sortMode() & KrViewProperties::DirsFirst) + if (sortMode() & KrViewProperties::DirsFirst) sp = static_cast<KrViewProperties::SortSpec>(sp | KrViewProperties::DirsFirst); if (sortMode() & KrViewProperties::IgnoreCase) sp = static_cast<KrViewProperties::SortSpec>(sp | KrViewProperties::IgnoreCase); @@ -1574,12 +1575,12 @@ void KrDetailedView::slotSortOrderChanged(int col) { sp = static_cast<KrViewProperties::SortSpec>(sp | KrViewProperties::AlwaysSortDirsByName); // fix the ascending/decending stuff if (sortMode() == sp) { - if (sp & KrViewProperties::Descending) + if (sp & KrViewProperties::Descending) sp = static_cast<KrViewProperties::SortSpec>(sp &~ KrViewProperties::Descending); else sp = static_cast<KrViewProperties::SortSpec>(sp | KrViewProperties::Descending); } PROPS->sortMode = sp; - + if( !_focused ) op()->emitNeedFocus(); } diff --git a/krusader/Panel/krviewitem.cpp b/krusader/Panel/krviewitem.cpp index 42d4562..916ed91 100644 --- a/krusader/Panel/krviewitem.cpp +++ b/krusader/Panel/krviewitem.cpp @@ -8,13 +8,14 @@ #define PROPS static_cast<const KrViewProperties*>(_viewProperties) -TQString atomicExtensions[] = { - ".tar.gz", - ".tar.bz2", +TQString atomicExtensions[] = { + ".tar.gz", + ".tar.bz2", ".moc.cpp" + ".tar.xz", }; -KrViewItem::KrViewItem(vfile *vf, const KrViewProperties* properties): +KrViewItem::KrViewItem(vfile *vf, const KrViewProperties* properties): _vf(vf), dummyVfile(false), _viewProperties(properties), _hasExtension(false), _hidden(false), _extension("") { if (vf) { // check if the file has an extension @@ -32,7 +33,7 @@ KrViewItem::KrViewItem(vfile *vf, const KrViewProperties* properties): _extension = vfName.mid(loc+1); _hasExtension=true; } - + if( vfName.startsWith(".") ) _hidden = true; } @@ -50,16 +51,16 @@ TQString KrViewItem::description() const { TQString comment = KMimeType::mimeType(_vf->vfile_getMime())->comment(text, false); TQString myLinkDest = _vf->vfile_getSymDest(); TDEIO::filesize_t mySize = _vf->vfile_getSize(); - + TQString text2 = text.copy(); mode_t m_fileMode = _vf->vfile_getMode(); - + if (_vf->vfile_isSymLink() ){ TQString tmp; if ( comment.isEmpty() ) tmp = i18n ( "Symbolic Link" ) ; else if( _vf->vfile_getMime() == "Broken Link !" ) tmp = i18n("(broken link !)"); else tmp = i18n("%1 (Link)").arg(comment); - + text += "->"; text += myLinkDest; text += " "; @@ -89,13 +90,13 @@ TQString KrViewItem::dateTime() const { } TQPixmap KrViewItem::icon() { -#if 0 +#if 0 TQPixmap *p; // This is bad - very bad. the function must return a valid reference, // This is an interface flow - shie please fix it with a function that return TQPixmap* // this way we can return 0 - and do our error checking... - + // shie answers: why? what's the difference? if we return an empty pixmap, others can use it as it // is, without worrying or needing to do error checking. empty pixmap displays nothing #endif diff --git a/krusader/Panel/panelfunc.cpp b/krusader/Panel/panelfunc.cpp index 3448b56..e5053fe 100755 --- a/krusader/Panel/panelfunc.cpp +++ b/krusader/Panel/panelfunc.cpp @@ -5,10 +5,10 @@ copyright : (C) 2000 by Shie Erlich & Rafi Yanai e-mail : [email protected] web site : http://krusader.sourceforge.net --------------------------------------------------------------------------- -Description +Description *************************************************************************** -A +A db dD d8888b. db db .d8888. .d8b. d8888b. d88888b d8888b. 88 ,8P' 88 `8D 88 88 88' YP d8' `8b 88 `8D 88' 88 `8D @@ -27,12 +27,12 @@ A * (at your option) any later version. * * * ***************************************************************************/ -#include <unistd.h> +#include <unistd.h> // TQt Includes #include <tqdir.h> #include <tqtextstream.h> #include <tqeventloop.h> -#include <tqclipboard.h> +#include <tqclipboard.h> // KDE Includes #include <tdelocale.h> #include <kprocess.h> @@ -48,7 +48,7 @@ A #include <kdebug.h> #include <tdeio/netaccess.h> #include <kstandarddirs.h> -#include <ktempdir.h> +#include <ktempdir.h> #include <kurlrequester.h> #include <kprocio.h> #include <kdesktopfile.h> @@ -91,7 +91,7 @@ panel( parent ), inRefresh( false ), vfsP( 0 ) { } void ListPanelFunc::openUrl( const TQString& url, const TQString& nameToMakeCurrent ) { - openUrl( vfs::fromPathOrURL( + openUrl( vfs::fromPathOrURL( // KURLRequester is buggy: it should return a string containing "/home/shie/downloads" // but it returns "~/downloads" which is parsed incorrectly by vfs::fromPathOrURL. // replacedPath should replace ONLY $HOME and environment variables @@ -121,7 +121,7 @@ void ListPanelFunc::immediateOpenUrl( const KURL& urlIn ) { // if we are not refreshing to current URL bool is_equal_url = files() ->vfs_getOrigin().equals( url, true ); - + if ( !is_equal_url ) { // change the cursor to busy panel->setCursor( KCursor::waitCursor() ); @@ -135,7 +135,7 @@ void ListPanelFunc::immediateOpenUrl( const KURL& urlIn ) { if ( is_equal_url ) { panel->view->setCurrentItem( nameToMakeCurrent ); panel->view->makeItemVisible( panel->view->getCurrentKrViewItem() ); - } + } } vfs* v = 0; @@ -152,11 +152,11 @@ void ListPanelFunc::immediateOpenUrl( const KURL& urlIn ) { if ( !v ) continue; //this should not happen ! if ( v != vfsP ) { - if( vfsP->vfs_canDelete() ) + if( vfsP->vfs_canDelete() ) delete vfsP; else { connect( vfsP, TQT_SIGNAL( deleteAllowed() ), vfsP, TQT_SLOT( deleteLater() ) ); - vfsP->vfs_requestDelete(); + vfsP->vfs_requestDelete(); } vfsP = v; // v != 0 so this is safe } else { @@ -173,10 +173,10 @@ void ListPanelFunc::immediateOpenUrl( const KURL& urlIn ) { break; // we have a valid refreshed URL now } if ( vfsP == 0 ) // the object was deleted during vfs_refresh? Hoping the best... - return; + return; // prevent repeated error messages if ( vfsP->vfs_isDeleting() ) - break; + break; vfsP->vfs_setQuiet( true ); } vfsP->vfs_setQuiet( false ); @@ -204,12 +204,12 @@ void ListPanelFunc::immediateOpenUrl( const KURL& urlIn ) { panel, TQT_SLOT( slotItemDeleted( const TQString& ) ) ); connect( files(), TQT_SIGNAL( cleared() ), panel, TQT_SLOT( slotCleared() ) ); - + // on local file system change the working directory if ( files() ->vfs_getType() == vfs::NORMAL ) chdir( files() ->vfs_getOrigin().path().local8Bit() ); - - // see if the open url operation failed, and if so, + + // see if the open url operation failed, and if so, // put the attempted url in the origin bar and let the user change it if (refreshFailed) { panel->origin->setURL(urlIn.prettyURL()); @@ -529,25 +529,25 @@ void ListPanelFunc::mkdir() { KURL ListPanelFunc::getVirtualBaseURL() { if( files()->vfs_getType() != vfs::VIRT || otherFunc()->files()->vfs_getType() == vfs::VIRT ) return KURL(); - + TQStringList fileNames; panel->getSelectedNames( &fileNames ); - + KURL::List* fileUrls = files() ->vfs_getFiles( &fileNames ); if( fileUrls->count() == 0 ) return KURL(); - + KURL base = (*fileUrls)[ 0 ].upURL(); - + if( base.protocol() == "virt" ) // is it a virtual subfolder? return KURL(); // --> cannot keep the directory structure - + for( unsigned i=1; i < fileUrls->count(); i++ ) { if( base.isParentOf( (*fileUrls)[ i ] ) ) continue; if( base.protocol() != (*fileUrls)[ i ].protocol() ) return KURL(); - + do { KURL oldBase = base; base = base.upURL(); @@ -721,15 +721,13 @@ void ListPanelFunc::execute( TQString& name ) { dirUp(); return ; } - vfile *vf = files() ->vfs_search( name ); if ( vf == 0 ) return ; - + 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 ); @@ -748,7 +746,7 @@ void ListPanelFunc::execute( TQString& name ) { } else { KURL url = files() ->vfs_getFile( name ); KFileItem kfi( vf->vfile_getEntry(), url,true ); - kfi.run(); + kfi.run(); } } @@ -776,15 +774,15 @@ void ListPanelFunc::pack() { if ( PackGUI::type == TQString() ) return ; // the user canceled - // check for partial URLs + // check for partial URLs if( !PackGUI::destination.contains(":/") && !PackGUI::destination.startsWith("/") ){ PackGUI::destination = panel->virtualPath().prettyURL()+"/"+PackGUI::destination; } - + TQString destDir = PackGUI::destination; if( !destDir.endsWith( "/" ) ) destDir += "/"; - + bool packToOtherPanel = ( destDir == panel->otherPanel->virtualPath().prettyURL(1) ); // on remote URL-s first pack into a temp file then copy to its right place @@ -795,8 +793,8 @@ void ListPanelFunc::pack() { arcFile = destURL.path(); else if( destURL.protocol() == "virt" ) { KMessageBox::error( krApp, i18n( "Cannot pack files onto a virtual destination!" ) ); - return; - } + return; + } else { tempDestFile = new KTempFile( TQString(), "." + PackGUI::type ); tempDestFile->setAutoDelete( true ); @@ -884,15 +882,15 @@ void ListPanelFunc::testArchive() { TQString mime = files() ->vfs_search( arcName ) ->vfile_getMime(); bool encrypted = false; TQString type = KRarcHandler::getType( encrypted, url, mime ); - + // check we that archive is supported if ( !KRarcHandler::arcSupported( type ) ) { KMessageBox::sorry( krApp, i18n( "%1, unknown archive type." ).arg( arcName ) ); return ; } - + TQString password = encrypted ? KRarcHandler::getPassword( url ) : TQString(); - + // test the archive if ( KRarcHandler::test( url, type, password ) ) KMessageBox::information( krApp, i18n( "%1, test passed." ).arg( arcName ) ); @@ -964,9 +962,9 @@ void ListPanelFunc::unpack() { KMessageBox::sorry( krApp, i18n( "%1, unknown archive type" ).arg( arcName ) ); continue; } - + TQString password = encrypted ? KRarcHandler::getPassword( url ) : TQString(); - + // unpack the files KRarcHandler::unpack( url, type, password, dest.path( -1 ) ); @@ -1020,7 +1018,7 @@ void ListPanelFunc::matchChecksum() { TQValueList<vfile*> checksumFiles = files()->vfs_search( KRQuery(MatchChecksumDlg::checksumTypesFilter) ); - MatchChecksumDlg dlg(args, folders, panel->realPath(), + MatchChecksumDlg dlg(args, folders, panel->realPath(), (checksumFiles.size()==1 ? checksumFiles[0]->vfile_getUrl().prettyURL() : TQString())); } @@ -1149,7 +1147,7 @@ void ListPanelFunc::copyToClipboard( bool move ) { KMessageBox::error( krApp, i18n( "Cannot copy a virtual URL collection onto the clipboard!" ) ); return; } - + TQStringList fileNames; panel->getSelectedNames( &fileNames ); @@ -1160,10 +1158,10 @@ void ListPanelFunc::copyToClipboard( bool move ) { if ( fileUrls ) { KRDrag * urlData = KRDrag::newDrag( *fileUrls, move, krApp->mainView, "krusader" ); TQApplication::clipboard() ->setData( urlData ); - + if( move && files()->vfs_getType() == vfs::VIRT ) ( static_cast<virt_vfs*>( files() ) )->vfs_removeFiles( &fileNames ); - + delete fileUrls; } } diff --git a/krusader/VFS/krarchandler.cpp b/krusader/VFS/krarchandler.cpp index 5431a0c..51a0b79 100644 --- a/krusader/VFS/krarchandler.cpp +++ b/krusader/VFS/krarchandler.cpp @@ -26,15 +26,15 @@ * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * -***************************************************************************/ +***************************************************************************/ // QT includes -#include <tqtextstream.h> +#include <tqtextstream.h> // KDE includes #include <kprocess.h> #include <tdetempfile.h> #include <tdelocale.h> #include <tdemessagebox.h> -#include <tdeio/passdlg.h> +#include <tdeio/passdlg.h> #include <tqfile.h> #include <kstandarddirs.h> #include <ktar.h> @@ -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,8 +179,9 @@ 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() ) { if ( type == "-arj" ) lister += " -g'" + password + "'"; @@ -198,11 +207,11 @@ long KRarcHandler::arcFileCount( TQString archive, TQString type, TQString passw list.kill(); } ; // busy wait - need to find something better... - + krApp->stopWait(); - + if( !list.normalExit() || !checkStatus( type, list.exitStatus() ) ) { - KMessageBox::detailedError (krApp, i18n( "Failed to list the content of the archive (%1)!" ).arg( archive ), + KMessageBox::detailedError (krApp, i18n( "Failed to list the content of the archive (%1)!" ).arg( archive ), list.getErrorMsg(), i18n("Error" ) ); return 0; } @@ -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()); @@ -259,11 +270,11 @@ bool KRarcHandler::unpack( TQString archive, TQString type, TQString password, T cpio << KrServices::fullPathName( "rpm2cpio" ) << " " + KrServices::quote( archive ) << " > " << cpioName; cpio.start(TDEProcess::Block, TDEProcess::AllOutput ); if( !cpio.normalExit() || !checkStatus( "cpio", cpio.exitStatus() ) ) { - KMessageBox::detailedError (krApp, i18n( "Failed to convert rpm (%1) to cpio!" ).arg( archive ), + KMessageBox::detailedError (krApp, i18n( "Failed to convert rpm (%1) to cpio!" ).arg( archive ), cpio.getErrorMsg(), i18n("Error" ) ); return 0; } - + archive = cpioName; packer = KrServices::fullPathName( "cpio" ) + " --force-local --no-absolute-filenames -iuvdF"; } @@ -276,18 +287,18 @@ bool KRarcHandler::unpack( TQString archive, TQString type, TQString password, T dpkg << KrServices::fullPathName( "dpkg" ) << " --fsys-tarfile " + KrServices::quote( archive ) << " > " << cpioName; dpkg.start(TDEProcess::Block, TDEProcess::AllOutput ); if( !dpkg.normalExit() || !checkStatus( "-deb", dpkg.exitStatus() ) ) { - KMessageBox::detailedError (krApp, i18n( "Failed to convert deb (%1) to tar!" ).arg( archive ), + KMessageBox::detailedError (krApp, i18n( "Failed to convert deb (%1) to tar!" ).arg( archive ), dpkg.getErrorMsg(), i18n("Error" ) ); return 0; } - + archive = cpioName; packer = KrServices::fullPathName( "tar" ) + " xvf "; } else return false; if ( !password.isNull() ) { - if ( type == "-zip" ) + if ( type == "-zip" ) packer += " -P '" + password + "'"; if ( type == "-arj" ) packer += " -g'" + password + "'"; @@ -305,7 +316,7 @@ bool KRarcHandler::unpack( TQString archive, TQString type, TQString password, T } if( type == "-ace" && TQFile( "/dev/ptmx" ).exists() ) // Don't remove, unace crashes if missing!!! proc << "<" << "/dev/ptmx"; - + TQString save = getcwd( 0, 0 ); chdir( dest.local8Bit() ); @@ -333,11 +344,11 @@ bool KRarcHandler::unpack( TQString archive, TQString type, TQString password, T if( !cpioName.isEmpty() ) TQFile( cpioName ).remove(); /* remove the cpio file */ - + // check the return value if ( !proc.normalExit() || !checkStatus( type, proc.exitStatus() ) ) { - KMessageBox::detailedError (krApp, i18n( "Failed to unpack %1!" ).arg( archive ), - krApp->wasWaitingCancelled() ? i18n( "User cancelled." ) : + KMessageBox::detailedError (krApp, i18n( "Failed to unpack %1!" ).arg( archive ), + krApp->wasWaitingCancelled() ? i18n( "User cancelled." ) : proc.getErrorMsg(), i18n("Error" ) ); return false; } @@ -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,10 +374,11 @@ 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() ) { - if ( type == "-zip" ) + if ( type == "-zip" ) packer += " -P '" + password + "'"; if ( type == "-arj" ) packer += " -g'" + password + "'"; @@ -379,7 +392,7 @@ bool KRarcHandler::test( TQString archive, TQString type, TQString password, lon if( type == "-ace" && TQFile( "/dev/ptmx" ).exists() ) // Don't remove, unace crashes if missing!!! proc << "<" << "/dev/ptmx"; - + // tell the user to wait krApp->startWaiting( i18n( "Testing Archive" ), count, true ); if ( count != 0 ) connect( &proc, TQT_SIGNAL( receivedStdout( TDEProcess*, char*, int ) ), @@ -407,23 +420,25 @@ bool KRarcHandler::pack( TQStringList fileNames, TQString type, TQString dest, l // set the right packer to do the job TQString packer; - if ( type == "zip" ) { packer = KrServices::fullPathName( "zip" ) + " -ry"; type = "-zip"; } - 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 == "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"; } + if ( type == "zip" ) { packer = KrServices::fullPathName( "zip" ) + " -ry"; type = "-zip"; } + 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(); - + if( extraProps.count( "Password" ) > 0 ) { password = extraProps[ "Password" ]; if ( !password.isNull() ) { - if ( type == "-zip" ) + if ( type == "-zip" ) packer += " -P '" + password + "'"; else if ( type == "-arj" ) packer += " -g'" + password + "'"; @@ -473,11 +488,15 @@ 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 ) packer += TQString( " %1" ).arg( extraProps[ "CommandLineSwitches" ] ); - + // prepare to pack KrShellProcess proc; proc << packer << KrServices::quote( dest ); @@ -505,8 +524,8 @@ bool KRarcHandler::pack( TQStringList fileNames, TQString type, TQString dest, l // check the return value if ( !proc.normalExit() || !checkStatus( type, proc.exitStatus() ) ) { - KMessageBox::detailedError (krApp, i18n( "Failed to pack %1!" ).arg( dest ), - krApp->wasWaitingCancelled() ? i18n( "User cancelled." ) : proc.getErrorMsg(), + KMessageBox::detailedError (krApp, i18n( "Failed to pack %1!" ).arg( dest ), + krApp->wasWaitingCancelled() ? i18n( "User cancelled." ) : proc.getErrorMsg(), i18n("Error" ) ); return false; } @@ -522,9 +541,9 @@ bool KRarcHandler::pack( TQStringList fileNames, TQString type, TQString dest, l TQString KRarcHandler::getPassword( TQString path ) { TQString password; - + TQString key = "krarc-" + path; - + if( !TDEWallet::Wallet::keyDoesNotExist(TDEWallet::Wallet::NetworkWallet(), TDEWallet::Wallet::PasswordFolder(), key ) ) { if( !TDEWallet::Wallet::isOpen( TDEWallet::Wallet::NetworkWallet() ) && wallet != 0 ) { delete wallet; @@ -542,7 +561,7 @@ TQString KRarcHandler::getPassword( TQString path ) { } } } - + bool keep = true; TQString user = "archive"; TDEIO::PasswordDialog passDlg( i18n("This archive is encrypted, please supply the password:"), @@ -572,7 +591,7 @@ TQString KRarcHandler::getPassword( TQString path ) { } return password; } - + return ""; } @@ -580,7 +599,7 @@ bool KRarcHandler::isArchive(const KURL& url) { TQString protocol = url.protocol(); if (arcProtocols.find(protocol) != arcProtocols.end()) return true; - else return false; + else return false; } TQString KRarcHandler::getType( bool &encrypted, TQString fileName, TQString mime, bool checkEncrypted ) { @@ -589,10 +608,16 @@ TQString KRarcHandler::getType( bool &encrypted, TQString fileName, TQString mim result = mime; 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; @@ -623,27 +648,28 @@ TQString KRarcHandler::detectArchive( bool &encrypted, TQString fileName, bool c {"rpm", 0, "\xed\xab\xee\xdb"}, {"ace", 7, "**ACE**" }, {"bzip2",0, "\x42\x5a\x68\x39\x31" }, - {"gzip", 0, "\x1f\x8b"}, + {"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; - + TQFile arcFile( fileName ); if ( arcFile.open( IO_ReadOnly ) ) { char buffer[ 1024 ]; long sizeMax = arcFile.readBlock( buffer, sizeof( buffer ) ); arcFile.close(); - + for( int i=0; i < autoDetectElems; i++ ) { TQString detectionString = autoDetectParams[ i ].detectionString; int location = autoDetectParams[ i ].location; - + int endPtr = detectionString.length() + location; if( endPtr > sizeMax ) continue; - + unsigned int j=0; for(; j != detectionString.length(); j++ ) { if( detectionString[ j ] == '?' ) @@ -651,7 +677,7 @@ TQString KRarcHandler::detectArchive( bool &encrypted, TQString fileName, bool c if( buffer[ location + j ] != detectionString[ j ] ) break; } - + if( j == detectionString.length() ) { TQString type = autoDetectParams[ i ].type; if( type == "bzip2" || type == "gzip" ) { @@ -686,7 +712,7 @@ TQString KRarcHandler::detectArchive( bool &encrypted, TQString fileName, bool c long headerSize = ((unsigned char *)buffer)[ offset+5 ] + 256*((unsigned char *)buffer)[ offset+6 ]; bool isDir = (buffer[ offset+7 ] == '\0' ) && (buffer[ offset+8 ] == '\0' ) && (buffer[ offset+9 ] == '\0' ) && (buffer[ offset+10 ] == '\0' ); - + if( buffer[ offset + 2 ] != (char)0x74 ) break; if( !isDir ) { @@ -706,7 +732,7 @@ TQString KRarcHandler::detectArchive( bool &encrypted, TQString fileName, bool c long headerSize = ((unsigned char *)buffer)[ offset+2 ] + 256*((unsigned char *)buffer)[ offset+3 ] + 4; bool isDir = (buffer[ offset+11 ] == '\0' ) && (buffer[ offset+12 ] == '\0' ) && (buffer[ offset+13 ] == '\0' ) && (buffer[ offset+14 ] == '\0' ); - + if( buffer[ offset + 4 ] != (char)0x01 ) break; if( !isDir ) { @@ -729,7 +755,7 @@ TQString KRarcHandler::detectArchive( bool &encrypted, TQString fileName, bool c return type; } } - + if( sizeMax >= 512 ) { /* checking if it's a tar file */ unsigned checksum = 32*8; @@ -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(); } diff --git a/krusader/defaults.h b/krusader/defaults.h index 82cf1db..309449b 100644 --- a/krusader/defaults.h +++ b/krusader/defaults.h @@ -33,19 +33,19 @@ /////////////////////// [Startup] // UI Save Settings -#define _UiSave false +#define _UiSave false // Show Cmd Line -#define _ShowCmdline true +#define _ShowCmdline true // Show status bar -#define _ShowStatusBar true +#define _ShowStatusBar true // Show tool bar -#define _ShowToolBar true +#define _ShowToolBar true // Show FN Keys -#define _ShowFNkeys true +#define _ShowFNkeys true // Show Terminal Emulator -#define _ShowTerminalEmulator false +#define _ShowTerminalEmulator false // Remember Position -#define _RememberPos true +#define _RememberPos true // Start to tray #define _StartToTray false // Left Tab Bar @@ -60,21 +60,21 @@ // Filelist Font /////// #define _FilelistFont new TQFont(TDEGlobalSettings::generalFont()) // Warn On Exit //////// -#define _WarnOnExit false +#define _WarnOnExit false // Minimize To Tray //// -#define _MinimizeToTray false +#define _MinimizeToTray false // Mark Dirs /////////// -#define _MarkDirs false +#define _MarkDirs false // Show Hidden ///////// -#define _ShowHidden true +#define _ShowHidden true // Sort By Extention /// -#define _SortByExt false +#define _SortByExt false // Case Sensative Sort / -#define _CaseSensativeSort false +#define _CaseSensativeSort false // Html Min Font Size // -#define _HtmlMinFontSize 12 +#define _HtmlMinFontSize 12 // Filelist Icon Size // -#define _FilelistIconSize TQString("22") +#define _FilelistIconSize TQString("22") // Mouse Selection ///// #define _MouseSelection 0 // 0 - normal (shift+click, ctrl+click), 1 - left click, 2 - right click // Use fullpath tab names ///// @@ -82,23 +82,23 @@ // Panel Toolbar Checkboxes // Panel Toolbar Visible checkbox turned off -#define _PanelToolBar true +#define _PanelToolBar true // cd / is turned on -#define _cdRoot true +#define _cdRoot true // cd ~ is turned on -#define _cdHome false +#define _cdHome false // cd .. is turned on -#define _cdUp true +#define _cdUp true // cd other panel is turned on -#define _cdOther false +#define _cdOther false // Open directory is turned on -#define _Open false +#define _Open false // syncBrowseButton is turned on -#define _syncBrowseButton false +#define _syncBrowseButton false // Clear Location Bar Visible #define _ClearLocation true // Use the default colors of KDE -#define _KDEDefaultColors true +#define _KDEDefaultColors true // Enable Alternate Background colors #define _AlternateBackground true // Show current item even if not focussed @@ -124,19 +124,19 @@ /////////////////////// [General] // Mimetype Magic ///// -#define _MimetypeMagic true +#define _MimetypeMagic true // Move To Trash ////// -#define _MoveToTrash false +#define _MoveToTrash false // Terminal /////////// #define _Terminal "konsole" // Send CDs /////////// #define _SendCDs true // Editor ///////////// -#define _Editor "internal editor" +#define _Editor "internal editor" // Temp Directory ///// -#define _TempDirectory "/tmp/krusader.tmp" +#define _TempDirectory "/tmp/krusader.tmp" // Classic Quicksearch -#define _NewStyleQuicksearch true +#define _NewStyleQuicksearch true // Case Sensitive quick search, if _NewStyleQuicksearch is true #define _CaseSensitiveQuicksearch false // View In Separate Window @@ -146,57 +146,59 @@ // Permission Check /// //#define _PermCheck true // AutoMount ////////// -#define _AutoMount false +#define _AutoMount false // Preserving date ////////// #define _PreserveAttributes false // Nonmount Points //// #define _NonMountPoints "/, " // Confirm Unempty Dir // (for delete) -#define _ConfirmUnemptyDir true +#define _ConfirmUnemptyDir true // Confirm Delete ///// (for deleting files) -#define _ConfirmDelete true +#define _ConfirmDelete true // Confirm Copy /////// (for copying files) -#define _ConfirmCopy true +#define _ConfirmCopy true // Confirm Move /////// (for moving files) -#define _ConfirmMove true +#define _ConfirmMove true // Icon Cache Size //// #define _IconCacheSize 2048 /////////////////////// [Archives] // Do Tar ///////////// -#define _DoTar true +#define _DoTar true // Do GZip //////////// -#define _DoGZip true +#define _DoGZip true // Do Zip ///////////// -#define _DoZip true +#define _DoZip true // Do UnZip /////////// -#define _DoUnZip true +#define _DoUnZip true // Do BZip2 /////////// -#define _DoBZip2 true +#define _DoBZip2 true // Do Rar ///////////// -#define _DoRar true +#define _DoRar true // Do UnRar /////////// -#define _DoUnRar true +#define _DoUnRar true // Do UnAce /////////// -#define _DoUnAce true +#define _DoUnAce true // Do Arj ///////////// -#define _DoArj true +#define _DoArj true // Do UnArj /////////// -#define _DoUnarj true +#define _DoUnarj true // Do RPM ///////////// -#define _DoRPM true +#define _DoRPM true // Do DEB ///////////// ====> new #define _DoDEB true // Do Lha ///////////// -#define _DoLha true -// Do 7z ///////////// ====> new +#define _DoLha true +// Do 7z ////////////// ====> new #define _Do7z true +// Do Xz ////////////// +#define _DoXz true // Allow Move Into Archive // -#define _MoveIntoArchive false +#define _MoveIntoArchive false // Test Archives ////// -#define _TestArchives false +#define _TestArchives false // Test Before Unpack //// -#define _TestBeforeUnpack true +#define _TestBeforeUnpack true // Supported Packers // ====> a TQStringList of SYSTEM supported archives ( also new ) /////////////////////// [UserActions] @@ -211,13 +213,13 @@ /////////////////////// [Private] // Start Position ///// -#define _StartPosition new TQPoint(TQApplication::desktop()->width()/2 - mainView->sizeHint().width()/2,TQApplication::desktop()->height()/2 - 250) +#define _StartPosition new TQPoint(TQApplication::desktop()->width()/2 - mainView->sizeHint().width()/2,TQApplication::desktop()->height()/2 - 250) // Start Size ///////// -#define _StartSize new TQSize(mainView->sizeHint().width(),500) +#define _StartSize new TQSize(mainView->sizeHint().width(),500) // Panel Size ///////// -#define _PanelSize 0 +#define _PanelSize 0 // Terminal Size ////// -#define _TerminalSize 0 +#define _TerminalSize 0 // Left Name Size - size of the left panel's name column // Left Size Size - size of the left panel's size column // Left Date Size - size of the left panel's date column @@ -251,33 +253,33 @@ /////////////////////// [Synchronize directories] // Don't overwrite automatically ///////////// -#define _ConfirmOverWrites false +#define _ConfirmOverWrites false // Recursive search in the subdirectories ///////////// -#define _RecurseSubdirs true +#define _RecurseSubdirs true // The searcher follows symlinks ///////////// -#define _FollowSymlinks false +#define _FollowSymlinks false // Files with similar size are compared by content ///////////// -#define _CompareByContent false +#define _CompareByContent false // The date information is ignored at synchronization ///////////// -#define _IgnoreDate false +#define _IgnoreDate false // Asymmetric Client-File Server compare mode ///////////// -#define _Asymmetric false +#define _Asymmetric false // Case insensitive compare in synchronizer ///////////// -#define _IgnoreCase false +#define _IgnoreCase false // Scrolls the results of the synchronization ///////////// -#define _ScrollResults false +#define _ScrollResults false // The right arrow button is turned on ///////////// -#define _BtnLeftToRight true +#define _BtnLeftToRight true // The equals button is turned on ///////////// -#define _BtnEquals true +#define _BtnEquals true // The not equals button is turned on ///////////// -#define _BtnDifferents true +#define _BtnDifferents true // The left arrow button is turned on ///////////// -#define _BtnRightToLeft true +#define _BtnRightToLeft true // The trash button is turned on ///////////// -#define _BtnDeletable true +#define _BtnDeletable true // The duplicates button is turned on ///////////// -#define _BtnDuplicates true +#define _BtnDuplicates true // The singles button is turned on ///////////// #define _BtnSingles true diff --git a/krusader/krusader.cpp b/krusader/krusader.cpp index 2545aa5..560426a 100644 --- a/krusader/krusader.cpp +++ b/krusader/krusader.cpp @@ -5,10 +5,10 @@ copyright : (C) 2000 by Shie Erlich & Rafi Yanai e-mail : [email protected] web site : http://krusader.sourceforge.net --------------------------------------------------------------------------- -Description +Description *************************************************************************** -A +A db dD d8888b. db db .d8888. .d8b. d8888b. d88888b d8888b. 88 ,8P' 88 `8D 88 88 88' YP d8' `8b 88 `8D 88' 88 `8D @@ -28,7 +28,7 @@ YP YD 88 YD ~Y8888P' `8888Y' YP YP Y8888D' Y88888P 88 YD * * ***************************************************************************/ #include <sys/types.h> -#include <sys/stat.h> +#include <sys/stat.h> #include <sys/param.h> #include <unistd.h> #ifdef BSD @@ -51,7 +51,7 @@ YP YD 88 YD ~Y8888P' `8888Y' YP YP Y8888D' Y88888P 88 YD #include <tdeactionclasses.h> #endif -#include <tdeversion.h> +#include <tdeversion.h> // QT includes #include <tqpixmap.h> #include <tqstringlist.h> @@ -59,7 +59,7 @@ YP YD 88 YD ~Y8888P' `8888Y' YP YP Y8888D' Y88888P 88 YD #include <tqprinter.h> #include <tqprogressdialog.h> #include <tqvaluelist.h> -#include <tqwhatsthis.h> +#include <tqwhatsthis.h> #include <tqwidgetlist.h> #include <tqdatetime.h> #include <dcopclient.h> @@ -181,7 +181,7 @@ TDERadioAction *Krusader::actSelectSingle = 0; TDERadioAction *Krusader::actSelectNewer = 0; TDERadioAction *Krusader::actSelectDifferentAndSingle = 0; TDERadioAction *Krusader::actSelectDifferent = 0; -TDERadioAction **Krusader::compareArray[] = {&actSelectNewerAndSingle, &actSelectNewer, &actSelectSingle, +TDERadioAction **Krusader::compareArray[] = {&actSelectNewerAndSingle, &actSelectNewer, &actSelectSingle, &actSelectDifferentAndSingle, &actSelectDifferent, 0}; TDERadioAction *Krusader::actExecStartAndForget = 0; TDERadioAction *Krusader::actExecCollectSeparate = 0; @@ -278,7 +278,7 @@ Krusader::Krusader() : KParts::MainWindow(0,0,WType_TopLevel|WDestructiveClose|T int rightActiveTab = krConfig->readNumEntry( "Right Active Tab", 0 ); TQString startProfile = krConfig->readEntry("Starter Profile Name", TQString() ); bool leftActive = krConfig->readBoolEntry( "Left Side Is Active", false ); - + // get command-line arguments if ( args->isSet( "left" ) ) { leftTabs = TQStringList::split( ',', args->getOption( "left" ) ); @@ -329,8 +329,8 @@ Krusader::Krusader() : KParts::MainWindow(0,0,WType_TopLevel|WDestructiveClose|T leftTabs.clear(); leftTabTypes.clear(); leftTabProps.clear(); - rightTabs.clear(); - rightTabTypes.clear(); + rightTabs.clear(); + rightTabTypes.clear(); rightTabProps.clear(); leftActiveTab = rightActiveTab = 0; } @@ -349,7 +349,7 @@ Krusader::Krusader() : KParts::MainWindow(0,0,WType_TopLevel|WDestructiveClose|T } // starting the panels - mainView->start( leftTabs, leftTabTypes, leftTabProps, leftActiveTab, rightTabs, + mainView->start( leftTabs, leftTabTypes, leftTabProps, leftActiveTab, rightTabs, rightTabTypes, rightTabProps, rightActiveTab, leftActive ); // create the user menu @@ -397,7 +397,7 @@ Krusader::Krusader() : KParts::MainWindow(0,0,WType_TopLevel|WDestructiveClose|T if ( runKonfig ) slot->runKonfigurator( true ); - + if (!runKonfig) { config->setGroup( "Private" ); if ( krConfig->readBoolEntry( "Maximized" ) ) @@ -407,7 +407,7 @@ Krusader::Krusader() : KParts::MainWindow(0,0,WType_TopLevel|WDestructiveClose|T resize( oldSize = krConfig->readSizeEntry( "Start Size", _StartSize )); } } - + if( startToTray ) { sysTray->show(); hide(); @@ -436,7 +436,7 @@ bool Krusader::versionControl() { config = kapp->config(); bool firstRun = config->readBoolEntry(FIRST_RUN, true); -#if 0 +#if 0 TQString oldVerText = config->readEntry( "Version", "10.0" ); oldVerText.truncate( oldVerText.findRev( "." ) ); // remove the third dot float oldVer = oldVerText.toFloat(); @@ -459,13 +459,28 @@ 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; } void Krusader::statusBarUpdate( TQString& mess ) { // change the message on the statusbar for 2 seconds - if (status) // ugly!!!! But as statusBar() creates a status bar if there is no, I have to ask status to prevent + if (status) // ugly!!!! But as statusBar() creates a status bar if there is no, I have to ask status to prevent // the creation of the TDE default status bar instead of KrusaderStatus. statusBar() ->message( mess, 5000 ); } @@ -476,7 +491,7 @@ void Krusader::showEvent ( TQShowEvent * ) { config->setGroup( "Look&Feel" ); bool showTrayIcon = krConfig->readBoolEntry( "Minimize To Tray", _MinimizeToTray ); bool singleInstanceMode = krConfig->readBoolEntry( "Single Instance Mode", _SingleInstanceMode ); - + if( showTrayIcon && !singleInstanceMode ) sysTray->hide(); show(); // needed to make sure krusader is removed from @@ -706,7 +721,7 @@ void Krusader::setupActions() { actRoot = new TDEAction( i18n( "Root" ), "go-top", CTRL + Key_Backspace, SLOTS, TQT_SLOT( root() ), actionCollection(), "root" ); actSavePosition = new TDEAction( i18n( "Save &Position" ), 0, - TQT_TQOBJECT(krApp), TQT_SLOT( savePosition() ), actionCollection(), "save position" ); + TQT_TQOBJECT(krApp), TQT_SLOT( savePosition() ), actionCollection(), "save position" ); actAllFilter = new TDEAction( i18n( "&All Files" ), SHIFT + Key_F10, SLOTS, TQT_SLOT( allFilter() ), actionCollection(), "all files" ); //actExecFilter = new TDEAction( i18n( "&Executables" ), SHIFT + Key_F11, @@ -745,7 +760,7 @@ void Krusader::setupActions() { SLOTS, TQT_SLOT( newSymlink() ), actionCollection(), "new symlink"); new TDEToggleAction( i18n( "Toggle Popup Panel" ), ALT + Key_Down, SLOTS, TQT_SLOT( togglePopupPanel() ), actionCollection(), "toggle popup panel" ); - actVerticalMode = new TDEToggleAction( i18n( "Vertical Mode" ), "view_top_bottom", ALT + CTRL + Key_R, TQT_TQOBJECT(MAIN_VIEW), + actVerticalMode = new TDEToggleAction( i18n( "Vertical Mode" ), "view_top_bottom", ALT + CTRL + Key_R, TQT_TQOBJECT(MAIN_VIEW), TQT_SLOT( toggleVerticalMode() ), actionCollection(), "toggle vertical mode" ); actNewTab = new TDEAction( i18n( "New Tab" ), "tab_new", ALT + CTRL + Key_N, SLOTS, TQT_SLOT( newTab() ), actionCollection(), "new tab" ); @@ -833,11 +848,11 @@ void Krusader::savePosition() { mainView->right->popup->saveSizes(); if( !MAIN_VIEW->getTerminalEmulatorSplitterSizes().isEmpty() ) config->writeEntry( "Terminal Emulator Splitter Sizes", MAIN_VIEW->getTerminalEmulatorSplitterSizes() ); - + // save view settings ---> fix when we have tabbed-browsing mainView->left->view->saveSettings(); mainView->right->view->saveSettings(); - + config->setGroup( "Startup" ); config->writeEntry( "Vertical Mode", actVerticalMode->isChecked()); config->sync(); @@ -846,13 +861,13 @@ void Krusader::savePosition() { void Krusader::saveSettings() { toolBar() ->saveSettings( krConfig, "Private" ); toolBar("actionsToolBar")->saveSettings( krConfig, "Actions Toolbar" ); - config->setGroup( "Startup" ); + config->setGroup( "Startup" ); config->writeEntry( "Left Active Tab", mainView->leftMng->activeTab() ); config->writeEntry( "Right Active Tab", mainView->rightMng->activeTab() ); config->writeEntry( "Left Side Is Active", MAIN_VIEW->activePanel->isLeft() ); mainView->leftMng->saveSettings( krConfig, "Left Tab Bar" ); mainView->rightMng->saveSettings( krConfig, "Right Tab Bar" ); - + bool rememberpos = config->readBoolEntry( "Remember Position", _RememberPos ); bool uisavesettings = config->readBoolEntry( "UI Save Settings", _UiSave ); @@ -898,7 +913,7 @@ void Krusader::configChanged() { config->setGroup( "Look&Feel" ); bool minimizeToTray = config->readBoolEntry( "Minimize To Tray", _MinimizeToTray ); bool singleInstanceMode = config->readBoolEntry( "Single Instance Mode", _SingleInstanceMode ); - + if( !isHidden() ) { if( singleInstanceMode && minimizeToTray ) sysTray->show(); @@ -918,9 +933,9 @@ void Krusader::slotClose() { bool Krusader::queryClose() { if( isStarting || isExiting ) return false; - + if( kapp->sessionSaving() ) // KDE is logging out, accept the close - { + { saveSettings(); kapp->dcopClient()->registerAs( TDEApplication::kApplication()->name(), true ); @@ -929,9 +944,9 @@ bool Krusader::queryClose() { kapp->deref(); // and close the application return isExiting = true; // this will also kill the pending jobs } - + krConfig->setGroup( "Look&Feel" ); - if( !directExit && krConfig->readBoolEntry( "Single Instance Mode", _SingleInstanceMode ) && + if( !directExit && krConfig->readBoolEntry( "Single Instance Mode", _SingleInstanceMode ) && krConfig->readBoolEntry( "Minimize To Tray", _MinimizeToTray ) ) { hide(); return false; @@ -942,7 +957,7 @@ bool Krusader::queryClose() { directExit = false; bool quit = true; - + if ( krConfig->readBoolEntry( "Warn On Exit", _WarnOnExit ) ) { switch ( KMessageBox::warningYesNo( this, i18n( "Are you sure you want to quit?" ) ) ) { @@ -989,11 +1004,11 @@ bool Krusader::queryClose() { if( w->inherits( TQDIALOG_OBJECT_NAME_STRING ) ) fprintf( stderr, "Failed to close: %s\n", w->className() ); - + return false; } } - + saveSettings(); isExiting = true; @@ -1016,8 +1031,8 @@ void Krusader::startWaiting( TQString msg, int count , bool cancel ) { plzWait->startWaiting( msg , count, cancel ); } -bool Krusader::wasWaitingCancelled() const { - return plzWait->wasCancelled(); +bool Krusader::wasWaitingCancelled() const { + return plzWait->wasCancelled(); } void Krusader::incProgress( TDEProcess *, char *buffer, int buflen ) { @@ -1039,18 +1054,18 @@ void Krusader::updateGUI( bool enforce ) { // call the XML GUI function to draw the UI createGUI( mainView->konsole_part ); - + // this needs to be called AFTER createGUI() !!! userActionMenu = (TDEPopupMenu*) guiFactory()->container( "useractionmenu", this ); if ( userActionMenu ) userAction->populateMenu( userActionMenu ); - + toolBar() ->applySettings( krConfig, "Private" ); - + toolBar("actionsToolBar") ->applySettings( krConfig, "Actions Toolbar" ); static_cast<TDEToggleAction*>(actionCollection()->action("toggle actions toolbar"))-> setChecked(toolBar("actionsToolBar")->isVisible()); - + if ( enforce ) { // now, hide what need to be hidden if ( !krConfig->readBoolEntry( "Show tool bar", _ShowToolBar ) ) { |