summaryrefslogtreecommitdiffstats
path: root/ark/rar.cpp
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2012-06-17 19:09:27 +0200
committerSlávek Banko <slavek.banko@axis.cz>2012-06-17 19:48:22 +0200
commit74f40aa76a59135eefdb30a61638799f66490bf1 (patch)
treedb382e95bc9e9216cd2ffc67291bcaa9e5c7bf14 /ark/rar.cpp
parent4b45c94a3a80aea92d839c793a9d5160e42d2af8 (diff)
downloadtdeutils-74f40aa76a59135eefdb30a61638799f66490bf1.tar.gz
tdeutils-74f40aa76a59135eefdb30a61638799f66490bf1.zip
[Ark] Repairs and extensions
Added support for Arj Added support for check archives Added support for password processing Fix show broken filenames into real UTF-8 This closes Bug 1030 (cherry picked from commit 1c84948d57c174bcd9732a5a0a51d42d3626d000)
Diffstat (limited to 'ark/rar.cpp')
-rw-r--r--ark/rar.cpp45
1 files changed, 44 insertions, 1 deletions
diff --git a/ark/rar.cpp b/ark/rar.cpp
index 5369e89..ac59d74 100644
--- a/ark/rar.cpp
+++ b/ark/rar.cpp
@@ -107,6 +107,12 @@ bool RarArch::processLine( const TQCString &line )
TQStringList l2 = TQStringList::split( ' ', line );
+ if( l2[5].startsWith("d") )
+ {
+ m_isFirstLine = true;
+ return true;
+ }
+
list << m_entryFilename; // filename
list << l2[ 0 ]; // size
list << l2[ 1 ]; // packed
@@ -179,6 +185,12 @@ void RarArch::create()
Arch::Extract | Arch::Delete | Arch::Add | Arch::View );
}
+void RarArch::createPassword()
+{
+ if( m_password.isEmpty() && ArkSettings::askCreatePassword() )
+ KPasswordDialog::getNewPassword( m_password, i18n("Warning!\nUsing KGpg for encryption is more secure.\nCancel this dialog or enter password for %1 archiver:").arg(m_archiver_program) );
+}
+
void RarArch::addDir( const TQString & _dirName )
{
if ( !_dirName.isEmpty() )
@@ -206,6 +218,9 @@ void RarArch::addFile( const TQStringList & urls )
if ( ArkSettings::rarRecurseSubdirs() )
*kp << "-r";
+ if ( !m_password.isEmpty() )
+ *kp << "-p"+m_password;
+
*kp << m_filename;
KURL dir( urls.first() );
@@ -291,7 +306,7 @@ void RarArch::unarchFileInternal()
bool RarArch::passwordRequired()
{
- return m_lastShellOutput.findRev("password incorrect ?)")+1;
+ return m_lastShellOutput.find("Enter password") >= 0;
}
void RarArch::remove( TQStringList *list )
@@ -325,4 +340,32 @@ void RarArch::remove( TQStringList *list )
}
}
+void RarArch::test()
+{
+ clearShellOutput();
+
+ KProcess *kp = m_currentProcess = new KProcess;
+ kp->clearArguments();
+
+ *kp << m_unarchiver_program << "t";
+
+ if ( !m_password.isEmpty() )
+ *kp << "-p" + m_password;
+
+ *kp << m_filename;
+
+ connect( kp, SIGNAL( receivedStdout(KProcess*, char*, int) ),
+ SLOT( slotReceivedOutput(KProcess*, char*, int) ) );
+ connect( kp, SIGNAL( receivedStderr(KProcess*, char*, int) ),
+ SLOT( slotReceivedOutput(KProcess*, char*, int) ) );
+ connect( kp, SIGNAL( processExited(KProcess*) ),
+ SLOT( slotTestExited(KProcess*) ) );
+
+ if ( !kp->start( KProcess::NotifyOnExit, KProcess::AllOutput ) )
+ {
+ KMessageBox::error( 0, i18n( "Could not start a subprocess." ) );
+ emit sigTest( false );
+ }
+}
+
#include "rar.moc"