summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Heinecke <[email protected]>2016-06-13 16:47:45 +0200
committerAndre Heinecke <[email protected]>2016-06-13 16:47:45 +0200
commitd3ff69c7953884025f1673099443249562531c4a (patch)
tree937a8611e6f95b77aebe97d5a9b1cca09bbd3a22
parente5e2613a36cdef819027eb7132df3f1cd5c58965 (diff)
Add SignEncryptFolderCommand
Same as signencryptfiles but working with folders. This was previously only doable in Kleopatra when called from command line or through GpgEX / Assuan
-rw-r--r--src/CMakeLists.txt1
-rw-r--r--src/commands/signencryptfoldercommand.cpp65
-rw-r--r--src/commands/signencryptfoldercommand.h59
-rw-r--r--src/kleopatra.rc3
-rw-r--r--src/view/keylistcontroller.cpp6
5 files changed, 133 insertions, 1 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index af86c7e..a168849 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -179,6 +179,7 @@ set(_kleopatra_SRCS
commands/deletecertificatescommand.cpp
commands/decryptverifyfilescommand.cpp
commands/signencryptfilescommand.cpp
+ commands/signencryptfoldercommand.cpp
commands/encryptclipboardcommand.cpp
commands/signclipboardcommand.cpp
commands/decryptverifyclipboardcommand.cpp
diff --git a/src/commands/signencryptfoldercommand.cpp b/src/commands/signencryptfoldercommand.cpp
new file mode 100644
index 0000000..c504e56
--- /dev/null
+++ b/src/commands/signencryptfoldercommand.cpp
@@ -0,0 +1,65 @@
+/* -*- mode: c++; c-basic-offset:4 -*-
+ commands/signencryptfoldercommand.cpp
+
+ This file is part of Kleopatra, the KDE keymanager
+ Copyright (c) 2016 Intevation GmbH
+
+ Kleopatra is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ Kleopatra is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+ In addition, as a special exception, the copyright holders give
+ permission to link the code of this program with any edition of
+ the Qt library by Trolltech AS, Norway (or with modified versions
+ of Qt that use the same license as Qt), and distribute linked
+ combinations including the two. You must obey the GNU General
+ Public License in all respects for all of the code used other than
+ Qt. If you modify this file, you may extend this exception to
+ your version of the file, but you are not obligated to do so. If
+ you do not wish to do so, delete this exception statement from
+ your version.
+*/
+
+#include <config-kleopatra.h>
+
+#include "signencryptfoldercommand.h"
+
+#include <KLocalizedString>
+
+#include <QStringList>
+#include <QApplication>
+#include <QFileDialog>
+
+using namespace Kleo;
+using namespace Kleo::Commands;
+
+SignEncryptFolderCommand::SignEncryptFolderCommand(QAbstractItemView *v, KeyListController *c)
+ : SignEncryptFilesCommand(v, c)
+{
+ setArchivePolicy(Force);
+}
+
+SignEncryptFolderCommand::SignEncryptFolderCommand(KeyListController *c)
+ : SignEncryptFolderCommand(Q_NULLPTR, c)
+{
+}
+
+QStringList SignEncryptFolderCommand::selectFiles() const
+{
+ const QString dir = QFileDialog::getExistingDirectory(qApp->activeWindow(),
+ i18n("Select Folder to Sign and/or Encrypt"));
+ if (dir.isNull()) {
+ return QStringList();
+ }
+ return QStringList() << dir;
+}
diff --git a/src/commands/signencryptfoldercommand.h b/src/commands/signencryptfoldercommand.h
new file mode 100644
index 0000000..d64d9d5
--- /dev/null
+++ b/src/commands/signencryptfoldercommand.h
@@ -0,0 +1,59 @@
+/* -*- mode: c++; c-basic-offset:4 -*-
+ commands/signencryptfoldercommand.h
+
+ This file is part of Kleopatra, the KDE keymanager
+ Copyright (c) 2016 Intevation GmbH
+
+ Kleopatra is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ Kleopatra is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+ In addition, as a special exception, the copyright holders give
+ permission to link the code of this program with any edition of
+ the Qt library by Trolltech AS, Norway (or with modified versions
+ of Qt that use the same license as Qt), and distribute linked
+ combinations including the two. You must obey the GNU General
+ Public License in all respects for all of the code used other than
+ Qt. If you modify this file, you may extend this exception to
+ your version of the file, but you are not obligated to do so. If
+ you do not wish to do so, delete this exception statement from
+ your version.
+*/
+
+#ifndef __KLEOPATRA_COMMMANDS_SIGNENCRYPTFOLDERCOMMAND_H__
+#define __KLEOPATRA_COMMMANDS_SIGNENCRYPTFOLDERCOMMAND_H__
+
+#include "signencryptfilescommand.h"
+
+class QStringList;
+
+namespace Kleo
+{
+namespace Commands
+{
+
+class SignEncryptFolderCommand : public SignEncryptFilesCommand
+{
+ Q_OBJECT
+public:
+ explicit SignEncryptFolderCommand(QAbstractItemView *view, KeyListController *parent);
+ explicit SignEncryptFolderCommand(KeyListController *parent);
+
+protected:
+ QStringList selectFiles() const Q_DECL_OVERRIDE;
+};
+
+}
+}
+
+#endif // __KLEOPATRA_COMMMANDS_SIGNENCRYPTFOLDERCOMMAND_H__
diff --git a/src/kleopatra.rc b/src/kleopatra.rc
index ee29a64..31edebb 100644
--- a/src/kleopatra.rc
+++ b/src/kleopatra.rc
@@ -1,5 +1,5 @@
<!DOCTYPE kpartgui >
-<kpartgui name="kleopatra" version="481" >
+<kpartgui name="kleopatra" version="492" >
<MenuBar>
<Menu name="file">
<text>&amp;File</text>
@@ -15,6 +15,7 @@
<Separator/>
<Action name="file_decrypt_verify_files"/>
<Action name="file_sign_encrypt_files"/>
+ <Action name="file_sign_encrypt_folder"/>
<Separator/>
<Action name="file_checksum_create_files"/>
<Action name="file_checksum_verify_files"/>
diff --git a/src/view/keylistcontroller.cpp b/src/view/keylistcontroller.cpp
index 64aa18a..24294c1 100644
--- a/src/view/keylistcontroller.cpp
+++ b/src/view/keylistcontroller.cpp
@@ -58,6 +58,7 @@
#include "commands/deletecertificatescommand.h"
#include "commands/decryptverifyfilescommand.h"
#include "commands/signencryptfilescommand.h"
+#include "commands/signencryptfoldercommand.h"
#include "commands/clearcrlcachecommand.h"
#include "commands/dumpcrlcachecommand.h"
#include "commands/dumpcertificatecommand.h"
@@ -402,6 +403,10 @@ void KeyListController::createActions(KActionCollection *coll)
"document-edit-sign-encrypt", 0, 0, QString(), false, true
},
{
+ "file_sign_encrypt_folder", i18n("Sign/Encrypt Folder..."), QString(),
+ 0/*"folder-edit-sign-encrypt"*/, 0, 0, QString(), false, true
+ },
+ {
"file_checksum_create_files", i18n("Create Checksum Files..."), QString(),
0/*"document-checksum-create"*/, 0, 0, QString(), false, true
},
@@ -505,6 +510,7 @@ void KeyListController::createActions(KActionCollection *coll)
//---
registerActionForCommand<DecryptVerifyFilesCommand>(coll->action(QStringLiteral("file_decrypt_verify_files")));
registerActionForCommand<SignEncryptFilesCommand>(coll->action(QStringLiteral("file_sign_encrypt_files")));
+ registerActionForCommand<SignEncryptFolderCommand>(coll->action(QStringLiteral("file_sign_encrypt_folder")));
//---
registerActionForCommand<ChecksumCreateFilesCommand>(coll->action(QStringLiteral("file_checksum_create_files")));
registerActionForCommand<ChecksumVerifyFilesCommand>(coll->action(QStringLiteral("file_checksum_verify_files")));