diff options
author | Michele Calgaro <michele.calgaro@yahoo.it> | 2018-08-18 15:36:09 +0900 |
---|---|---|
committer | Michele Calgaro <michele.calgaro@yahoo.it> | 2018-08-18 15:36:09 +0900 |
commit | 4a7a9f41a5d5084aa98379422facc449888552c0 (patch) | |
tree | cd147247e34c101a85d94276d46a7eb12af19a07 /ark | |
parent | 4a66f15d28b50197e79974c6ff81e67f908b4eb1 (diff) | |
download | tdeutils-4a7a9f41a5d5084aa98379422facc449888552c0.tar.gz tdeutils-4a7a9f41a5d5084aa98379422facc449888552c0.zip |
A few code clean up and improvements
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
Diffstat (limited to 'ark')
-rw-r--r-- | ark/archiveformatinfo.cpp | 2 | ||||
-rw-r--r-- | ark/compressedfile.cpp | 19 | ||||
-rw-r--r-- | ark/tar.cpp | 30 |
3 files changed, 23 insertions, 28 deletions
diff --git a/ark/archiveformatinfo.cpp b/ark/archiveformatinfo.cpp index c99ef56..4a961d6 100644 --- a/ark/archiveformatinfo.cpp +++ b/ark/archiveformatinfo.cpp @@ -67,7 +67,7 @@ void ArchiveFormatInfo::buildFormatInfos() addFormatInfo( COMPRESSED_FORMAT, "application/x-bzip2", ".bz2" ); addFormatInfo( COMPRESSED_FORMAT, "application/x-lzip", ".lz" ); addFormatInfo( COMPRESSED_FORMAT, "application/x-lzma", ".lzma" ); - addFormatInfo( COMPRESSED_FORMAT, "application/x-lzop", ".lzo" ); + addFormatInfo( COMPRESSED_FORMAT, "application/x-lzop", ".lzo" ); addFormatInfo( COMPRESSED_FORMAT, "application/x-compress", ".Z" ); find( COMPRESSED_FORMAT ).description = i18n( "Compressed File" ); diff --git a/ark/compressedfile.cpp b/ark/compressedfile.cpp index 86e5fbd..a00bc16 100644 --- a/ark/compressedfile.cpp +++ b/ark/compressedfile.cpp @@ -112,47 +112,46 @@ void CompressedFile::initData() m_archiver_program = "gzip"; m_defaultExtensions << ".gz" << "-gz" << ".z" << "-z" << "_z" << ".Z"; } - if ( mimeType == "application/x-bzip" ) + else if ( mimeType == "application/x-bzip" ) { m_unarchiver_program = "bunzip"; m_archiver_program = "bzip"; m_defaultExtensions << ".bz"; } - if ( mimeType == "application/x-bzip2" ) + else if ( mimeType == "application/x-bzip2" ) { m_unarchiver_program = "bunzip2"; m_archiver_program = "bzip2"; m_defaultExtensions << ".bz2" << ".bz"; } - if (mimeType == "application/x-lzip") { + else if ( mimeType == "application/x-lzip" ) { m_unarchiver_program = "lzip"; m_archiver_program = "lzip"; m_defaultExtensions << ".lz"; } - if ( mimeType == "application/x-lzma" ) + else if ( mimeType == "application/x-lzma" ) { m_unarchiver_program = "unlzma"; m_archiver_program = "lzma"; m_defaultExtensions << ".lzma"; } - if ( mimeType == "application/x-xz" ) + else if ( mimeType == "application/x-xz" ) { m_unarchiver_program = "unxz"; m_archiver_program = "xz"; m_defaultExtensions << ".xz"; } - if ( mimeType == "application/x-lzop" ) + else if ( mimeType == "application/x-lzop" ) { m_unarchiver_program = "lzop"; m_archiver_program = "lzop"; m_defaultExtensions << ".lzo"; } - if ( mimeType == "application/x-compress" ) + else if ( mimeType == "application/x-compress" ) { m_unarchiver_program = TDEGlobal::dirs()->findExe( "uncompress" ).isNull()? "gunzip" : "uncompress"; m_archiver_program = "compress"; m_defaultExtensions = ".Z"; } - } TQString CompressedFile::extension() @@ -192,10 +191,10 @@ void CompressedFile::open() TDEProcess *kp = m_currentProcess = new TDEProcess; kp->clearArguments(); *kp << m_unarchiver_program << "-f" ; - if (m_unarchiver_program == "lzip") { + if ( m_unarchiver_program == "lzip" ) { *kp << "-d"; } - if ( m_unarchiver_program == "lzop") + else if ( m_unarchiver_program == "lzop" ) { *kp << "-d"; // lzop hack, see comment in tar.cpp createTmp() diff --git a/ark/tar.cpp b/ark/tar.cpp index 33f27a6..0c6f3d2 100644 --- a/ark/tar.cpp +++ b/ark/tar.cpp @@ -184,7 +184,6 @@ void TarArch::updateProgress( TDEProcess * _proc, char *_buffer, int _bufflen ) _proc->kill(); KMessageBox::error(0, i18n("Trouble writing to the archive...")); kdWarning( 1601 ) << "trouble updating tar archive" << endl; - //kdFatal( 1601 ) << "trouble updating tar archive" << endl; } } @@ -198,17 +197,16 @@ TQString TarArch::getCompressor() if ( m_fileMimeType == "application/x-tgz" ) return TQString( "gzip" ); - if ( m_fileMimeType == "application/x-tbz" ) + if ( m_fileMimeType == "application/x-tbz" ) return TQString( "bzip2" ); - if (m_fileMimeType == "application/x-tlz") { - return TQString("lzip"); - } + if ( m_fileMimeType == "application/x-tlz" ) + return TQString( "lzip" ); - if ( m_fileMimeType == "application/x-txz" ) - return TQString( "xz" ); + if ( m_fileMimeType == "application/x-txz" ) + return TQString( "xz" ); - if( m_fileMimeType == "application/x-tzo" ) + if ( m_fileMimeType == "application/x-tzo" ) return TQString( "lzop" ); return TQString(); @@ -223,24 +221,22 @@ TQString TarArch::getUnCompressor() if ( m_fileMimeType == "application/x-tgz" ) return TQString( "gunzip" ); - if ( m_fileMimeType == "application/x-tbz" ) + if ( m_fileMimeType == "application/x-tbz" ) return TQString( "bunzip2" ); - if (m_fileMimeType == "application/x-tlz") { - return TQString("lzip"); - } + if ( m_fileMimeType == "application/x-tlz" ) + return TQString( "lzip" ); - if ( m_fileMimeType == "application/x-txz" ) + if ( m_fileMimeType == "application/x-txz" ) return TQString( "unxz" ); - if( m_fileMimeType == "application/x-tzo" ) + if ( m_fileMimeType == "application/x-tzo" ) return TQString( "lzop" ); return TQString(); } -void -TarArch::open() +void TarArch::open() { if ( compressed ) TQFile::remove(tmpfile); // just to make sure @@ -396,7 +392,7 @@ void TarArch::createTmp() if (strUncompressor == "lzip") { *kp << "-d"; } - if (strUncompressor == "lzop") + else if (strUncompressor == "lzop") { // setting up a pty for lzop, since it doesn't like stdin to // be /dev/null ( "no filename allowed when reading from stdin" ) |