summaryrefslogtreecommitdiffstats
path: root/ark
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-04-28 04:07:15 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-04-28 04:07:15 +0000
commit4facf42feec57b22dcf46badc115ad6c5b5cc512 (patch)
tree44a6974c79669355758ee9ec7b10be04f51e9680 /ark
parent035fa88dbc0474a148dbdbe949b5a92b9bce5e78 (diff)
downloadtdeutils-4facf42feec57b22dcf46badc115ad6c5b5cc512.tar.gz
tdeutils-4facf42feec57b22dcf46badc115ad6c5b5cc512.zip
Repaired opening of encrypted RAR files (closes bug 181)
Thanks to jm82an4zn1@sxipper.net for the patch! git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeutils@1119969 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'ark')
-rw-r--r--ark/arch.cpp25
-rw-r--r--ark/rar.cpp9
2 files changed, 33 insertions, 1 deletions
diff --git a/ark/arch.cpp b/ark/arch.cpp
index 999647a..1916e12 100644
--- a/ark/arch.cpp
+++ b/ark/arch.cpp
@@ -100,6 +100,31 @@ void Arch::verifyUncompressUtilityIsAvailable( const QString &utility )
void Arch::slotOpenExited( KProcess* _kp )
{
+ bool success = ( _kp->normalExit() && ( _kp->exitStatus() == 0 ) );
+
+ if( !success )
+ {
+ if ( passwordRequired() )
+ {
+ QString msg;
+ if ( !m_password.isEmpty() )
+ msg = i18n("The password was incorrect. ");
+ if (KPasswordDialog::getPassword( m_password, msg+i18n("You must enter a password to open the file:") ) == KPasswordDialog::Accepted )
+ {
+ delete _kp;
+ _kp = m_currentProcess = 0;
+ clearShellOutput();
+ open(); // try to open the file again with a password
+ return;
+ }
+ m_password = "";
+ emit sigOpen( this, false, QString::null, 0 );
+ delete _kp;
+ _kp = m_currentProcess = 0;
+ return;
+ }
+ }
+
int exitStatus = 100; // arbitrary bad exit status
if ( _kp->normalExit() )
diff --git a/ark/rar.cpp b/ark/rar.cpp
index 742df1c..071dc9e 100644
--- a/ark/rar.cpp
+++ b/ark/rar.cpp
@@ -128,7 +128,14 @@ void RarArch::open()
m_finished = false;
KProcess *kp = m_currentProcess = new KProcess;
- *kp << m_unarchiver_program << "v" << "-c-" << m_filename;
+ *kp << m_unarchiver_program << "v" << "-c-";
+
+ if ( !m_password.isEmpty() )
+ *kp << "-p" + m_password;
+ else
+ *kp << "-p-";
+
+ *kp << m_filename;
connect( kp, SIGNAL( receivedStdout(KProcess*, char*, int) ),
SLOT( slotReceivedTOC(KProcess*, char*, int) ) );