File indexing completed on 2024-06-23 05:13:52

0001 /* -*- mode: c++; c-basic-offset:4 -*-
0002     crypto/gui/signencryptfileswizard.h
0003 
0004     This file is part of Kleopatra, the KDE keymanager
0005     SPDX-FileCopyrightText: 2009 Klarälvdalens Datakonsult AB
0006 
0007     SPDX-FileCopyrightText: 2016 Bundesamt für Sicherheit in der Informationstechnik
0008     SPDX-FileContributor: Intevation GmbH
0009 
0010     SPDX-License-Identifier: GPL-2.0-or-later
0011 */
0012 
0013 #pragma once
0014 
0015 #include <utils/pimpl_ptr.h>
0016 
0017 #include <gpgme++/global.h>
0018 
0019 #include <QWizard>
0020 
0021 #include <QMap>
0022 
0023 #include <memory>
0024 
0025 namespace GpgME
0026 {
0027 class Key;
0028 }
0029 
0030 namespace Kleo
0031 {
0032 namespace Crypto
0033 {
0034 class TaskCollection;
0035 }
0036 }
0037 
0038 class ResultPage;
0039 class SigEncPage;
0040 
0041 namespace Kleo
0042 {
0043 
0044 class SignEncryptFilesWizard : public QWizard
0045 {
0046     Q_OBJECT
0047 public:
0048     enum KindNames {
0049         SignatureCMS,
0050         SignaturePGP,
0051         CombinedPGP,
0052         EncryptedPGP,
0053         EncryptedCMS,
0054         Directory,
0055     };
0056 
0057     explicit SignEncryptFilesWizard(QWidget *parent = nullptr, Qt::WindowFlags f = {});
0058     ~SignEncryptFilesWizard() override;
0059 
0060     // Inputs
0061     void setSigningPreset(bool preset);
0062     void setSigningUserMutable(bool mut);
0063 
0064     void setEncryptionPreset(bool preset);
0065     void setEncryptionUserMutable(bool mut);
0066 
0067     void setArchiveForced(bool archive);
0068     void setArchiveMutable(bool archive);
0069 
0070     void setSingleFile(bool singleFile);
0071 
0072     void setOutputNames(const QMap<int, QString> &nameMap) const;
0073     QMap<int, QString> outputNames() const;
0074 
0075     void setTaskCollection(const std::shared_ptr<Kleo::Crypto::TaskCollection> &coll);
0076 
0077     // Outputs
0078     std::vector<GpgME::Key> resolvedRecipients() const;
0079     std::vector<GpgME::Key> resolvedSigners() const;
0080     bool encryptSymmetric() const;
0081 
0082     void setLabelText(const QString &label);
0083 
0084 protected:
0085     void readConfig();
0086     void writeConfig();
0087 
0088 Q_SIGNALS:
0089     void operationPrepared();
0090 
0091 private Q_SLOTS:
0092     void slotCurrentIdChanged(int);
0093 
0094 private:
0095     SigEncPage *mSigEncPage = nullptr;
0096     ResultPage *mResultPage = nullptr;
0097     bool mSigningUserMutable = true;
0098     bool mEncryptionUserMutable = true;
0099 };
0100 
0101 }