summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRolf Eike Beer <kde@opensource.sf-tec.de>2012-03-19 17:20:22 (GMT)
committerRolf Eike Beer <kde@opensource.sf-tec.de>2012-03-19 17:21:53 (GMT)
commit5bf78b98d39a789b596c755548bb6c0cc382e015 (patch)
tree78b2e01abd5e1ea8de7f885e4811707c2c3e4868
parent954c7c3e8a1b8313bae8d717c557df8b7eafba12 (diff)
honor the selected compression format when encrypting a folder
Until now this always created a ZIP archive.
-rw-r--r--foldercompressjob.cpp11
-rw-r--r--foldercompressjob.h18
-rw-r--r--kgpgexternalactions.cpp4
3 files changed, 19 insertions, 14 deletions
diff --git a/foldercompressjob.cpp b/foldercompressjob.cpp
index a37c2bb..2a2b96c 100644
--- a/foldercompressjob.cpp
+++ b/foldercompressjob.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 Rolf Eike Beer <kde@opensource.sf-tec.de>
+ * Copyright (C) 2011,2012 Rolf Eike Beer <kde@opensource.sf-tec.de>
*/
/***************************************************************************
@@ -24,7 +24,7 @@
#include "transactions/kgpgencrypt.h"
-FolderCompressJob::FolderCompressJob(QObject *parent, const KUrl &source, const KUrl &dest, KTemporaryFile *tempfile, const QStringList &keys, const QStringList &options, const KGpgEncrypt::EncryptOptions encOptions)
+FolderCompressJob::FolderCompressJob(QObject *parent, const KUrl &source, const KUrl &dest, KTemporaryFile *tempfile, const QStringList &keys, const QStringList &options, const KGpgEncrypt::EncryptOptions encOptions, const int archive)
: KJob(parent),
m_description(i18n("Processing folder compression and encryption")),
m_source(source),
@@ -32,7 +32,8 @@ FolderCompressJob::FolderCompressJob(QObject *parent, const KUrl &source, const
m_tempfile(tempfile),
m_keys(keys),
m_options(options),
- m_encOptions(encOptions)
+ m_encOptions(encOptions),
+ m_archiveType(archive)
{
}
@@ -51,8 +52,8 @@ void
FolderCompressJob::doWork()
{
KArchive *arch = NULL;
- int compressionScheme = 0;
- switch (compressionScheme) {
+
+ switch (m_archiveType) {
case 0:
arch = new KZip(m_tempfile->fileName());
break;
diff --git a/foldercompressjob.h b/foldercompressjob.h
index 5abc096..21c22d0 100644
--- a/foldercompressjob.h
+++ b/foldercompressjob.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 Rolf Eike Beer <kde@opensource.sf-tec.de>
+ * Copyright (C) 2011,2012 Rolf Eike Beer <kde@opensource.sf-tec.de>
*/
/***************************************************************************
@@ -40,18 +40,22 @@ class FolderCompressJob : public KJob {
const QStringList m_keys;
QStringList m_options;
const KGpgEncrypt::EncryptOptions m_encOptions;
+ const int m_archiveType;
public:
/**
* @brief create a new KJob to compress and encrypt a folder
* @param parent object owning this job
- * @param description
- *
- * The job will take ownership of the transaction, i.e.
- * will delete the transaction object when the job is done.
+ * @param source the source directories to include
+ * @param dest the name of the encrypted file
+ * @param tempfile the temporary file that should be used for archiving
+ * @param keys the public key ids to encrypt to
+ * @param options special options to pass to the GnuPG process
+ * @param encOptions special options to pass to the GnuPG process
+ * @param archive the archive type to use
*/
- FolderCompressJob(QObject *parent, const KUrl &source, const KUrl &dest, KTemporaryFile *tempfile, const QStringList &keys, const QStringList &options, const KGpgEncrypt::EncryptOptions encOptions);
-
+ FolderCompressJob(QObject *parent, const KUrl &source, const KUrl &dest, KTemporaryFile *tempfile, const QStringList &keys, const QStringList &options, const KGpgEncrypt::EncryptOptions encOptions, const int archive);
+
/**
* @brief FolderCompressJob destructor
*/
diff --git a/kgpgexternalactions.cpp b/kgpgexternalactions.cpp
index e273331..b086309 100644
--- a/kgpgexternalactions.cpp
+++ b/kgpgexternalactions.cpp
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2002 Jean-Baptiste Mardelle <bj@altern.org>
- * Copyright (C) 2008,2009,2010,2011 Rolf Eike Beer <kde@opensource.sf-tec.de>
+ * Copyright (C) 2008,2009,2010,2011,2012 Rolf Eike Beer <kde@opensource.sf-tec.de>
*/
/***************************************************************************
@@ -183,7 +183,7 @@ void KGpgExternalActions::startFolderEncode()
delete over;
}
- FolderCompressJob *trayinfo = new FolderCompressJob(m_keysmanager, droppedUrls.first(), encryptedFile, kgpgfoldertmp, selec, encryptOptions, encOptions);
+ FolderCompressJob *trayinfo = new FolderCompressJob(m_keysmanager, droppedUrls.first(), encryptedFile, kgpgfoldertmp, selec, encryptOptions, encOptions, compressionScheme);
connect(trayinfo, SIGNAL(result(KJob*)), SLOT(slotFolderFinished(KJob*)));
KIO::getJobTracker()->registerJob(trayinfo);
trayinfo->start();