diff --git a/src/crypto/gui/signencryptwidget.h b/src/crypto/gui/signencryptwidget.h index 079e11f2f..1e0eefb00 100644 --- a/src/crypto/gui/signencryptwidget.h +++ b/src/crypto/gui/signencryptwidget.h @@ -1,133 +1,132 @@ /* crypto/gui/signencryptwidget.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2016 Bundesamt für Sicherheit in der Informationstechnik SPDX-FileContributor: Intevation GmbH SPDX-License-Identifier: GPL-2.0-or-later */ #pragma once #include <QVector> #include <QWidget> #include <gpgme++/global.h> #include <memory> namespace GpgME { class Key; } namespace Kleo { class CertificateLineEdit; class KeyGroup; class SignEncryptWidget : public QWidget { Q_OBJECT public: enum Operation { NoOperation = 0x00, Sign = 0x01, Encrypt = 0x02, SignAndEncrypt = Sign | Encrypt }; Q_DECLARE_FLAGS(Operations, Operation) /** If cmsSigEncExclusive is true CMS operations can be * done only either as sign or as encrypt */ explicit SignEncryptWidget(QWidget *parent = nullptr, bool cmsSigEncExclusive = false); ~SignEncryptWidget() override; /** Overwrite default text with custom text, e.g. with a character marked * as shortcut key. */ void setSignAsText(const QString &text); void setEncryptForMeText(const QString &text); void setEncryptForOthersText(const QString &text); void setEncryptWithPasswordText(const QString &text); /** Returns the list of recipients selected in the dialog * or an empty list if encryption is disabled */ std::vector<GpgME::Key> recipients() const; /** Returns the selected signing key or a null key if signing * is disabled. */ GpgME::Key signKey() const; /** Returns the selected encrypt to self key or a null key if * encrypt to self is disabled. */ GpgME::Key selfKey() const; /** Returns the operation based on the current selection. */ Operations currentOp() const; /** Whether or not symmetric encryption should also be used. */ bool encryptSymmetric() const; /** Save the currently selected signing and encrypt to self keys. */ void saveOwnKeys() const; /** Return whether or not all keys involved in the operation are compliant with CO_DE_VS, and all keys are valid (i.e. all userIDs have Validity >= Full). */ bool isDeVsAndValid() const; /** Set whether or not signing group should be checked */ void setSigningChecked(bool value); /** Set whether or not encryption group should be checked */ void setEncryptionChecked(bool value); /** Filter for a specific protocol. Use UnknownProtocol for both * S/MIME and OpenPGP */ void setProtocol(GpgME::Protocol protocol); /** Add a recipient with the key key */ void addRecipient(const GpgME::Key &key); /** Add a group of recipients */ void addRecipient(const Kleo::KeyGroup &group); /** Add a placehoder for an unknown key */ void addUnknownRecipient(const char *keyId); /** Remove all Recipients added by keyId or by key. */ void clearAddedRecipients(); /** Remove a Recipient key */ void removeRecipient(const GpgME::Key &key); /** Remove a recipient group */ void removeRecipient(const Kleo::KeyGroup &group); /** Returns true if all required information has been entered. */ bool isComplete() const; /** Returns true if all recipients have been resolved. Otherwise, shows an error message and returns false. */ bool validate(); protected Q_SLOTS: void updateOp(); void recipientsChanged(); void certificateSelectionRequested(CertificateLineEdit *w); protected: void loadKeys(); Q_SIGNALS: /* Emitted when the certificate selection changed the operation * with that selection. e.g. "Sign" or "Sign/Encrypt". * If no crypto operation is selected this returns a null string. */ void operationChanged(Operations op); /* Emitted when the certificate selection might be changed. */ void keysChanged(); private: class Private; const std::unique_ptr<Private> d; }; - -Q_DECLARE_OPERATORS_FOR_FLAGS(SignEncryptWidget::Operations) - } // namespace Kleo + +Q_DECLARE_OPERATORS_FOR_FLAGS(Kleo::SignEncryptWidget::Operations) diff --git a/src/utils/overwritedialog.h b/src/utils/overwritedialog.h index 5cad61837..a707b600b 100644 --- a/src/utils/overwritedialog.h +++ b/src/utils/overwritedialog.h @@ -1,82 +1,81 @@ /* utils/overwritedialog.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2023 g10 Code GmbH SPDX-FileContributor: Ingo Klöcker <dev@ingo-kloecker.de> SPDX-License-Identifier: GPL-2.0-or-later */ #pragma once #include <QDialog> #include <memory> namespace Kleo { /** * @class Kleo::OverwriteDialog overwritedialog.h <overwritedialog.h> * * This dialog can be shown when you realize that a file you want to write * already exists and you want to offer the user the choice to either Rename, * Overwrite, Append, or Skip. */ class OverwriteDialog : public QDialog { Q_OBJECT public: /** * @see Options */ enum Option { AllowRename = 1, ///< Allow the user to enter a different file name. AllowSkip = 2, ///< Offer a "Skip" button, to skip other files too. Requires MultipleItems. MultipleItems = 4, ///< Set if the current operation concerns multiple files, so it makes sense to offer buttons that apply the user's choice to all files/folders. AllowAppend = 8, ///< Allow the user to choose Append. }; /** * Stores a combination of #Option values. */ Q_DECLARE_FLAGS(Options, Option) enum Result { Cancel = 0, // = QDialog::Rejected Overwrite = 1, OverwriteAll = 2, Rename = 3, AutoRename = 4, Skip = 5, AutoSkip = 6, Append = 7, }; /** * Construct an "overwrite" dialog to let the user know that the file @p fileName is about to be overwritten. * * @param parent parent widget * @param title the title for the dialog * @param fileName the path of the file that already exists * @param options parameters for the dialog (which buttons to show...), */ OverwriteDialog(QWidget *parent, const QString &title, const QString &fileName, Options options); ~OverwriteDialog() override; /** * Returns the new file name to use if the user selected the Rename option. * Otherwise, returns an empty string. * * @return the new file name or an empty string */ QString newFileName() const; private: class Private; std::unique_ptr<Private> const d; }; - -Q_DECLARE_OPERATORS_FOR_FLAGS(OverwriteDialog::Options) - } + +Q_DECLARE_OPERATORS_FOR_FLAGS(Kleo::OverwriteDialog::Options) diff --git a/src/view/openpgpkeycardwidget.h b/src/view/openpgpkeycardwidget.h index 323f90c13..cb20577ea 100644 --- a/src/view/openpgpkeycardwidget.h +++ b/src/view/openpgpkeycardwidget.h @@ -1,54 +1,53 @@ /* view/openpgpkeycardwidget.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2021, 2022 g10 Code GmbH SPDX-FileContributor: Ingo Klöcker <dev@ingo-kloecker.de> SPDX-License-Identifier: GPL-2.0-or-later */ #pragma once #include <QWidget> #include <memory> namespace Kleo { namespace SmartCard { class Card; } class OpenPGPKeyCardWidget : public QWidget { Q_OBJECT public: enum Action { NoAction = 0x00, CreateCSR = 0x01, GenerateKey = 0x02, AllActions = CreateCSR | GenerateKey, }; Q_DECLARE_FLAGS(Actions, Action) explicit OpenPGPKeyCardWidget(QWidget *parent = nullptr); ~OpenPGPKeyCardWidget() override; void setAllowedActions(Actions actions); public Q_SLOTS: void update(const SmartCard::Card *card); Q_SIGNALS: void createCSRRequested(const std::string &keyRef); void generateKeyRequested(const std::string &keyRef); private: class Private; std::unique_ptr<Private> d; }; - -Q_DECLARE_OPERATORS_FOR_FLAGS(OpenPGPKeyCardWidget::Actions) - } + +Q_DECLARE_OPERATORS_FOR_FLAGS(Kleo::OpenPGPKeyCardWidget::Actions)