summaryrefslogtreecommitdiffstats
path: root/ark/zip.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:15:56 +0200
commit1c84948d57c174bcd9732a5a0a51d42d3626d000 (patch)
treebea1edb0356d7d6809d03f27ff37e89273fbe595 /ark/zip.cpp
parentba8d2a9f33e4921a7188936098ad76af8d9ab8be (diff)
downloadtdeutils-1c84948d57c174bcd9732a5a0a51d42d3626d000.tar.gz
tdeutils-1c84948d57c174bcd9732a5a0a51d42d3626d000.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
Diffstat (limited to 'ark/zip.cpp')
-rw-r--r--ark/zip.cpp38
1 files changed, 37 insertions, 1 deletions
diff --git a/ark/zip.cpp b/ark/zip.cpp
index 4a647b5..1888d50 100644
--- a/ark/zip.cpp
+++ b/ark/zip.cpp
@@ -34,6 +34,7 @@
#include <klocale.h>
#include <kmessagebox.h>
#include <kprocess.h>
+#include <kpassdlg.h>
// ark includes
#include "zip.h"
@@ -114,6 +115,12 @@ void ZipArch::create()
Arch::Extract | Arch::Delete | Arch::Add | Arch::View );
}
+void ZipArch::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 ZipArch::addDir( const TQString & _dirName )
{
if ( !_dirName.isEmpty() )
@@ -240,7 +247,7 @@ void ZipArch::unarchFileInternal()
bool ZipArch::passwordRequired()
{
- return m_lastShellOutput.findRev("unable to get password\n")!=-1 || m_lastShellOutput.endsWith("password inflating\n") || m_lastShellOutput.findRev("password incorrect--reenter:")!=-1 || m_lastShellOutput.endsWith("incorrect password\n");
+ return m_lastShellOutput.findRev("password:") >= 0 || m_lastShellOutput.findRev("unable to get password\n")!=-1 || m_lastShellOutput.endsWith("password inflating\n") || m_lastShellOutput.findRev("password incorrect--reenter:")!=-1 || m_lastShellOutput.endsWith("incorrect password\n");
}
void ZipArch::remove( TQStringList *list )
@@ -248,6 +255,7 @@ void ZipArch::remove( TQStringList *list )
if ( !list )
return;
+
KProcess *kp = m_currentProcess = new KProcess;
kp->clearArguments();
@@ -274,4 +282,32 @@ void ZipArch::remove( TQStringList *list )
}
}
+void ZipArch::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 "zip.moc"