Commit d3ff69c7 authored by Andre Heinecke's avatar Andre Heinecke

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
parent e5e2613a
......@@ -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
......
/* -*- 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;
}
/* -*- 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__
<!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"/>
......
......@@ -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"
......@@ -401,6 +402,10 @@ void KeyListController::createActions(KActionCollection *coll)
"file_sign_encrypt_files", i18n("Sign/Encrypt Files..."), QString(),
"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")));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment