File ark-rar_encrypted.patch of Package kdeutils3

Index: ark/arch.cpp
===================================================================
--- ark/arch.cpp.orig	2008-02-13 12:38:15.000000000 +0300
+++ ark/arch.cpp	2010-08-15 10:14:01.000000000 +0400
@@ -100,6 +100,31 @@ void Arch::verifyUncompressUtilityIsAvai
 
 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() )
Index: ark/rar.cpp
===================================================================
--- ark/rar.cpp.orig	2008-02-13 12:38:15.000000000 +0300
+++ ark/rar.cpp	2010-08-15 10:14:01.000000000 +0400
@@ -119,7 +119,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) ) );
openSUSE Build Service is sponsored by