1 /* -*- mode: c++; c-basic-offset:4 -*-
2     crypto/gui/signencryptfileswizard.h
3 
4     This file is part of Kleopatra, the KDE keymanager
5     SPDX-FileCopyrightText: 2009 Klarälvdalens Datakonsult AB
6 
7     SPDX-FileCopyrightText: 2016 Bundesamt für Sicherheit in der Informationstechnik
8     SPDX-FileContributor: Intevation GmbH
9 
10     SPDX-License-Identifier: GPL-2.0-or-later
11 */
12 
13 #pragma once
14 
15 #include <utils/pimpl_ptr.h>
16 
17 #include <gpgme++/global.h>
18 
19 #include <QWizard>
20 
21 #include <QVector>
22 #include <QMap>
23 
24 #include <memory>
25 
26 
27 namespace GpgME
28 {
29 class Key;
30 }
31 
32 namespace Kleo
33 {
34 namespace Crypto
35 {
36 class TaskCollection;
37 }
38 }
39 
40 class ResultPage;
41 class SigEncPage;
42 
43 namespace Kleo
44 {
45 
46 class SignEncryptFilesWizard : public QWizard
47 {
48     Q_OBJECT
49 public:
50     enum KindNames {
51         SignatureCMS,
52         SignaturePGP,
53         CombinedPGP,
54         EncryptedPGP,
55         EncryptedCMS,
56         Directory
57     };
58 
59     explicit SignEncryptFilesWizard(QWidget *parent = nullptr, Qt::WindowFlags f = {});
60     ~SignEncryptFilesWizard() override;
61 
62     // Inputs
63     void setSigningPreset(bool preset);
64     void setSigningUserMutable(bool mut);
65 
66     void setEncryptionPreset(bool preset);
67     void setEncryptionUserMutable(bool mut);
68 
69     void setArchiveForced(bool archive);
70     void setArchiveMutable(bool archive);
71 
72     void setSingleFile(bool singleFile);
73 
74     void setOutputNames(const QMap<int, QString> &nameMap) const;
75     QMap<int, QString> outputNames() const;
76 
77     void setTaskCollection(const std::shared_ptr<Kleo::Crypto::TaskCollection> &coll);
78 
79     // Outputs
80     std::vector<GpgME::Key> resolvedRecipients() const;
81     std::vector<GpgME::Key> resolvedSigners() const;
82     bool encryptSymmetric() const;
83 
84     void setLabelText(const QString &label);
85 
86 protected:
87     void readConfig();
88     void writeConfig();
89 
90 Q_SIGNALS:
91     void operationPrepared();
92 
93 private Q_SLOTS:
94     void slotCurrentIdChanged(int);
95 
96 private:
97     SigEncPage *mSigEncPage = nullptr;
98     ResultPage *mResultPage = nullptr;
99     bool mSigningUserMutable = true;
100     bool mEncryptionUserMutable = true;
101 };
102 
103 }
104 
105