diff --git a/src/aboutdata.h b/src/aboutdata.h index 286f94350..82573c6c6 100644 --- a/src/aboutdata.h +++ b/src/aboutdata.h @@ -1,27 +1,25 @@ /* aboutdata.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2001, 2002, 2004 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __ABOUTDATA_H__ -#define __ABOUTDATA_H__ +#pragma once #include class AboutData : public KAboutData { public: AboutData(); }; class AboutGpg4WinData : public KAboutData { public: AboutGpg4WinData(); }; -#endif // __ABOUTDATA_H__ diff --git a/src/commands/adduseridcommand.h b/src/commands/adduseridcommand.h index 4b26355fe..790b3d171 100644 --- a/src/commands/adduseridcommand.h +++ b/src/commands/adduseridcommand.h @@ -1,60 +1,58 @@ /* -*- mode: c++; c-basic-offset:4 -*- commands/adduseridcommand.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2008 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_COMMANDS_ADDUSERIDCOMMAND_H__ -#define __KLEOPATRA_COMMANDS_ADDUSERIDCOMMAND_H__ +#pragma once #include namespace Kleo { namespace Commands { class AddUserIDCommand : public Command { Q_OBJECT public: explicit AddUserIDCommand(QAbstractItemView *view, KeyListController *parent); explicit AddUserIDCommand(KeyListController *parent); explicit AddUserIDCommand(const GpgME::Key &key); ~AddUserIDCommand() override; /* reimp */ static Restrictions restrictions() { return OnlyOneKey | MustBeOpenPGP | NeedSecretKey; } void setName(const QString &name); const QString &name() const; void setEmail(const QString &email); const QString &email() const; void setComment(const QString &comment); const QString &comment() const; private: void doStart() override; void doCancel() override; private: class Private; inline Private *d_func(); inline const Private *d_func() const; Q_PRIVATE_SLOT(d_func(), void slotResult(GpgME::Error)) Q_PRIVATE_SLOT(d_func(), void slotDialogAccepted()) Q_PRIVATE_SLOT(d_func(), void slotDialogRejected()) Q_PRIVATE_SLOT(d_func(), void slotSimpleDialogAccepted()) }; } } -#endif // __KLEOPATRA_COMMANDS_ADDUSERIDCOMMAND_H__ diff --git a/src/commands/authenticatepivcardapplicationcommand.h b/src/commands/authenticatepivcardapplicationcommand.h index c5ae1e124..9c184c375 100644 --- a/src/commands/authenticatepivcardapplicationcommand.h +++ b/src/commands/authenticatepivcardapplicationcommand.h @@ -1,49 +1,47 @@ /* commands/authenticatepivcardapplicationcommand.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2020 g10 Code GmbH SPDX-FileContributor: Ingo Klöcker SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_COMMMANDS_AUTHENTICATEPIVCARDAPPLICATIONCOMMAND_H__ -#define __KLEOPATRA_COMMMANDS_AUTHENTICATEPIVCARDAPPLICATIONCOMMAND_H__ +#pragma once #include "cardcommand.h" namespace GpgME { class Error; } namespace Kleo { namespace Commands { class AuthenticatePIVCardApplicationCommand : public CardCommand { Q_OBJECT public: explicit AuthenticatePIVCardApplicationCommand(const std::string &serialNumber, QWidget *parent); ~AuthenticatePIVCardApplicationCommand() override; void setPrompt(const QString& prompt); private: void doStart() override; void doCancel() override; private: class Private; inline Private *d_func(); inline const Private *d_func() const; Q_PRIVATE_SLOT(d_func(), void slotDialogAccepted()) Q_PRIVATE_SLOT(d_func(), void slotDialogRejected()) Q_PRIVATE_SLOT(d_func(), void slotResult(GpgME::Error)) }; } // namespace Commands } // namespace Kleo -#endif // __KLEOPATRA_COMMMANDS_AUTHENTICATEPIVCARDAPPLICATIONCOMMAND_H__ diff --git a/src/commands/cardcommand.h b/src/commands/cardcommand.h index 475554d52..ddc81c986 100644 --- a/src/commands/cardcommand.h +++ b/src/commands/cardcommand.h @@ -1,37 +1,35 @@ /* commands/cardcommand.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2007 Klarälvdalens Datakonsult AB SPDX-FileCopyrightText: 2020 g10 Code GmbH SPDX-FileContributor: Ingo Klöcker SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_COMMANDS_CARDCOMMAND_H__ -#define __KLEOPATRA_COMMANDS_CARDCOMMAND_H__ +#pragma once #include "command.h" namespace Kleo { class CardCommand : public Command { Q_OBJECT public: explicit CardCommand(const std::string &serialNumber, QWidget *parent); ~CardCommand() override; protected: class Private; inline Private *d_func(); inline const Private *d_func() const; protected: explicit CardCommand(Private *pp); }; } // namespace Kleo -#endif /* __KLEOPATRA_COMMANDS_CARDCOMMAND_H__ */ diff --git a/src/commands/cardcommand_p.h b/src/commands/cardcommand_p.h index c6de00afc..911aeabc5 100644 --- a/src/commands/cardcommand_p.h +++ b/src/commands/cardcommand_p.h @@ -1,43 +1,41 @@ /* commands/cardcommand_p.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2007 Klarälvdalens Datakonsult AB SPDX-FileCopyrightText: 2020 g10 Code GmbH SPDX-FileContributor: Ingo Klöcker SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_COMMANDS_CARDCOMMAND_P_H__ -#define __KLEOPATRA_COMMANDS_CARDCOMMAND_P_H__ +#pragma once #include "cardcommand.h" #include "command_p.h" class Kleo::CardCommand::Private : public Command::Private { friend class ::Kleo::CardCommand; Kleo::CardCommand *q_func() const { return static_cast(q); } public: explicit Private(CardCommand *qq, const std::string &serialNumber, QWidget *parent); ~Private(); std::string serialNumber() const { return serialNumber_; } protected: void setSerialNumber(const std::string &serialNumber) { serialNumber_ = serialNumber; } private: std::string serialNumber_; }; -#endif /* __KLEOPATRA_COMMANDS_CARDCOMMAND_P_H__ */ diff --git a/src/commands/certificatetopivcardcommand.h b/src/commands/certificatetopivcardcommand.h index 6240746f4..2162eb1b0 100644 --- a/src/commands/certificatetopivcardcommand.h +++ b/src/commands/certificatetopivcardcommand.h @@ -1,48 +1,46 @@ /* commands/certificatetopivcardcommand.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2020 g10 Code GmbH SPDX-FileContributor: Ingo Klöcker SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_COMMANDS_CERTIFICATETOPIVCARDCOMMAND_H__ -#define __KLEOPATRA_COMMANDS_CERTIFICATETOPIVCARDCOMMAND_H__ +#pragma once #include namespace GpgME { class Error; } namespace Kleo { namespace Commands { class CertificateToPIVCardCommand : public CardCommand { Q_OBJECT public: CertificateToPIVCardCommand(const std::string& cardSlot, const std::string &serialno); ~CertificateToPIVCardCommand() override; public Q_SLOTS: void certificateToPIVCardDone(const GpgME::Error &err); private: void doStart() override; void doCancel() override; private: class Private; inline Private *d_func(); inline const Private *d_func() const; }; } } -#endif /* __KLEOPATRA_COMMANDS_CERTIFICATETOPIVCARDCOMMAND_H__ */ diff --git a/src/commands/certifycertificatecommand.h b/src/commands/certifycertificatecommand.h index 6c1987edc..4a9a1bc72 100644 --- a/src/commands/certifycertificatecommand.h +++ b/src/commands/certifycertificatecommand.h @@ -1,65 +1,63 @@ /* -*- mode: c++; c-basic-offset:4 -*- commands/signcertificatecommand.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2008 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_COMMANDS_CERTIFYCERTIFICATECOMMAND_H__ -#define __KLEOPATRA_COMMANDS_CERTIFYCERTIFICATECOMMAND_H__ +#pragma once #include namespace GpgME { class UserID; } namespace Kleo { namespace Commands { class CertifyCertificateCommand : public Command { Q_OBJECT public: explicit CertifyCertificateCommand(QAbstractItemView *view, KeyListController *parent); explicit CertifyCertificateCommand(KeyListController *parent); explicit CertifyCertificateCommand(const GpgME::Key &key); explicit CertifyCertificateCommand(const GpgME::UserID &uid); explicit CertifyCertificateCommand(const std::vector &uids); ~CertifyCertificateCommand() override; /* reimp */ static Restrictions restrictions() { return OnlyOneKey | MustBeOpenPGP; } void setCertificationExportable(bool on); void setCertificationRevocable(bool on); void setCertifyingKey(const GpgME::Key &key); void setUserID(const GpgME::UserID &uid); void setUserIDs(const std::vector &uids); private: void doStart() override; void doCancel() override; private: class Private; inline Private *d_func(); inline const Private *d_func() const; Q_PRIVATE_SLOT(d_func(), void slotResult(GpgME::Error)) Q_PRIVATE_SLOT(d_func(), void slotDialogRejected()) Q_PRIVATE_SLOT(d_func(), void slotCertificationPrepared()) }; } } -#endif // __KLEOPATRA_COMMANDS_SIGNCERTIFICATECOMMAND_H__ diff --git a/src/commands/changeexpirycommand.h b/src/commands/changeexpirycommand.h index 9e0b1e8c1..a716c2c29 100644 --- a/src/commands/changeexpirycommand.h +++ b/src/commands/changeexpirycommand.h @@ -1,57 +1,55 @@ /* -*- mode: c++; c-basic-offset:4 -*- commands/changeexpirycommand.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2008 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_COMMMANDS_CHANGEEXPIRYCOMMAND_H__ -#define __KLEOPATRA_COMMMANDS_CHANGEEXPIRYCOMMAND_H__ +#pragma once #include namespace GpgME { class Subkey; } namespace Kleo { namespace Commands { class ChangeExpiryCommand : public Command { Q_OBJECT public: explicit ChangeExpiryCommand(QAbstractItemView *view, KeyListController *parent); explicit ChangeExpiryCommand(KeyListController *parent); explicit ChangeExpiryCommand(const GpgME::Key &key); ~ChangeExpiryCommand() override; /* reimp */ static Restrictions restrictions() { return OnlyOneKey | MustBeOpenPGP | NeedSecretKey; } void setSubkey(const GpgME::Subkey &subkey); private: void doStart() override; void doCancel() override; private: class Private; inline Private *d_func(); inline const Private *d_func() const; Q_PRIVATE_SLOT(d_func(), void slotResult(GpgME::Error)) Q_PRIVATE_SLOT(d_func(), void slotDialogAccepted()) Q_PRIVATE_SLOT(d_func(), void slotDialogRejected()) }; } } -#endif // __KLEOPATRA_COMMMANDS_CHANGEEXPIRYCOMMAND_H__ diff --git a/src/commands/changeownertrustcommand.h b/src/commands/changeownertrustcommand.h index 4c8af5665..e5e05ff5f 100644 --- a/src/commands/changeownertrustcommand.h +++ b/src/commands/changeownertrustcommand.h @@ -1,50 +1,48 @@ /* -*- mode: c++; c-basic-offset:4 -*- commands/changeownertrustcommand.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2008 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_COMMMANDS_CHANGEOWNERTRUSTCOMMAND_H__ -#define __KLEOPATRA_COMMMANDS_CHANGEOWNERTRUSTCOMMAND_H__ +#pragma once #include namespace Kleo { namespace Commands { class ChangeOwnerTrustCommand : public Command { Q_OBJECT public: explicit ChangeOwnerTrustCommand(QAbstractItemView *view, KeyListController *parent); explicit ChangeOwnerTrustCommand(KeyListController *parent); explicit ChangeOwnerTrustCommand(const GpgME::Key &key); ~ChangeOwnerTrustCommand() override; /* reimp */ static Restrictions restrictions() { return OnlyOneKey | MustBeOpenPGP | MayOnlyBeSecretKeyIfOwnerTrustIsNotYetUltimate; } private: void doStart() override; void doCancel() override; private: class Private; inline Private *d_func(); inline const Private *d_func() const; Q_PRIVATE_SLOT(d_func(), void slotResult(GpgME::Error)) Q_PRIVATE_SLOT(d_func(), void slotDialogAccepted()) Q_PRIVATE_SLOT(d_func(), void slotDialogRejected()) }; } } -#endif // __KLEOPATRA_COMMMANDS_CHANGEOWNERTRUSTCOMMAND_H__ diff --git a/src/commands/changepassphrasecommand.h b/src/commands/changepassphrasecommand.h index e7b2d22a9..317c99715 100644 --- a/src/commands/changepassphrasecommand.h +++ b/src/commands/changepassphrasecommand.h @@ -1,48 +1,46 @@ /* -*- mode: c++; c-basic-offset:4 -*- commands/changepassphrasecommand.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2010 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_COMMMANDS_CHANGEPASSPHRASECOMMAND_H__ -#define __KLEOPATRA_COMMMANDS_CHANGEPASSPHRASECOMMAND_H__ +#pragma once #include namespace Kleo { namespace Commands { class ChangePassphraseCommand : public Command { Q_OBJECT public: explicit ChangePassphraseCommand(QAbstractItemView *view, KeyListController *parent); explicit ChangePassphraseCommand(KeyListController *parent); explicit ChangePassphraseCommand(const GpgME::Key &key); ~ChangePassphraseCommand() override; /* reimp */ static Restrictions restrictions() { return OnlyOneKey | NeedSecretKey; } private: void doStart() override; void doCancel() override; private: class Private; inline Private *d_func(); inline const Private *d_func() const; Q_PRIVATE_SLOT(d_func(), void slotResult(GpgME::Error)) }; } } -#endif // __KLEOPATRA_COMMMANDS_CHANGEPASSPHRASECOMMAND_H__ diff --git a/src/commands/changepincommand.h b/src/commands/changepincommand.h index 83090958a..34cfebfc7 100644 --- a/src/commands/changepincommand.h +++ b/src/commands/changepincommand.h @@ -1,55 +1,53 @@ /* commands/changepincommand.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2020 g10 Code GmbH SPDX-FileContributor: Ingo Klöcker SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_COMMMANDS_CHANGEPINCOMMAND_H__ -#define __KLEOPATRA_COMMMANDS_CHANGEPINCOMMAND_H__ +#pragma once #include "cardcommand.h" namespace GpgME { class Error; } namespace Kleo { namespace Commands { class ChangePinCommand : public CardCommand { Q_OBJECT public: enum ChangePinMode { NormalMode = 0, ResetMode = 1, NullPinMode = 2 }; explicit ChangePinCommand(const std::string &serialNumber, const std::string &appName, QWidget *parent); ~ChangePinCommand() override; void setKeyRef(const std::string &keyRef); void setMode(ChangePinMode mode = NormalMode); private: void doStart() override; void doCancel() override; private: class Private; inline Private *d_func(); inline const Private *d_func() const; Q_PRIVATE_SLOT(d_func(), void slotResult(GpgME::Error)) }; } // namespace Commands } // namespace Kleo -#endif // __KLEOPATRA_COMMMANDS_CHANGEPINCOMMAND_H__ diff --git a/src/commands/changeroottrustcommand.h b/src/commands/changeroottrustcommand.h index 2787e42a4..1edba3429 100644 --- a/src/commands/changeroottrustcommand.h +++ b/src/commands/changeroottrustcommand.h @@ -1,119 +1,117 @@ /* -*- mode: c++; c-basic-offset:4 -*- commands/changeroottrustcommand.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2010 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_COMMANDS_CHANGEROOTTRUSTCOMMAND_H__ -#define __KLEOPATRA_COMMANDS_CHANGEROOTTRUSTCOMMAND_H__ +#pragma once #include #include namespace Kleo { namespace Commands { class ChangeRootTrustCommand : public Command { Q_OBJECT public: explicit ChangeRootTrustCommand(KeyListController *parent); explicit ChangeRootTrustCommand(QAbstractItemView *view, KeyListController *parent); explicit ChangeRootTrustCommand(const GpgME::Key &key, KeyListController *parent); explicit ChangeRootTrustCommand(const GpgME::Key &key, QAbstractItemView *view, KeyListController *parent); ~ChangeRootTrustCommand() override; void setTrust(GpgME::Key::OwnerTrust trust); GpgME::Key::OwnerTrust trust() const; void setTrustListFile(const QString &file); QString trustListFile() const; /* reimp */ static Restrictions restrictions() { return OnlyOneKey | MustBeCMS | MustBeRoot; } private: void doStart() override; void doCancel() override; private: class Private; inline Private *d_func(); inline const Private *d_func() const; Q_PRIVATE_SLOT(d_func(), void slotOperationFinished()) }; class TrustRootCommand : public ChangeRootTrustCommand { public: explicit TrustRootCommand(KeyListController *parent) : ChangeRootTrustCommand(parent) { setTrust(GpgME::Key::Ultimate); } explicit TrustRootCommand(QAbstractItemView *view, KeyListController *parent) : ChangeRootTrustCommand(view, parent) { setTrust(GpgME::Key::Ultimate); } explicit TrustRootCommand(const GpgME::Key &key, KeyListController *parent) : ChangeRootTrustCommand(key, parent) { setTrust(GpgME::Key::Ultimate); } explicit TrustRootCommand(const GpgME::Key &key, QAbstractItemView *view, KeyListController *parent) : ChangeRootTrustCommand(key, view, parent) { setTrust(GpgME::Key::Ultimate); } /* reimp */ static Restrictions restrictions() { return ChangeRootTrustCommand::restrictions() | MustBeUntrustedRoot; } }; class DistrustRootCommand : public ChangeRootTrustCommand { public: explicit DistrustRootCommand(KeyListController *parent) : ChangeRootTrustCommand(parent) { setTrust(GpgME::Key::Never); } explicit DistrustRootCommand(QAbstractItemView *view, KeyListController *parent) : ChangeRootTrustCommand(view, parent) { setTrust(GpgME::Key::Never); } explicit DistrustRootCommand(const GpgME::Key &key, KeyListController *parent) : ChangeRootTrustCommand(key, parent) { setTrust(GpgME::Key::Never); } explicit DistrustRootCommand(const GpgME::Key &key, QAbstractItemView *view, KeyListController *parent) : ChangeRootTrustCommand(key, view, parent) { setTrust(GpgME::Key::Never); } /* reimp */ static Restrictions restrictions() { return ChangeRootTrustCommand::restrictions() | MustBeTrustedRoot; } }; } } -#endif /* __KLEOPATRA_COMMANDS_CHANGEROOTTRUSTCOMMAND_H__ */ diff --git a/src/commands/checksumcreatefilescommand.h b/src/commands/checksumcreatefilescommand.h index 150bb8b12..b8528ac0b 100644 --- a/src/commands/checksumcreatefilescommand.h +++ b/src/commands/checksumcreatefilescommand.h @@ -1,53 +1,51 @@ /* -*- mode: c++; c-basic-offset:4 -*- commands/checksumcreatefilescommand.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2008 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_COMMMANDS_CHECKSUMCREATEFILESCOMMAND_H__ -#define __KLEOPATRA_COMMMANDS_CHECKSUMCREATEFILESCOMMAND_H__ +#pragma once #include #include #include #include namespace Kleo { namespace Commands { class ChecksumCreateFilesCommand : public Command { Q_OBJECT public: explicit ChecksumCreateFilesCommand(QAbstractItemView *view, KeyListController *parent); explicit ChecksumCreateFilesCommand(KeyListController *parent); explicit ChecksumCreateFilesCommand(const QStringList &files, QAbstractItemView *view, KeyListController *parent); explicit ChecksumCreateFilesCommand(const QStringList &files, KeyListController *parent); ~ChecksumCreateFilesCommand() override; void setFiles(const QStringList &files); private: void doStart() override; void doCancel() override; private: class Private; inline Private *d_func(); inline const Private *d_func() const; Q_PRIVATE_SLOT(d_func(), void slotControllerDone()) Q_PRIVATE_SLOT(d_func(), void slotControllerError(int, QString)) }; } } -#endif // __KLEOPATRA_COMMMANDS_CHECKSUMCREATEFILESCOMMAND_H__ diff --git a/src/commands/checksumverifyfilescommand.h b/src/commands/checksumverifyfilescommand.h index 1fc8d4240..0a82ada0a 100644 --- a/src/commands/checksumverifyfilescommand.h +++ b/src/commands/checksumverifyfilescommand.h @@ -1,53 +1,51 @@ /* -*- mode: c++; c-basic-offset:4 -*- commands/checksumverifyfilescommand.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2008 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_COMMMANDS_CHECKSUMVERIFYFILESCOMMAND_H__ -#define __KLEOPATRA_COMMMANDS_CHECKSUMVERIFYFILESCOMMAND_H__ +#pragma once #include #include #include #include namespace Kleo { namespace Commands { class ChecksumVerifyFilesCommand : public Command { Q_OBJECT public: explicit ChecksumVerifyFilesCommand(QAbstractItemView *view, KeyListController *parent); explicit ChecksumVerifyFilesCommand(KeyListController *parent); explicit ChecksumVerifyFilesCommand(const QStringList &files, QAbstractItemView *view, KeyListController *parent); explicit ChecksumVerifyFilesCommand(const QStringList &files, KeyListController *parent); ~ChecksumVerifyFilesCommand() override; void setFiles(const QStringList &files); private: void doStart() override; void doCancel() override; private: class Private; inline Private *d_func(); inline const Private *d_func() const; Q_PRIVATE_SLOT(d_func(), void slotControllerDone()) Q_PRIVATE_SLOT(d_func(), void slotControllerError(int, QString)) }; } } -#endif // __KLEOPATRA_COMMMANDS_CHECKSUMVERIFYFILESCOMMAND_H__ diff --git a/src/commands/clearcrlcachecommand.h b/src/commands/clearcrlcachecommand.h index 189442004..81e0df783 100644 --- a/src/commands/clearcrlcachecommand.h +++ b/src/commands/clearcrlcachecommand.h @@ -1,42 +1,40 @@ /* -*- mode: c++; c-basic-offset:4 -*- commands/clearcrlcachecommand.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2008 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_COMMMANDS_CLEARCRLCACHECOMMAND_H__ -#define __KLEOPATRA_COMMMANDS_CLEARCRLCACHECOMMAND_H__ +#pragma once #include namespace Kleo { namespace Commands { class ClearCrlCacheCommand : public GnuPGProcessCommand { Q_OBJECT public: explicit ClearCrlCacheCommand(QAbstractItemView *view, KeyListController *parent); explicit ClearCrlCacheCommand(KeyListController *parent); ~ClearCrlCacheCommand() override; private: QStringList arguments() const override; QString errorCaption() const override; QString successCaption() const override; QString crashExitMessage(const QStringList &) const override; QString errorExitMessage(const QStringList &) const override; QString successMessage(const QStringList &) const override; }; } } -#endif // __KLEOPATRA_COMMMANDS_CLEARCRLCACHECOMMAND_H__ diff --git a/src/commands/command.h b/src/commands/command.h index 73f99698d..b55592531 100644 --- a/src/commands/command.h +++ b/src/commands/command.h @@ -1,139 +1,137 @@ /* -*- mode: c++; c-basic-offset:4 -*- commands/command.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2007 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_COMMANDS_COMMAND_H__ -#define __KLEOPATRA_COMMANDS_COMMAND_H__ +#pragma once #include #include // for WId #include #include // for ExecutionContext #include class QModelIndex; template class QList; class QAbstractItemView; namespace GpgME { class Key; } namespace Kleo { class KeyListController; class AbstractKeyListSortFilterProxyModel; class Command : public QObject, public ExecutionContext { Q_OBJECT public: explicit Command(KeyListController *parent); explicit Command(QAbstractItemView *view, KeyListController *parent); explicit Command(const GpgME::Key &key); explicit Command(const std::vector &keys); ~Command() override; enum Restriction { NoRestriction = 0, NeedSelection = 1, OnlyOneKey = 2, NeedSecretKey = 4, MustNotBeSecretKey = 8, MustBeOpenPGP = 16, MustBeCMS = 32, // esoteric: MayOnlyBeSecretKeyIfOwnerTrustIsNotYetUltimate = 64, // for set-owner-trust AnyCardHasNullPin = 128, AnyCardCanLearnKeys = 256, MustBeRoot = 512, MustBeTrustedRoot = 1024 | MustBeRoot, MustBeUntrustedRoot = 2048 | MustBeRoot, _AllRestrictions_Helper, AllRestrictions = 2 * (_AllRestrictions_Helper - 1) - 1 }; Q_DECLARE_FLAGS(Restrictions, Restriction) static Restrictions restrictions() { return NoRestriction; } /** Classify the files and return the most appropriate commands. * * @param files: A list of files. * * @returns null QString on success. Error message otherwise. */ static QVectorcommandsForFiles(const QStringList &files); /** Get a command for a query. * * @param query: A keyid / fingerprint or any string to use in the search. */ static Command *commandForQuery(const QString &query); void setParentWidget(QWidget *widget); void setParentWId(WId wid); void setView(QAbstractItemView *view); void setIndex(const QModelIndex &idx); void setIndexes(const QList &idx); void setKey(const GpgME::Key &key); void setKeys(const std::vector &keys); void setAutoDelete(bool on); bool autoDelete() const; void setWarnWhenRunningAtShutdown(bool warn); bool warnWhenRunningAtShutdown() const; public Q_SLOTS: void start(); void cancel(); Q_SIGNALS: void info(const QString &message, int timeout = 0); void progress(const QString &message, int current, int total); void finished(); void canceled(); private: virtual void doStart() = 0; virtual void doCancel() = 0; private: void applyWindowID(QWidget *wid) const override; protected: void addTemporaryView(const QString &title, AbstractKeyListSortFilterProxyModel *proxy = nullptr, const QString &tabToolTip = QString()); protected: class Private; kdtools::pimpl_ptr d; protected: explicit Command(Private *pp); explicit Command(QAbstractItemView *view, Private *pp); explicit Command(const std::vector &keys, Private *pp); explicit Command(const GpgME::Key &key, Private *pp); }; } Q_DECLARE_OPERATORS_FOR_FLAGS(Kleo::Command::Restrictions) -#endif /* __KLEOPATRA_COMMANDS_COMMAND_H__ */ diff --git a/src/commands/command_p.h b/src/commands/command_p.h index d3e807010..7923b1a5d 100644 --- a/src/commands/command_p.h +++ b/src/commands/command_p.h @@ -1,123 +1,121 @@ /* -*- mode: c++; c-basic-offset:4 -*- commands/command_p.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2007 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_COMMANDS_COMMAND_P_H__ -#define __KLEOPATRA_COMMANDS_COMMAND_P_H__ +#pragma once #include "command.h" #include "view/keylistcontroller.h" #include #include #include #include #include #include #include #include #include class Kleo::Command::Private { friend class ::Kleo::Command; protected: Command *const q; public: explicit Private(Command *qq); explicit Private(Command *qq, KeyListController *controller); explicit Private(Command *qq, QWidget *parent); virtual ~Private(); QAbstractItemView *view() const { return view_; } QWidget *parentWidgetOrView() const { if (parentWidget_) { return parentWidget_; } else { return view_; } } KeyListModelInterface *model() const { return view_ ? dynamic_cast(view_->model()) : nullptr; } KeyListController *controller() const { return controller_; } QList indexes() const { QList result; std::copy(indexes_.begin(), indexes_.end(), std::back_inserter(result)); return result; } GpgME::Key key() const { return keys_.empty() ? model() && !indexes_.empty() ? model()->key(indexes_.front()) : GpgME::Key::null : keys_.front(); } std::vector keys() const { return keys_.empty() ? model() ? model()->keys(indexes()) : std::vector() : keys_; } void finished() { Q_EMIT q->finished(); if (autoDelete) { q->deleteLater(); } } void canceled() { Q_EMIT q->canceled(); finished(); } void error(const QString &text, const QString &caption = QString(), KMessageBox::Options options = KMessageBox::Notify) const { if (parentWId) { KMessageBox::errorWId(parentWId, text, caption, options); } else { KMessageBox::error(parentWidgetOrView(), text, caption, options); } } void information(const QString &text, const QString &caption = QString(), const QString &dontShowAgainName = QString(), KMessageBox::Options options = KMessageBox::Notify) const { if (parentWId) { KMessageBox::informationWId(parentWId, text, caption, dontShowAgainName, options); } else { KMessageBox::information(parentWidgetOrView(), text, caption, dontShowAgainName, options); } } void applyWindowID(QWidget *w) const { q->applyWindowID(w); } private: bool autoDelete : 1; bool warnWhenRunningAtShutdown : 1; std::vector keys_; QList indexes_; QPointer view_; QPointer parentWidget_; WId parentWId = 0; QPointer controller_; }; -#endif /* __KLEOPATRA_COMMANDS_COMMAND_P_H__ */ diff --git a/src/commands/createcsrforcardkeycommand.h b/src/commands/createcsrforcardkeycommand.h index cbac948dc..f91244584 100644 --- a/src/commands/createcsrforcardkeycommand.h +++ b/src/commands/createcsrforcardkeycommand.h @@ -1,44 +1,42 @@ /* -*- mode: c++; c-basic-offset:4 -*- commands/createcsrforcardkeycommand.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2020 g10 Code GmbH SPDX-FileContributor: Ingo Klöcker SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_COMMANDS_CREATECSRFORCARDKEYCOMMAND_H__ -#define __KLEOPATRA_COMMANDS_CREATECSRFORCARDKEYCOMMAND_H__ +#pragma once #include "cardcommand.h" namespace Kleo { namespace Commands { class CreateCSRForCardKeyCommand : public CardCommand { Q_OBJECT public: explicit CreateCSRForCardKeyCommand(const std::string &keyRef, const std::string &serialNumber, const std::string &appName, QWidget *parent = nullptr); ~CreateCSRForCardKeyCommand() override; private: void doStart() override; void doCancel() override; private: class Private; inline Private *d_func(); inline const Private *d_func() const; Q_PRIVATE_SLOT(d_func(), void slotDialogAccepted()) Q_PRIVATE_SLOT(d_func(), void slotDialogRejected()) Q_PRIVATE_SLOT(d_func(), void slotResult(const GpgME::KeyGenerationResult &, const QByteArray &)) }; } // namespace Commands } // namespace Kleo -#endif // __KLEOPATRA_COMMANDS_CREATECSRFORCARDKEYCOMMAND_H__ diff --git a/src/commands/createopenpgpkeyfromcardkeyscommand.h b/src/commands/createopenpgpkeyfromcardkeyscommand.h index 68ccf540d..dd27d224b 100644 --- a/src/commands/createopenpgpkeyfromcardkeyscommand.h +++ b/src/commands/createopenpgpkeyfromcardkeyscommand.h @@ -1,46 +1,44 @@ /* -*- mode: c++; c-basic-offset:4 -*- commands/createopenpgpkeyfromcardkeyscommand.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2020 g10 Code GmbH SPDX-FileContributor: Ingo Klöcker SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_COMMANDS_CREATEOPENPGPKEYFROMCARDKEYSCOMMAND_H__ -#define __KLEOPATRA_COMMANDS_CREATEOPENPGPKEYFROMCARDKEYSCOMMAND_H__ +#pragma once #include namespace Kleo { namespace Commands { class CreateOpenPGPKeyFromCardKeysCommand : public CardCommand { Q_OBJECT public: explicit CreateOpenPGPKeyFromCardKeysCommand(const std::string &serialNumber, const std::string &appName, QWidget *parent = nullptr); ~CreateOpenPGPKeyFromCardKeysCommand() override; static bool isSupported(); private: void doStart() override; void doCancel() override; private: class Private; inline Private *d_func(); inline const Private *d_func() const; Q_PRIVATE_SLOT(d_func(), void slotDialogAccepted()) Q_PRIVATE_SLOT(d_func(), void slotDialogRejected()) Q_PRIVATE_SLOT(d_func(), void slotResult(GpgME::Error)) }; } // namespace Commands } // namespace Kleo -#endif // __KLEOPATRA_COMMANDS_CREATEOPENPGPKEYFROMCARDKEYSCOMMAND_H__ diff --git a/src/commands/decryptverifyclipboardcommand.h b/src/commands/decryptverifyclipboardcommand.h index 2e80e911d..1149a7158 100644 --- a/src/commands/decryptverifyclipboardcommand.h +++ b/src/commands/decryptverifyclipboardcommand.h @@ -1,51 +1,49 @@ /* -*- mode: c++; c-basic-offset:4 -*- commands/decryptverifyclipboardcommand.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2008 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_COMMMANDS_DECRYPTVERIFYCLIPBOARDCOMMAND_H__ -#define __KLEOPATRA_COMMMANDS_DECRYPTVERIFYCLIPBOARDCOMMAND_H__ +#pragma once #include #ifndef QT_NO_CLIPBOARD #include namespace Kleo { namespace Commands { class DecryptVerifyClipboardCommand : public Command { Q_OBJECT public: explicit DecryptVerifyClipboardCommand(QAbstractItemView *view, KeyListController *parent); explicit DecryptVerifyClipboardCommand(KeyListController *parent); ~DecryptVerifyClipboardCommand() override; static bool canDecryptVerifyCurrentClipboard(); private: void doStart() override; void doCancel() override; private: class Private; inline Private *d_func(); inline const Private *d_func() const; Q_PRIVATE_SLOT(d_func(), void slotControllerDone()) Q_PRIVATE_SLOT(d_func(), void slotControllerError(int, QString)) }; } } #endif // QT_NO_CLIPBOARD -#endif // __KLEOPATRA_COMMMANDS_DECRYPTVERIFYCLIPBOARDCOMMAND_H__ diff --git a/src/commands/decryptverifyfilescommand.h b/src/commands/decryptverifyfilescommand.h index 66380eaac..fb4a4cc76 100644 --- a/src/commands/decryptverifyfilescommand.h +++ b/src/commands/decryptverifyfilescommand.h @@ -1,54 +1,52 @@ /* -*- mode: c++; c-basic-offset:4 -*- commands/decryptverifyfilescommand.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2008 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_COMMMANDS_DECRYPTVERIFYFILESCOMMAND_H__ -#define __KLEOPATRA_COMMMANDS_DECRYPTVERIFYFILESCOMMAND_H__ +#pragma once #include "commands/command.h" #include "utils/types.h" #include namespace Kleo { namespace Commands { class DecryptVerifyFilesCommand : public Command { Q_OBJECT public: explicit DecryptVerifyFilesCommand(QAbstractItemView *view, KeyListController *parent); explicit DecryptVerifyFilesCommand(KeyListController *parent); explicit DecryptVerifyFilesCommand(const QStringList &files, QAbstractItemView *view, KeyListController *parent); explicit DecryptVerifyFilesCommand(const QStringList &files, KeyListController *parent, bool forceManualMode = false); ~DecryptVerifyFilesCommand() override; void setFiles(const QStringList &files); void setOperation(DecryptVerifyOperation operation); DecryptVerifyOperation operation() const; private: void doStart() override; void doCancel() override; private: class Private; inline Private *d_func(); inline const Private *d_func() const; Q_PRIVATE_SLOT(d_func(), void slotControllerDone()) Q_PRIVATE_SLOT(d_func(), void slotControllerError(int, QString)) }; } } -#endif // __KLEOPATRA_COMMMANDS_DECRYPTVERIFYFILESCOMMAND_H__ diff --git a/src/commands/deletecertificatescommand.h b/src/commands/deletecertificatescommand.h index e54624498..576ca561a 100644 --- a/src/commands/deletecertificatescommand.h +++ b/src/commands/deletecertificatescommand.h @@ -1,46 +1,44 @@ /* -*- mode: c++; c-basic-offset:4 -*- deletecertificatescommand.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2007 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_COMMANDS_DELETECERTIFICATESCOMMAND_H__ -#define __KLEOPATRA_COMMANDS_DELETECERTIFICATESCOMMAND_H__ +#pragma once #include "command.h" namespace Kleo { class DeleteCertificatesCommand : public Command { Q_OBJECT public: explicit DeleteCertificatesCommand(QAbstractItemView *view, KeyListController *parent); explicit DeleteCertificatesCommand(KeyListController *parent); ~DeleteCertificatesCommand() override; /* reimp */ static Restrictions restrictions() { return NeedSelection; } private: void doStart() override; void doCancel() override; private: class Private; inline Private *d_func(); inline const Private *d_func() const; Q_PRIVATE_SLOT(d_func(), void slotDialogAccepted()) Q_PRIVATE_SLOT(d_func(), void slotDialogRejected()) Q_PRIVATE_SLOT(d_func(), void pgpDeleteResult(GpgME::Error)) Q_PRIVATE_SLOT(d_func(), void cmsDeleteResult(GpgME::Error)) }; } -#endif // __KLEOPATRA_COMMANDS_DELETECERTIFICATESCOMMAND_H__ diff --git a/src/commands/detailscommand.h b/src/commands/detailscommand.h index 7c778561d..93e618535 100644 --- a/src/commands/detailscommand.h +++ b/src/commands/detailscommand.h @@ -1,54 +1,52 @@ /* -*- mode: c++; c-basic-offset:4 -*- commands/detailscommand.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2007 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_COMMANDS_DETAILSCOMMAND_H__ -#define __KLEOPATRA_COMMANDS_DETAILSCOMMAND_H__ +#pragma once #include namespace GpgME { class Key; } namespace Kleo { namespace Commands { class DetailsCommand : public Command { Q_OBJECT public: explicit DetailsCommand(KeyListController *parent); explicit DetailsCommand(QAbstractItemView *view, KeyListController *parent); explicit DetailsCommand(const GpgME::Key &key, KeyListController *parent); explicit DetailsCommand(const GpgME::Key &key, QAbstractItemView *view, KeyListController *parent); ~DetailsCommand() override; /* reimp */ static Restrictions restrictions() { return OnlyOneKey; } private: void doStart() override; void doCancel() override; private: class Private; inline Private *d_func(); inline const Private *d_func() const; Q_PRIVATE_SLOT(d_func(), void slotDialogClosed()) }; } } -#endif /* __KLEOPATRA_COMMANDS_DETAILSCOMMAND_H__ */ diff --git a/src/commands/dumpcertificatecommand.h b/src/commands/dumpcertificatecommand.h index a7a994a8a..0049338d8 100644 --- a/src/commands/dumpcertificatecommand.h +++ b/src/commands/dumpcertificatecommand.h @@ -1,57 +1,55 @@ /* -*- mode: c++; c-basic-offset:4 -*- commands/dumpcertificatecommand.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2008 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_COMMMANDS_DUMPCERTIFICATECOMMAND_H__ -#define __KLEOPATRA_COMMMANDS_DUMPCERTIFICATECOMMAND_H__ +#pragma once #include namespace Kleo { namespace Commands { class DumpCertificateCommand : public Command { Q_OBJECT public: explicit DumpCertificateCommand(QAbstractItemView *view, KeyListController *parent); explicit DumpCertificateCommand(KeyListController *parent); explicit DumpCertificateCommand(const GpgME::Key &key); ~DumpCertificateCommand() override; static Restrictions restrictions() { return OnlyOneKey | MustBeCMS; } void setUseDialog(bool on); bool useDialog() const; QStringList output() const; private: void doStart() override; void doCancel() override; private: class Private; inline Private *d_func(); inline const Private *d_func() const; Q_PRIVATE_SLOT(d_func(), void slotProcessFinished(int, QProcess::ExitStatus)) Q_PRIVATE_SLOT(d_func(), void slotProcessReadyReadStandardOutput()) Q_PRIVATE_SLOT(d_func(), void slotProcessReadyReadStandardError()) Q_PRIVATE_SLOT(d_func(), void slotUpdateRequested()) Q_PRIVATE_SLOT(d_func(), void slotDialogDestroyed()) }; } } -#endif // __KLEOPATRA_COMMMANDS_DUMPCERTIFICATECOMMAND_H__ diff --git a/src/commands/dumpcrlcachecommand.h b/src/commands/dumpcrlcachecommand.h index 1a6e8ee1a..472fc90b5 100644 --- a/src/commands/dumpcrlcachecommand.h +++ b/src/commands/dumpcrlcachecommand.h @@ -1,46 +1,44 @@ /* -*- mode: c++; c-basic-offset:4 -*- commands/dumpcrlcachecommand.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2008 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_COMMMANDS_DUMPCRLCACHECOMMAND_H__ -#define __KLEOPATRA_COMMMANDS_DUMPCRLCACHECOMMAND_H__ +#pragma once #include namespace Kleo { namespace Commands { class DumpCrlCacheCommand : public Command { Q_OBJECT public: explicit DumpCrlCacheCommand(QAbstractItemView *view, KeyListController *parent); explicit DumpCrlCacheCommand(KeyListController *parent); ~DumpCrlCacheCommand() override; private: void doStart() override; void doCancel() override; private: class Private; inline Private *d_func(); inline const Private *d_func() const; Q_PRIVATE_SLOT(d_func(), void slotProcessFinished(int, QProcess::ExitStatus)) Q_PRIVATE_SLOT(d_func(), void slotProcessReadyReadStandardOutput()) Q_PRIVATE_SLOT(d_func(), void slotProcessReadyReadStandardError()) Q_PRIVATE_SLOT(d_func(), void slotUpdateRequested()) Q_PRIVATE_SLOT(d_func(), void slotDialogDestroyed()) }; } } -#endif // __KLEOPATRA_COMMMANDS_DUMPCRLCACHECOMMAND_H__ diff --git a/src/commands/encryptclipboardcommand.h b/src/commands/encryptclipboardcommand.h index 94165408c..195db2098 100644 --- a/src/commands/encryptclipboardcommand.h +++ b/src/commands/encryptclipboardcommand.h @@ -1,52 +1,50 @@ /* -*- mode: c++; c-basic-offset:4 -*- commands/encryptclipboardcommand.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2008 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_COMMMANDS_ENCRYPTCLIPBOARDCOMMAND_H__ -#define __KLEOPATRA_COMMMANDS_ENCRYPTCLIPBOARDCOMMAND_H__ +#pragma once #include #ifndef QT_NO_CLIPBOARD #include namespace Kleo { namespace Commands { class EncryptClipboardCommand : public Command { Q_OBJECT public: explicit EncryptClipboardCommand(QAbstractItemView *view, KeyListController *parent); explicit EncryptClipboardCommand(KeyListController *parent); ~EncryptClipboardCommand() override; static bool canEncryptCurrentClipboard(); private: void doStart() override; void doCancel() override; private: class Private; inline Private *d_func(); inline const Private *d_func() const; Q_PRIVATE_SLOT(d_func(), void slotRecipientsResolved()) Q_PRIVATE_SLOT(d_func(), void slotControllerDone()) Q_PRIVATE_SLOT(d_func(), void slotControllerError(int, QString)) }; } } #endif // QT_NO_CLIPBOARD -#endif // __KLEOPATRA_COMMMANDS_ENCRYPTCLIPBOARDCOMMAND_H__ diff --git a/src/commands/exportcertificatecommand.h b/src/commands/exportcertificatecommand.h index a55dc1c30..d7a91fe90 100644 --- a/src/commands/exportcertificatecommand.h +++ b/src/commands/exportcertificatecommand.h @@ -1,50 +1,48 @@ /* -*- mode: c++; c-basic-offset:4 -*- exportcertificatecommand.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2007 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_EXPORTCERTIFICATECOMMAND_H__ -#define __KLEOPATRA_EXPORTCERTIFICATECOMMAND_H__ +#pragma once #include "command.h" namespace Kleo { class ExportCertificateCommand : public Command { Q_OBJECT public: explicit ExportCertificateCommand(QAbstractItemView *view, KeyListController *parent); explicit ExportCertificateCommand(KeyListController *parent); explicit ExportCertificateCommand(const GpgME::Key &key); ~ExportCertificateCommand() override; /* reimp */ static Restrictions restrictions() { return NeedSelection; } void setOpenPGPFileName(const QString &fileName); QString openPGPFileName() const; void setX509FileName(const QString &fileName); QString x509FileName() const; private: void doStart() override; void doCancel() override; private: class Private; inline Private *d_func(); inline const Private *d_func() const; Q_PRIVATE_SLOT(d_func(), void exportResult(GpgME::Error, QByteArray)) }; } -#endif // __KLEOPATRA_EXPORTCERTIFICATECOMMAND_H__ diff --git a/src/commands/exportopenpgpcertstoservercommand.h b/src/commands/exportopenpgpcertstoservercommand.h index 5c982be14..79fd1d32c 100644 --- a/src/commands/exportopenpgpcertstoservercommand.h +++ b/src/commands/exportopenpgpcertstoservercommand.h @@ -1,51 +1,49 @@ /* -*- mode: c++; c-basic-offset:4 -*- commands/exportopenpgpcertstoservercommand.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2008 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_COMMMANDS_EXPORTOPENPGPCERTSTOSERVERCOMMAND_H__ -#define __KLEOPATRA_COMMMANDS_EXPORTOPENPGPCERTSTOSERVERCOMMAND_H__ +#pragma once #include namespace Kleo { namespace Commands { class ExportOpenPGPCertsToServerCommand : public GnuPGProcessCommand { Q_OBJECT public: explicit ExportOpenPGPCertsToServerCommand(QAbstractItemView *view, KeyListController *parent); explicit ExportOpenPGPCertsToServerCommand(KeyListController *parent); explicit ExportOpenPGPCertsToServerCommand(const GpgME::Key &key); ~ExportOpenPGPCertsToServerCommand() override; static Restrictions restrictions() { return MustBeOpenPGP; } private: bool preStartHook(QWidget *) const override; QStringList arguments() const override; QString errorCaption() const override; QString successCaption() const override; QString crashExitMessage(const QStringList &) const override; QString errorExitMessage(const QStringList &) const override; QString successMessage(const QStringList &) const override; }; } } -#endif // __KLEOPATRA_COMMMANDS_EXPORTOPENPGPCERTSTOSERVERCOMMAND_H__ diff --git a/src/commands/exportpaperkeycommand.h b/src/commands/exportpaperkeycommand.h index 91bd9adbe..68af54e6b 100644 --- a/src/commands/exportpaperkeycommand.h +++ b/src/commands/exportpaperkeycommand.h @@ -1,59 +1,57 @@ /* -*- mode: c++; c-basic-offset:4 -*- commands/exportsecretkeycommand.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 */ -#ifndef __KLEOPATRA_COMMMANDS_EXPORTPAPERKEYCOMMAND_H__ -#define __KLEOPATRA_COMMMANDS_EXPORTPAPERKEYCOMMAND_H__ +#pragma once #include #include #include class QWidget; namespace Kleo { namespace Commands { class ExportPaperKeyCommand : public GnuPGProcessCommand { Q_OBJECT public: explicit ExportPaperKeyCommand(QAbstractItemView *view, KeyListController *parent); static Restrictions restrictions() { return OnlyOneKey | NeedSecretKey | MustBeOpenPGP; } protected Q_SLOTS: void pkProcFinished(int code, QProcess::ExitStatus status); private: QStringList arguments() const override; bool preStartHook(QWidget *parentWidget) const override; QString errorCaption() const override; QString crashExitMessage(const QStringList &) const override; QString errorExitMessage(const QStringList &) const override; private: QWidget *const mParent; QProcess mPkProc; }; } } -#endif // __KLEOPATRA_COMMMANDS_EXPORTPAPERKEYCOMMAND_H__ diff --git a/src/commands/exportsecretkeycommand.h b/src/commands/exportsecretkeycommand.h index 237432041..807015c3b 100644 --- a/src/commands/exportsecretkeycommand.h +++ b/src/commands/exportsecretkeycommand.h @@ -1,64 +1,62 @@ /* -*- mode: c++; c-basic-offset:4 -*- commands/exportsecretkeycommand.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2008 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_COMMMANDS_EXPORTSECRETKEYCOMMAND_H__ -#define __KLEOPATRA_COMMMANDS_EXPORTSECRETKEYCOMMAND_H__ +#pragma once #include #include namespace Kleo { namespace Commands { class ExportSecretKeyCommand : public GnuPGProcessCommand { Q_OBJECT public: explicit ExportSecretKeyCommand(QAbstractItemView *view, KeyListController *parent); explicit ExportSecretKeyCommand(KeyListController *parent); explicit ExportSecretKeyCommand(const GpgME::Key &key); ~ExportSecretKeyCommand() override; void setFileName(const QString &fileName); QString fileName() const { return m_filename; } /* reimp */ static Restrictions restrictions() { return OnlyOneKey | NeedSecretKey; } private: bool preStartHook(QWidget *) const override; void postSuccessHook(QWidget *) override; QStringList arguments() const override; QString errorCaption() const override; QString successCaption() const override; QString crashExitMessage(const QStringList &) const override; QString errorExitMessage(const QStringList &) const override; QString successMessage(const QStringList &) const override; private: mutable QString m_filename; mutable bool m_armor; bool mHasError = false; }; } } -#endif // __KLEOPATRA_COMMMANDS_EXPORTSECRETKEYCOMMAND_H__ diff --git a/src/commands/genrevokecommand.h b/src/commands/genrevokecommand.h index a04140dd8..8c3428caf 100644 --- a/src/commands/genrevokecommand.h +++ b/src/commands/genrevokecommand.h @@ -1,56 +1,54 @@ /* -*- mode: c++; c-basic-offset:4 -*- commands/genrevokecommand.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2017 Bundesamt für Sicherheit in der Informationstechnik SPDX-FileContributor: Intevation GmbH SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_COMMMANDS_GENREVOKECOMMAND_H__ -#define __KLEOPATRA_COMMMANDS_GENREVOKECOMMAND_H__ +#pragma once #include #include class QWidget; namespace Kleo { namespace Commands { class GenRevokeCommand : public GnuPGProcessCommand { Q_OBJECT public: explicit GenRevokeCommand(QAbstractItemView *view, KeyListController *parent); explicit GenRevokeCommand(KeyListController *parent); explicit GenRevokeCommand(const GpgME::Key &key); static Restrictions restrictions() { return OnlyOneKey | NeedSecretKey | MustBeOpenPGP; } private: void postSuccessHook(QWidget *parentWidget) override; QStringList arguments() const override; QString errorCaption() const override; QString crashExitMessage(const QStringList &) const override; QString errorExitMessage(const QStringList &) const override; void doStart() override; QString mOutputFileName; }; } } -#endif // __KLEOPATRA_COMMMANDS_GENREVOKECOMMAND_H__ diff --git a/src/commands/gnupgprocesscommand.h b/src/commands/gnupgprocesscommand.h index a6c63758b..3ac54547d 100644 --- a/src/commands/gnupgprocesscommand.h +++ b/src/commands/gnupgprocesscommand.h @@ -1,73 +1,71 @@ /* -*- mode: c++; c-basic-offset:4 -*- commands/gnupgprocesscommand.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2008 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_COMMMANDS_GNUPGPROCESSCOMMAND_H__ -#define __KLEOPATRA_COMMMANDS_GNUPGPROCESSCOMMAND_H__ +#pragma once #include #include class QString; class QProcess; namespace Kleo { namespace Commands { class GnuPGProcessCommand : public Command { Q_OBJECT protected: explicit GnuPGProcessCommand(QAbstractItemView *view, KeyListController *parent); explicit GnuPGProcessCommand(KeyListController *parent); explicit GnuPGProcessCommand(const GpgME::Key &key); ~GnuPGProcessCommand() override; public: QDialog *dialog() const; private: virtual bool preStartHook(QWidget *parentWidget) const; virtual QStringList arguments() const = 0; virtual QString errorCaption() const = 0; virtual QString successCaption() const; virtual QString crashExitMessage(const QStringList &args) const = 0; virtual QString errorExitMessage(const QStringList &args) const = 0; virtual QString successMessage(const QStringList &args) const; virtual void postSuccessHook(QWidget *parentWidget); protected: QString errorString() const; void setIgnoresSuccessOrFailure(bool ignore); bool ignoresSuccessOrFailure() const; void setShowsOutputWindow(bool show); bool showsOutputWindow() const; QProcess *process(); void doStart() override; void doCancel() override; private: class Private; inline Private *d_func(); inline const Private *d_func() const; Q_PRIVATE_SLOT(d_func(), void slotProcessFinished(int, QProcess::ExitStatus)) Q_PRIVATE_SLOT(d_func(), void slotProcessReadyReadStandardError()) }; } } -#endif // __KLEOPATRA_COMMMANDS_GNUPGPROCESSCOMMAND_H__ diff --git a/src/commands/importcertificatefromclipboardcommand.h b/src/commands/importcertificatefromclipboardcommand.h index d71aca7da..0a38c6f21 100644 --- a/src/commands/importcertificatefromclipboardcommand.h +++ b/src/commands/importcertificatefromclipboardcommand.h @@ -1,43 +1,41 @@ /* -*- mode: c++; c-basic-offset:4 -*- importcertificatefromclipboardcommand.h This clipboard is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2007 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_IMPORTCERTIFICATEFROMCLIPBOARDCOMMAND_H__ -#define __KLEOPATRA_IMPORTCERTIFICATEFROMCLIPBOARDCOMMAND_H__ +#pragma once #include "importcertificatescommand.h" #ifndef QT_NO_CLIPBOARD namespace Kleo { class ImportCertificateFromClipboardCommand : public ImportCertificatesCommand { Q_OBJECT public: explicit ImportCertificateFromClipboardCommand(KeyListController *parent); explicit ImportCertificateFromClipboardCommand(QAbstractItemView *view, KeyListController *parent); ~ImportCertificateFromClipboardCommand() override; static bool canImportCurrentClipboard(); private: void doStart() override; private: class Private; inline Private *d_func(); inline const Private *d_func() const; }; } #endif // QT_NO_CLIPBOARD -#endif // __KLEOPATRA_IMPORTCERTIFICATEFROMCLIPBOARDCOMMAND_H__ diff --git a/src/commands/importcertificatefromdatacommand.h b/src/commands/importcertificatefromdatacommand.h index 849e98107..6a5e0c9f2 100644 --- a/src/commands/importcertificatefromdatacommand.h +++ b/src/commands/importcertificatefromdatacommand.h @@ -1,41 +1,39 @@ /* -*- mode: c++; c-basic-offset:4 -*- importcertificatefromdatacommand.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2018 Intevation GmbH SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_IMPORTCERTIFICATEFROMDATACOMMAND_H__ -#define __KLEOPATRA_IMPORTCERTIFICATEFROMDATACOMMAND_H__ +#pragma once #include "importcertificatescommand.h" #include namespace Kleo { class ImportCertificateFromDataCommand : public ImportCertificatesCommand { Q_OBJECT public: explicit ImportCertificateFromDataCommand(const QByteArray &data, GpgME::Protocol proto, const QString &id = QString()); ~ImportCertificateFromDataCommand() override; private: void doStart() override; private: class Private; inline Private *d_func(); inline const Private *d_func() const; }; } -#endif // __KLEOPATRA_IMPORTCERTIFICATEFROMDATACOMMAND_H__ diff --git a/src/commands/importcertificatefromfilecommand.h b/src/commands/importcertificatefromfilecommand.h index 6ccffa1f8..a4c6b79d4 100644 --- a/src/commands/importcertificatefromfilecommand.h +++ b/src/commands/importcertificatefromfilecommand.h @@ -1,45 +1,43 @@ /* -*- mode: c++; c-basic-offset:4 -*- importcertificatefromfilecommand.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2007 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_IMPORTCERTIFICATEFROMFILECOMMAND_H__ -#define __KLEOPATRA_IMPORTCERTIFICATEFROMFILECOMMAND_H__ +#pragma once #include "importcertificatescommand.h" #include namespace Kleo { class ImportCertificateFromFileCommand : public ImportCertificatesCommand { Q_OBJECT public: explicit ImportCertificateFromFileCommand(); explicit ImportCertificateFromFileCommand(KeyListController *parent); explicit ImportCertificateFromFileCommand(QAbstractItemView *view, KeyListController *parent); explicit ImportCertificateFromFileCommand(const QStringList &files, KeyListController *parent); explicit ImportCertificateFromFileCommand(const QStringList &files, QAbstractItemView *view, KeyListController *parent); ~ImportCertificateFromFileCommand() override; void setFiles(const QStringList &files); QStringList files() const; private: void doStart() override; private: class Private; inline Private *d_func(); inline const Private *d_func() const; }; } -#endif // __KLEOPATRA_IMPORTCERTIFICATEFROMFILECOMMAND_H__ diff --git a/src/commands/importcertificatefrompivcardcommand.h b/src/commands/importcertificatefrompivcardcommand.h index e7566d263..58b047683 100644 --- a/src/commands/importcertificatefrompivcardcommand.h +++ b/src/commands/importcertificatefrompivcardcommand.h @@ -1,40 +1,38 @@ /* commands/importcertificatefrompivcardcommand.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2020 g10 Code GmbH SPDX-FileContributor: Ingo Klöcker SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef KLEOPATRA_COMMANDS_IMPORTCERTIFICATEFROMPIVCARDCOMMAND_H -#define KLEOPATRA_COMMANDS_IMPORTCERTIFICATEFROMPIVCARDCOMMAND_H +#pragma once #include "cardcommand.h" namespace Kleo { namespace Commands { class ImportCertificateFromPIVCardCommand : public CardCommand { Q_OBJECT public: ImportCertificateFromPIVCardCommand(const std::string& cardSlot, const std::string &serialno); ~ImportCertificateFromPIVCardCommand() override; private: void doStart() override; void doCancel() override; private: class Private; inline Private *d_func(); inline const Private *d_func() const; }; } } -#endif /* KLEOPATRA_COMMANDS_IMPORTCERTIFICATEFROMPIVCARDCOMMAND_H */ diff --git a/src/commands/importcertificatescommand.h b/src/commands/importcertificatescommand.h index 9d66a251e..b70122988 100644 --- a/src/commands/importcertificatescommand.h +++ b/src/commands/importcertificatescommand.h @@ -1,45 +1,43 @@ /* -*- mode: c++; c-basic-offset:4 -*- commands/importcertificatescommand.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2007, 2008 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_IMPORTCERTIFICATESCOMMAND_H__ -#define __KLEOPATRA_IMPORTCERTIFICATESCOMMAND_H__ +#pragma once #include "command.h" namespace Kleo { class ImportCertificatesCommand : public Command { Q_OBJECT public: explicit ImportCertificatesCommand(KeyListController *parent); explicit ImportCertificatesCommand(QAbstractItemView *view, KeyListController *parent); ~ImportCertificatesCommand() override; protected: void doCancel() override; protected: class Private; inline Private *d_func(); inline const Private *d_func() const; Q_PRIVATE_SLOT(d_func(), void importResult(GpgME::ImportResult)) Q_PRIVATE_SLOT(d_func(), void keyListDone(GpgME::KeyListResult, std::vector keys, QString, GpgME::Error)) protected: explicit ImportCertificatesCommand(Private *pp); explicit ImportCertificatesCommand(QAbstractItemView *view, Private *pp); }; } -#endif // __KLEOPATRA_IMPORTCERTIFICATESCOMMAND_H__ diff --git a/src/commands/importcertificatescommand_p.h b/src/commands/importcertificatescommand_p.h index bfa225134..5b1073e10 100644 --- a/src/commands/importcertificatescommand_p.h +++ b/src/commands/importcertificatescommand_p.h @@ -1,94 +1,92 @@ /* -*- mode: c++; c-basic-offset:4 -*- commands/importcertificatescommand_p.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2007, 2008 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_IMPORTCERTIFICATESCOMMAND_P_H__ -#define __KLEOPATRA_IMPORTCERTIFICATESCOMMAND_P_H__ +#pragma once #include "command_p.h" #include "importcertificatescommand.h" #include #include #include namespace GpgME { class ImportResult; class Import; class KeyListResult; class Error; } namespace QGpgME { class AbstractImportJob; } class QByteArray; class Kleo::ImportCertificatesCommand::Private : public Command::Private { friend class ::Kleo::ImportCertificatesCommand; Kleo::ImportCertificatesCommand *q_func() const { return static_cast(q); } public: explicit Private(ImportCertificatesCommand *qq, KeyListController *c); ~Private(); void setWaitForMoreJobs(bool waiting); void startImport(GpgME::Protocol proto, const QByteArray &data, const QString &id = QString()); void startImport(GpgME::Protocol proto, const std::vector &keys, const QString &id = QString()); void importResult(const GpgME::ImportResult &); void importResult(const GpgME::ImportResult &, const QString &); void showError(QWidget *parent, const GpgME::Error &error, const QString &id = QString()); void showError(const GpgME::Error &error, const QString &id = QString()); void showDetails(QWidget *parent, const std::vector &results, const QStringList &ids); void showDetails(const std::vector &results, const QStringList &ids); void setImportResultProxyModel(const std::vector &results, const QStringList &ids); bool showPleaseCertify(const GpgME::Import &imp); void keyListDone(const GpgME::KeyListResult &result, const std::vector &keys, const QString &, const GpgME::Error&); private: void handleExternalCMSImports(); void tryToFinish(); private: bool waitForMoreJobs; bool containedExternalCMSCerts; std::vector nonWorkingProtocols; std::map idsByJob; std::vector jobs; std::vector results; QStringList ids; }; inline Kleo::ImportCertificatesCommand::Private *Kleo::ImportCertificatesCommand::d_func() { return static_cast(d.get()); } inline const Kleo::ImportCertificatesCommand::Private *Kleo::ImportCertificatesCommand::d_func() const { return static_cast(d.get()); } inline Kleo::ImportCertificatesCommand::ImportCertificatesCommand(Private *pp) : Command(pp) {} inline Kleo::ImportCertificatesCommand::ImportCertificatesCommand(QAbstractItemView *v, Private *pp) : Command(v, pp) {} -#endif /* __KLEOPATRA_IMPORTCERTIFICATESCOMMAND_P_H__ */ diff --git a/src/commands/importcrlcommand.h b/src/commands/importcrlcommand.h index 79f028799..6dca0f14b 100644 --- a/src/commands/importcrlcommand.h +++ b/src/commands/importcrlcommand.h @@ -1,49 +1,47 @@ /* -*- mode: c++; c-basic-offset:4 -*- commands/importcrlcommand.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2008 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_COMMMANDS_IMPORTCRLCOMMAND_H__ -#define __KLEOPATRA_COMMMANDS_IMPORTCRLCOMMAND_H__ +#pragma once #include #include namespace Kleo { namespace Commands { class ImportCrlCommand : public Command { Q_OBJECT public: explicit ImportCrlCommand(QAbstractItemView *view, KeyListController *parent); explicit ImportCrlCommand(KeyListController *parent); explicit ImportCrlCommand(const QStringList &files, QAbstractItemView *view, KeyListController *parent); explicit ImportCrlCommand(const QStringList &files, KeyListController *parent); ~ImportCrlCommand() override; void setFiles(const QStringList &files); private: void doStart() override; void doCancel() override; private: class Private; inline Private *d_func(); inline const Private *d_func() const; Q_PRIVATE_SLOT(d_func(), void slotProcessFinished(int, QProcess::ExitStatus)) Q_PRIVATE_SLOT(d_func(), void slotProcessReadyReadStandardError()) }; } } -#endif // __KLEOPATRA_COMMMANDS_IMPORTCRLCOMMAND_H__ diff --git a/src/commands/importpaperkeycommand.h b/src/commands/importpaperkeycommand.h index b11eb692c..be13ff0f2 100644 --- a/src/commands/importpaperkeycommand.h +++ b/src/commands/importpaperkeycommand.h @@ -1,67 +1,65 @@ /* commands/importpaperkeycommand.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2017 Bundesamt für Sicherheit in der Informationstechnik SPDX-FileContributor: Intevation GmbH SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_COMMMANDS_IMPORTPAPERKEYCOMMAND_H__ -#define __KLEOPATRA_COMMMANDS_IMPORTPAPERKEYCOMMAND_H__ +#pragma once #include #include #include class QWidget; namespace GpgME { class Error; class Key; } // namespace GpgME namespace Kleo { namespace Commands { class ImportPaperKeyCommand : public GnuPGProcessCommand { Q_OBJECT public: explicit ImportPaperKeyCommand(const GpgME::Key &key); static Restrictions restrictions() { return OnlyOneKey | MustBeOpenPGP; } void postSuccessHook(QWidget *parentWidget) override; QString successMessage(const QStringList &args) const override; private Q_SLOTS: void exportResult(const GpgME::Error &err, const QByteArray &data); private: QStringList arguments() const override; void doStart() override; QString errorCaption() const override; QString crashExitMessage(const QStringList &) const override; QString errorExitMessage(const QStringList &) const override; QTemporaryDir mTmpDir; QString mFileName; }; } } -#endif // __KLEOPATRA_COMMMANDS_IMPORTPAPERKEYCOMMAND_H__ diff --git a/src/commands/keytocardcommand.h b/src/commands/keytocardcommand.h index 010151c3c..101c003fa 100644 --- a/src/commands/keytocardcommand.h +++ b/src/commands/keytocardcommand.h @@ -1,60 +1,58 @@ /* commands/keytocardcommand.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2017 Bundesamt für Sicherheit in der Informationstechnik SPDX-FileContributor: Intevation GmbH SPDX-FileCopyrightText: 2020 g10 Code GmbH SPDX-FileContributor: Ingo Klöcker SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_COMMANDS_KEYTOCARDCOMMAND_H__ -#define __KLEOPATRA_COMMANDS_KEYTOCARDCOMMAND_H__ +#pragma once #include #include namespace Kleo { namespace SmartCard { class Card; } } namespace Kleo { namespace Commands { class KeyToCardCommand : public CardCommand { Q_OBJECT public: KeyToCardCommand(const GpgME::Subkey &subkey); KeyToCardCommand(const std::string &cardSlot, const std::string &serialNumber, const std::string &appName); ~KeyToCardCommand() override; static std::vector > getSuitableCards(const GpgME::Subkey &subkey); public Q_SLOTS: void keyToOpenPGPCardDone(const GpgME::Error &err); void keyToPIVCardDone(const GpgME::Error &err); void deleteDone(const GpgME::Error &err); private: void doStart() override; void doCancel() override; private: class Private; inline Private *d_func(); inline const Private *d_func() const; }; } } -#endif /* __KLEOPATRA_COMMANDS_KEYTOCARDCOMMAND_H__ */ diff --git a/src/commands/learncardkeyscommand.h b/src/commands/learncardkeyscommand.h index 9c1ac809c..2c02d76e3 100644 --- a/src/commands/learncardkeyscommand.h +++ b/src/commands/learncardkeyscommand.h @@ -1,55 +1,53 @@ /* -*- mode: c++; c-basic-offset:4 -*- commands/learncardkeyscommand.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2008 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_COMMMANDS_LEARNCARDKEYSCOMMAND_H__ -#define __KLEOPATRA_COMMMANDS_LEARNCARDKEYSCOMMAND_H__ +#pragma once #include #include namespace Kleo { namespace Commands { class LearnCardKeysCommand : public GnuPGProcessCommand { Q_OBJECT public: explicit LearnCardKeysCommand(GpgME::Protocol proto); ~LearnCardKeysCommand() override; GpgME::Protocol protocol() const; /* reimp */ static Restrictions restrictions() { return AnyCardCanLearnKeys; } private: void doStart() override; QStringList arguments() const override; QString errorCaption() const override; QString successCaption() const override; QString crashExitMessage(const QStringList &) const override; QString errorExitMessage(const QStringList &) const override; QString successMessage(const QStringList &) const override; private: GpgME::Protocol m_protocol; }; } } -#endif // __KLEOPATRA_COMMMANDS_LEARNCARDKEYSCOMMAND_H__ diff --git a/src/commands/lookupcertificatescommand.h b/src/commands/lookupcertificatescommand.h index 24c53e0eb..888f4f6b4 100644 --- a/src/commands/lookupcertificatescommand.h +++ b/src/commands/lookupcertificatescommand.h @@ -1,49 +1,47 @@ /* -*- mode: c++; c-basic-offset:4 -*- commands/lookupcertificatescommand.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2008 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_COMMMANDS_LOOKUPCERTIFICATESCOMMAND_H__ -#define __KLEOPATRA_COMMMANDS_LOOKUPCERTIFICATESCOMMAND_H__ +#pragma once #include namespace Kleo { namespace Commands { class LookupCertificatesCommand : public ImportCertificatesCommand { Q_OBJECT public: explicit LookupCertificatesCommand(QAbstractItemView *view, KeyListController *parent); explicit LookupCertificatesCommand(KeyListController *parent); explicit LookupCertificatesCommand(const QString &fingerPrint, KeyListController *parent); ~LookupCertificatesCommand() override; private: void doStart() override; void doCancel() override; private: class Private; inline Private *d_func(); inline const Private *d_func() const; Q_PRIVATE_SLOT(d_func(), void slotSearchTextChanged(QString)) Q_PRIVATE_SLOT(d_func(), void slotNextKey(GpgME::Key)) Q_PRIVATE_SLOT(d_func(), void slotKeyListResult(GpgME::KeyListResult)) Q_PRIVATE_SLOT(d_func(), void slotImportRequested(std::vector)) Q_PRIVATE_SLOT(d_func(), void slotDetailsRequested(GpgME::Key)) Q_PRIVATE_SLOT(d_func(), void slotSaveAsRequested(std::vector)) Q_PRIVATE_SLOT(d_func(), void slotDialogRejected()) }; } } -#endif // __KLEOPATRA_COMMMANDS_LOOKUPCERTIFICATESCOMMAND_H__ diff --git a/src/commands/newcertificatecommand.h b/src/commands/newcertificatecommand.h index 1056fe0cb..393c47ab0 100644 --- a/src/commands/newcertificatecommand.h +++ b/src/commands/newcertificatecommand.h @@ -1,49 +1,47 @@ /* -*- mode: c++; c-basic-offset:4 -*- commands/newcertificatecommand.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2008 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_COMMANDS_NEWCERTIFICATECOMMAND_H__ -#define __KLEOPATRA_COMMANDS_NEWCERTIFICATECOMMAND_H__ +#pragma once #include #include namespace Kleo { namespace Commands { class NewCertificateCommand : public Command { Q_OBJECT public: explicit NewCertificateCommand(QAbstractItemView *view, KeyListController *parent); explicit NewCertificateCommand(KeyListController *parent); explicit NewCertificateCommand(); ~NewCertificateCommand() override; void setProtocol(GpgME::Protocol proto); GpgME::Protocol protocol() const; private: void doStart() override; void doCancel() override; private: class Private; inline Private *d_func(); inline const Private *d_func() const; Q_PRIVATE_SLOT(d_func(), void slotDialogRejected()) Q_PRIVATE_SLOT(d_func(), void slotDialogAccepted()) }; } } -#endif // __KLEOPATRA_COMMANDS_NEWCERTIFICATECOMMAND_H__ diff --git a/src/commands/pivgeneratecardkeycommand.h b/src/commands/pivgeneratecardkeycommand.h index 11b3d58d0..2aae3fc85 100644 --- a/src/commands/pivgeneratecardkeycommand.h +++ b/src/commands/pivgeneratecardkeycommand.h @@ -1,49 +1,47 @@ /* commands/pivgeneratecardkeycommand.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2020 g10 Code GmbH SPDX-FileContributor: Ingo Klöcker SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_COMMMANDS_PIVGENERATECARDKEYCOMMAND_H__ -#define __KLEOPATRA_COMMMANDS_PIVGENERATECARDKEYCOMMAND_H__ +#pragma once #include "cardcommand.h" namespace GpgME { class Error; } namespace Kleo { namespace Commands { class PIVGenerateCardKeyCommand : public CardCommand { Q_OBJECT public: explicit PIVGenerateCardKeyCommand(const std::string &serialNumber, QWidget *parent); ~PIVGenerateCardKeyCommand() override; void setKeyRef(const std::string &keyref); private: void doStart() override; void doCancel() override; private: class Private; inline Private *d_func(); inline const Private *d_func() const; Q_PRIVATE_SLOT(d_func(), void slotDialogAccepted()) Q_PRIVATE_SLOT(d_func(), void slotDialogRejected()) Q_PRIVATE_SLOT(d_func(), void slotResult(GpgME::Error)) }; } // namespace Commands } // namespace Kleo -#endif // __KLEOPATRA_COMMMANDS_PIVGENERATECARDKEYCOMMAND_H__ diff --git a/src/commands/refreshopenpgpcertscommand.h b/src/commands/refreshopenpgpcertscommand.h index 2174c558c..4bc40c4e8 100644 --- a/src/commands/refreshopenpgpcertscommand.h +++ b/src/commands/refreshopenpgpcertscommand.h @@ -1,44 +1,42 @@ /* -*- mode: c++; c-basic-offset:4 -*- commands/refreshopenpgpcertscommand.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2008 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_COMMMANDS_REFRESHOPENPGPCERTSCOMMAND_H__ -#define __KLEOPATRA_COMMMANDS_REFRESHOPENPGPCERTSCOMMAND_H__ +#pragma once #include namespace Kleo { namespace Commands { class RefreshOpenPGPCertsCommand : public GnuPGProcessCommand { Q_OBJECT public: explicit RefreshOpenPGPCertsCommand(QAbstractItemView *view, KeyListController *parent); explicit RefreshOpenPGPCertsCommand(KeyListController *parent); ~RefreshOpenPGPCertsCommand() override; private: bool preStartHook(QWidget *) const override; QStringList arguments() const override; QString errorCaption() const override; QString successCaption() const override; QString crashExitMessage(const QStringList &) const override; QString errorExitMessage(const QStringList &) const override; QString successMessage(const QStringList &) const override; }; } } -#endif // __KLEOPATRA_COMMMANDS_REFRESHOPENPGPCERTSCOMMAND_H__ diff --git a/src/commands/refreshx509certscommand.h b/src/commands/refreshx509certscommand.h index 97e4bc752..52899af09 100644 --- a/src/commands/refreshx509certscommand.h +++ b/src/commands/refreshx509certscommand.h @@ -1,44 +1,42 @@ /* -*- mode: c++; c-basic-offset:4 -*- commands/refreshx509certscommand.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2008 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_COMMMANDS_REFRESHX509CERTSCOMMAND_H__ -#define __KLEOPATRA_COMMMANDS_REFRESHX509CERTSCOMMAND_H__ +#pragma once #include namespace Kleo { namespace Commands { class RefreshX509CertsCommand : public GnuPGProcessCommand { Q_OBJECT public: explicit RefreshX509CertsCommand(QAbstractItemView *view, KeyListController *parent); explicit RefreshX509CertsCommand(KeyListController *parent); ~RefreshX509CertsCommand() override; private: bool preStartHook(QWidget *) const override; QStringList arguments() const override; QString errorCaption() const override; QString successCaption() const override; QString crashExitMessage(const QStringList &) const override; QString errorExitMessage(const QStringList &) const override; QString successMessage(const QStringList &) const override; }; } } -#endif // __KLEOPATRA_COMMMANDS_REFRESHX509CERTSCOMMAND_H__ diff --git a/src/commands/reloadkeyscommand.h b/src/commands/reloadkeyscommand.h index a4344f6b3..545a8e49c 100644 --- a/src/commands/reloadkeyscommand.h +++ b/src/commands/reloadkeyscommand.h @@ -1,39 +1,37 @@ /* -*- mode: c++; c-basic-offset:4 -*- reloadkeyscommand.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2007 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_RELOADKEYSCOMMAND_H__ -#define __KLEOPATRA_RELOADKEYSCOMMAND_H__ +#pragma once #include namespace Kleo { class ReloadKeysCommand : public Command { Q_OBJECT public: explicit ReloadKeysCommand(KeyListController *parent); ReloadKeysCommand(QAbstractItemView *view, KeyListController *parent); ~ReloadKeysCommand() override; private: void doStart() override; void doCancel() override; private: class Private; inline Private *d_func(); inline const Private *d_func() const; Q_PRIVATE_SLOT(d_func(), void keyListingDone(GpgME::KeyListResult)) }; } -#endif // __KLEOPATRA_RELOADKEYSCOMMAND_H__ diff --git a/src/commands/revokecertificationcommand.h b/src/commands/revokecertificationcommand.h index 886fe22f6..073c44721 100644 --- a/src/commands/revokecertificationcommand.h +++ b/src/commands/revokecertificationcommand.h @@ -1,55 +1,53 @@ /* -*- mode: c++; c-basic-offset:4 -*- commands/revokecertificationcommand.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2020 g10 Code GmbH SPDX-FileContributor: Ingo Klöcker SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_COMMANDS_REVOKECERTIFICATIONCOMMAND_H__ -#define __KLEOPATRA_COMMANDS_REVOKECERTIFICATIONCOMMAND_H__ +#pragma once #include #include namespace Kleo { namespace Commands { class RevokeCertificationCommand : public Command { Q_OBJECT public: explicit RevokeCertificationCommand(QAbstractItemView *view, KeyListController *parent); explicit RevokeCertificationCommand(const GpgME::UserID &uid); explicit RevokeCertificationCommand(const GpgME::UserID::Signature &signature); ~RevokeCertificationCommand() override; /* reimp */ static Restrictions restrictions() { return OnlyOneKey | MustBeOpenPGP; } static bool isSupported(); private: void doStart() override; void doCancel() override; private: class Private; inline Private *d_func(); inline const Private *d_func() const; Q_PRIVATE_SLOT(d_func(), void slotResult(GpgME::Error)) Q_PRIVATE_SLOT(d_func(), void slotDialogAccepted()) Q_PRIVATE_SLOT(d_func(), void slotDialogRejected()) }; } // namespace Commands } // namespace Kleo -#endif // __KLEOPATRA_COMMANDS_REVOKECERTIFICATIONCOMMAND_H__ diff --git a/src/commands/selftestcommand.h b/src/commands/selftestcommand.h index 12d1f1459..2eb53c81d 100644 --- a/src/commands/selftestcommand.h +++ b/src/commands/selftestcommand.h @@ -1,48 +1,46 @@ /* -*- mode: c++; c-basic-offset:4 -*- commands/selftestcommand.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2008 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_COMMMANDS_SELFTESTCOMMAND_H__ -#define __KLEOPATRA_COMMMANDS_SELFTESTCOMMAND_H__ +#pragma once #include namespace Kleo { namespace Commands { class SelfTestCommand : public Command { Q_OBJECT public: explicit SelfTestCommand(QAbstractItemView *view, KeyListController *parent); explicit SelfTestCommand(KeyListController *parent); ~SelfTestCommand() override; void setAutomaticMode(bool automatic); bool isCanceled() const; private: void doStart() override; void doCancel() override; private: class Private; inline Private *d_func(); inline const Private *d_func() const; Q_PRIVATE_SLOT(d_func(), void slotUpdateRequested()) Q_PRIVATE_SLOT(d_func(), void slotDialogAccepted()) Q_PRIVATE_SLOT(d_func(), void slotDialogRejected()) }; } } -#endif // __KLEOPATRA_COMMMANDS_SELFTESTCOMMAND_H__ diff --git a/src/commands/setinitialpincommand.h b/src/commands/setinitialpincommand.h index 6c469ce1c..0f7238d5e 100644 --- a/src/commands/setinitialpincommand.h +++ b/src/commands/setinitialpincommand.h @@ -1,51 +1,49 @@ /* -*- mode: c++; c-basic-offset:4 -*- commands/setinitialpincommand.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2009 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_COMMANDS_SETINITIALPINCOMMAND_H__ -#define __KLEOPATRA_COMMANDS_SETINITIALPINCOMMAND_H__ +#pragma once #include namespace Kleo { namespace Commands { class SetInitialPinCommand : public CardCommand { Q_OBJECT public: SetInitialPinCommand(const std::string &serialNumber); ~SetInitialPinCommand() override; /* reimp */ static Restrictions restrictions() { return AnyCardHasNullPin; } QDialog *dialog() const; private: void doStart() override; void doCancel() override; private: class Private; inline Private *d_func(); inline const Private *d_func() const; Q_PRIVATE_SLOT(d_func(), void slotDialogRejected()) Q_PRIVATE_SLOT(d_func(), void slotDialogAccepted()) Q_PRIVATE_SLOT(d_func(), void slotNksPinRequested()) Q_PRIVATE_SLOT(d_func(), void slotSigGPinRequested()) }; } } -#endif /* __KLEOPATRA_COMMANDS_SETINITIALPINCOMMAND_H__ */ diff --git a/src/commands/setpivcardapplicationadministrationkeycommand.h b/src/commands/setpivcardapplicationadministrationkeycommand.h index f5c9d4a08..987e01db8 100644 --- a/src/commands/setpivcardapplicationadministrationkeycommand.h +++ b/src/commands/setpivcardapplicationadministrationkeycommand.h @@ -1,47 +1,45 @@ /* commands/setpivcardapplicationadministrationkeycommand.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2020 g10 Code GmbH SPDX-FileContributor: Ingo Klöcker SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_COMMMANDS_SETPIVCARDAPPLICATIONADMINISTRATIONKEYCOMMAND_H__ -#define __KLEOPATRA_COMMMANDS_SETPIVCARDAPPLICATIONADMINISTRATIONKEYCOMMAND_H__ +#pragma once #include "cardcommand.h" namespace GpgME { class Error; } namespace Kleo { namespace Commands { class SetPIVCardApplicationAdministrationKeyCommand : public CardCommand { Q_OBJECT public: explicit SetPIVCardApplicationAdministrationKeyCommand(const std::string &serialNumber, QWidget *parent); ~SetPIVCardApplicationAdministrationKeyCommand() override; private: void doStart() override; void doCancel() override; private: class Private; inline Private *d_func(); inline const Private *d_func() const; Q_PRIVATE_SLOT(d_func(), void slotDialogAccepted()) Q_PRIVATE_SLOT(d_func(), void slotDialogRejected()) Q_PRIVATE_SLOT(d_func(), void slotResult(GpgME::Error)) }; } // namespace Commands } // namespace Kleo -#endif // __KLEOPATRA_COMMMANDS_SETPIVCARDAPPLICATIONADMINISTRATIONKEYCOMMAND_H__ diff --git a/src/commands/signclipboardcommand.h b/src/commands/signclipboardcommand.h index 867a88019..e6aafdb5e 100644 --- a/src/commands/signclipboardcommand.h +++ b/src/commands/signclipboardcommand.h @@ -1,54 +1,52 @@ /* -*- mode: c++; c-basic-offset:4 -*- commands/signclipboardcommand.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2008 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_COMMMANDS_SIGNCLIPBOARDCOMMAND_H__ -#define __KLEOPATRA_COMMMANDS_SIGNCLIPBOARDCOMMAND_H__ +#pragma once #include #ifndef QT_NO_CLIPBOARD #include #include namespace Kleo { namespace Commands { class SignClipboardCommand : public Command { Q_OBJECT public: explicit SignClipboardCommand(GpgME::Protocol protocol, QAbstractItemView *view, KeyListController *parent); explicit SignClipboardCommand(GpgME::Protocol protocol, KeyListController *parent); ~SignClipboardCommand() override; static bool canSignCurrentClipboard(); private: void doStart() override; void doCancel() override; private: class Private; inline Private *d_func(); inline const Private *d_func() const; Q_PRIVATE_SLOT(d_func(), void slotSignersResolved()) Q_PRIVATE_SLOT(d_func(), void slotControllerDone()) Q_PRIVATE_SLOT(d_func(), void slotControllerError(int, QString)) }; } } #endif // QT_NO_CLIPBOARD -#endif // __KLEOPATRA_COMMMANDS_SIGNCLIPBOARDCOMMAND_H__ diff --git a/src/commands/signencryptfilescommand.h b/src/commands/signencryptfilescommand.h index bfa6a3d3e..bc5589792 100644 --- a/src/commands/signencryptfilescommand.h +++ b/src/commands/signencryptfilescommand.h @@ -1,68 +1,66 @@ /* -*- mode: c++; c-basic-offset:4 -*- commands/signencryptfilescommand.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2008 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_COMMMANDS_SIGNENCRYPTFILESCOMMAND_H__ -#define __KLEOPATRA_COMMMANDS_SIGNENCRYPTFILESCOMMAND_H__ +#pragma once #include #include #include #include namespace Kleo { namespace Commands { class SignEncryptFilesCommand : public Command { Q_OBJECT public: explicit SignEncryptFilesCommand(QAbstractItemView *view, KeyListController *parent); explicit SignEncryptFilesCommand(KeyListController *parent); explicit SignEncryptFilesCommand(const QStringList &files, QAbstractItemView *view, KeyListController *parent); explicit SignEncryptFilesCommand(const QStringList &files, KeyListController *parent); ~SignEncryptFilesCommand() override; void setFiles(const QStringList &files); void setSigningPolicy(Policy policy); Policy signingPolicy() const; void setEncryptionPolicy(Policy force); Policy encryptionPolicy() const; void setArchivePolicy(Policy force); Policy archivePolicy() const; void setProtocol(GpgME::Protocol protocol); GpgME::Protocol protocol() const; protected: virtual QStringList selectFiles() const; private: void doStart() override; void doCancel() override; private: class Private; inline Private *d_func(); inline const Private *d_func() const; Q_PRIVATE_SLOT(d_func(), void slotControllerDone()) Q_PRIVATE_SLOT(d_func(), void slotControllerError(int, QString)) }; } } -#endif // __KLEOPATRA_COMMMANDS_SIGNENCRYPTFILESCOMMAND_H__ diff --git a/src/commands/signencryptfoldercommand.h b/src/commands/signencryptfoldercommand.h index 525d80a73..dfc09be20 100644 --- a/src/commands/signencryptfoldercommand.h +++ b/src/commands/signencryptfoldercommand.h @@ -1,37 +1,35 @@ /* -*- mode: c++; c-basic-offset:4 -*- commands/signencryptfoldercommand.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 */ -#ifndef __KLEOPATRA_COMMMANDS_SIGNENCRYPTFOLDERCOMMAND_H__ -#define __KLEOPATRA_COMMMANDS_SIGNENCRYPTFOLDERCOMMAND_H__ +#pragma once #include "signencryptfilescommand.h" #include 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 override; }; } } -#endif // __KLEOPATRA_COMMMANDS_SIGNENCRYPTFOLDERCOMMAND_H__ diff --git a/src/conf/appearanceconfigpage.h b/src/conf/appearanceconfigpage.h index 3816842e6..40c97f0af 100644 --- a/src/conf/appearanceconfigpage.h +++ b/src/conf/appearanceconfigpage.h @@ -1,41 +1,39 @@ /* -*- mode: c++; c-basic-offset:4 -*- conf/appearanceconfigpage.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2004, 2008 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef KLEOPATRA_CONFIG_APPEARANCECONFIGPAGE_H -#define KLEOPATRA_CONFIG_APPEARANCECONFIGPAGE_H +#pragma once #include namespace Kleo { namespace Config { class AppearanceConfigWidget; /** * "Appearance" configuration page for kleopatra's configuration dialog */ class AppearanceConfigurationPage : public KCModule { Q_OBJECT public: explicit AppearanceConfigurationPage(QWidget *parent = nullptr, const QVariantList &args = QVariantList()); void load() override; void save() override; void defaults() override; private: AppearanceConfigWidget *mWidget; }; } } -#endif // KLEOPATRA_CONFIG_APPEARANCECONFIGPAGE_H diff --git a/src/conf/appearanceconfigwidget.h b/src/conf/appearanceconfigwidget.h index d9f8c6f34..c138f055b 100644 --- a/src/conf/appearanceconfigwidget.h +++ b/src/conf/appearanceconfigwidget.h @@ -1,63 +1,61 @@ /* appearanceconfigwidget.h This file is part of kleopatra, the KDE key manager SPDX-FileCopyrightText: 2002, 2004, 2008 Klarälvdalens Datakonsult AB SPDX-FileCopyrightText: 2002, 2003 Marc Mutz SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_CONFIG_APPEARANCECONFIGWIDGET_H__ -#define __KLEOPATRA_CONFIG_APPEARANCECONFIGWIDGET_H__ +#pragma once #include #include namespace Kleo { namespace Config { class AppearanceConfigWidget : public QWidget { Q_OBJECT public: explicit AppearanceConfigWidget(QWidget *parent = nullptr, Qt::WindowFlags f = {}); ~AppearanceConfigWidget(); public Q_SLOTS: void load(); void save(); void defaults(); Q_SIGNALS: void changed(); private: class Private; kdtools::pimpl_ptr d; Q_PRIVATE_SLOT(d, void slotIconClicked()) #ifndef QT_NO_COLORDIALOG Q_PRIVATE_SLOT(d, void slotForegroundClicked()) Q_PRIVATE_SLOT(d, void slotBackgroundClicked()) #endif #ifndef QT_NO_FONTDIALOG Q_PRIVATE_SLOT(d, void slotFontClicked()) #endif Q_PRIVATE_SLOT(d, void slotSelectionChanged()) Q_PRIVATE_SLOT(d, void slotDefaultClicked()) Q_PRIVATE_SLOT(d, void slotItalicToggled(bool)) Q_PRIVATE_SLOT(d, void slotBoldToggled(bool)) Q_PRIVATE_SLOT(d, void slotStrikeOutToggled(bool)) Q_PRIVATE_SLOT(d, void slotTooltipValidityChanged(bool)) Q_PRIVATE_SLOT(d, void slotTooltipDetailsChanged(bool)) Q_PRIVATE_SLOT(d, void slotTooltipOwnerChanged(bool)) Q_PRIVATE_SLOT(d, void slotUseTagsChanged(bool)) }; } } -#endif // __KLEOPATRA_CONFIG_APPEARANCECONFIGWIDGET_H__ diff --git a/src/conf/configuredialog.h b/src/conf/configuredialog.h index 80ee67727..ff88c1b34 100644 --- a/src/conf/configuredialog.h +++ b/src/conf/configuredialog.h @@ -1,44 +1,42 @@ /* configuredialog.h This file is part of Kleopatra SPDX-FileCopyrightText: 2000 Espen Sand SPDX-FileCopyrightText: 2001-2002 Marc Mutz SPDX-FileCopyrightText: 2004 Klarälvdalens Datakonsult AB SPDX-FileCopyrightText: 2016 Bundesamt für Sicherheit in der Informationstechnik SPDX-FileContributor: Intevation GmbH SPDX-License-Identifier: GPL-2.0-only */ -#ifndef __KLEOPATRA_CONF_CONFIGUREDIALOG_H__ -#define __KLEOPATRA_CONF_CONFIGUREDIALOG_H__ +#pragma once #include /** * This is a small wrapper class that holds common code between * the KCM Config dialog (which is used when KCMUtils are available) * and the KleoPageConfigDialog. Which is just a KPageView * with the necessary bits of the KCMultiDialog behavior. */ #if HAVE_KCMUTILS # include class ConfigureDialog : public KCMultiDialog #else # include "kleopageconfigdialog.h" class ConfigureDialog : public KleoPageConfigDialog #endif { Q_OBJECT public: explicit ConfigureDialog(QWidget *parent = nullptr); ~ConfigureDialog() override; protected: void hideEvent(QHideEvent *) override; }; -#endif /* __KLEOPATRA_CONF_CONFIGUREDIALOG_H__ */ diff --git a/src/conf/cryptooperationsconfigpage.h b/src/conf/cryptooperationsconfigpage.h index 9d50bcac6..97bf000ec 100644 --- a/src/conf/cryptooperationsconfigpage.h +++ b/src/conf/cryptooperationsconfigpage.h @@ -1,41 +1,39 @@ /* -*- mode: c++; c-basic-offset:4 -*- conf/cryptooperationsconfigpage.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2010 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef KLEOPATRA_CONFIG_CRYPTOOPERATIONSCONFIGPAGE_H -#define KLEOPATRA_CONFIG_CRYPTOOPERATIONSCONFIGPAGE_H +#pragma once #include namespace Kleo { namespace Config { class CryptoOperationsConfigWidget; /** * "Crypto Operations" configuration page for kleopatra's configuration dialog */ class CryptoOperationsConfigurationPage : public KCModule { Q_OBJECT public: explicit CryptoOperationsConfigurationPage(QWidget *parent = nullptr, const QVariantList &args = QVariantList()); void load() override; void save() override; void defaults() override; private: CryptoOperationsConfigWidget *mWidget; }; } } -#endif // KLEOPATRA_CONFIG_CRYPTOOPERATIONSCONFIGPAGE_H diff --git a/src/conf/cryptooperationsconfigwidget.h b/src/conf/cryptooperationsconfigwidget.h index c92d10638..db69d6da1 100644 --- a/src/conf/cryptooperationsconfigwidget.h +++ b/src/conf/cryptooperationsconfigwidget.h @@ -1,60 +1,58 @@ /* cryptooperationsconfigwidget.h This file is part of kleopatra, the KDE key manager SPDX-FileCopyrightText: 2010 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_CONFIG_CRYPTOOPERATIONSCONFIGWIDGET_H__ -#define __KLEOPATRA_CONFIG_CRYPTOOPERATIONSCONFIGWIDGET_H__ +#pragma once #include #include class QCheckBox; class QComboBox; class QBoxLayout; class QPushButton; namespace Kleo { namespace Config { class CryptoOperationsConfigWidget : public QWidget { Q_OBJECT public: explicit CryptoOperationsConfigWidget(QWidget *parent = nullptr, Qt::WindowFlags f = {}); ~CryptoOperationsConfigWidget(); public Q_SLOTS: void load(); void save(); void defaults(); Q_SIGNALS: void changed(); private: void setupGui(); void setupProfileGui(QBoxLayout *layout); void applyProfile(const QString &profile); QCheckBox *mQuickEncryptCB, *mQuickSignCB, *mPGPFileExtCB, *mAutoDecryptVerifyCB, *mASCIIArmorCB, *mTmpDirCB; QComboBox *mChecksumDefinitionCB, *mArchiveDefinitionCB; QPushButton *mApplyBtn; }; } } -#endif // __KLEOPATRA_CONFIG_CRYPTOOPERATIONSCONFIGWIDGET_H__ diff --git a/src/conf/dirservconfigpage.h b/src/conf/dirservconfigpage.h index cfd0a06c0..1a933ccee 100644 --- a/src/conf/dirservconfigpage.h +++ b/src/conf/dirservconfigpage.h @@ -1,72 +1,70 @@ /* -*- mode: c++; c-basic-offset:4 -*- conf/dirservconfigpage.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2004, 2008 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef DIRSERVCONFIGPAGE_H -#define DIRSERVCONFIGPAGE_H +#pragma once #include #include class QCheckBox; class QLabel; class QTimeEdit; class QSpinBox; namespace Kleo { class DirectoryServicesWidget; } /** * "Directory Services" configuration page for kleopatra's configuration dialog * The user can configure LDAP servers in this page, to be used for listing/fetching * remote certificates in kleopatra. */ class DirectoryServicesConfigurationPage : public KCModule { Q_OBJECT public: explicit DirectoryServicesConfigurationPage(QWidget *parent = nullptr, const QVariantList &args = QVariantList()); void load() override; void save() override; void defaults() override; private: enum EntryMultiplicity { SingleValue, ListValue }; enum ShowError { DoNotShowError, DoShowError }; QGpgME::CryptoConfigEntry *configEntry(const char *componentName, const char *entryName, QGpgME::CryptoConfigEntry::ArgType argType, EntryMultiplicity multiplicity, ShowError showError); Kleo::DirectoryServicesWidget *mWidget; QTimeEdit *mTimeout; QSpinBox *mMaxItems; QLabel *mMaxItemsLabel; QCheckBox *mAddNewServersCB; QGpgME::CryptoConfigEntry *mX509ServicesEntry; QGpgME::CryptoConfigEntry *mOpenPGPServiceEntry; QGpgME::CryptoConfigEntry *mTimeoutConfigEntry; QGpgME::CryptoConfigEntry *mMaxItemsConfigEntry; QGpgME::CryptoConfigEntry *mAddNewServersConfigEntry; QGpgME::CryptoConfig *mConfig; }; -#endif diff --git a/src/conf/gnupgsystemconfigurationpage.h b/src/conf/gnupgsystemconfigurationpage.h index eb77fc398..b7b64a30e 100644 --- a/src/conf/gnupgsystemconfigurationpage.h +++ b/src/conf/gnupgsystemconfigurationpage.h @@ -1,41 +1,39 @@ /* -*- mode: c++; c-basic-offset:4 -*- conf/gnupgsystemconfigurationpage.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2008 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef KLEOPATRA_GNUPGSYSTEMCONFIGURATIONPAGE_H -#define KLEOPATRA_GNUPGSYSTEMCONFIGURATIONPAGE_H +#pragma once #include namespace Kleo { class CryptoConfigModule; } namespace Kleo { namespace Config { class GnuPGSystemConfigurationPage : public KCModule { Q_OBJECT public: explicit GnuPGSystemConfigurationPage(QWidget *parent = nullptr, const QVariantList &args = QVariantList()); ~GnuPGSystemConfigurationPage() override; void load() override; void save() override; void defaults() override; private: Kleo::CryptoConfigModule *mWidget; }; } } -#endif // KLEOPATRA_GNUPGSYSTEMCONFIGURATIONPAGE_H diff --git a/src/conf/groupsconfigdialog.h b/src/conf/groupsconfigdialog.h index 12d75f3be..df9b47a2a 100644 --- a/src/conf/groupsconfigdialog.h +++ b/src/conf/groupsconfigdialog.h @@ -1,37 +1,35 @@ /* conf/groupsconfigdialog.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2021 g10 Code GmbH SPDX-FileContributor: Ingo Klöcker SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_CONF_GROUPSCONFIGDIALOG_H__ -#define __KLEOPATRA_CONF_GROUPSCONFIGDIALOG_H__ +#pragma once #include class GroupsConfigDialog : public KConfigDialog { Q_OBJECT public: explicit GroupsConfigDialog(QWidget *parent = nullptr); ~GroupsConfigDialog() override; static QString dialogName(); private Q_SLOTS: void updateSettings() override; void updateWidgets() override; private: bool hasChanged() override; private: class Private; const std::unique_ptr d; }; -#endif /* __KLEOPATRA_CONF_GROUPSCONFIGDIALOG_H__ */ diff --git a/src/conf/groupsconfigpage.h b/src/conf/groupsconfigpage.h index 5e19ad5a0..a71d2e91c 100644 --- a/src/conf/groupsconfigpage.h +++ b/src/conf/groupsconfigpage.h @@ -1,35 +1,33 @@ /* conf/groupsconfigpage.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2021 g10 Code GmbH SPDX-FileContributor: Ingo Klöcker SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_CONF_GROUPSCONFIGPAGE_H__ -#define __KLEOPATRA_CONF_GROUPSCONFIGPAGE_H__ +#pragma once #include class GroupsConfigPage : public QWidget { Q_OBJECT public: explicit GroupsConfigPage(QWidget *parent = nullptr); ~GroupsConfigPage() override; public Q_SLOTS: void load(); void save(); Q_SIGNALS: void changed(bool state); private: class Private; const std::unique_ptr d; }; -#endif // __KLEOPATRA_CONF_GROUPSCONFIGPAGE_H__ diff --git a/src/conf/groupsconfigwidget.h b/src/conf/groupsconfigwidget.h index ceb66a050..83485e4fa 100644 --- a/src/conf/groupsconfigwidget.h +++ b/src/conf/groupsconfigwidget.h @@ -1,42 +1,40 @@ /* conf/groupsconfigwidget.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2021 g10 Code GmbH SPDX-FileContributor: Ingo Klöcker SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_CONF_GROUPSCONFIGWIDGET_H__ -#define __KLEOPATRA_CONF_GROUPSCONFIGWIDGET_H__ +#pragma once #include #include namespace Kleo { class KeyGroup; class GroupsConfigWidget : public QWidget { Q_OBJECT public: explicit GroupsConfigWidget(QWidget *parent = nullptr); ~GroupsConfigWidget() override; void setGroups(const std::vector &groups); std::vector groups() const; Q_SIGNALS: void changed(); private: class Private; const std::unique_ptr d; }; } -#endif // __KLEOPATRA_CONF_GROUPSCONFIGWIDGET_H__ diff --git a/src/conf/kleopageconfigdialog.h b/src/conf/kleopageconfigdialog.h index da9927244..df49a4043 100644 --- a/src/conf/kleopageconfigdialog.h +++ b/src/conf/kleopageconfigdialog.h @@ -1,52 +1,50 @@ /* kleopageconfigdialog.h.h This file is part of Kleopatra SPDX-FileCopyrightText: 2016 Bundesamt für Sicherheit in der Informationstechnik SPDX-FileContributor: Intevation GmbH SPDX-License-Identifier: GPL-2.0-only */ -#ifndef __KLEOPATRA_CONF_KLEOPAGECONFIGDIALOG_H__ -#define __KLEOPATRA_CONF_KLEOPAGECONFIGDIALOG_H__ +#pragma once #include #include class KCModule; class KPageWidgetItem; /** * KPageDialog based config dialog to be used when * KCMUtils are not available. */ class KleoPageConfigDialog : public KPageDialog { Q_OBJECT public: explicit KleoPageConfigDialog(QWidget *parent = nullptr); void addModule(const QString &module); Q_SIGNALS: void configCommitted(); protected Q_SLOTS: void slotDefaultClicked(); void slotUser1Clicked(); void slotApplyClicked(); void slotOkClicked(); void slotHelpClicked(); void slotCurrentPageChanged(KPageWidgetItem *current, KPageWidgetItem *previous); void moduleChanged(bool value); private: void clientChanged(); void apply(); QList mModules; QList mChangedModules; QMap mHelpUrls; }; -#endif /* __KLEOPATRA_CONF_KLEOPAGECONFIGDIALOG_H__ */ diff --git a/src/conf/smimevalidationconfigurationpage.h b/src/conf/smimevalidationconfigurationpage.h index d8d200e4a..55697ebcb 100644 --- a/src/conf/smimevalidationconfigurationpage.h +++ b/src/conf/smimevalidationconfigurationpage.h @@ -1,37 +1,35 @@ /* -*- mode: c++; c-basic-offset:4 -*- conf/smimevalidationconfigurationpage.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2008 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef KLEOPATRA_SMIMEVALIDATIONCONFIGURATIONPAGE_H -#define KLEOPATRA_SMIMEVALIDATIONCONFIGURATIONPAGE_H +#pragma once #include namespace Kleo { namespace Config { class SMimeValidationConfigurationWidget; class SMimeValidationConfigurationPage : public KCModule { Q_OBJECT public: explicit SMimeValidationConfigurationPage(QWidget *parent = nullptr, const QVariantList &args = QVariantList()); void load() override; void save() override; void defaults() override; private: SMimeValidationConfigurationWidget *mWidget; }; } } -#endif // KLEOPATRA_SMIMEVALIDATIONCONFIGURATIONPAGE_H diff --git a/src/conf/smimevalidationconfigurationwidget.h b/src/conf/smimevalidationconfigurationwidget.h index 4359d85a7..a6f0d60c3 100644 --- a/src/conf/smimevalidationconfigurationwidget.h +++ b/src/conf/smimevalidationconfigurationwidget.h @@ -1,46 +1,44 @@ /* -*- mode: c++; c-basic-offset:4 -*- conf/smimevalidationconfigurationwidget.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2008 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_CONF_SMIMEVALIDATIONCONFIGURATIONWIDGET_H__ -#define __KLEOPATRA_CONF_SMIMEVALIDATIONCONFIGURATIONWIDGET_H__ +#pragma once #include #include namespace Kleo { namespace Config { class SMimeValidationConfigurationWidget : public QWidget { Q_OBJECT public: explicit SMimeValidationConfigurationWidget(QWidget *parent = nullptr, Qt::WindowFlags f = {}); ~SMimeValidationConfigurationWidget(); public Q_SLOTS: void load(); void save() const; void defaults(); Q_SIGNALS: void changed(); private: class Private; kdtools::pimpl_ptr d; Q_PRIVATE_SLOT(d, void enableDisableActions()) }; } } -#endif /* __KLEOPATRA_CONF_SMIMEVALIDATIONCONFIGURATIONWIDGET_H__ */ diff --git a/src/crlview.h b/src/crlview.h index 14f48a954..8898f57a8 100644 --- a/src/crlview.h +++ b/src/crlview.h @@ -1,49 +1,47 @@ /* crlview.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2001, 2002, 2004 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef CRLVIEW_H -#define CRLVIEW_H +#pragma once #include #include #include class QTextEdit; class QPushButton; class KProcess; class QTimer; class QCloseEvent; class CRLView : public QDialog { Q_OBJECT public: explicit CRLView(QWidget *parent = nullptr); ~CRLView(); public Q_SLOTS: void slotUpdateView(); protected Q_SLOTS: void slotReadStdout(); void slotProcessExited(int, QProcess::ExitStatus); void slotAppendBuffer(); protected: void closeEvent(QCloseEvent *); void processExited(); private: QTextEdit *_textView; QPushButton *_updateButton; QPushButton *_closeButton; KProcess *_process; QTimer *_timer; QString _buffer; }; -#endif // CRLVIEW_H diff --git a/src/crypto/autodecryptverifyfilescontroller.h b/src/crypto/autodecryptverifyfilescontroller.h index 3c96c4724..819d41a5d 100644 --- a/src/crypto/autodecryptverifyfilescontroller.h +++ b/src/crypto/autodecryptverifyfilescontroller.h @@ -1,59 +1,57 @@ /* -*- mode: c++; c-basic-offset:4 -*- autodecryptverifyfilescontroller.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2008 Klarälvdalens Datakonsult AB SPDX-FileCopyrightText: 2016 Bundesamt für Sicherheit in der Informationstechnik SPDX-FileContributor: Intevation GmbH SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_CRYPTO_AUTODECRYPTVERIFYFILESCONTROLLER_H__ -#define __KLEOPATRA_CRYPTO_AUTODECRYPTVERIFYFILESCONTROLLER_H__ +#pragma once #include "crypto/decryptverifyfilescontroller.h" #include #include #include namespace Kleo { namespace Crypto { class AutoDecryptVerifyFilesController : public DecryptVerifyFilesController { Q_OBJECT public: explicit AutoDecryptVerifyFilesController(QObject *parent = nullptr); explicit AutoDecryptVerifyFilesController(const std::shared_ptr &ctx, QObject *parent = nullptr); ~AutoDecryptVerifyFilesController(); void setFiles(const QStringList &files) override; void setOperation(DecryptVerifyOperation op) override; DecryptVerifyOperation operation() const override; void start() override; public Q_SLOTS: void cancel() override; private: void doTaskDone(const Task *task, const std::shared_ptr &) override; private: class Private; kdtools::pimpl_ptr d; Q_PRIVATE_SLOT(d, void slotDialogCanceled()) Q_PRIVATE_SLOT(d, void schedule()) }; } } -#endif // __KLEOPATRA_CRYPTO_AUTODECRYPTVERIFYFILESCONTROLLER_H__ diff --git a/src/crypto/certificateresolver.h b/src/crypto/certificateresolver.h index d8561fe15..18f2db2d1 100644 --- a/src/crypto/certificateresolver.h +++ b/src/crypto/certificateresolver.h @@ -1,90 +1,88 @@ /* -*- mode: c++; c-basic-offset:4 -*- crypto/certificateresolver.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2007 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_CRYPTO_CERTIFICATERESOLVER_H__ -#define __KLEOPATRA_CRYPTO_CERTIFICATERESOLVER_H__ +#pragma once #include #include #include #include #include class KConfig; namespace GpgME { class Key; } namespace Kleo { namespace Crypto { class SigningPreferences { public: virtual ~SigningPreferences() {} virtual GpgME::Key preferredCertificate(GpgME::Protocol protocol) = 0; virtual void setPreferredCertificate(GpgME::Protocol protocol, const GpgME::Key &certificate) = 0; }; class RecipientPreferences { public: virtual ~RecipientPreferences() {} virtual GpgME::Key preferredCertificate(const KMime::Types::Mailbox &recipient, GpgME::Protocol protocol) = 0; virtual void setPreferredCertificate(const KMime::Types::Mailbox &recipient, GpgME::Protocol protocol, const GpgME::Key &certificate) = 0; }; class KConfigBasedRecipientPreferences : public RecipientPreferences { public: explicit KConfigBasedRecipientPreferences(const KSharedConfigPtr &config); ~KConfigBasedRecipientPreferences() override; GpgME::Key preferredCertificate(const KMime::Types::Mailbox &recipient, GpgME::Protocol protocol) override; void setPreferredCertificate(const KMime::Types::Mailbox &recipient, GpgME::Protocol protocol, const GpgME::Key &certificate) override; private: Q_DISABLE_COPY(KConfigBasedRecipientPreferences) class Private; kdtools::pimpl_ptr d; }; class KConfigBasedSigningPreferences : public SigningPreferences { public: explicit KConfigBasedSigningPreferences(const KSharedConfigPtr &config); ~KConfigBasedSigningPreferences() override; GpgME::Key preferredCertificate(GpgME::Protocol protocol) override; void setPreferredCertificate(GpgME::Protocol protocol, const GpgME::Key &certificate) override; private: Q_DISABLE_COPY(KConfigBasedSigningPreferences) class Private; kdtools::pimpl_ptr d; }; class CertificateResolver { public: static std::vector< std::vector > resolveRecipients(const std::vector &recipients, GpgME::Protocol proto); static std::vector resolveRecipient(const KMime::Types::Mailbox &recipient, GpgME::Protocol proto); static std::vector< std::vector > resolveSigners(const std::vector &signers, GpgME::Protocol proto); static std::vector resolveSigner(const KMime::Types::Mailbox &signer, GpgME::Protocol proto); }; } } -#endif /* __KLEOPATRA_UISERVER_CERTIFICATERESOLVER_H__ */ diff --git a/src/crypto/controller.h b/src/crypto/controller.h index 53e0b20fe..c1986d12d 100644 --- a/src/crypto/controller.h +++ b/src/crypto/controller.h @@ -1,68 +1,66 @@ /* -*- mode: c++; c-basic-offset:4 -*- crypto/controller.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2008 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_CRYPTO_CONTROLLER_H__ -#define __KLEOPATRA_CRYPTO_CONTROLLER_H__ +#pragma once #include #include #include #include #include namespace Kleo { namespace Crypto { class Controller : public QObject, protected ExecutionContextUser { Q_OBJECT public: explicit Controller(QObject *parent = nullptr); explicit Controller(const std::shared_ptr &cmd, QObject *parent = nullptr); ~Controller(); using ExecutionContextUser::setExecutionContext; Q_SIGNALS: void progress(int current, int total, const QString &what); protected: void emitDoneOrError(); void setLastError(int err, const QString &details); void connectTask(const std::shared_ptr &task); virtual void doTaskDone(const Task *task, const std::shared_ptr &result); protected Q_SLOTS: void taskDone(const std::shared_ptr &); Q_SIGNALS: #ifndef Q_MOC_RUN # ifndef DOXYGEN_SHOULD_SKIP_THIS private: // don't tell moc or doxygen, but those signals are in fact private # endif #endif void error(int err, const QString &details); void done(); private: class Private; kdtools::pimpl_ptr d; }; } } -#endif /* __KLEOPATRA_CRYPTO_CONTROLLER_H__ */ diff --git a/src/crypto/createchecksumscontroller.h b/src/crypto/createchecksumscontroller.h index 382a08550..2e49c45e1 100644 --- a/src/crypto/createchecksumscontroller.h +++ b/src/crypto/createchecksumscontroller.h @@ -1,57 +1,55 @@ /* -*- mode: c++; c-basic-offset:4 -*- crypto/createchecksumscontroller.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2010 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_CRYPTO_CREATECHECKSUMSCONTROLLER_H__ -#define __KLEOPATRA_CRYPTO_CREATECHECKSUMSCONTROLLER_H__ +#pragma once #include #include #include #include #include #include namespace Kleo { namespace Crypto { class CreateChecksumsController : public Controller { Q_OBJECT public: explicit CreateChecksumsController(QObject *parent = nullptr); explicit CreateChecksumsController(const std::shared_ptr &ctx, QObject *parent = nullptr); ~CreateChecksumsController(); void setAllowAddition(bool allow); bool allowAddition() const; void setFiles(const QStringList &files); void start(); public Q_SLOTS: void cancel(); private: class Private; kdtools::pimpl_ptr d; Q_PRIVATE_SLOT(d, void slotOperationFinished()) Q_PRIVATE_SLOT(d, void slotProgress(int, int, QString)) }; } } -#endif /* __KLEOPATRA_UISERVER_CREATECHECKSUMSCONTROLLER_H__ */ diff --git a/src/crypto/decryptverifyemailcontroller.h b/src/crypto/decryptverifyemailcontroller.h index 6f07a0290..ffd45b669 100644 --- a/src/crypto/decryptverifyemailcontroller.h +++ b/src/crypto/decryptverifyemailcontroller.h @@ -1,95 +1,93 @@ /* -*- mode: c++; c-basic-offset:4 -*- decryptverifyemailcontroller.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2008 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_CRYPTO_DECRYPTVERIFYEMAILCONTROLLER_H__ -#define __KLEOPATRA_CRYPTO_DECRYPTVERIFYEMAILCONTROLLER_H__ +#pragma once #include #include #include #include #include #include namespace KMime { namespace Types { class Mailbox; } } namespace GpgME { class VerificationResult; } namespace Kleo { class Input; class Output; namespace Crypto { class DecryptVerifyEMailController : public Controller { Q_OBJECT public: explicit DecryptVerifyEMailController(QObject *parent = nullptr); explicit DecryptVerifyEMailController(const std::shared_ptr &cmd, QObject *parent = nullptr); ~DecryptVerifyEMailController() override; void setInput(const std::shared_ptr &input); void setInputs(const std::vector > &inputs); void setSignedData(const std::shared_ptr &data); void setSignedData(const std::vector > &data); void setOutput(const std::shared_ptr &output); void setOutputs(const std::vector > &outputs); void setInformativeSenders(const std::vector &senders); void setWizardShown(bool shown); void setOperation(DecryptVerifyOperation operation); void setVerificationMode(VerificationMode vm); void setProtocol(GpgME::Protocol protocol); void setSessionId(unsigned int id); void start(); public Q_SLOTS: void cancel(); Q_SIGNALS: void verificationResult(const GpgME::VerificationResult &); private: void doTaskDone(const Task *task, const std::shared_ptr &result) override; class Private; kdtools::pimpl_ptr d; Q_PRIVATE_SLOT(d, void slotWizardCanceled()) Q_PRIVATE_SLOT(d, void schedule()) }; } //namespace Crypto } //namespace Kleo Q_DECLARE_METATYPE(GpgME::VerificationResult) -#endif // __KLEOPATRA_CTYPTO_DECRYPTVERIFYEMAILCONTROLLER_H__ diff --git a/src/crypto/decryptverifyfilescontroller.h b/src/crypto/decryptverifyfilescontroller.h index ecb67fd5d..f2084155a 100644 --- a/src/crypto/decryptverifyfilescontroller.h +++ b/src/crypto/decryptverifyfilescontroller.h @@ -1,73 +1,71 @@ /* -*- mode: c++; c-basic-offset:4 -*- decryptverifyfilescontroller.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2008 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_CRYPTO_DECRYPTVERIFYFILESCONTROLLER_H__ -#define __KLEOPATRA_CRYPTO_DECRYPTVERIFYFILESCONTROLLER_H__ +#pragma once #include "crypto/controller.h" #include "utils/types.h" #include "utils/archivedefinition.h" #include #include #include namespace GpgME { class VerificationResult; } namespace Kleo { namespace Crypto { class DecryptVerifyFilesController : public Controller { Q_OBJECT public: explicit DecryptVerifyFilesController(QObject *parent = nullptr); explicit DecryptVerifyFilesController(const std::shared_ptr &ctx, QObject *parent = nullptr); ~DecryptVerifyFilesController() override; virtual void setFiles(const QStringList &files); virtual void setOperation(DecryptVerifyOperation op); virtual DecryptVerifyOperation operation() const; virtual void start(); public Q_SLOTS: virtual void cancel(); protected: std::shared_ptr pick_archive_definition(GpgME::Protocol proto, const std::vector< std::shared_ptr > &ads, const QString &filename); Q_SIGNALS: void verificationResult(const GpgME::VerificationResult &); private: void doTaskDone(const Task *task, const std::shared_ptr &) override; private: class Private; std::shared_ptr d; Q_PRIVATE_SLOT(d, void slotWizardOperationPrepared()) Q_PRIVATE_SLOT(d, void slotWizardCanceled()) Q_PRIVATE_SLOT(d, void schedule()) }; } } Q_DECLARE_METATYPE(GpgME::VerificationResult) -#endif // __KLEOPATRA_CRYPTO_DECRYPTVERIFYFILESCONTROLLER_H__ diff --git a/src/crypto/decryptverifytask.h b/src/crypto/decryptverifytask.h index abc72945a..3bb452087 100644 --- a/src/crypto/decryptverifytask.h +++ b/src/crypto/decryptverifytask.h @@ -1,261 +1,259 @@ /* -*- mode: c++; c-basic-offset:4 -*- decryptverifytask.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2008 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_CRYPTO_DECRYPTVERIFYTASK_H__ -#define __KLEOPATRA_CRYPTO_DECRYPTVERIFYTASK_H__ +#pragma once #include "task.h" #include #include #include namespace KMime { namespace Types { class Mailbox; } } namespace GpgME { class DecryptionResult; class VerificationResult; class Key; class Signature; } namespace Kleo { class Input; class Output; class AuditLog; } namespace Kleo { namespace Crypto { class DecryptVerifyResult; class AbstractDecryptVerifyTask : public Task { Q_OBJECT public: explicit AbstractDecryptVerifyTask(QObject *parent = nullptr); virtual ~AbstractDecryptVerifyTask(); virtual void autodetectProtocolFromInput() = 0; KMime::Types::Mailbox informativeSender() const; void setInformativeSender(const KMime::Types::Mailbox &senders); virtual QString inputLabel() const = 0; virtual QString outputLabel() const = 0; Q_SIGNALS: void decryptVerifyResult(const std::shared_ptr &); protected: std::shared_ptr fromDecryptResult(const GpgME::DecryptionResult &dr, const QByteArray &plaintext, const AuditLog &auditLog); std::shared_ptr fromDecryptResult(const GpgME::Error &err, const QString &details, const AuditLog &auditLog); std::shared_ptr fromDecryptVerifyResult(const GpgME::DecryptionResult &dr, const GpgME::VerificationResult &vr, const QByteArray &plaintext, const AuditLog &auditLog); std::shared_ptr fromDecryptVerifyResult(const GpgME::Error &err, const QString &what, const AuditLog &auditLog); std::shared_ptr fromVerifyOpaqueResult(const GpgME::VerificationResult &vr, const QByteArray &plaintext, const AuditLog &auditLog); std::shared_ptr fromVerifyOpaqueResult(const GpgME::Error &err, const QString &details, const AuditLog &auditLog); std::shared_ptr fromVerifyDetachedResult(const GpgME::VerificationResult &vr, const AuditLog &auditLog); std::shared_ptr fromVerifyDetachedResult(const GpgME::Error &err, const QString &details, const AuditLog &auditLog); private: class Private; kdtools::pimpl_ptr d; }; class DecryptTask : public AbstractDecryptVerifyTask { Q_OBJECT public: explicit DecryptTask(QObject *parent = nullptr); ~DecryptTask() override; void setInput(const std::shared_ptr &input); void setOutput(const std::shared_ptr &output); void setProtocol(GpgME::Protocol prot); void autodetectProtocolFromInput() override; QString label() const override; GpgME::Protocol protocol() const override; QString inputLabel() const override; QString outputLabel() const override; public Q_SLOTS: void cancel() override; private: void doStart() override; unsigned long long inputSize() const override; private: class Private; kdtools::pimpl_ptr d; Q_PRIVATE_SLOT(d, void slotResult(GpgME::DecryptionResult, QByteArray)) }; class VerifyDetachedTask : public AbstractDecryptVerifyTask { Q_OBJECT public: explicit VerifyDetachedTask(QObject *parent = nullptr); ~VerifyDetachedTask() override; void setInput(const std::shared_ptr &input); void setSignedData(const std::shared_ptr &signedData); void setProtocol(GpgME::Protocol prot); void autodetectProtocolFromInput() override; QString label() const override; GpgME::Protocol protocol() const override; QString inputLabel() const override; QString outputLabel() const override; public Q_SLOTS: void cancel() override; private: void doStart() override; unsigned long long inputSize() const override; private: class Private; kdtools::pimpl_ptr d; Q_PRIVATE_SLOT(d, void slotResult(GpgME::VerificationResult)) }; class VerifyOpaqueTask : public AbstractDecryptVerifyTask { Q_OBJECT public: explicit VerifyOpaqueTask(QObject *parent = nullptr); ~VerifyOpaqueTask() override; void setInput(const std::shared_ptr &input); void setOutput(const std::shared_ptr &output); void setProtocol(GpgME::Protocol prot); void autodetectProtocolFromInput()override; QString label() const override; GpgME::Protocol protocol() const override; QString inputLabel() const override; QString outputLabel() const override; public Q_SLOTS: void cancel() override; private: void doStart() override; unsigned long long inputSize() const override; private: class Private; kdtools::pimpl_ptr d; Q_PRIVATE_SLOT(d, void slotResult(GpgME::VerificationResult, QByteArray)) }; class DecryptVerifyTask : public AbstractDecryptVerifyTask { Q_OBJECT public: explicit DecryptVerifyTask(QObject *parent = nullptr); ~DecryptVerifyTask() override; void setInput(const std::shared_ptr &input); void setSignedData(const std::shared_ptr &signedData); void setOutput(const std::shared_ptr &output); void setProtocol(GpgME::Protocol prot); void autodetectProtocolFromInput() override; QString label() const override; GpgME::Protocol protocol() const override; void setIgnoreMDCError(bool value); QString inputLabel() const override; QString outputLabel() const override; public Q_SLOTS: void cancel() override; private: void doStart() override; unsigned long long inputSize() const override; private: class Private; kdtools::pimpl_ptr d; Q_PRIVATE_SLOT(d, void slotResult(GpgME::DecryptionResult, GpgME::VerificationResult, QByteArray)) }; class DecryptVerifyResult : public Task::Result { friend class ::Kleo::Crypto::AbstractDecryptVerifyTask; public: class SenderInfo; QString overview() const override; QString details() const override; bool hasError() const; int errorCode() const override; QString errorString() const override; VisualCode code() const override; AuditLog auditLog() const override; QPointer parentTask() const override; GpgME::VerificationResult verificationResult() const; GpgME::DecryptionResult decryptionResult() const; private: static QString keyToString(const GpgME::Key &key); private: DecryptVerifyResult(); DecryptVerifyResult(const DecryptVerifyResult &); DecryptVerifyResult &operator=(const DecryptVerifyResult &other); DecryptVerifyResult(DecryptVerifyOperation op, const GpgME::VerificationResult &vr, const GpgME::DecryptionResult &dr, const QByteArray &stuff, int errCode, const QString &errString, const QString &inputLabel, const QString &outputLabel, const AuditLog &auditLog, Task *parentTask, const KMime::Types::Mailbox &informativeSender); private: class Private; kdtools::pimpl_ptr d; }; } } -#endif //__KLEOPATRA_CRYPTO_DECRYPTVERIFYTASK_H__ diff --git a/src/crypto/encryptemailcontroller.h b/src/crypto/encryptemailcontroller.h index ead261499..7a1da75bb 100644 --- a/src/crypto/encryptemailcontroller.h +++ b/src/crypto/encryptemailcontroller.h @@ -1,96 +1,94 @@ /* -*- mode: c++; c-basic-offset:4 -*- crypto/encryptemailcontroller.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2007 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_CRYPTO_ENCRYPTEMAILCONTROLLER_H__ -#define __KLEOPATRA_CRYPTO_ENCRYPTEMAILCONTROLLER_H__ +#pragma once #include #include #include #include #include namespace KMime { namespace Types { class Mailbox; } } namespace Kleo { class Input; class Output; namespace Crypto { class EncryptEMailController : public Controller { Q_OBJECT public: enum Mode { GpgOLMode, ClipboardMode, NumModes }; explicit EncryptEMailController(Mode mode, QObject *parent = nullptr); explicit EncryptEMailController(const std::shared_ptr &xc, Mode mode, QObject *parent = nullptr); ~EncryptEMailController() override; Mode mode() const; static const char *mementoName() { return "EncryptEMailController"; } void setProtocol(GpgME::Protocol proto); const char *protocolAsString() const; GpgME::Protocol protocol() const; void startResolveRecipients(); void startResolveRecipients(const std::vector &recipients, const std::vector &senders); void setInputAndOutput(const std::shared_ptr &input, const std::shared_ptr &output); void setInputsAndOutputs(const std::vector< std::shared_ptr > &inputs, const std::vector< std::shared_ptr > &outputs); void start(); public Q_SLOTS: void cancel(); Q_SIGNALS: void recipientsResolved(); private: void doTaskDone(const Task *task, const std::shared_ptr &) override; class Private; kdtools::pimpl_ptr d; Q_PRIVATE_SLOT(d, void slotWizardRecipientsResolved()) Q_PRIVATE_SLOT(d, void slotWizardCanceled()) Q_PRIVATE_SLOT(d, void schedule()) }; } // Crypto } // Kleo -#endif /* __KLEOPATRA_CRYPTO_ENCRYPTEMAILCONTROLLER_H__ */ diff --git a/src/crypto/encryptemailtask.h b/src/crypto/encryptemailtask.h index b916b3410..b5c49c338 100644 --- a/src/crypto/encryptemailtask.h +++ b/src/crypto/encryptemailtask.h @@ -1,67 +1,65 @@ /* -*- mode: c++; c-basic-offset:4 -*- crypto/encryptemailtask.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2007 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_CRYPTO_ENCRYPTEMAILTASK_H__ -#define __KLEOPATRA_CRYPTO_ENCRYPTEMAILTASK_H__ +#pragma once #include #include #include #include namespace GpgME { class Key; } namespace Kleo { class Input; class Output; } namespace Kleo { namespace Crypto { class EncryptEMailTask : public Task { Q_OBJECT public: explicit EncryptEMailTask(QObject *parent = nullptr); ~EncryptEMailTask() override; void setInput(const std::shared_ptr &input); void setOutput(const std::shared_ptr &output); void setRecipients(const std::vector &recipients); GpgME::Protocol protocol() const override; void cancel() override; QString label() const override; private: void doStart() override; unsigned long long inputSize() const override; private: class Private; kdtools::pimpl_ptr d; Q_PRIVATE_SLOT(d, void slotResult(const GpgME::EncryptionResult &)) }; } } -#endif /* __KLEOPATRA_CRYPTO_ENCRYPTEMAILTASK_H__ */ diff --git a/src/crypto/gui/certificatelineedit.h b/src/crypto/gui/certificatelineedit.h index 008209b4f..5fa321030 100644 --- a/src/crypto/gui/certificatelineedit.h +++ b/src/crypto/gui/certificatelineedit.h @@ -1,107 +1,105 @@ /* crypto/gui/certificatelineedit.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-FileCopyrightText: 2021 g10 Code GmbH SPDX-FileContributor: Ingo Klöcker SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef CRYPTO_GUI_CERTIFICATELINEEDIT_H -#define CRYPTO_GUI_CERTIFICATELINEEDIT_H +#pragma once #include #include #include #include class QCompleter; class QLabel; class QAction; namespace Kleo { class AbstractKeyListModel; class KeyFilter; class KeyListSortFilterProxyModel; /** Line edit and completion based Certificate Selection Widget. * * Shows the status of the selection with a status label and icon. * * The widget will use a single line HBox Layout. For larger dialog * see certificateslectiondialog. */ class CertificateLineEdit: public QLineEdit { Q_OBJECT public: /** Create the certificate selection line. * * If parent is not NULL the model is not taken * over but the parent argument used as the parent of the model. * * @param model: The keylistmodel to use. * @param parent: The usual widget parent. * @param filter: The filters to use. See certificateselectiondialog. */ CertificateLineEdit(AbstractKeyListModel *model, QWidget *parent = nullptr, KeyFilter *filter = nullptr); /** Get the selected key */ GpgME::Key key() const; KeyGroup group() const; /** Check if the text is empty */ bool isEmpty() const; /** Set the preselected Key for this widget. */ void setKey(const GpgME::Key &key); /** Set the preselected group for this widget. */ void setGroup(const KeyGroup &group); /** Set the used keyfilter. */ void setKeyFilter(const std::shared_ptr &filter); Q_SIGNALS: /** Emitted when the selected key changed. */ void keyChanged(); /** Emitted when the entry is empty and editing is finished. */ void wantsRemoval(CertificateLineEdit *w); /** Emitted when the entry is no longer empty. */ void editingStarted(); /** Emitted when the details dialog or the selection dialog is requested. */ void dialogRequested(); private Q_SLOTS: void updateKey(); void editChanged(); void editFinished(); void checkLocate(); private: KeyListSortFilterProxyModel *const mFilterModel; KeyListSortFilterProxyModel *const mCompleterFilterModel; QCompleter *mCompleter = nullptr; QLabel *mStatusLabel, *mStatusIcon; GpgME::Key mKey; KeyGroup mGroup; GpgME::Protocol mCurrentProto; std::shared_ptr mFilter; bool mEditStarted = false; bool mEditFinished = false; QAction *const mLineAction; }; } -#endif diff --git a/src/crypto/gui/certificateselectionline.h b/src/crypto/gui/certificateselectionline.h index eba871ba2..fcc8badee 100644 --- a/src/crypto/gui/certificateselectionline.h +++ b/src/crypto/gui/certificateselectionline.h @@ -1,91 +1,89 @@ /* crypto/gui/certificateselectionline.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2009 Klarälvdalens Datakonsult AB SPDX-FileCopyrightText: 2016 Bundesamt für Sicherheit in der Informationstechnik SPDX-FileContributor: Intevation GmbH SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef CRYPTO_GUI_CERTIFICATESELECTIONLINE_H -#define CRYPTO_GUI_CERTIFICATESELECTIONLINE_H +#pragma once #include #include #include #include class QToolButton; class QLabel; class QStackedWidget; namespace Kleo { class KeysComboBox; class CertificateSelectionLine { public: /** Number of columns needed in the gridlayout. */ static const unsigned int NumColumns = 4; /** Create a certificateselection line that distinguishes between protocols. * * Ambiguity means here that there is not a single valid choice or that * soemthing is not selected. There are basically two modes here, one is * for a protocol specific selection, that is used mainly by GpgOL over assuan. * This is the constructor for that mode. The second mode does not care about * protocols. * * @param toFrom: An optional label. * @param mailbox: The Mailbox for which the certificate should be selected. * @param pgp: List of PGP Certificates. * @param pgpAmbig: Whether or not the PGP Cert is ambiguous. * @param cms: List of CMS Certificates. * @param cmsAmbig: Whether or not the CMS Cert is ambiguous. * @param q: Parent widget. * @param glay: Layout to add the widgets to. */ CertificateSelectionLine(const QString &toFrom, const QString &mailbox, const std::vector &pgp, bool pgpAmbig, const std::vector &cms, bool cmsAmbig, QWidget *q, QGridLayout &glay); void showHide(GpgME::Protocol proto, bool &first, bool showAll, bool op) const; bool wasInitiallyAmbiguous(GpgME::Protocol proto) const; bool isStillAmbiguous(GpgME::Protocol proto) const; QString mailboxText() const; void addAndSelectCertificate(const GpgME::Key &key) const; GpgME::Key key(GpgME::Protocol proto) const; const QToolButton *toolButton() const; void kill(); KeysComboBox *comboBox(GpgME::Protocol proto) const; private: bool pgpAmbiguous : 1; bool cmsAmbiguous : 1; QLabel *mToFromLB; QLabel *mMailboxLB; QStackedWidget *mSbox; KeysComboBox *mPgpCB, *mCmsCB, *noProtocolCB; QToolButton *mToolTB; }; } // namespace Kleo -#endif // CRYPTO_GUI_CERTIFICATESELECTIONLINE_H diff --git a/src/crypto/gui/decryptverifyfilesdialog.h b/src/crypto/gui/decryptverifyfilesdialog.h index 0e79c76cc..3a36f32a7 100644 --- a/src/crypto/gui/decryptverifyfilesdialog.h +++ b/src/crypto/gui/decryptverifyfilesdialog.h @@ -1,76 +1,74 @@ /* crypto/gui/decryptverifyfilesdialog.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2007 Klarälvdalens Datakonsult AB SPDX-FileCopyrightText: 2016 Bundesamt für Sicherheit in der Informationstechnik SPDX-FileContributor: Intevation GmbH SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef CRYPTO_GUI_DECRYPTVERIFYFILESDIALOG_H -#define CRYPTO_GUI_DECRYPTVERIFYFILESDIALOG_H +#pragma once #include #include #include #include #include "crypto/task.h" class QVBoxLayout; class QProgressBar; template class QHash; class QLabel; namespace Kleo { class FileNameRequester; namespace Crypto { class TaskCollection; namespace Gui { class ResultListWidget; class DecryptVerifyFilesDialog : public QDialog { Q_OBJECT public: explicit DecryptVerifyFilesDialog(const std::shared_ptr &coll, QWidget *parent = nullptr); ~DecryptVerifyFilesDialog(); void setOutputLocation(const QString &dir); QString outputLocation() const; protected Q_SLOTS: void progress(const QString &msg, int progress, int total); void started(const std::shared_ptr &result); void allDone(); void btnClicked(QAbstractButton *btn); void checkAccept(); protected: void readConfig(); void writeConfig(); protected: QLabel *labelForTag(const QString &tag); private: std::shared_ptr m_tasks; QProgressBar *m_progressBar; QHash m_progressLabelByTag; QVBoxLayout *m_progressLabelLayout; int m_lastErrorItemIndex; ResultListWidget *m_resultList; FileNameRequester *m_outputLocationFNR; QDialogButtonBox::StandardButton m_saveButton = QDialogButtonBox::NoButton; QDialogButtonBox *const m_buttonBox; }; } // namespace Gui } //namespace Crypto; } // namespace Kleo -#endif // CRYPTO_GUI_DECRYPTVERIFYFILESDIALOG_H diff --git a/src/crypto/gui/decryptverifyfileswizard.h b/src/crypto/gui/decryptverifyfileswizard.h index c7393ecb2..79e01246e 100644 --- a/src/crypto/gui/decryptverifyfileswizard.h +++ b/src/crypto/gui/decryptverifyfileswizard.h @@ -1,65 +1,63 @@ /* -*- mode: c++; c-basic-offset:4 -*- crypto/gui/decryptverifyfileswizard.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2007 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_CRYPTO_GUI_DECRYPTVERIFYFILESWIZARD_H__ -#define __KLEOPATRA_CRYPTO_GUI_DECRYPTVERIFYFILESWIZARD_H__ +#pragma once #include #include #include namespace Kleo { namespace Crypto { class Task; class TaskCollection; namespace Gui { class DecryptVerifyOperationWidget; class DecryptVerifyFilesWizard : public Wizard { Q_OBJECT public: enum Page { OperationsPage = 0, ResultPage }; explicit DecryptVerifyFilesWizard(QWidget *parent = nullptr, Qt::WindowFlags f = {}); ~DecryptVerifyFilesWizard() override; void setOutputDirectory(const QString &dir); QString outputDirectory() const; bool useOutputDirectory() const; void setTaskCollection(const std::shared_ptr &coll); DecryptVerifyOperationWidget *operationWidget(unsigned int idx); Q_SIGNALS: void operationPrepared(); private: void onNext(int id) override; private: class Private; kdtools::pimpl_ptr d; }; } } } -#endif /* __KLEOPATRA_CRYPTO_GUI_DECRYPTVERIFYFILESWIZARD_H__ */ diff --git a/src/crypto/gui/decryptverifyoperationwidget.h b/src/crypto/gui/decryptverifyoperationwidget.h index 059a0a653..0191340e4 100644 --- a/src/crypto/gui/decryptverifyoperationwidget.h +++ b/src/crypto/gui/decryptverifyoperationwidget.h @@ -1,71 +1,69 @@ /* -*- mode: c++; c-basic-offset:4 -*- crypto/gui/decryptverifyoperationwidget.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2007 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_CRYPTO_GUI_DECRYPTVERIFYOPERATIONWIDGET_H__ -#define __KLEOPATRA_CRYPTO_GUI_DECRYPTVERIFYOPERATIONWIDGET_H__ +#pragma once #include #include #include #include namespace Kleo { class ArchiveDefinition; } namespace Kleo { namespace Crypto { namespace Gui { class DecryptVerifyOperationWidget : public QWidget { Q_OBJECT Q_ENUMS(Mode) Q_PROPERTY(Mode mode READ mode WRITE setMode) Q_PROPERTY(QString inputFileName READ inputFileName WRITE setInputFileName) Q_PROPERTY(QString signedDataFileName READ signedDataFileName WRITE setSignedDataFileName) public: explicit DecryptVerifyOperationWidget(QWidget *parent = nullptr); ~DecryptVerifyOperationWidget(); enum Mode { VerifyDetachedWithSignature, VerifyDetachedWithSignedData, DecryptVerifyOpaque }; void setMode(Mode mode, const std::shared_ptr &ad); void setMode(Mode mode); Mode mode() const; void setInputFileName(const QString &name); QString inputFileName() const; void setSignedDataFileName(const QString &name); QString signedDataFileName() const; void setArchiveDefinitions(const std::vector< std::shared_ptr > &ads); std::shared_ptr selectedArchiveDefinition() const; private: class Private; kdtools::pimpl_ptr d; Q_PRIVATE_SLOT(d, void enableDisableWidgets()) }; } } } -#endif /* __KLEOPATRA_UISERVER_DECRYPTVERIFYOPERATIONWIDGET_H__ */ diff --git a/src/crypto/gui/encryptemailwizard.h b/src/crypto/gui/encryptemailwizard.h index f1a5799ef..b57bbc8a5 100644 --- a/src/crypto/gui/encryptemailwizard.h +++ b/src/crypto/gui/encryptemailwizard.h @@ -1,39 +1,37 @@ /* -*- mode: c++; c-basic-offset:4 -*- crypto/gui/encryptemailwizard.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2008 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_ENCRYPTEMAILWIZARD_H__ -#define __KLEOPATRA_ENCRYPTEMAILWIZARD_H__ +#pragma once #include namespace Kleo { namespace Crypto { namespace Gui { class EncryptEMailWizard : public SignEncryptWizard { Q_OBJECT public: explicit EncryptEMailWizard(QWidget *parent = nullptr, Qt::WindowFlags flags = {}); ~EncryptEMailWizard(); bool quickMode() const; void setQuickMode(bool quick); private: class Private; kdtools::pimpl_ptr d; }; } } } -#endif // __KLEOPATRA_ENCRYPTEMAILWIZARD_H__ diff --git a/src/crypto/gui/newresultpage.h b/src/crypto/gui/newresultpage.h index 1e2c070f7..236c1723d 100644 --- a/src/crypto/gui/newresultpage.h +++ b/src/crypto/gui/newresultpage.h @@ -1,63 +1,61 @@ /* -*- mode: c++; c-basic-offset:4 -*- crypto/gui/newresultpage.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2008, 2009 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_CRYPTO_GUI_NEWRESULTPAGE_H__ -#define __KLEOPATRA_CRYPTO_GUI_NEWRESULTPAGE_H__ +#pragma once #include #include #include namespace Kleo { namespace Crypto { class TaskCollection; class Task; } } namespace Kleo { namespace Crypto { namespace Gui { class NewResultPage : public QWizardPage { Q_OBJECT public: explicit NewResultPage(QWidget *parent = nullptr); ~NewResultPage() override; void setTaskCollection(const std::shared_ptr &coll); void addTaskCollection(const std::shared_ptr &coll); bool isComplete() const override; Q_SIGNALS: void linkActivated(const QString &link); private: class Private; kdtools::pimpl_ptr d; Q_PRIVATE_SLOT(d, void progress(QString, int, int)) Q_PRIVATE_SLOT(d, void result(std::shared_ptr)) Q_PRIVATE_SLOT(d, void started(std::shared_ptr)) Q_PRIVATE_SLOT(d, void allDone()) }; } } } -#endif // __KLEOPATRA_CRYPTO_GUI_NEWRESULTPAGE_H__ diff --git a/src/crypto/gui/objectspage.h b/src/crypto/gui/objectspage.h index f5351dc47..85c576898 100644 --- a/src/crypto/gui/objectspage.h +++ b/src/crypto/gui/objectspage.h @@ -1,50 +1,48 @@ /* -*- mode: c++; c-basic-offset:4 -*- crypto/gui/objectspage.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2007 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_CRYPTO_GUI_OBJECTSPAGE_H__ -#define __KLEOPATRA_CRYPTO_GUI_OBJECTSPAGE_H__ +#pragma once #include #include #include namespace Kleo { namespace Crypto { namespace Gui { class ObjectsPage : public WizardPage { Q_OBJECT public: explicit ObjectsPage(QWidget *parent = nullptr, Qt::WindowFlags f = {}); ~ObjectsPage() override; bool isComplete() const override; void setFiles(const QStringList &files); QStringList files() const; private: class Private; kdtools::pimpl_ptr d; Q_PRIVATE_SLOT(d, void add()) Q_PRIVATE_SLOT(d, void remove()) Q_PRIVATE_SLOT(d, void listSelectionChanged()) }; } } } -#endif // __KLEOPATRA_CRYPTO_GUI_OBJECTSPAGE_H__ diff --git a/src/crypto/gui/resolverecipientspage.h b/src/crypto/gui/resolverecipientspage.h index 2be229586..6892e528a 100644 --- a/src/crypto/gui/resolverecipientspage.h +++ b/src/crypto/gui/resolverecipientspage.h @@ -1,105 +1,103 @@ /* -*- mode: c++; c-basic-offset:4 -*- crypto/gui/resolverecipientspage.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2007 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_CRYPTO_GUI_RESOLVERECIPIENTSPAGE_H__ -#define __KLEOPATRA_CRYPTO_GUI_RESOLVERECIPIENTSPAGE_H__ +#pragma once #include #include #include #include #include namespace GpgME { class Key; } namespace KMime { namespace Types { class Mailbox; } } namespace Kleo { namespace Crypto { class RecipientPreferences; namespace Gui { class ResolveRecipientsPage : public WizardPage { Q_OBJECT public: explicit ResolveRecipientsPage(QWidget *parent = nullptr); ~ResolveRecipientsPage() override; bool isComplete() const override; /** * The protocol selected by the user (which is chosen by * the user in case none was preset) */ GpgME::Protocol selectedProtocol() const; /** * the protocol set before the dialog is shown. Defaults to * GpgME::UnknownProtocol */ GpgME::Protocol presetProtocol() const; void setPresetProtocol(GpgME::Protocol protocol); bool multipleProtocolsAllowed() const; void setMultipleProtocolsAllowed(bool allowed); /** if true, the user is allowed to remove/add recipients via the UI. * Defaults to @p false. */ bool recipientsUserMutable() const; void setRecipientsUserMutable(bool isMutable); void setAdditionalRecipientsInfo(const std::vector &recipients); void setRecipients(const std::vector &recipients, const std::vector &encryptToSelfRecipients); std::vector resolvedCertificates() const; std::shared_ptr recipientPreferences() const; void setRecipientPreferences(const std::shared_ptr &prefs); Q_SIGNALS: void selectedProtocolChanged(); private: void onNext() override; private: class Private; kdtools::pimpl_ptr d; Q_PRIVATE_SLOT(d, void selectionChanged()) Q_PRIVATE_SLOT(d, void protocolSelected(int)) Q_PRIVATE_SLOT(d, void addRecipient()) Q_PRIVATE_SLOT(d, void removeSelectedEntries()) Q_PRIVATE_SLOT(d, void completeChangedInternal()) class ListWidget; class ItemWidget; }; } } } -#endif // __KLEOPATRA_CRYPTO_GUI_RESOLVERECIPIENTSPAGE_H__ diff --git a/src/crypto/gui/resolverecipientspage_p.h b/src/crypto/gui/resolverecipientspage_p.h index 84179b241..a899dd01a 100644 --- a/src/crypto/gui/resolverecipientspage_p.h +++ b/src/crypto/gui/resolverecipientspage_p.h @@ -1,109 +1,107 @@ /* -*- mode: c++; c-basic-offset:4 -*- crypto/gui/resolverecipientspage_p.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2007 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_CRYPTO_GUI_RESOLVERECIPIENTSPAGE_P_H__ -#define __KLEOPATRA_CRYPTO_GUI_RESOLVERECIPIENTSPAGE_P_H__ +#pragma once #include #include #include class QComboBox; class QLabel; class QListWidget; class QListWidgetItem; #include class QToolButton; class Kleo::Crypto::Gui::ResolveRecipientsPage::ListWidget : public QWidget { Q_OBJECT public: explicit ListWidget(QWidget *parent = nullptr, Qt::WindowFlags flags = {}); ~ListWidget(); void addEntry(const QString &id, const QString &name); void addEntry(const KMime::Types::Mailbox &mbox); void addEntry(const QString &id, const QString &name, const KMime::Types::Mailbox &mbox); void removeEntry(const QString &id); QStringList selectedEntries() const; void setCertificates(const QString &id, const std::vector &pgpCerts, const std::vector &cmsCerts); GpgME::Key selectedCertificate(const QString &id) const; GpgME::Key selectedCertificate(const QString &id, GpgME::Protocol prot) const; KMime::Types::Mailbox mailbox(const QString &id) const; QStringList identifiers() const; void setProtocol(GpgME::Protocol prot); void showSelectionDialog(const QString &id); enum Role { IdRole = Qt::UserRole }; Q_SIGNALS: void selectionChanged(); void completeChanged(); private Q_SLOTS: void onSelectionChange(); private: QListWidget *m_listWidget; QHash widgets; QHash items; GpgME::Protocol m_protocol; }; class Kleo::Crypto::Gui::ResolveRecipientsPage::ItemWidget : public QWidget { Q_OBJECT public: explicit ItemWidget(const QString &id, const QString &name, const KMime::Types::Mailbox &mbox, QWidget *parent = nullptr, Qt::WindowFlags flags = {}); ~ItemWidget(); QString id() const; KMime::Types::Mailbox mailbox() const; void setCertificates(const std::vector &pgp, const std::vector &cms); GpgME::Key selectedCertificate() const; GpgME::Key selectedCertificate(GpgME::Protocol prot) const; std::vector certificates() const; void setProtocol(GpgME::Protocol protocol); void setSelected(bool selected); bool isSelected() const; public Q_SLOTS: void showSelectionDialog(); Q_SIGNALS: void changed(); private: void addCertificateToComboBox(const GpgME::Key &key); void resetCertificates(); void selectCertificateInComboBox(const GpgME::Key &key); void updateVisibility(); private: QString m_id; KMime::Types::Mailbox m_mailbox; QLabel *m_nameLabel; QLabel *m_certLabel; QComboBox *m_certCombo; QToolButton *m_selectButton; GpgME::Protocol m_protocol; QHash m_selectedCertificates; std::vector m_pgp, m_cms; bool m_selected; }; -#endif // __KLEOPATRA_CRYPTO_GUI_RESOLVERECIPIENTSPAGE_P_H__ diff --git a/src/crypto/gui/resultitemwidget.h b/src/crypto/gui/resultitemwidget.h index 442cfde36..b5b7ee4d5 100644 --- a/src/crypto/gui/resultitemwidget.h +++ b/src/crypto/gui/resultitemwidget.h @@ -1,60 +1,58 @@ /* -*- mode: c++; c-basic-offset:4 -*- crypto/gui/resultitemwidget.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2008 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_CRYPTO_GUI_RESULTITEMWIDGET_H__ -#define __KLEOPATRA_CRYPTO_GUI_RESULTITEMWIDGET_H__ +#pragma once #include #include #include #include class QString; namespace Kleo { namespace Crypto { class Task; namespace Gui { class ResultItemWidget : public QWidget { Q_OBJECT public: explicit ResultItemWidget(const std::shared_ptr &result, QWidget *parent = nullptr, Qt::WindowFlags flags = {}); ~ResultItemWidget(); bool hasErrorResult() const; void showCloseButton(bool show); public Q_SLOTS: void showAuditLog(); Q_SIGNALS: void linkActivated(const QString &link); void closeButtonClicked(); private: class Private; kdtools::pimpl_ptr d; Q_PRIVATE_SLOT(d, void slotLinkActivated(QString)) }; } } } -#endif // __KLEOPATRA_CRYPTO_GUI_RESULTITEMWIDGET_H__ diff --git a/src/crypto/gui/resultlistwidget.h b/src/crypto/gui/resultlistwidget.h index b5180bf91..0d4908c11 100644 --- a/src/crypto/gui/resultlistwidget.h +++ b/src/crypto/gui/resultlistwidget.h @@ -1,65 +1,63 @@ /* -*- mode: c++; c-basic-offset:4 -*- crypto/gui/resultlistwidget.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2008 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_CRYPTO_GUI_RESULTLISTWIDGET_H__ -#define __KLEOPATRA_CRYPTO_GUI_RESULTLISTWIDGET_H__ +#pragma once #include #include #include #include class QString; namespace Kleo { namespace Crypto { class TaskCollection; namespace Gui { class ResultListWidget : public QWidget { Q_OBJECT public: explicit ResultListWidget(QWidget *parent = nullptr, Qt::WindowFlags flags = {}); ~ResultListWidget(); void setTaskCollection(const std::shared_ptr &coll); void addTaskCollection(const std::shared_ptr &coll); void setStandaloneMode(bool standalone); bool isComplete() const; unsigned int totalNumberOfTasks() const; unsigned int numberOfCompletedTasks() const; Q_SIGNALS: void linkActivated(const QString &link); void completeChanged(); private: class Private; kdtools::pimpl_ptr d; Q_PRIVATE_SLOT(d, void result(std::shared_ptr)) Q_PRIVATE_SLOT(d, void started(std::shared_ptr)) Q_PRIVATE_SLOT(d, void allTasksDone()) }; } } } -#endif // __KLEOPATRA_CRYPTO_GUI_RESULTLISTWIDGET_H__ diff --git a/src/crypto/gui/resultpage.h b/src/crypto/gui/resultpage.h index 80b165a2a..46c4069c3 100644 --- a/src/crypto/gui/resultpage.h +++ b/src/crypto/gui/resultpage.h @@ -1,59 +1,57 @@ /* -*- mode: c++; c-basic-offset:4 -*- crypto/gui/resultpage.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2008 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_CRYPTO_GUI_RESULTPAGE_H__ -#define __KLEOPATRA_CRYPTO_GUI_RESULTPAGE_H__ +#pragma once #include #include #include #include namespace Kleo { namespace Crypto { class TaskCollection; namespace Gui { class ResultPage : public WizardPage { Q_OBJECT public: explicit ResultPage(QWidget *parent = nullptr, Qt::WindowFlags flags = {}); ~ResultPage() override; void setTaskCollection(const std::shared_ptr &coll); bool isComplete() const override; bool keepOpenWhenDone() const; void setKeepOpenWhenDone(bool keep); private: class Private; kdtools::pimpl_ptr d; Q_PRIVATE_SLOT(d, void progress(QString, int, int)) Q_PRIVATE_SLOT(d, void result(std::shared_ptr)) Q_PRIVATE_SLOT(d, void started(std::shared_ptr)) Q_PRIVATE_SLOT(d, void keepOpenWhenDone(bool)) Q_PRIVATE_SLOT(d, void allDone()) }; } } } -#endif // __KLEOPATRA_CRYPTO_GUI_RESULTPAGE_H__ diff --git a/src/crypto/gui/signemailwizard.h b/src/crypto/gui/signemailwizard.h index 6cad78103..7ab0c0e54 100644 --- a/src/crypto/gui/signemailwizard.h +++ b/src/crypto/gui/signemailwizard.h @@ -1,43 +1,41 @@ /* -*- mode: c++; c-basic-offset:4 -*- crypto/gui/signemailwizard.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2008 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_CRYPTO_GUI_SIGNEMAILWIZARD_H__ -#define __KLEOPATRA_CRYPTO_GUI_SIGNEMAILWIZARD_H__ +#pragma once #include #include namespace Kleo { namespace Crypto { namespace Gui { class SignEMailWizard : public SignEncryptWizard { Q_OBJECT public: explicit SignEMailWizard(QWidget *parent = nullptr, Qt::WindowFlags f = {}); ~SignEMailWizard(); bool quickMode() const; void setQuickMode(bool quick); private: class Private; kdtools::pimpl_ptr d; }; } } } -#endif // __KLEOPATRA_SIGNEMAILWIZARD_H__ diff --git a/src/crypto/gui/signencryptemailconflictdialog.h b/src/crypto/gui/signencryptemailconflictdialog.h index 89e828d38..cf9eeda7a 100644 --- a/src/crypto/gui/signencryptemailconflictdialog.h +++ b/src/crypto/gui/signencryptemailconflictdialog.h @@ -1,91 +1,89 @@ /* -*- mode: c++; c-basic-offset:4 -*- crypto/gui/signencryptemailconflictdialog.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2009 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_CRYPTO_GUI_SIGNENCRYPTEMAILCONFLICTDIALOG_H__ -#define __KLEOPATRA_CRYPTO_GUI_SIGNENCRYPTEMAILCONFLICTDIALOG_H__ +#pragma once #include #include #include #include namespace GpgME { class Key; } namespace Kleo { namespace Crypto { class Sender; class Recipient; } } namespace Kleo { namespace Crypto { namespace Gui { class SignEncryptEMailConflictDialog : public QDialog { Q_OBJECT public: explicit SignEncryptEMailConflictDialog(QWidget *parent = nullptr); ~SignEncryptEMailConflictDialog(); // Inputs void setPresetProtocol(GpgME::Protocol proto); void setSubject(const QString &subject); void setSenders(const std::vector &senders); void setRecipients(const std::vector &recipients); void setSign(bool on); void setEncrypt(bool on); void setQuickMode(bool on); // To wrap up inputs: void pickProtocol(); void setConflict(bool conflict); // Intermediate bool isComplete() const; // Outputs GpgME::Protocol selectedProtocol() const; std::vector resolvedSigningKeys() const; std::vector resolvedEncryptionKeys() const; bool isQuickMode() const; private: Q_PRIVATE_SLOT(d, void slotCompleteChanged()) Q_PRIVATE_SLOT(d, void slotShowAllRecipientsToggled(bool)) Q_PRIVATE_SLOT(d, void slotProtocolChanged()) Q_PRIVATE_SLOT(d, void slotCertificateSelectionDialogRequested()) class Private; kdtools::pimpl_ptr d; }; } } } -#endif /* __KLEOPATRA_CRYPTO_GUI_SIGNENCRYPTEMAILCONFLICTDIALOG_H__ */ diff --git a/src/crypto/gui/signencryptfileswizard.h b/src/crypto/gui/signencryptfileswizard.h index 324b2d874..b9206314b 100644 --- a/src/crypto/gui/signencryptfileswizard.h +++ b/src/crypto/gui/signencryptfileswizard.h @@ -1,105 +1,103 @@ /* -*- mode: c++; c-basic-offset:4 -*- crypto/gui/signencryptfileswizard.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2009 Klarälvdalens Datakonsult AB SPDX-FileCopyrightText: 2016 Bundesamt für Sicherheit in der Informationstechnik SPDX-FileContributor: Intevation GmbH SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_CRYPTO_GUI_SIGNENCRYPTFILESWIZARD_H__ -#define __KLEOPATRA_CRYPTO_GUI_SIGNENCRYPTFILESWIZARD_H__ +#pragma once #include #include #include #include #include #include namespace GpgME { class Key; } namespace Kleo { namespace Crypto { class TaskCollection; } } class ResultPage; class SigEncPage; namespace Kleo { class SignEncryptFilesWizard : public QWizard { Q_OBJECT public: enum KindNames{ SignatureCMS, CombinedPGP, EncryptedPGP, EncryptedCMS, SignaturePGP, Directory }; explicit SignEncryptFilesWizard(QWidget *parent = nullptr, Qt::WindowFlags f = {}); ~SignEncryptFilesWizard(); // Inputs void setSigningPreset(bool preset); void setSigningUserMutable(bool mut); void setEncryptionPreset(bool preset); void setEncryptionUserMutable(bool mut); void setArchiveForced(bool archive); void setArchiveMutable(bool archive); void setOutputNames(const QMap &nameMap) const; QMap outputNames() const; void setTaskCollection(const std::shared_ptr &coll); // Outputs std::vector resolvedRecipients() const; std::vector resolvedSigners() const; bool encryptSymmetric() const; void setLabelText(const QString &label) const; protected: void readConfig(); void writeConfig(); Q_SIGNALS: void operationPrepared(); private Q_SLOTS: void slotCurrentIdChanged(int); private: SigEncPage *mSigEncPage = nullptr; ResultPage *mResultPage = nullptr; QAbstractButton *mLabel = nullptr; bool mSigningUserMutable = true; bool mEncryptionUserMutable = true; }; } -#endif /* __KLEOPATRA_CRYPTO_GUI_SIGNENCRYPTFILESWIZARD_H__ */ diff --git a/src/crypto/gui/signencryptwidget.h b/src/crypto/gui/signencryptwidget.h index b0dd41dd0..815052d63 100644 --- a/src/crypto/gui/signencryptwidget.h +++ b/src/crypto/gui/signencryptwidget.h @@ -1,133 +1,131 @@ /* 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 */ -#ifndef CRYPTO_GUI_SIGNENCRYPTWIDGET_H -#define CRYPTO_GUI_SIGNENCRYPTWIDGET_H +#pragma once #include #include #include class QGridLayout; class QCheckBox; namespace Kleo { class CertificateLineEdit; class KeyGroup; class KeySelectionCombo; class AbstractKeyListModel; class UnknownRecipientWidget; class SignEncryptWidget: public QWidget { Q_OBJECT public: /** If cmsSigEncExclusive is true CMS operations can be * done only either as sign or as encrypt */ explicit SignEncryptWidget(QWidget *parent = nullptr, bool cmsSigEncExclusive = false); /** Returns the list of recipients selected in the dialog * or an empty list if encryption is disabled */ std::vector 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 or * a null string if nothing would happen. */ QString 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); /** Validate that each line edit with content has a key. */ bool validate(); protected Q_SLOTS: void updateOp(); void recipientsChanged(); void recpRemovalRequested(CertificateLineEdit *w); void dialogRequested(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(const QString &op); /* Emitted when the certificate selection might be changed. */ void keysChanged(); private: CertificateLineEdit* addRecipientWidget(); private: KeySelectionCombo *mSigSelect = nullptr; KeySelectionCombo *mSelfSelect = nullptr; QVector mRecpWidgets; QVector mUnknownWidgets; QVector mAddedKeys; QVector mAddedGroups; QGridLayout *mRecpLayout = nullptr; QString mOp; AbstractKeyListModel *mModel = nullptr; QCheckBox *mSymmetric = nullptr; QCheckBox *mSigChk = nullptr; QCheckBox *mEncOtherChk = nullptr; QCheckBox *mEncSelfChk = nullptr; int mRecpRowCount = 2; GpgME::Protocol mCurrentProto; const bool mIsExclusive; }; } // namespace Kleo -#endif // CRYPTO_GUI_SIGNENCRYPTWIDGET_H diff --git a/src/crypto/gui/signencryptwizard.h b/src/crypto/gui/signencryptwizard.h index 0c3918ff8..ffe4aa545 100644 --- a/src/crypto/gui/signencryptwizard.h +++ b/src/crypto/gui/signencryptwizard.h @@ -1,140 +1,138 @@ /* -*- mode: c++; c-basic-offset:4 -*- crypto/gui/signencryptwizard.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2007 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_CRYPTO_GUI_SIGNENCRYPTWIZARD_H__ -#define __KLEOPATRA_CRYPTO_GUI_SIGNENCRYPTWIZARD_H__ +#pragma once #include #include #include #include #include #include #include namespace GpgME { class Key; } class QFileInfo; template class QList; typedef QList QFileInfoList; namespace Kleo { namespace Crypto { class Task; class TaskCollection; namespace Gui { class ObjectsPage; class ResolveRecipientsPage; class ResultPage; class SignerResolvePage; class SignEncryptWizard : public Wizard { Q_OBJECT public: explicit SignEncryptWizard(QWidget *parent = nullptr, Qt::WindowFlags f = {}); ~SignEncryptWizard() override; enum Page { ResolveSignerPage = 0, ObjectsPage, ResolveRecipientsPage, ResultPage }; void setCommitPage(Page); GpgME::Protocol presetProtocol() const; void setPresetProtocol(GpgME::Protocol proto); GpgME::Protocol selectedProtocol() const; /// SignOrEncryptFiles mode subinterface //@{ QFileInfoList resolvedFiles() const; void setFiles(const QStringList &files); bool signingSelected() const; void setSigningSelected(bool selected); bool encryptionSelected() const; void setEncryptionSelected(bool selected); bool isSigningUserMutable() const; void setSigningUserMutable(bool isMutable); bool isEncryptionUserMutable() const; void setEncryptionUserMutable(bool isMutable); bool isMultipleProtocolsAllowed() const; void setMultipleProtocolsAllowed(bool allowed); //@} void setRecipients(const std::vector &recipients, const std::vector &encryptoToSelfRecipients); /** if true, the user is allowed to remove/add recipients via the UI. * Defaults to @p false. */ bool recipientsUserMutable() const; void setRecipientsUserMutable(bool isMutable); void setSignersAndCandidates(const std::vector &signers, const std::vector< std::vector > &keys); void setTaskCollection(const std::shared_ptr &tasks); std::vector resolvedCertificates() const; std::vector resolvedSigners() const; bool isAsciiArmorEnabled() const; void setAsciiArmorEnabled(bool enabled); bool keepResultPageOpenWhenDone() const; void setKeepResultPageOpenWhenDone(bool keep); void onNext(int currentId) override; Q_SIGNALS: void signersResolved(); void objectsResolved(); void recipientsResolved(); protected: Gui::SignerResolvePage *signerResolvePage(); const Gui::SignerResolvePage *signerResolvePage() const; Gui::ObjectsPage *objectsPage(); Gui::ResultPage *resultPage(); Gui::ResolveRecipientsPage *resolveRecipientsPage(); void setSignerResolvePageValidator(const std::shared_ptr &validator); private: class Private; kdtools::pimpl_ptr d; }; } } } -#endif /* __KLEOPATRA_CRYPTO_GUI_SIGNENCRYPTWIZARD_H__ */ diff --git a/src/crypto/gui/signerresolvepage.h b/src/crypto/gui/signerresolvepage.h index c1f17f24a..9ec349301 100644 --- a/src/crypto/gui/signerresolvepage.h +++ b/src/crypto/gui/signerresolvepage.h @@ -1,126 +1,124 @@ /* -*- mode: c++; c-basic-offset:4 -*- crypto/gui/signerresolvepage.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2007 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_CRYPTO_GUI_SIGNERRESOLVEPAGE_H__ -#define __KLEOPATRA_CRYPTO_GUI_SIGNERRESOLVEPAGE_H__ +#pragma once #include #include #include #include #include #include #include namespace GpgME { class Key; } namespace Kleo { namespace Crypto { class SigningPreferences; namespace Gui { class SignerResolvePage : public WizardPage { Q_OBJECT public: explicit SignerResolvePage(QWidget *parent = nullptr, Qt::WindowFlags f = {}); ~SignerResolvePage() override; void setSignersAndCandidates(const std::vector &signers, const std::vector< std::vector > &keys); std::vector resolvedSigners() const; std::vector signingCertificates(GpgME::Protocol protocol = GpgME::UnknownProtocol) const; bool isComplete() const override; bool encryptionSelected() const; void setEncryptionSelected(bool selected); bool signingSelected() const; void setSigningSelected(bool selected); bool isEncryptionUserMutable() const; void setEncryptionUserMutable(bool ismutable); bool isSigningUserMutable() const; void setSigningUserMutable(bool ismutable); bool isAsciiArmorEnabled() const; void setAsciiArmorEnabled(bool enabled); void setPresetProtocol(GpgME::Protocol protocol); void setPresetProtocols(const std::vector &protocols); std::set selectedProtocols() const; std::set selectedProtocolsWithoutSigningCertificate() const; void setMultipleProtocolsAllowed(bool allowed); bool multipleProtocolsAllowed() const; void setProtocolSelectionUserMutable(bool ismutable); bool protocolSelectionUserMutable() const; enum Operation { SignAndEncrypt = 0, SignOnly, EncryptOnly }; Operation operation() const; class Validator { public: virtual ~Validator() {} virtual bool isComplete() const = 0; virtual QString explanation() const = 0; /** * returns a custom window title, or a null string if no custom * title is required. * (use this if the title needs dynamic adaption * depending on the user's selection) */ virtual QString customWindowTitle() const = 0; }; void setValidator(const std::shared_ptr &); std::shared_ptr validator() const; void setSigningPreferences(const std::shared_ptr &prefs); std::shared_ptr signingPreferences() const; private: void onNext() override; private: class Private; kdtools::pimpl_ptr d; Q_PRIVATE_SLOT(d, void operationButtonClicked(int)) Q_PRIVATE_SLOT(d, void selectCertificates()) Q_PRIVATE_SLOT(d, void updateUi()) }; } } } -#endif // __KLEOPATRA_CRYPTO_GUI_SIGNERRESOLVEPAGE_H__ diff --git a/src/crypto/gui/signerresolvepage_p.h b/src/crypto/gui/signerresolvepage_p.h index fb1d1b9f4..b434f07ee 100644 --- a/src/crypto/gui/signerresolvepage_p.h +++ b/src/crypto/gui/signerresolvepage_p.h @@ -1,82 +1,80 @@ /* -*- mode: c++; c-basic-offset:4 -*- crypto/gui/signerresolvepage_p.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2007 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_CRYPTO_GUI_SIGNERRESOLVEPAGE_P_H__ -#define __KLEOPATRA_CRYPTO_GUI_SIGNERRESOLVEPAGE_P_H__ +#pragma once #include class QButtonGroup; class QCheckBox; class QLabel; #include #include #include namespace Kleo { namespace Crypto { namespace Gui { class AbstractSigningProtocolSelectionWidget : public QWidget { Q_OBJECT public: explicit AbstractSigningProtocolSelectionWidget(QWidget *parent = nullptr, Qt::WindowFlags flags = {}); virtual void setProtocolChecked(GpgME::Protocol protocol, bool checked) = 0; virtual bool isProtocolChecked(GpgME::Protocol protocol) const = 0; virtual std::set checkedProtocols() const = 0; virtual void setCertificate(GpgME::Protocol protocol, const GpgME::Key &key) = 0; Q_SIGNALS: void userSelectionChanged(); }; class SigningProtocolSelectionWidget : public AbstractSigningProtocolSelectionWidget { Q_OBJECT public: explicit SigningProtocolSelectionWidget(QWidget *parent = nullptr, Qt::WindowFlags flags = {}); void setProtocolChecked(GpgME::Protocol protocol, bool checked) override; bool isProtocolChecked(GpgME::Protocol protocol) const override; std::set checkedProtocols() const override; void setCertificate(GpgME::Protocol protocol, const GpgME::Key &key) override; void setExclusive(bool exclusive); bool isExclusive() const; private: QCheckBox *button(GpgME::Protocol p) const; std::map m_buttons; QButtonGroup *m_buttonGroup; }; class ReadOnlyProtocolSelectionWidget : public AbstractSigningProtocolSelectionWidget { Q_OBJECT public: explicit ReadOnlyProtocolSelectionWidget(QWidget *parent = nullptr, Qt::WindowFlags flags = {}); void setProtocolChecked(GpgME::Protocol protocol, bool checked) override; bool isProtocolChecked(GpgME::Protocol protocol) const override; std::set checkedProtocols() const override; void setCertificate(GpgME::Protocol protocol, const GpgME::Key &key) override; private: QLabel *label(GpgME::Protocol p) const; std::map m_labels; }; } } } -#endif // __KLEOPATRA_CRYPTO_GUI_SIGNERRESOLVEPAGE_P_H__ diff --git a/src/crypto/gui/signingcertificateselectiondialog.h b/src/crypto/gui/signingcertificateselectiondialog.h index 74103b334..985284b97 100644 --- a/src/crypto/gui/signingcertificateselectiondialog.h +++ b/src/crypto/gui/signingcertificateselectiondialog.h @@ -1,53 +1,51 @@ /* -*- mode: c++; c-basic-offset:4 -*- crypto/gui/signingcertificateselectiondialog.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2007 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_CRYPTO_GUI_SIGNINGCERTIFICATESELECTIONDIALOG_H__ -#define __KLEOPATRA_CRYPTO_GUI_SIGNINGCERTIFICATESELECTIONDIALOG_H__ +#pragma once #include #include #include #include template class QMap; namespace Kleo { namespace Crypto { namespace Gui { class SigningCertificateSelectionWidget; class SigningCertificateSelectionDialog : public QDialog { Q_OBJECT public: explicit SigningCertificateSelectionDialog(QWidget *parent = nullptr); ~SigningCertificateSelectionDialog(); void setAllowedProtocols(const std::set &allowedProtocols); void setSelectedCertificates(const QMap &certificates); Q_REQUIRED_RESULT QMap selectedCertificates() const; Q_REQUIRED_RESULT bool rememberAsDefault() const; private: SigningCertificateSelectionWidget *const widget; }; } } } -#endif // __KLEOPATRA_CRYPTO_GUI_SIGNINGCERTIFICATESELECTIONDIALOG_H__ diff --git a/src/crypto/gui/signingcertificateselectionwidget.h b/src/crypto/gui/signingcertificateselectionwidget.h index 5dbd28da8..0fd380c60 100644 --- a/src/crypto/gui/signingcertificateselectionwidget.h +++ b/src/crypto/gui/signingcertificateselectionwidget.h @@ -1,59 +1,57 @@ /* -*- mode: c++; c-basic-offset:4 -*- crypto/gui/signingcertificateselectionwidget.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2007, 2009 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_CRYPTO_GUI_SIGNINGCERTIFICATESELECTIONWIDGET_H__ -#define __KLEOPATRA_CRYPTO_GUI_SIGNINGCERTIFICATESELECTIONWIDGET_H__ +#pragma once #include #include #include #include template class QMap; namespace GpgME { class Key; } namespace Kleo { namespace Crypto { namespace Gui { class SigningCertificateSelectionWidget : public QWidget { Q_OBJECT public: explicit SigningCertificateSelectionWidget(QWidget *parent = nullptr, Qt::WindowFlags f = {}); ~SigningCertificateSelectionWidget(); void setAllowedProtocols(const std::set &allowedProtocols); void setAllowedProtocols(bool pgp, bool cms); void setSelectedCertificates(const QMap &certificates); void setSelectedCertificates(const GpgME::Key &pgp, const GpgME::Key &cms); QMap selectedCertificates() const; bool rememberAsDefault() const; private: class Private; kdtools::pimpl_ptr d; }; } } } -#endif // __KLEOPATRA_CRYPTO_GUI_SIGNINGCERTIFICATESELECTIONWIDGET_H__ diff --git a/src/crypto/gui/unknownrecipientwidget.h b/src/crypto/gui/unknownrecipientwidget.h index 178b0c2ad..f74ad52c5 100644 --- a/src/crypto/gui/unknownrecipientwidget.h +++ b/src/crypto/gui/unknownrecipientwidget.h @@ -1,28 +1,26 @@ /* crypto/gui/unknownrecipientwidget.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2018 Intevation GmbH SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef CRYPTO_GUI_UNKNOWNRECIPIENTWIDGET_H -#define CRYPTO_GUI_UNKNOWNRECIPIENTWIDGET_H +#pragma once #include #include namespace Kleo { class UnknownRecipientWidget: public QWidget { Q_OBJECT public: explicit UnknownRecipientWidget(const char *keyid, QWidget *parent = nullptr); QString keyID() const; private: QString mKeyID; }; } // namespace Kleo: -#endif diff --git a/src/crypto/gui/verifychecksumsdialog.h b/src/crypto/gui/verifychecksumsdialog.h index 6dbb00c7a..1a6cae2a1 100644 --- a/src/crypto/gui/verifychecksumsdialog.h +++ b/src/crypto/gui/verifychecksumsdialog.h @@ -1,66 +1,64 @@ /* -*- mode: c++; c-basic-offset:4 -*- crypto/gui/verifychecksumsdialog.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2010 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_CRYPTO_GUI_VERIFYCHECKSUMSDIALOG_H__ -#define __KLEOPATRA_CRYPTO_GUI_VERIFYCHECKSUMSDIALOG_H__ +#pragma once #include #include #ifndef QT_NO_DIRMODEL #include namespace Kleo { namespace Crypto { namespace Gui { class VerifyChecksumsDialog : public QDialog { Q_OBJECT Q_ENUMS(Status) public: explicit VerifyChecksumsDialog(QWidget *parent = nullptr); ~VerifyChecksumsDialog(); enum Status { Unknown, OK, Failed, Error, NumStatii }; public Q_SLOTS: void setBaseDirectories(const QStringList &bases); void setProgress(int current, int total); void setStatus(const QString &file, Kleo::Crypto::Gui::VerifyChecksumsDialog::Status status); void setErrors(const QStringList &errors); void clearStatusInformation(); Q_SIGNALS: void canceled(); private: Q_PRIVATE_SLOT(d, void slotErrorButtonClicked()) class Private; kdtools::pimpl_ptr d; }; } } } Q_DECLARE_METATYPE(Kleo::Crypto::Gui::VerifyChecksumsDialog::Status) #endif // QT_NO_DIRMODEL -#endif // __KLEOPATRA_CRYPTO_GUI_RESULTITEMWIDGET_H__ diff --git a/src/crypto/gui/wizard.h b/src/crypto/gui/wizard.h index f3b866627..3d10d1806 100644 --- a/src/crypto/gui/wizard.h +++ b/src/crypto/gui/wizard.h @@ -1,80 +1,78 @@ /* -*- mode: c++; c-basic-offset:4 -*- crypto/gui/wizard.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2007 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_CRYPTO_GUI_WIZARD_H__ -#define __KLEOPATRA_CRYPTO_GUI_WIZARD_H__ +#pragma once #include #include #include namespace Kleo { namespace Crypto { namespace Gui { class WizardPage; class Wizard : public QDialog { Q_OBJECT public: explicit Wizard(QWidget *parent = nullptr, Qt::WindowFlags f = {}); ~Wizard(); enum Page { InvalidPage = -1 }; void setPage(int id, WizardPage *page); const WizardPage *page(int id) const; WizardPage *page(int id); void setPageOrder(const std::vector &pages); void setPageVisible(int id, bool visible); void setCurrentPage(int id); int currentPage() const; const WizardPage *currentPageWidget() const; WizardPage *currentPageWidget(); bool canGoToPreviousPage() const; bool canGoToNextPage() const; public Q_SLOTS: void next(); void back(); Q_SIGNALS: void canceled(); protected: virtual void onNext(int currentId); virtual void onBack(int currentId); private: class Private; kdtools::pimpl_ptr d; Q_PRIVATE_SLOT(d, void updateButtonStates()) Q_PRIVATE_SLOT(d, void updateHeader()) }; } } } -#endif // __KLEOPATRA_WIZARD_H__ diff --git a/src/crypto/gui/wizardpage.h b/src/crypto/gui/wizardpage.h index 16e01f53c..5dd9c3cfd 100644 --- a/src/crypto/gui/wizardpage.h +++ b/src/crypto/gui/wizardpage.h @@ -1,78 +1,76 @@ /* -*- mode: c++; c-basic-offset:4 -*- crypto/gui/wizardpage.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2007 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_CRYPTO_GUI_WIZARDPAGE_H__ -#define __KLEOPATRA_CRYPTO_GUI_WIZARDPAGE_H__ +#pragma once #include #include class KGuiItem; namespace Kleo { namespace Crypto { namespace Gui { class Wizard; class WizardPage : public QWidget { friend class ::Kleo::Crypto::Gui::Wizard; Q_OBJECT public: explicit WizardPage(QWidget *parent = nullptr, Qt::WindowFlags f = {}); virtual ~WizardPage(); virtual bool isComplete() const = 0; bool isCommitPage() const; void setCommitPage(bool commitPage); bool autoAdvance() const; void setAutoAdvance(bool enabled); QString title() const; void setTitle(const QString &title); QString subTitle() const; void setSubTitle(const QString &subTitle); QString explanation() const; void setExplanation(const QString &explanation); KGuiItem customNextButton() const; void setCustomNextButton(const KGuiItem &item); Q_SIGNALS: void completeChanged(); void explanationChanged(); void titleChanged(); void subTitleChanged(); void autoAdvanceChanged(); void windowTitleChanged(const QString &title); protected: virtual void onNext(); private: class Private; kdtools::pimpl_ptr d; }; } } } -#endif // __KLEOPATRA_CRYPTO_GUI_WIZARDPAGE_H__ diff --git a/src/crypto/newsignencryptemailcontroller.h b/src/crypto/newsignencryptemailcontroller.h index 92b8c506a..278d3974e 100644 --- a/src/crypto/newsignencryptemailcontroller.h +++ b/src/crypto/newsignencryptemailcontroller.h @@ -1,107 +1,105 @@ /* -*- mode: c++; c-basic-offset:4 -*- crypto/newsignencryptemailcontroller.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2007 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_CRYPTO_NEWSIGNENCRYPTEMAILCONTROLLER_H__ -#define __KLEOPATRA_CRYPTO_NEWSIGNENCRYPTEMAILCONTROLLER_H__ +#pragma once #include #include #include #include #include #include namespace KMime { namespace Types { class Mailbox; } } namespace GpgME { } namespace Kleo { class Input; class Output; namespace Crypto { class NewSignEncryptEMailController : public Controller { Q_OBJECT public: explicit NewSignEncryptEMailController(QObject *parent = nullptr); explicit NewSignEncryptEMailController(const std::shared_ptr &xc, QObject *parent = nullptr); ~NewSignEncryptEMailController() override; static const char *mementoName() { return "NewSignEncryptEMailController"; } // 1st stage inputs void setSubject(const QString &subject); void setProtocol(GpgME::Protocol proto); const char *protocolAsString() const; GpgME::Protocol protocol() const; void setSigning(bool sign); bool isSigning() const; void setEncrypting(bool encrypt); bool isEncrypting() const; void startResolveCertificates(const std::vector &recipients, const std::vector &senders); bool isResolvingInProgress() const; bool areCertificatesResolved() const; // 2nd stage inputs void setDetachedSignature(bool detached); void startSigning(const std::vector< std::shared_ptr > &inputs, const std::vector< std::shared_ptr > &outputs); void startEncryption(const std::vector< std::shared_ptr > &inputs, const std::vector< std::shared_ptr > &outputs); public Q_SLOTS: void cancel(); Q_SIGNALS: void certificatesResolved(); void reportMicAlg(const QString &micAlg); private: void doTaskDone(const Task *task, const std::shared_ptr &) override; class Private; kdtools::pimpl_ptr d; Q_PRIVATE_SLOT(d, void slotDialogAccepted()) Q_PRIVATE_SLOT(d, void slotDialogRejected()) Q_PRIVATE_SLOT(d, void schedule()) }; } // Crypto } // Kleo -#endif /* __KLEOPATRA_CRYPTO_NEWSIGNENCRYPTEMAILCONTROLLER_H__ */ diff --git a/src/crypto/recipient.h b/src/crypto/recipient.h index 67164a837..238ceba61 100644 --- a/src/crypto/recipient.h +++ b/src/crypto/recipient.h @@ -1,87 +1,85 @@ /* -*- mode: c++; c-basic-offset:4 -*- ./crypto/recipient.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2009 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_CRYPTO_RECIPIENT_H__ -#define __KLEOPATRA_CRYPTO_RECIPIENT_H__ +#pragma once #include #include #include namespace KMime { namespace Types { class Mailbox; } } namespace GpgME { class Key; class UserID; } namespace Kleo { namespace Crypto { class Recipient { public: Recipient() : d() {} explicit Recipient(const KMime::Types::Mailbox &mailbox); void swap(Recipient &other) { d.swap(other.d); } bool isNull() const { return !d; } bool isEncryptionAmbiguous(GpgME::Protocol protocol) const; const KMime::Types::Mailbox &mailbox() const; const std::vector &encryptionCertificateCandidates(GpgME::Protocol proto) const; void setResolvedEncryptionKey(const GpgME::Key &key); GpgME::Key resolvedEncryptionKey(GpgME::Protocol proto) const; void setResolvedOpenPGPEncryptionUserID(const GpgME::UserID &uid); GpgME::UserID resolvedOpenPGPEncryptionUserID() const; friend inline bool operator==(const Recipient &lhs, const Recipient &rhs) { return rhs.d == lhs.d || lhs.deepEquals(rhs); } private: void detach(); bool deepEquals(const Recipient &other) const; private: class Private; std::shared_ptr d; }; inline bool operator!=(const Recipient &lhs, const Recipient &rhs) { return !operator==(lhs, rhs); } } // namespace Crypto } // namespace Kleo -#endif /* __KLEOPATRA_CRYPTO_RECIPIENT_H__ */ diff --git a/src/crypto/sender.h b/src/crypto/sender.h index 34ca98c67..d3ec83a0d 100644 --- a/src/crypto/sender.h +++ b/src/crypto/sender.h @@ -1,92 +1,90 @@ /* -*- mode: c++; c-basic-offset:4 -*- ./crypto/sender.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2009 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_CRYPTO_SENDER_H__ -#define __KLEOPATRA_CRYPTO_SENDER_H__ +#pragma once #include #include #include namespace KMime { namespace Types { class Mailbox; } } namespace GpgME { class Key; class UserID; } namespace Kleo { namespace Crypto { class Sender { public: Sender() : d() {} explicit Sender(const KMime::Types::Mailbox &mailbox); void swap(Sender &other) { d.swap(other.d); } bool isNull() const { return !d; } bool isSigningAmbiguous(GpgME::Protocol proto) const; bool isEncryptionAmbiguous(GpgME::Protocol proto) const; const KMime::Types::Mailbox &mailbox() const; const std::vector &signingCertificateCandidates(GpgME::Protocol proto) const; const std::vector &encryptToSelfCertificateCandidates(GpgME::Protocol proto) const; void setResolvedSigningKey(const GpgME::Key &key); GpgME::Key resolvedSigningKey(GpgME::Protocol proto) const; void setResolvedEncryptionKey(const GpgME::Key &key); GpgME::Key resolvedEncryptionKey(GpgME::Protocol proto) const; void setResolvedOpenPGPEncryptionUserID(const GpgME::UserID &uid); GpgME::UserID resolvedOpenPGPEncryptionUserID() const; friend inline bool operator==(const Sender &lhs, const Sender &rhs) { return rhs.d == lhs.d || lhs.deepEquals(rhs); } private: void detach(); bool deepEquals(const Sender &other) const; private: class Private; std::shared_ptr d; }; inline bool operator!=(const Sender &lhs, const Sender &rhs) { return !operator==(lhs, rhs); } } // namespace Crypto } // namespace Kleo -#endif /* __KLEOPATRA_CRYPTO_SENDER_H__ */ diff --git a/src/crypto/signemailcontroller.h b/src/crypto/signemailcontroller.h index c1295fc7b..ba45d224c 100644 --- a/src/crypto/signemailcontroller.h +++ b/src/crypto/signemailcontroller.h @@ -1,93 +1,91 @@ /* -*- mode: c++; c-basic-offset:4 -*- crypto/signemailcontroller.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2007 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_CRYPTO_SIGNEMAILCONTROLLER_H__ -#define __KLEOPATRA_CRYPTO_SIGNEMAILCONTROLLER_H__ +#pragma once #include #include #include #include #include namespace KMime { namespace Types { class Mailbox; } } namespace Kleo { class Input; class Output; namespace Crypto { class SignEMailController : public Controller { Q_OBJECT public: enum Mode { GpgOLMode, ClipboardMode, NumModes }; explicit SignEMailController(Mode mode, QObject *parent = nullptr); explicit SignEMailController(const std::shared_ptr &xc, Mode mode, QObject *parent = nullptr); ~SignEMailController() override; Mode mode() const; void setProtocol(GpgME::Protocol proto); GpgME::Protocol protocol() const; //const char * protocolAsString() const; void startResolveSigners(); void startResolveSigners(const std::vector &signers); void setDetachedSignature(bool detached); void setInputAndOutput(const std::shared_ptr &input, const std::shared_ptr &output); void setInputsAndOutputs(const std::vector< std::shared_ptr > &inputs, const std::vector< std::shared_ptr > &outputs); void start(); public Q_SLOTS: void cancel(); Q_SIGNALS: void signersResolved(); void reportMicAlg(const QString &micalg); private: void doTaskDone(const Task *task, const std::shared_ptr &result) override; class Private; kdtools::pimpl_ptr d; Q_PRIVATE_SLOT(d, void slotWizardSignersResolved()) Q_PRIVATE_SLOT(d, void slotWizardCanceled()) Q_PRIVATE_SLOT(d, void schedule()) }; } // Crypto } // Kleo -#endif /* __KLEOPATRA_CRYPTO_SIGNEMAILCONTROLLER_H__ */ diff --git a/src/crypto/signemailtask.h b/src/crypto/signemailtask.h index 86648efbb..8f23c4942 100644 --- a/src/crypto/signemailtask.h +++ b/src/crypto/signemailtask.h @@ -1,73 +1,71 @@ /* -*- mode: c++; c-basic-offset:4 -*- crypto/signemailtask.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2007 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_CRYPTO_SIGNEMAILTASK_H__ -#define __KLEOPATRA_CRYPTO_SIGNEMAILTASK_H__ +#pragma once #include #include #include #include #include namespace GpgME { class Key; } namespace Kleo { class Input; class Output; } namespace Kleo { namespace Crypto { class SignEMailTask : public Task { Q_OBJECT public: explicit SignEMailTask(QObject *parent = nullptr); ~SignEMailTask() override; void setInput(const std::shared_ptr &input); void setOutput(const std::shared_ptr &output); void setSigners(const std::vector &recipients); void setDetachedSignature(bool detached); void setClearsign(bool clear); GpgME::Protocol protocol() const override; void cancel() override; QString label() const override; QString micAlg() const; private: void doStart() override; unsigned long long inputSize() const override; private: class Private; kdtools::pimpl_ptr d; Q_PRIVATE_SLOT(d, void slotResult(const GpgME::SigningResult &)) }; } } -#endif /* __KLEOPATRA_CRYPTO_SIGNEMAILTASK_H__ */ diff --git a/src/crypto/signencryptfilescontroller.h b/src/crypto/signencryptfilescontroller.h index bffb282d1..571c3aefa 100644 --- a/src/crypto/signencryptfilescontroller.h +++ b/src/crypto/signencryptfilescontroller.h @@ -1,83 +1,81 @@ /* -*- mode: c++; c-basic-offset:4 -*- crypto/signencryptfilescontroller.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2007 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_CRYPTO_SIGNENCRYPTFILESCONTROLLER_H__ -#define __KLEOPATRA_CRYPTO_SIGNENCRYPTFILESCONTROLLER_H__ +#pragma once #include #include #include #include #include #include namespace Kleo { namespace Crypto { class SignEncryptFilesController : public Controller { Q_OBJECT public: explicit SignEncryptFilesController(QObject *parent = nullptr); explicit SignEncryptFilesController(const std::shared_ptr &ctx, QObject *parent = nullptr); ~SignEncryptFilesController() override; void setProtocol(GpgME::Protocol proto); GpgME::Protocol protocol() const; //const char * protocolAsString() const; enum Operation { SignDisallowed = 0, SignAllowed = 1, SignSelected = 2, SignMask = SignAllowed | SignSelected, EncryptDisallowed = 0, EncryptAllowed = 4, EncryptSelected = 8, EncryptMask = EncryptAllowed | EncryptSelected, ArchiveDisallowed = 0, ArchiveAllowed = 16, ArchiveForced = 32, ArchiveMask = ArchiveAllowed | ArchiveForced }; void setOperationMode(unsigned int mode); unsigned int operationMode() const; void setFiles(const QStringList &files); void start(); public Q_SLOTS: void cancel(); private: void doTaskDone(const Task *task, const std::shared_ptr &) override; class Private; kdtools::pimpl_ptr d; Q_PRIVATE_SLOT(d, void slotWizardOperationPrepared()) Q_PRIVATE_SLOT(d, void slotWizardCanceled()) Q_PRIVATE_SLOT(d, void schedule()) }; } } -#endif /* __KLEOPATRA_UISERVER_SIGNENCRYPTFILESCONTROLLER_H__ */ diff --git a/src/crypto/signencrypttask.h b/src/crypto/signencrypttask.h index 0711ae13c..7b9bd8eec 100644 --- a/src/crypto/signencrypttask.h +++ b/src/crypto/signencrypttask.h @@ -1,85 +1,83 @@ /* -*- mode: c++; c-basic-offset:4 -*- crypto/signencrypttask.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2007 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_CRYPTO_SIGNENCRYPTTASK_H__ -#define __KLEOPATRA_CRYPTO_SIGNENCRYPTTASK_H__ +#pragma once #include #include #include #include #include class QString; namespace GpgME { class Key; } namespace Kleo { class OverwritePolicy; class Input; class Output; } namespace Kleo { namespace Crypto { class SignEncryptTask : public Task { Q_OBJECT public: explicit SignEncryptTask(QObject *parent = nullptr); ~SignEncryptTask() override; void setInputFileName(const QString &fileName); void setInputFileNames(const QStringList &fileNames); void setInput(const std::shared_ptr &input); void setOutput(const std::shared_ptr &output); void setOutputFileName(const QString &fileName); void setSigners(const std::vector &signers); void setRecipients(const std::vector &recipients); void setSign(bool sign); void setEncrypt(bool encrypt); void setDetachedSignature(bool detached); void setEncryptSymmetric(bool symmetric); void setClearsign(bool clearsign); void setOverwritePolicy(const std::shared_ptr &policy); GpgME::Protocol protocol() const override; void cancel() override; QString label() const override; QString tag() const override; private: void doStart() override; unsigned long long inputSize() const override; private: class Private; kdtools::pimpl_ptr d; Q_PRIVATE_SLOT(d, void slotResult(const GpgME::SigningResult &)) Q_PRIVATE_SLOT(d, void slotResult(const GpgME::SigningResult &, const GpgME::EncryptionResult &)) Q_PRIVATE_SLOT(d, void slotResult(const GpgME::EncryptionResult &)) }; } } -#endif /* __KLEOPATRA_CRYPTO_SIGNENCRYPTTASK_H__ */ diff --git a/src/crypto/task.h b/src/crypto/task.h index cf4eccc38..5b6f63477 100644 --- a/src/crypto/task.h +++ b/src/crypto/task.h @@ -1,133 +1,131 @@ /* -*- mode: c++; c-basic-offset:4 -*- crypto/task.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2007 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_CRYPTO_TASK_H__ -#define __KLEOPATRA_CRYPTO_TASK_H__ +#pragma once #include #include #include #include #include #include namespace Kleo { class AuditLog; } namespace Kleo { namespace Crypto { class Task : public QObject { Q_OBJECT public: explicit Task(QObject *parent = nullptr); ~Task(); class Result; void setAsciiArmor(bool armor); bool asciiArmor() const; virtual GpgME::Protocol protocol() const = 0; void start(); virtual QString label() const = 0; virtual QString tag() const; QString progressLabel() const; int currentProgress() const; int totalProgress() const; int id() const; static std::shared_ptr makeErrorTask(int code, const QString &details, const QString &label); public Q_SLOTS: virtual void cancel() = 0; Q_SIGNALS: void progress(const QString &what, int processed, int total, QPrivateSignal); void result(const std::shared_ptr &, QPrivateSignal); void started(QPrivateSignal); protected: std::shared_ptr makeErrorResult(int errCode, const QString &details); void emitResult(const std::shared_ptr &result); protected Q_SLOTS: void setProgress(const QString &msg, int processed, int total); private Q_SLOTS: void emitError(int errCode, const QString &details); private: virtual void doStart() = 0; virtual unsigned long long inputSize() const = 0; private: class Private; kdtools::pimpl_ptr d; }; class Task::Result { const QString m_nonce; public: Result(); virtual ~Result(); const QString &nonce() const { return m_nonce; } bool hasError() const; enum VisualCode { AllGood, Warning, Danger, NeutralSuccess, NeutralError }; virtual QString icon() const; virtual QString overview() const = 0; virtual QString details() const = 0; virtual int errorCode() const = 0; virtual QString errorString() const = 0; virtual VisualCode code() const = 0; virtual AuditLog auditLog() const = 0; virtual QPointer parentTask() const {return QPointer();} protected: static QString iconPath(VisualCode code); static QString makeOverview(const QString &msg); private: class Private; kdtools::pimpl_ptr d; }; } } -#endif /* __KLEOPATRA_CRYPTO_TASK_H__ */ diff --git a/src/crypto/task_p.h b/src/crypto/task_p.h index b40a93001..b6042e73e 100644 --- a/src/crypto/task_p.h +++ b/src/crypto/task_p.h @@ -1,62 +1,60 @@ /* -*- mode: c++; c-basic-offset:4 -*- crypto/task_p.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2007 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_CRYPTO_TASK_P_H__ -#define __KLEOPATRA_CRYPTO_TASK_P_H__ +#pragma once #include #include #include namespace Kleo { namespace Crypto { class SimpleTask : public Task { Q_OBJECT public: explicit SimpleTask(const QString &label) : m_result(), m_label(label) {} void setResult(const std::shared_ptr &res) { m_result = res; } GpgME::Protocol protocol() const override { return GpgME::UnknownProtocol; } QString label() const override { return m_label; } void cancel() override {} private: void doStart() override { QTimer::singleShot(0, this, &SimpleTask::slotEmitResult); } unsigned long long inputSize() const override { return 0; } private Q_SLOTS: void slotEmitResult() { emitResult(m_result); } private: std::shared_ptr m_result; QString m_label; }; } } -#endif // __KLEOPATRA_CRYPTO_TASK_P_H__ diff --git a/src/crypto/taskcollection.h b/src/crypto/taskcollection.h index 8a142a922..a241afa91 100644 --- a/src/crypto/taskcollection.h +++ b/src/crypto/taskcollection.h @@ -1,64 +1,62 @@ /* -*- mode: c++; c-basic-offset:4 -*- crypto/taskcollection.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2008 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_CRYPTO_TASKCOLLECTION_H__ -#define __KLEOPATRA_CRYPTO_TASKCOLLECTION_H__ +#pragma once #include #include #include #include #include namespace Kleo { namespace Crypto { class TaskCollection : public QObject { Q_OBJECT public: explicit TaskCollection(QObject *parent = nullptr); ~TaskCollection(); std::vector > tasks() const; std::shared_ptr taskById(int id) const; void setTasks(const std::vector > &tasks); bool isEmpty() const; size_t size() const; int numberOfCompletedTasks() const; bool allTasksCompleted() const; bool errorOccurred() const; bool allTasksHaveErrors() const; Q_SIGNALS: void progress(const QString &msg, int processed, int total); void result(const std::shared_ptr &result); void started(const std::shared_ptr &task); void done(); private: class Private; kdtools::pimpl_ptr d; Q_PRIVATE_SLOT(d, void taskProgress(QString, int, int)) Q_PRIVATE_SLOT(d, void taskResult(std::shared_ptr)) Q_PRIVATE_SLOT(d, void taskStarted()) }; } } -#endif // __KLEOPATRA_CRYPTO_TASKCOLLECTION_H__ diff --git a/src/crypto/verifychecksumscontroller.h b/src/crypto/verifychecksumscontroller.h index aca1b3c77..95fa070f2 100644 --- a/src/crypto/verifychecksumscontroller.h +++ b/src/crypto/verifychecksumscontroller.h @@ -1,57 +1,55 @@ /* -*- mode: c++; c-basic-offset:4 -*- crypto/verifychecksumscontroller.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2010 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_CRYPTO_VERIFYCHECKSUMSCONTROLLER_H__ -#define __KLEOPATRA_CRYPTO_VERIFYCHECKSUMSCONTROLLER_H__ +#pragma once #include #ifndef QT_NO_DIRMODEL #include #include #include #include #include namespace Kleo { namespace Crypto { class VerifyChecksumsController : public Controller { Q_OBJECT public: explicit VerifyChecksumsController(QObject *parent = nullptr); explicit VerifyChecksumsController(const std::shared_ptr &ctx, QObject *parent = nullptr); ~VerifyChecksumsController(); void setFiles(const QStringList &files); void start(); public Q_SLOTS: void cancel(); private: class Private; kdtools::pimpl_ptr d; Q_PRIVATE_SLOT(d, void slotOperationFinished()) }; } } #endif // QT_NO_DIRMODEL -#endif /* __KLEOPATRA_UISERVER_VERIFYCHECKSUMSCONTROLLER_H__ */ diff --git a/src/dialogs/addemaildialog.h b/src/dialogs/addemaildialog.h index f21a365af..74a36e816 100644 --- a/src/dialogs/addemaildialog.h +++ b/src/dialogs/addemaildialog.h @@ -1,42 +1,40 @@ /* -*- mode: c++; c-basic-offset:4 -*- dialogs/addemaildialog.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2019 g 10 Code GmbH SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_DIALOGS_ADDEMAILDIALOG_H__ -#define __KLEOPATRA_DIALOGS_ADDEMAILDIALOG_H__ +#pragma once #include #include class QString; namespace Kleo { namespace Dialogs { class AddEmailDialog : public QDialog { Q_OBJECT public: explicit AddEmailDialog(QWidget *parent = nullptr); ~AddEmailDialog(); void setEmail(const QString &email); QString email() const; bool advancedSelected(); private: class Private; std::shared_ptr d; }; } } -#endif diff --git a/src/dialogs/adduseriddialog.h b/src/dialogs/adduseriddialog.h index 5c88ed90a..38c8c78a1 100644 --- a/src/dialogs/adduseriddialog.h +++ b/src/dialogs/adduseriddialog.h @@ -1,52 +1,50 @@ /* -*- mode: c++; c-basic-offset:4 -*- dialogs/addUserIDdialog.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2008 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_DIALOGS_ADDUSERIDDIALOG_H__ -#define __KLEOPATRA_DIALOGS_ADDUSERIDDIALOG_H__ +#pragma once #include #include class QString; namespace Kleo { namespace Dialogs { class AddUserIDDialog : public QDialog { Q_OBJECT Q_PROPERTY(QString name READ name WRITE setName) Q_PROPERTY(QString email READ email WRITE setEmail) Q_PROPERTY(QString comment READ comment WRITE setComment) public: explicit AddUserIDDialog(QWidget *parent = nullptr); ~AddUserIDDialog(); void setName(const QString &name); QString name() const; void setEmail(const QString &email); QString email() const; void setComment(const QString &comment); QString comment() const; private: class Private; kdtools::pimpl_ptr d; Q_PRIVATE_SLOT(d, void slotUserIDChanged()) }; } } -#endif /* __KLEOPATRA_DIALOGS_ADDUSERIDDIALOG_H__ */ diff --git a/src/dialogs/certificatedetailsinputwidget.h b/src/dialogs/certificatedetailsinputwidget.h index 91559de64..ecf1d936f 100644 --- a/src/dialogs/certificatedetailsinputwidget.h +++ b/src/dialogs/certificatedetailsinputwidget.h @@ -1,46 +1,44 @@ /* -*- mode: c++; c-basic-offset:4 -*- dialogs/certificatedetailsinputwidget.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2020 g10 Code GmbH SPDX-FileContributor: Ingo Klöcker SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_DIALOGS_CERTIFICATEDETAILSINPUTWIDGET_H__ -#define __KLEOPATRA_DIALOGS_CERTIFICATEDETAILSINPUTWIDGET_H__ +#pragma once #include namespace Kleo { namespace Dialogs { class CertificateDetailsInputWidget : public QWidget { Q_OBJECT public: explicit CertificateDetailsInputWidget(QWidget *parent = nullptr); ~CertificateDetailsInputWidget() override; void setName(const QString &name); void setEmail(const QString &email); QString email() const; QString dn() const; Q_SIGNALS: void validityChanged(bool valid); private: class Private; const std::unique_ptr d; }; } } -#endif // __KLEOPATRA_DIALOGS_CERTIFICATEDETAILSINPUTWIDGET_H__ diff --git a/src/dialogs/certificatedetailswidget.h b/src/dialogs/certificatedetailswidget.h index ebb231cda..276e9768f 100644 --- a/src/dialogs/certificatedetailswidget.h +++ b/src/dialogs/certificatedetailswidget.h @@ -1,57 +1,55 @@ /* SPDX-FileCopyrightText: 2016 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef KLEO_CERTIFICATEDETAILS_WIDGET_H -#define KLEO_CERTIFICATEDETAILS_WIDGET_H +#pragma once #include #include #include namespace GpgME { class Key; class Error; class KeyListResult; } class CertificateDetailsWidget : public QWidget { Q_OBJECT public: explicit CertificateDetailsWidget(QWidget *parent = nullptr); ~CertificateDetailsWidget(); void setKey(const GpgME::Key &key); GpgME::Key key() const; private: class Private; const QScopedPointer d; // Windows QGpgME new style connect problem makes this necessary. Q_PRIVATE_SLOT(d, void keyListDone(const GpgME::KeyListResult &, const std::vector &, const QString &, const GpgME::Error &)) }; class CertificateDetailsDialog : public QDialog { Q_OBJECT public: explicit CertificateDetailsDialog(QWidget *parent = nullptr); ~CertificateDetailsDialog(); void setKey(const GpgME::Key &key); GpgME::Key key() const; private: void readConfig(); void writeConfig(); }; -#endif diff --git a/src/dialogs/certificateselectiondialog.h b/src/dialogs/certificateselectiondialog.h index f531cfcec..31cdccff6 100644 --- a/src/dialogs/certificateselectiondialog.h +++ b/src/dialogs/certificateselectiondialog.h @@ -1,102 +1,100 @@ /* -*- mode: c++; c-basic-offset:4 -*- dialogs/certificateselectiondialog.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2008 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_DIALOGS_CERTIFICATESELECTIONDIALOG_H__ -#define __KLEOPATRA_DIALOGS_CERTIFICATESELECTIONDIALOG_H__ +#pragma once #include #include #include #include #include namespace GpgME { class Key; } namespace Kleo { class KeyFilter; class KeyGroup; namespace Dialogs { class CertificateSelectionDialog : public QDialog { Q_OBJECT Q_FLAGS(Options) public: enum Option { SingleSelection = 0x00, MultiSelection = 0x01, SignOnly = 0x02, EncryptOnly = 0x04, AnyCertificate = 0x06, OpenPGPFormat = 0x08, CMSFormat = 0x10, AnyFormat = 0x18, Certificates = 0x00, SecretKeys = 0x20, IncludeGroups = 0x40, OptionMask }; Q_DECLARE_FLAGS(Options, Option) static Option optionsFromProtocol(GpgME::Protocol proto); explicit CertificateSelectionDialog(QWidget *parent = nullptr); ~CertificateSelectionDialog() override; void setCustomLabelText(const QString &text); QString customLabelText() const; void setOptions(Options options); Options options() const; void selectCertificates(const std::vector &certs); void selectCertificate(const GpgME::Key &key); std::vector selectedCertificates() const; GpgME::Key selectedCertificate() const; void selectGroups(const std::vector &groups); std::vector selectedGroups() const; static void filterAllowedKeys(std::vector &keys, int options); public Q_SLOTS: void setStringFilter(const QString &text); void setKeyFilter(const std::shared_ptr &filter); void accept() override; protected: void hideEvent(QHideEvent *) override; private: class Private; kdtools::pimpl_ptr d; }; } } Q_DECLARE_OPERATORS_FOR_FLAGS(Kleo::Dialogs::CertificateSelectionDialog::Options) -#endif /* __KLEOPATRA_DIALOGS_CERTIFICATESELECTIONDIALOG_H__ */ diff --git a/src/dialogs/certifycertificatedialog.h b/src/dialogs/certifycertificatedialog.h index 96a857a81..5bc62d37d 100644 --- a/src/dialogs/certifycertificatedialog.h +++ b/src/dialogs/certifycertificatedialog.h @@ -1,60 +1,58 @@ /* -*- mode: c++; c-basic-offset:4 -*- dialogs/signcertificatedialog.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2008 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_DIALOGS_CERTIFYCERTIFICATEDIALOG_H__ -#define __KLEOPATRA_DIALOGS_CERTIFYCERTIFICATEDIALOG_H__ +#pragma once #include #include #include #include namespace Kleo { class CertifyWidget; class CertifyCertificateDialog : public QDialog { Q_OBJECT public: explicit CertifyCertificateDialog(QWidget *parent = nullptr, Qt::WindowFlags f = {}); ~CertifyCertificateDialog(); bool exportableCertificationSelected() const; bool trustCertificationSelected() const; bool nonRevocableCertificationSelected() const; void setSelectedUserIDs(const std::vector &uids); std::vector selectedUserIDs() const; void setCertificatesWithSecretKeys(const std::vector &keys); GpgME::Key selectedSecretKey() const; bool sendToServer() const; unsigned int selectedCheckLevel() const; void setCertificateToCertify(const GpgME::Key &key); QString tags() const; private: CertifyWidget *mCertWidget; }; } -#endif /* __KLEOPATRA_DIALOGS_CERTIFYCERTIFICATEDIALOG_H__ */ diff --git a/src/dialogs/certifywidget.h b/src/dialogs/certifywidget.h index a6ab27ec5..c759fdcb5 100644 --- a/src/dialogs/certifywidget.h +++ b/src/dialogs/certifywidget.h @@ -1,62 +1,60 @@ -#ifndef SRC_VIEW_CERTIFYWIDGET_H -#define SRC_VIEW_CERTIFYWIDGET_H +#pragma once /* dialogs/certifywidget.cpp This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2019 g 10code GmbH SPDX-License-Identifier: GPL-2.0-or-later */ #include #include #include namespace GpgME { class Key; class UserID; } // namespace GpgME namespace Kleo { /** Widget for OpenPGP certification. */ class CertifyWidget : public QWidget { Q_OBJECT public: explicit CertifyWidget(QWidget *parent = nullptr); /* Set the key to certify */ void setTarget(const GpgME::Key &key); /* Get the key to certify */ GpgME::Key target() const; /* Select specific user ids. Default: all */ void selectUserIDs(const std::vector &uids); /* The user ids that should be signed */ std::vector selectedUserIDs() const; /* The secret key selected */ GpgME::Key secKey() const; /* Should the signature be exportable */ bool exportableSelected() const; /* Additional tags for the key */ QString tags() const; /* Should the signed key be be published */ bool publishSelected() const; private: class Private; std::shared_ptr d; }; } // namespace Kleo -#endif // SRC_VIEW_CERTIFYWIDGET_H diff --git a/src/dialogs/createcsrforcardkeydialog.h b/src/dialogs/createcsrforcardkeydialog.h index be11aabfb..e39761e24 100644 --- a/src/dialogs/createcsrforcardkeydialog.h +++ b/src/dialogs/createcsrforcardkeydialog.h @@ -1,43 +1,41 @@ /* -*- mode: c++; c-basic-offset:4 -*- dialogs/createcsrforcardkeydialog.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2020 g10 Code GmbH SPDX-FileContributor: Ingo Klöcker SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_DIALOGS_CREATECSRFORCARDKEYDIALOG_H__ -#define __KLEOPATRA_DIALOGS_CREATECSRFORCARDKEYDIALOG_H__ +#pragma once #include namespace Kleo { namespace Dialogs { class CreateCSRForCardKeyDialog : public QDialog { Q_OBJECT public: explicit CreateCSRForCardKeyDialog(QWidget *parent = nullptr); ~CreateCSRForCardKeyDialog() override; void setName(const QString &name); void setEmail(const QString &email); QString email() const; QString dn() const; private: class Private; const std::unique_ptr d; }; } } -#endif // __KLEOPATRA_DIALOGS_CREATECSRFORCARDKEYDIALOG_H__ diff --git a/src/dialogs/deletecertificatesdialog.h b/src/dialogs/deletecertificatesdialog.h index 8e929d81b..3185bebf7 100644 --- a/src/dialogs/deletecertificatesdialog.h +++ b/src/dialogs/deletecertificatesdialog.h @@ -1,52 +1,50 @@ /* -*- mode: c++; c-basic-offset:4 -*- dialogs/deletecertificatesdialog.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2009 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_DIALOGS_DELETECERTIFICATESDIALOG_H__ -#define __KLEOPATRA_DIALOGS_DELETECERTIFICATESDIALOG_H__ +#pragma once #include #include #include namespace GpgME { class Key; } namespace Kleo { namespace Dialogs { class DeleteCertificatesDialog : public QDialog { Q_OBJECT public: explicit DeleteCertificatesDialog(QWidget *parent = nullptr); ~DeleteCertificatesDialog() override; void setSelectedKeys(const std::vector &keys); void setUnselectedKeys(const std::vector &keys); std::vector keys() const; void accept() override; private: class Private; kdtools::pimpl_ptr d; Q_PRIVATE_SLOT(d, void slotWhatsThisRequested()) }; } } -#endif /* __KLEOPATRA_DIALOGS_DELETECERTIFICATESDIALOG_H__ */ diff --git a/src/dialogs/editgroupdialog.h b/src/dialogs/editgroupdialog.h index ece8c5e91..6d61b943f 100644 --- a/src/dialogs/editgroupdialog.h +++ b/src/dialogs/editgroupdialog.h @@ -1,56 +1,54 @@ /* dialogs/editgroupdialog.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2021 g10 Code GmbH SPDX-FileContributor: Ingo Klöcker SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_DIALOGS_EDITGROUPDIALOG_H__ -#define __KLEOPATRA_DIALOGS_EDITGROUPDIALOG_H__ +#pragma once #include #include namespace GpgME { class Key; } namespace Kleo { namespace Dialogs { class EditGroupDialog : public QDialog { Q_OBJECT public: enum FocusWidget { GroupName, KeysFilter }; explicit EditGroupDialog(QWidget *parent = nullptr); ~EditGroupDialog() override; void setInitialFocus(FocusWidget widget); void setGroupName(const QString &name); QString groupName() const; void setGroupKeys(const std::vector &keys); std::vector groupKeys() const; private: class Private; const std::unique_ptr d; }; } } -#endif // __KLEOPATRA_DIALOGS_EDITGROUPDIALOG_H__ diff --git a/src/dialogs/expirydialog.h b/src/dialogs/expirydialog.h index 0f3d47a4c..b09736760 100644 --- a/src/dialogs/expirydialog.h +++ b/src/dialogs/expirydialog.h @@ -1,46 +1,44 @@ /* -*- mode: c++; c-basic-offset:4 -*- dialogs/expirydialog.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2008 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_DIALOGS_EXPIRYDIALOG_H__ -#define __KLEOPATRA_DIALOGS_EXPIRYDIALOG_H__ +#pragma once #include #include class QDate; namespace Kleo { namespace Dialogs { class ExpiryDialog : public QDialog { Q_OBJECT Q_PROPERTY(QDate dateOfExpiry READ dateOfExpiry WRITE setDateOfExpiry) public: explicit ExpiryDialog(QWidget *parent = nullptr); ~ExpiryDialog(); void setDateOfExpiry(const QDate &date); QDate dateOfExpiry() const; private: class Private; kdtools::pimpl_ptr d; Q_PRIVATE_SLOT(d, void slotInAmountChanged()) Q_PRIVATE_SLOT(d, void slotInUnitChanged()) Q_PRIVATE_SLOT(d, void slotOnDateChanged()) }; } } -#endif /* __KLEOPATRA_DIALOGS_EXPIRYDIALOG_H__ */ diff --git a/src/dialogs/exportdialog.h b/src/dialogs/exportdialog.h index 9941b913b..e4a14bb0d 100644 --- a/src/dialogs/exportdialog.h +++ b/src/dialogs/exportdialog.h @@ -1,58 +1,56 @@ /* SPDX-FileCopyrightText: 2017 Intevation GmbH SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef KLEO_EXPORTDIALOG_H -#define KLEO_EXPORTDIALOG_H +#pragma once #include #include namespace GpgME { class Key; class Subkey; class Error; } namespace Kleo { class ExportWidget : public QWidget { Q_OBJECT public: explicit ExportWidget(QWidget *parent = nullptr); ~ExportWidget(); void setKey(const GpgME::Key &key, unsigned int flags = 0); void setKey(const GpgME::Subkey &key, unsigned int flags = 0); GpgME::Key key() const; private Q_SLOTS: void exportResult(const GpgME::Error &err, const QByteArray &data); private: class Private; const QScopedPointer d; }; class ExportDialog : public QDialog { Q_OBJECT public: explicit ExportDialog(QWidget *parent = nullptr); ~ExportDialog(); void setKey(const GpgME::Key &key, unsigned int flags = 0); void setKey(const GpgME::Subkey &key, unsigned int flags = 0); GpgME::Key key() const; private: ExportWidget *mWidget; }; } // namespace Kleo -#endif diff --git a/src/dialogs/gencardkeydialog.h b/src/dialogs/gencardkeydialog.h index 324ed0e49..7364a8300 100644 --- a/src/dialogs/gencardkeydialog.h +++ b/src/dialogs/gencardkeydialog.h @@ -1,62 +1,60 @@ /* dialogs/gencardkeydialog.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2017 Bundesamt für Sicherheit in der Informationstechnik SPDX-FileContributor: Intevation GmbH SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef DIALOGS_GENCARDKEYDIALOG_H -#define DIALOGS_GENCARDKEYDIALOG_H +#pragma once #include #include #include #include namespace Kleo { class GenCardKeyDialog: public QDialog { Q_OBJECT public: struct KeyParams { QString name; QString email; QString comment; std::string algorithm; bool backup; }; enum KeyAttribute { NoKeyAttributes = 0, KeyOwnerName = 1, KeyOwnerEmail = 2, KeyComment = 4, KeyAlgorithm = 8, LocalKeyBackup = 16, _AllKeyAttributes_Helper, AllKeyAttributes = 2 * (_AllKeyAttributes_Helper - 1) - 1 }; Q_DECLARE_FLAGS(KeyAttributes, KeyAttribute) explicit GenCardKeyDialog(KeyAttributes requiredAttributes, QWidget *parent = nullptr); KeyParams getKeyParams() const; void setSupportedAlgorithms(const std::vector> &algorithms, const std::string &defaultAlgo); private: class Private; std::shared_ptr d; }; } // namespace Kleo -#endif // DIALOGS_GENCARDKEYDIALOG_H diff --git a/src/dialogs/groupdetailsdialog.h b/src/dialogs/groupdetailsdialog.h index 384430017..0bb5a2321 100644 --- a/src/dialogs/groupdetailsdialog.h +++ b/src/dialogs/groupdetailsdialog.h @@ -1,40 +1,38 @@ /* dialogs/groupdetailsdialog.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2021 g10 Code GmbH SPDX-FileContributor: Ingo Klöcker SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_DIALOGS_GROUPDETAILSDIALOG_H__ -#define __KLEOPATRA_DIALOGS_GROUPDETAILSDIALOG_H__ +#pragma once #include namespace Kleo { class KeyGroup; namespace Dialogs { class GroupDetailsDialog : public QDialog { Q_OBJECT public: explicit GroupDetailsDialog(QWidget *parent = nullptr); ~GroupDetailsDialog() override; void setGroup(const Kleo::KeyGroup &group); private: class Private; const std::unique_ptr d; }; } } -#endif // __KLEOPATRA_DIALOGS_GROUPDETAILSDIALOG_H__ diff --git a/src/dialogs/lookupcertificatesdialog.h b/src/dialogs/lookupcertificatesdialog.h index 5d0805e4b..4f9cfe72f 100644 --- a/src/dialogs/lookupcertificatesdialog.h +++ b/src/dialogs/lookupcertificatesdialog.h @@ -1,66 +1,64 @@ /* -*- mode: c++; c-basic-offset:4 -*- dialogs/lookupcertificatesdialog.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2008 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_DIALOGS_LOOKUPCERTIFICATESDIALOG_H__ -#define __KLEOPATRA_DIALOGS_LOOKUPCERTIFICATESDIALOG_H__ +#pragma once #include #include #include namespace GpgME { class Key; } namespace Kleo { namespace Dialogs { class LookupCertificatesDialog : public QDialog { Q_OBJECT public: explicit LookupCertificatesDialog(QWidget *parent = nullptr, Qt::WindowFlags f = {}); ~LookupCertificatesDialog() override; void setCertificates(const std::vector &certs); std::vector selectedCertificates() const; void setPassive(bool passive); bool isPassive() const; void setSearchText(const QString &text); QString searchText() const; Q_SIGNALS: void searchTextChanged(const QString &text); void saveAsRequested(const std::vector &certs); void importRequested(const std::vector &certs); void detailsRequested(const GpgME::Key &certs); public Q_SLOTS: void accept() override; private: class Private; kdtools::pimpl_ptr d; Q_PRIVATE_SLOT(d, void slotSearchTextChanged()) Q_PRIVATE_SLOT(d, void slotSearchClicked()) Q_PRIVATE_SLOT(d, void slotSelectionChanged()) Q_PRIVATE_SLOT(d, void slotDetailsClicked()) Q_PRIVATE_SLOT(d, void slotSaveAsClicked()) }; } } -#endif /* __KLEOPATRA_DIALOGS_LOOKUPCERTIFICATESDIALOG_H__ */ diff --git a/src/dialogs/ownertrustdialog.h b/src/dialogs/ownertrustdialog.h index 840cff886..ed06e8a63 100644 --- a/src/dialogs/ownertrustdialog.h +++ b/src/dialogs/ownertrustdialog.h @@ -1,52 +1,50 @@ /* -*- mode: c++; c-basic-offset:4 -*- dialogs/ownertrustdialog.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2008 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_DIALOGS_OWNERTRUSTDIALOG_H__ -#define __KLEOPATRA_DIALOGS_OWNERTRUSTDIALOG_H__ +#pragma once #include #include #include namespace Kleo { namespace Dialogs { class OwnerTrustDialog : public QDialog { Q_OBJECT public: explicit OwnerTrustDialog(QWidget *parent = nullptr); ~OwnerTrustDialog(); void setFormattedCertificateName(const QString &formatted); QString formattedCertificateName() const; void setHasSecretKey(bool secret); bool hasSecretKey() const; void setAdvancedMode(bool advanced); bool isAdvancedMode() const; void setOwnerTrust(GpgME::Key::OwnerTrust); GpgME::Key::OwnerTrust ownerTrust() const; private: class Private; kdtools::pimpl_ptr d; Q_PRIVATE_SLOT(d, void slotTrustLevelChanged()) }; } } -#endif /* __KLEOPATRA_DIALOGS_OWNERTRUSTDIALOG_H__ */ diff --git a/src/dialogs/pivcardapplicationadministrationkeyinputdialog.h b/src/dialogs/pivcardapplicationadministrationkeyinputdialog.h index 55e202f9e..80270ed61 100644 --- a/src/dialogs/pivcardapplicationadministrationkeyinputdialog.h +++ b/src/dialogs/pivcardapplicationadministrationkeyinputdialog.h @@ -1,39 +1,37 @@ /* dialogs/pivcardapplicationadministrationkeyinputdialog.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2020 g10 Code GmbH SPDX-FileContributor: Ingo Klöcker SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef DIALOGS_PIVCARDAPPLICATIONADMINISTRATIONKEYINPUTDIALOG_H -#define DIALOGS_PIVCARDAPPLICATIONADMINISTRATIONKEYINPUTDIALOG_H +#pragma once #include namespace Kleo { namespace Dialogs { class PIVCardApplicationAdministrationKeyInputDialog: public QDialog { Q_OBJECT Q_PROPERTY(QString labelText READ labelText WRITE setLabelText) public: explicit PIVCardApplicationAdministrationKeyInputDialog(QWidget *parent = nullptr); void setLabelText(const QString& text); QString labelText() const; QByteArray adminKey() const; private: class Private; std::shared_ptr d; }; } // namespace Dialogs } // namespace Kleo -#endif // DIALOGS_PIVCARDAPPLICATIONADMINISTRATIONKEYINPUTDIALOG_H diff --git a/src/dialogs/revokecertificationdialog.h b/src/dialogs/revokecertificationdialog.h index bf7af90c6..de4699526 100644 --- a/src/dialogs/revokecertificationdialog.h +++ b/src/dialogs/revokecertificationdialog.h @@ -1,50 +1,48 @@ /* -*- mode: c++; c-basic-offset:4 -*- dialogs/revokecertificationdialog.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2008 Klarälvdalens Datakonsult AB SPDX-FileCopyrightText: 2020 g10 Code GmbH SPDX-FileContributor: Ingo Klöcker SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_DIALOGS_REVOKECERTIFICATIONDIALOG_H__ -#define __KLEOPATRA_DIALOGS_REVOKECERTIFICATIONDIALOG_H__ +#pragma once #include namespace GpgME { class Key; class UserID; } namespace Kleo { class RevokeCertificationDialog : public QDialog { Q_OBJECT public: explicit RevokeCertificationDialog(QWidget *parent = nullptr, Qt::WindowFlags f = {}); ~RevokeCertificationDialog() override; void setCertificateToRevoke(const GpgME::Key &key); void setSelectedUserIDs(const std::vector &uids); std::vector selectedUserIDs() const; void setSelectedCertificationKey(const GpgME::Key &key); GpgME::Key selectedCertificationKey() const; bool sendToServer() const; private: class Private; const std::unique_ptr d; }; } // namespace Kleo -#endif /* __KLEOPATRA_DIALOGS_REVOKECERTIFICATIONDIALOG_H__ */ diff --git a/src/dialogs/revokecertificationwidget.h b/src/dialogs/revokecertificationwidget.h index 274140bfe..e4652a1ea 100644 --- a/src/dialogs/revokecertificationwidget.h +++ b/src/dialogs/revokecertificationwidget.h @@ -1,64 +1,62 @@ /* -*- mode: c++; c-basic-offset:4 -*- dialogs/revokecertificationwidget.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2020 g10 Code GmbH SPDX-FileContributor: Ingo Klöcker SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_DIALOGS_REVOKECERTIFICATIONWIDGET_H__ -#define __KLEOPATRA_DIALOGS_REVOKECERTIFICATIONWIDGET_H__ +#pragma once #include #include namespace GpgME { class Key; class UserID; } namespace Kleo { /** Widget for revoking OpenPGP certifications. */ class RevokeCertificationWidget : public QWidget { Q_OBJECT public: explicit RevokeCertificationWidget(QWidget *parent = nullptr); ~RevokeCertificationWidget() override; /* Set the key to revoke certifications of */ void setTarget(const GpgME::Key &key); /* Get the key to revoke certifications of */ GpgME::Key target() const; /* Select specific user ids. Default: all */ void setSelectUserIDs(const std::vector &uids); /* The user ids whose certifications shall be revoked */ std::vector selectedUserIDs() const; /* Set the selected certification key. Default: last used key */ void setCertificationKey(const GpgME::Key &key); /* The selected certification key */ GpgME::Key certificationKey() const; /* Whether the revocations shall be published */ bool publishSelected() const; void saveConfig() const; private: class Private; const std::unique_ptr d; }; } // namespace Kleo -#endif // __KLEOPATRA_DIALOGS_REVOKECERTIFICATIONWIDGET_H__ diff --git a/src/dialogs/selftestdialog.h b/src/dialogs/selftestdialog.h index 57ce80d90..25f89a79f 100644 --- a/src/dialogs/selftestdialog.h +++ b/src/dialogs/selftestdialog.h @@ -1,61 +1,59 @@ /* -*- mode: c++; c-basic-offset:4 -*- dialogs/selftestdialog.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2008 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_DIALOGS_SELFTESTDIALOG_H__ -#define __KLEOPATRA_DIALOGS_SELFTESTDIALOG_H__ +#pragma once #include #include #include #include namespace Kleo { class SelfTest; namespace Dialogs { class SelfTestDialog : public QDialog { Q_OBJECT Q_PROPERTY(bool runAtStartUp READ runAtStartUp WRITE setRunAtStartUp) public: explicit SelfTestDialog(QWidget *parent = nullptr, Qt::WindowFlags f = {}); explicit SelfTestDialog(const std::vector> &tests, QWidget *parent = nullptr, Qt::WindowFlags f = {}); ~SelfTestDialog(); void setAutomaticMode(bool automatic); void addSelfTest(const std::shared_ptr &test); void addSelfTests(const std::vector> &tests); void setRunAtStartUp(bool run); bool runAtStartUp() const; public Q_SLOTS: void clear(); Q_SIGNALS: void updateRequested(); private: class Private; kdtools::pimpl_ptr d; Q_PRIVATE_SLOT(d, void slotSelectionChanged()) Q_PRIVATE_SLOT(d, void slotDoItClicked()) }; } } -#endif /* __KLEOPATRA_DIALOGS_SELFTESTDIALOG_H__ */ diff --git a/src/dialogs/setinitialpindialog.h b/src/dialogs/setinitialpindialog.h index b9efee174..cc32c7bae 100644 --- a/src/dialogs/setinitialpindialog.h +++ b/src/dialogs/setinitialpindialog.h @@ -1,57 +1,55 @@ /* -*- mode: c++; c-basic-offset:4 -*- dialogs/setinitialpindialog.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2009 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_DIALOGS_SETINITIALPINDIALOG_H__ -#define __KLEOPATRA_DIALOGS_SETINITIALPINDIALOG_H__ +#pragma once #include #include namespace GpgME { class Error; } namespace Kleo { namespace Dialogs { class SetInitialPinDialog : public QDialog { Q_OBJECT public: explicit SetInitialPinDialog(QWidget *parent = nullptr); ~SetInitialPinDialog(); void setNksPinPresent(bool); void setSigGPinPresent(bool); bool isComplete() const; public Q_SLOTS: void setNksPinSettingResult(const GpgME::Error &error); void setSigGPinSettingResult(const GpgME::Error &error); Q_SIGNALS: void nksPinRequested(); void sigGPinRequested(); private: class Private; kdtools::pimpl_ptr d; Q_PRIVATE_SLOT(d, void slotNksButtonClicked()) Q_PRIVATE_SLOT(d, void slotSigGButtonClicked()) }; } } -#endif /* __KLEOPATRA_DIALOGS_SETINITIALPINDIALOG_H__ */ diff --git a/src/dialogs/subkeyswidget.h b/src/dialogs/subkeyswidget.h index b0918725b..283fce09d 100644 --- a/src/dialogs/subkeyswidget.h +++ b/src/dialogs/subkeyswidget.h @@ -1,47 +1,45 @@ /* SPDX-FileCopyrightText: 2016 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef KLEO_SUBKEYSWIDGET_H -#define KLEO_SUBKEYSWIDGET_H +#pragma once #include #include namespace GpgME { class Key; } class SubKeysWidget : public QWidget { Q_OBJECT public: explicit SubKeysWidget(QWidget *parent = nullptr); ~SubKeysWidget(); void setKey(const GpgME::Key &key); GpgME::Key key() const; private: class Private; const QScopedPointer d; }; class SubKeysDialog : public QDialog { Q_OBJECT public: explicit SubKeysDialog(QWidget *parent = nullptr); ~SubKeysDialog(); void setKey(const GpgME::Key &key); GpgME::Key key() const; private: void readConfig(); void writeConfig(); }; -#endif diff --git a/src/dialogs/trustchainwidget.h b/src/dialogs/trustchainwidget.h index 8de38685a..06e4ea805 100644 --- a/src/dialogs/trustchainwidget.h +++ b/src/dialogs/trustchainwidget.h @@ -1,45 +1,43 @@ /* SPDX-FileCopyrightText: 2016 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef KLEO_TRUSTCHAINWIDGET_H -#define KLEO_TRUSTCHAINWIDGET_H +#pragma once #include #include namespace GpgME { class Key; } class TrustChainWidget : public QWidget { Q_OBJECT public: explicit TrustChainWidget(QWidget *parent = nullptr); ~TrustChainWidget(); void setKey(const GpgME::Key &key); GpgME::Key key() const; private: class Private; const QScopedPointer d; }; class TrustChainDialog : public QDialog { Q_OBJECT public: explicit TrustChainDialog(QWidget *parent = nullptr); ~TrustChainDialog(); void setKey(const GpgME::Key &key); GpgME::Key key() const; }; -#endif diff --git a/src/dialogs/updatenotification.h b/src/dialogs/updatenotification.h index 819f3aa54..9579c2366 100644 --- a/src/dialogs/updatenotification.h +++ b/src/dialogs/updatenotification.h @@ -1,38 +1,36 @@ /* dialogs/updatenotification.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2017 Bundesamt für Sicherheit in der Informationstechnik SPDX-FileContributor: Intevation GmbH SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef DIALOGS_UPDATENOTIFICATION_H -#define DIALOGS_UPDATENOTIFICATION_H +#pragma once #include #include namespace Kleo { /** Updatenotification for Gpg4win * * On Windows it is usual for Applications to notify the user * about updates. To avoid network access in Kleopatra and * to have only one TLS stack in our package this is implemented * in dirmngr. */ class UpdateNotification : public QDialog { public: /* Force an update check dirmngr loadswdb --force callse * check update afterwards. */ static void forceUpdateCheck(QWidget *parent); /* Check for an update. The force parameter overrides the * NeverShow setting */ static void checkUpdate(QWidget *parent, bool force = false); UpdateNotification(QWidget *parent, const QString &version); }; } // namespace Kleo -#endif // DIALOGS_UPDATENOTIFICATION_H diff --git a/src/dialogs/weboftrustdialog.h b/src/dialogs/weboftrustdialog.h index 532b83a3f..4841dcdca 100644 --- a/src/dialogs/weboftrustdialog.h +++ b/src/dialogs/weboftrustdialog.h @@ -1,35 +1,33 @@ /* SPDX-FileCopyrightText: 2017 Intevation GmbH SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef KLEO_WEBOFTRUSTDIALOG_H -#define KLEO_WEBOFTRUSTDIALOG_H +#pragma once #include #include namespace GpgME { class Key; } namespace Kleo { class WebOfTrustWidget; class WebOfTrustDialog : public QDialog { Q_OBJECT public: explicit WebOfTrustDialog(QWidget *parent = nullptr); ~WebOfTrustDialog(); void setKey(const GpgME::Key &key); GpgME::Key key() const; private: WebOfTrustWidget *mWidget; }; } // namespace Kleo -#endif diff --git a/src/dialogs/weboftrustwidget.h b/src/dialogs/weboftrustwidget.h index c86a6e13c..85f4ce7f2 100644 --- a/src/dialogs/weboftrustwidget.h +++ b/src/dialogs/weboftrustwidget.h @@ -1,39 +1,37 @@ /* SPDX-FileCopyrightText: 2017 Intevation GmbH SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef KLEO_WEBOFTRUSTWIDGET_H -#define KLEO_WEBOFTRUSTWIDGET_H +#pragma once #include namespace GpgME { class Key; class KeyListResult; } namespace Kleo { class WebOfTrustWidget : public QWidget { Q_OBJECT public: explicit WebOfTrustWidget(QWidget *parent = nullptr); ~WebOfTrustWidget(); void setKey(const GpgME::Key &key); GpgME::Key key() const; private Q_SLOTS: void signatureListingNextKey(const GpgME::Key &key); void signatureListingDone(const GpgME::KeyListResult &result); private: class Private; const QScopedPointer d; }; } // namespace Kleo -#endif diff --git a/src/kleo-assuan.h b/src/kleo-assuan.h index 5145e59c4..4819cb9ed 100644 --- a/src/kleo-assuan.h +++ b/src/kleo-assuan.h @@ -1,48 +1,46 @@ /* -*- mode: c++; c-basic-offset:4 -*- kleo-assuan.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2008 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEO_ASSUAN_H__ -#define __KLEO_ASSUAN_H__ +#pragma once #ifndef _ASSUAN_ONLY_GPG_ERRORS #define _ASSUAN_ONLY_GPG_ERRORS #endif #ifdef HAVE_USABLE_ASSUAN # include #else /* * copied from assuan.h: */ /* assuan.h - Definitions for the Assuan IPC library * SPDX-FileCopyrightText: 2001, 2002, 2003, 2005, 2007 Free Software Foundation Inc. * * This file is part of Assuan. * * SPDX-License-Identifier: LGPL-2.1-or-later */ #ifdef _WIN32 typedef void *assuan_fd_t; #define ASSUAN_INVALID_FD ((void*)(-1)) #define ASSUAN_INT2FD(s) ((void *)(s)) #define ASSUAN_FD2INT(h) ((unsigned int)(h)) #else typedef int assuan_fd_t; #define ASSUAN_INVALID_FD (-1) #define ASSUAN_INT2FD(s) ((s)) #define ASSUAN_FD2INT(h) ((h)) #endif /* * end copied from assuan.h */ #endif -#endif /* __KLEOPATRA_ASSUAN_H__ */ diff --git a/src/kleopatra_options.h b/src/kleopatra_options.h index 81cbafaf8..6da15ed32 100644 --- a/src/kleopatra_options.h +++ b/src/kleopatra_options.h @@ -1,93 +1,91 @@ /* kleopatra_options.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2015 Bundesamt für Sicherheit in der Informationstechnik SPDX-FileContributor: Intevation GmbH SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef KLEOPATRA_OPTIONS_H -#define KLEOPATRA_OPTIONS_H +#pragma once #include #include #include static void kleopatra_options(QCommandLineParser *parser) { QList options; options << QCommandLineOption(QStringList() << QStringLiteral("openpgp") << QStringLiteral("p"), i18n("Use OpenPGP for the following operation")) << QCommandLineOption(QStringList() << QStringLiteral("cms") << QStringLiteral("c"), i18n("Use CMS (X.509, S/MIME) for the following operation")) #ifdef HAVE_USABLE_ASSUAN << QCommandLineOption(QStringLiteral("uiserver-socket"), i18n("Location of the socket the ui server is listening on"), QStringLiteral("argument")) << QCommandLineOption(QStringLiteral("daemon"), i18n("Run UI server only, hide main window")) #endif << QCommandLineOption(QStringList() << QStringLiteral("import-certificate") << QStringLiteral("i"), i18n("Import certificate file(s)")) << QCommandLineOption(QStringList() << QStringLiteral("encrypt") << QStringLiteral("e"), i18n("Encrypt file(s)")) << QCommandLineOption(QStringList() << QStringLiteral("sign") << QStringLiteral("s"), i18n("Sign file(s)")) << QCommandLineOption(QStringList() << QStringLiteral("sign-encrypt") << QStringLiteral("E"), i18n("Sign and/or encrypt file(s)")) << QCommandLineOption(QStringLiteral("encrypt-sign"), i18n("Same as --sign-encrypt, do not use")) << QCommandLineOption(QStringList() << QStringLiteral("decrypt") << QStringLiteral("d"), i18n("Decrypt file(s)")) << QCommandLineOption(QStringList() << QStringLiteral("verify") << QStringLiteral("V"), i18n("Verify file/signature")) << QCommandLineOption(QStringList() << QStringLiteral("decrypt-verify") << QStringLiteral("D"), i18n("Decrypt and/or verify file(s)")) << QCommandLineOption(QStringList() << QStringLiteral("search"), i18n("Search for a certificate on a keyserver")) << QCommandLineOption(QStringList() << QStringLiteral("checksum"), i18n("Create or check a checksum file")) << QCommandLineOption(QStringList() << QStringLiteral("query") << QStringLiteral("q"), i18nc("If a certificate is already known it shows the certificate details dialog." "Otherwise it brings up the certificate search dialog.", "Show details of a local certificate or search for it on a keyserver" " by fingerprint")) << QCommandLineOption(QStringList() << QStringLiteral("gen-key"), i18n("Create a new key pair or certificate signing request")) << QCommandLineOption(QStringLiteral("parent-windowid"), i18n("Parent Window Id for dialogs"), QStringLiteral("windowId")) << QCommandLineOption(QStringList() << QStringLiteral("config"), i18n("Open the config dialog")); parser->addOptions(options); /* Security note: To avoid code execution by shared library injection * through e.g. -platformpluginpath any external input should be seperated * by a double dash -- this is why query / search uses positional arguments. * * For example on Windows there is an URLhandler for openpgp4fpr: * be opened with Kleopatra's query function. And while a browser should * urlescape such a query there might be tricks to inject a quote character * and as such inject command line options for Kleopatra in an URL. */ parser->addPositionalArgument(QStringLiteral("files"), i18n("File(s) to process"), QStringLiteral("-- [files..]")); parser->addPositionalArgument(QStringLiteral("query"), i18n("String or Fingerprint for query and search"), QStringLiteral("-- [query..]")); } -#endif diff --git a/src/kleopatraapplication.h b/src/kleopatraapplication.h index 541cffd5c..74437fb34 100644 --- a/src/kleopatraapplication.h +++ b/src/kleopatraapplication.h @@ -1,104 +1,102 @@ /* kleopatraapplication.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2008 Klarälvdalens Datakonsult AB SPDX-FileCopyrightText: 2016 Bundesamt für Sicherheit in der Informationstechnik SPDX-FileContributor: Intevation GmbH SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRAAPPLICATION_H__ -#define __KLEOPATRAAPPLICATION_H__ +#pragma once #include #include #include #include class MainWindow; class SysTrayIcon; class KleopatraApplication : public QApplication { Q_OBJECT public: /** Create a new Application object. You have to * make sure to call init afterwards to get a valid object. * This is to delay initialisation after the UniqueService * call is done and our init / call might be forwarded to * another instance. */ KleopatraApplication(int &argc, char *argv[]); ~KleopatraApplication(); /** Initialize the application. Without calling init any * other call to KleopatraApplication will result in undefined behavior * and likely crash. */ void init(); static KleopatraApplication *instance() { return qobject_cast(qApp); } /** Starts a new instance or a command from the command line. * * Handles the parser options and starts the according commands. * If ignoreNewInstance is set this function does nothing. * The parser should have been initialized with kleopatra_options and * already processed. * If kleopatra is not session restored * * @param parser: The command line parser to use. * @param workingDirectory: Optional working directory for file arguments. * * @returns an empty QString on success. A localized error message otherwise. * */ QString newInstance(const QCommandLineParser &parser, const QString &workingDirectory = QString()); void setMainWindow(MainWindow *mw); const MainWindow *mainWindow() const; MainWindow *mainWindow(); const SysTrayIcon *sysTrayIcon() const; SysTrayIcon *sysTrayIcon(); void setIgnoreNewInstance(bool on); bool ignoreNewInstance() const; void toggleMainWindowVisibility(); void restoreMainWindow(); void openConfigDialogWithForeignParent(WId parentWId); public Q_SLOTS: void openOrRaiseMainWindow(); void openOrRaiseConfigDialog(); #ifndef QT_NO_SYSTEMTRAYICON void startMonitoringSmartCard(); void importCertificatesFromFile(const QStringList &files, GpgME::Protocol proto); #endif void encryptFiles(const QStringList &files, GpgME::Protocol proto); void signFiles(const QStringList &files, GpgME::Protocol proto); void signEncryptFiles(const QStringList &files, GpgME::Protocol proto); void decryptFiles(const QStringList &files, GpgME::Protocol proto); void verifyFiles(const QStringList &files, GpgME::Protocol proto); void decryptVerifyFiles(const QStringList &files, GpgME::Protocol proto); void checksumFiles(const QStringList &files, GpgME::Protocol /* unused */); void slotActivateRequested(const QStringList &arguments, const QString &workingDirectory); Q_SIGNALS: /* Emitted from slotActivateRequested to enable setting the * correct exitValue */ void setExitValue(int value); private: class Private; kdtools::pimpl_ptr d; }; -#endif // __KLEOPATRAAPPLICATION_H__ diff --git a/src/kwatchgnupg/aboutdata.h b/src/kwatchgnupg/aboutdata.h index 4011321f9..8697ee161 100644 --- a/src/kwatchgnupg/aboutdata.h +++ b/src/kwatchgnupg/aboutdata.h @@ -1,21 +1,19 @@ /* aboutdata.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2004 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef ABOUTDATA_H -#define ABOUTDATA_H +#pragma once #include class AboutData : public KAboutData { public: AboutData(); }; -#endif // ABOUTDATA_H diff --git a/src/kwatchgnupg/kwatchgnupg.h b/src/kwatchgnupg/kwatchgnupg.h index 1ca678887..92c0978e1 100644 --- a/src/kwatchgnupg/kwatchgnupg.h +++ b/src/kwatchgnupg/kwatchgnupg.h @@ -1,19 +1,17 @@ /* This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2001, 2002, 2004 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef KWATCHGNUPG_H -#define KWATCHGNUPG_H +#pragma once #include #include #define WATCHGNUPGBINARY QStringLiteral("watchgnupg") #define WATCHGNUPGSOCKET QString( Kleo::gnupgHomeDirectory() + QLatin1String("/log-socket") ) -#endif /* KWATCHGNUPG_H */ diff --git a/src/kwatchgnupg/kwatchgnupgconfig.h b/src/kwatchgnupg/kwatchgnupgconfig.h index d82fdbb14..ced586a2d 100644 --- a/src/kwatchgnupg/kwatchgnupgconfig.h +++ b/src/kwatchgnupg/kwatchgnupgconfig.h @@ -1,52 +1,50 @@ /* kwatchgnupgconfig.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2001, 2002, 2004, 2008 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef KWATCHGNUPGCONFIG_H -#define KWATCHGNUPGCONFIG_H +#pragma once #include class QCheckBox; class QComboBox; class KPluralHandlingSpinBox; class QDialogButtonBox; namespace Kleo { class FileNameRequester; } class KWatchGnuPGConfig : public QDialog { Q_OBJECT public: explicit KWatchGnuPGConfig(QWidget *parent = nullptr); ~KWatchGnuPGConfig(); void loadConfig(); void saveConfig(); Q_SIGNALS: void reconfigure(); private Q_SLOTS: void slotChanged(); void slotSave(); void slotSetHistorySizeUnlimited(); private: Kleo::FileNameRequester *mExeED; Kleo::FileNameRequester *mSocketED; QComboBox *mLogLevelCB; KPluralHandlingSpinBox *mLoglenSB; QCheckBox *mWordWrapCB; QDialogButtonBox *mButtonBox; }; -#endif /* KWATCHGNUPGCONFIG_H */ diff --git a/src/kwatchgnupg/kwatchgnupgmainwin.h b/src/kwatchgnupg/kwatchgnupgmainwin.h index ed656301a..02712c193 100644 --- a/src/kwatchgnupg/kwatchgnupgmainwin.h +++ b/src/kwatchgnupg/kwatchgnupgmainwin.h @@ -1,60 +1,58 @@ /* main.cpp This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2001, 2002, 2004 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef KWATCHGNUPGMAINWIN_H -#define KWATCHGNUPGMAINWIN_H +#pragma once #include #include class KWatchGnuPGTray; class KWatchGnuPGConfig; class KProcess; class QTextEdit; class KWatchGnuPGMainWindow : public KXmlGuiWindow { Q_OBJECT public: explicit KWatchGnuPGMainWindow(QWidget *parent = nullptr); ~KWatchGnuPGMainWindow(); private Q_SLOTS: void slotWatcherExited(int, QProcess::ExitStatus); void slotReadStdout(); void slotSaveAs(); void slotQuit(); void slotClear(); void slotConfigure(); void slotConfigureToolbars(); void configureShortcuts(); void slotReadConfig(); public Q_SLOTS: /* reimp */ void show(); protected: bool queryClose() override; private: void createActions(); void startWatcher(); void setGnuPGConfig(); KProcess *mWatcher; QTextEdit *mCentralWidget; KWatchGnuPGTray *mSysTray; KWatchGnuPGConfig *mConfig; }; -#endif /* KWATCHGNUPGMAINWIN_H */ diff --git a/src/kwatchgnupg/tray.h b/src/kwatchgnupg/tray.h index 6d9725f28..0139cdae1 100644 --- a/src/kwatchgnupg/tray.h +++ b/src/kwatchgnupg/tray.h @@ -1,33 +1,31 @@ /* main.cpp This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2001, 2002, 2004 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef TRAY_H -#define TRAY_H +#pragma once #include #include class KWatchGnuPGMainWindow; class KWatchGnuPGTray : public KStatusNotifierItem { Q_OBJECT public: explicit KWatchGnuPGTray(KWatchGnuPGMainWindow *mainwin); virtual ~KWatchGnuPGTray(); public Q_SLOTS: void setAttention(bool att); private: QIcon mNormalPix; QIcon mAttentionPix; }; -#endif /* TRAY_H */ diff --git a/src/libkleopatraclient/core/command.h b/src/libkleopatraclient/core/command.h index 0d2f7b51b..4728e6b09 100644 --- a/src/libkleopatraclient/core/command.h +++ b/src/libkleopatraclient/core/command.h @@ -1,93 +1,91 @@ /* -*- mode: c++; c-basic-offset:4 -*- core/command.h This file is part of KleopatraClient, the Kleopatra interface library SPDX-FileCopyrightText: 2008 Klarälvdalens Datakonsult AB SPDX-License-Identifier: LGPL-2.0-or-later */ -#ifndef __LIBKLEOPATRACLIENT_CORE_COMMAND_H__ -#define __LIBKLEOPATRACLIENT_CORE_COMMAND_H__ +#pragma once #include "kleopatraclientcore_export.h" #include #include // only for WId, doesn't prevent linking against QtCore-only class QString; class QByteArray; class QVariant; namespace KleopatraClientCopy { class KLEOPATRACLIENTCORE_EXPORT Command : public QObject { Q_OBJECT public: explicit Command(QObject *parent = nullptr); ~Command(); void setParentWId(WId wid); WId parentWId() const; void setServerLocation(const QString &location); QString serverLocation() const; bool waitForFinished(); bool waitForFinished(unsigned long ms); bool error() const; bool wasCanceled() const; QString errorString() const; qint64 serverPid() const; public Q_SLOTS: void start(); void cancel(); Q_SIGNALS: void started(); void finished(); protected: void setOptionValue(const char *name, const QVariant &value, bool critical = true); void setOption(const char *name, bool critical = true); void unsetOption(const char *name); QVariant optionValue(const char *name) const; bool isOptionSet(const char *name) const; bool isOptionCritical(const char *name) const; void setFilePaths(const QStringList &filePaths); QStringList filePaths() const; void setRecipients(const QStringList &recipients, bool informative); QStringList recipients() const; bool areRecipientsInformative() const; void setSenders(const QStringList &senders, bool informative); QStringList senders() const; bool areSendersInformative() const; void setInquireData(const char *what, const QByteArray &data); void unsetInquireData(const char *what); QByteArray inquireData(const char *what) const; bool isInquireDataSet(const char *what) const; QByteArray receivedData() const; void setCommand(const char *command); QByteArray command() const; protected: class Private; Private *d; Command(Private *p, QObject *parent); }; } -#endif /* __LIBKLEOPATRACLIENT_CORE_COMMAND_H__ */ diff --git a/src/libkleopatraclient/core/command_p.h b/src/libkleopatraclient/core/command_p.h index 189cfd491..e04300f1e 100644 --- a/src/libkleopatraclient/core/command_p.h +++ b/src/libkleopatraclient/core/command_p.h @@ -1,77 +1,75 @@ /* -*- mode: c++; c-basic-offset:4 -*- command_p.h This file is part of KleopatraClient, the Kleopatra interface library SPDX-FileCopyrightText: 2008 Klarälvdalens Datakonsult AB SPDX-License-Identifier: LGPL-2.0-or-later */ -#ifndef __LIBKLEOPATRACLIENT_CORE_COMMAND_P_H__ -#define __LIBKLEOPATRACLIENT_CORE_COMMAND_P_H__ +#pragma once #include "command.h" #include #include #include #include #include #include #include #include class KleopatraClientCopy::Command::Private : public QThread { Q_OBJECT private: friend class ::KleopatraClientCopy::Command; Command *const q; public: explicit Private(Command *qq) : QThread(), q(qq), mutex(), inputs(), outputs() { } ~Private() override {} private: void init(); private: void run() override; private: QRecursiveMutex mutex; struct Option { QVariant value; bool hasValue : 1; bool isCritical : 1; }; struct Inputs { Inputs() : parentWId(0), areRecipientsInformative(false), areSendersInformative(false) {} std::map options; QStringList filePaths; QStringList recipients, senders; std::map inquireData; WId parentWId; QByteArray command; bool areRecipientsInformative : 1; bool areSendersInformative : 1; } inputs; struct Outputs { Outputs() : canceled(false), serverPid(0) {} QString errorString; bool canceled : 1; QByteArray data; qint64 serverPid; QString serverLocation; } outputs; }; -#endif /* __LIBKLEOPATRACLIENT_CORE_COMMAND_P_H__ */ diff --git a/src/libkleopatraclient/core/decryptverifyfilescommand.h b/src/libkleopatraclient/core/decryptverifyfilescommand.h index 46d5c2230..a6a68e430 100644 --- a/src/libkleopatraclient/core/decryptverifyfilescommand.h +++ b/src/libkleopatraclient/core/decryptverifyfilescommand.h @@ -1,35 +1,33 @@ /* -*- mode: c++; c-basic-offset:4 -*- core/decryptverifyfilescommand.h This file is part of KleopatraClient, the Kleopatra interface library SPDX-FileCopyrightText: 2008 Klarälvdalens Datakonsult AB SPDX-License-Identifier: LGPL-2.0-or-later */ -#ifndef __LIBKLEOPATRACLIENT_CORE_DECRYPTVERIFYFILESCOMMAND_H__ -#define __LIBKLEOPATRACLIENT_CORE_DECRYPTVERIFYFILESCOMMAND_H__ +#pragma once #include namespace KleopatraClientCopy { class KLEOPATRACLIENTCORE_EXPORT DecryptVerifyFilesCommand : public Command { Q_OBJECT public: explicit DecryptVerifyFilesCommand(QObject *parent = nullptr); ~DecryptVerifyFilesCommand(); // Inputs using Command::setFilePaths; using Command::filePaths; // No Outputs }; } -#endif /* __LIBKLEOPATRACLIENT_CORE_DECRYPTVERIFYFILESCOMMAND_H__ */ diff --git a/src/libkleopatraclient/core/initialization.h b/src/libkleopatraclient/core/initialization.h index cac325940..cdeec4199 100644 --- a/src/libkleopatraclient/core/initialization.h +++ b/src/libkleopatraclient/core/initialization.h @@ -1,27 +1,25 @@ /* -*- mode: c++; c-basic-offset:4 -*- initialization.h This file is part of KleopatraClient, the Kleopatra interface library SPDX-FileCopyrightText: 2008 Klarälvdalens Datakonsult AB SPDX-License-Identifier: LGPL-2.0-or-later */ -#ifndef __LIBKLEOPATRACLIENT_CORE_INITIALIZATION_H__ -#define __LIBKLEOPATRACLIENT_CORE_INITIALIZATION_H__ +#pragma once #include "kleopatraclientcore_export.h" namespace KleopatraClientCopy { class KLEOPATRACLIENTCORE_EXPORT Initialization { public: Initialization(); ~Initialization(); }; } -#endif /* __LIBKLEOPATRACLIENT_CORE_INITIALIZATION_H__ */ diff --git a/src/libkleopatraclient/core/selectcertificatecommand.h b/src/libkleopatraclient/core/selectcertificatecommand.h index 7c6558d40..22cd57b76 100644 --- a/src/libkleopatraclient/core/selectcertificatecommand.h +++ b/src/libkleopatraclient/core/selectcertificatecommand.h @@ -1,57 +1,55 @@ /* -*- mode: c++; c-basic-offset:4 -*- core/selectcertificatecommand.h This file is part of KleopatraClient, the Kleopatra interface library SPDX-FileCopyrightText: 2008 Klarälvdalens Datakonsult AB SPDX-License-Identifier: LGPL-2.0-or-later */ -#ifndef __LIBKLEOPATRACLIENT_CORE_SELECTCERTIFICATECOMMAND_H__ -#define __LIBKLEOPATRACLIENT_CORE_SELECTCERTIFICATECOMMAND_H__ +#pragma once #include namespace KleopatraClientCopy { class KLEOPATRACLIENTCORE_EXPORT SelectCertificateCommand : public Command { Q_OBJECT public: explicit SelectCertificateCommand(QObject *parent = nullptr); ~SelectCertificateCommand(); // Inputs void setMultipleCertificatesAllowed(bool allow); bool multipleCertificatesAllowed() const; void setOnlySigningCertificatesAllowed(bool allow); bool onlySigningCertificatesAllowed() const; void setOnlyEncryptionCertificatesAllowed(bool allow); bool onlyEncryptionCertificatesAllowed() const; void setOnlyOpenPGPCertificatesAllowed(bool allow); bool onlyOpenPGPCertificatesAllowed() const; void setOnlyX509CertificatesAllowed(bool allow); bool onlyX509CertificatesAllowed() const; void setOnlySecretKeysAllowed(bool allow); bool onlySecretKeysAllowed() const; // Input/Outputs void setSelectedCertificates(const QStringList &certs); QStringList selectedCertificates() const; void setSelectedCertificate(const QString &cert); QString selectedCertificate() const; }; } -#endif /* __LIBKLEOPATRACLIENT_CORE_SELECTCERTIFICATECOMMAND_H__ */ diff --git a/src/libkleopatraclient/core/signencryptfilescommand.h b/src/libkleopatraclient/core/signencryptfilescommand.h index f176b1518..735ab288e 100644 --- a/src/libkleopatraclient/core/signencryptfilescommand.h +++ b/src/libkleopatraclient/core/signencryptfilescommand.h @@ -1,35 +1,33 @@ /* -*- mode: c++; c-basic-offset:4 -*- core/signencryptfilescommand.h This file is part of KleopatraClient, the Kleopatra interface library SPDX-FileCopyrightText: 2008 Klarälvdalens Datakonsult AB SPDX-License-Identifier: LGPL-2.0-or-later */ -#ifndef __LIBKLEOPATRACLIENT_CORE_SIGNENCRYPTFILESCOMMAND_H__ -#define __LIBKLEOPATRACLIENT_CORE_SIGNENCRYPTFILESCOMMAND_H__ +#pragma once #include namespace KleopatraClientCopy { class KLEOPATRACLIENTCORE_EXPORT SignEncryptFilesCommand : public Command { Q_OBJECT public: explicit SignEncryptFilesCommand(QObject *parent = nullptr); ~SignEncryptFilesCommand(); // Inputs using Command::setFilePaths; using Command::filePaths; // No Outputs }; } -#endif /* __LIBKLEOPATRACLIENT_CORE_SIGNENCRYPTFILESCOMMAND_H__ */ diff --git a/src/libkleopatraclient/gui/certificaterequester.h b/src/libkleopatraclient/gui/certificaterequester.h index 14d336152..e9dac28da 100644 --- a/src/libkleopatraclient/gui/certificaterequester.h +++ b/src/libkleopatraclient/gui/certificaterequester.h @@ -1,73 +1,71 @@ /* -*- mode: c++; c-basic-offset:4 -*- gui/certificaterequester.h This file is part of KleopatraClient, the Kleopatra interface library SPDX-FileCopyrightText: 2008 Klarälvdalens Datakonsult AB SPDX-License-Identifier: LGPL-2.0-or-later */ -#ifndef __LIBKLEOPATRACLIENT_GUI_CERTIFICATEREQUESTER_H__ -#define __LIBKLEOPATRACLIENT_GUI_CERTIFICATEREQUESTER_H__ +#pragma once #include "kleopatraclientgui_export.h" #include namespace KleopatraClientCopy { namespace Gui { class KLEOPATRACLIENTGUI_EXPORT CertificateRequester : public QWidget { Q_OBJECT Q_PROPERTY(bool multipleCertificatesAllowed READ multipleCertificatesAllowed WRITE setMultipleCertificatesAllowed) Q_PROPERTY(bool onlySigningCertificatesAllowed READ onlySigningCertificatesAllowed WRITE setOnlySigningCertificatesAllowed) Q_PROPERTY(bool onlyEncryptionCertificatesAllowed READ onlyEncryptionCertificatesAllowed WRITE setOnlyEncryptionCertificatesAllowed) Q_PROPERTY(bool onlyOpenPGPCertificatesAllowed READ onlyOpenPGPCertificatesAllowed WRITE setOnlyOpenPGPCertificatesAllowed) Q_PROPERTY(bool onlyX509CertificatesAllowed READ onlyX509CertificatesAllowed WRITE setOnlyX509CertificatesAllowed) Q_PROPERTY(bool onlySecretKeysAllowed READ onlySecretKeysAllowed WRITE setOnlySecretKeysAllowed) Q_PROPERTY(QStringList selectedCertificates READ selectedCertificates WRITE setSelectedCertificates) public: explicit CertificateRequester(QWidget *parent = nullptr, Qt::WindowFlags f = {}); ~CertificateRequester(); void setMultipleCertificatesAllowed(bool allow); bool multipleCertificatesAllowed() const; void setOnlySigningCertificatesAllowed(bool allow); bool onlySigningCertificatesAllowed() const; void setOnlyEncryptionCertificatesAllowed(bool allow); bool onlyEncryptionCertificatesAllowed() const; void setOnlyOpenPGPCertificatesAllowed(bool allow); bool onlyOpenPGPCertificatesAllowed() const; void setOnlyX509CertificatesAllowed(bool allow); bool onlyX509CertificatesAllowed() const; void setOnlySecretKeysAllowed(bool allow); bool onlySecretKeysAllowed() const; void setSelectedCertificates(const QStringList &certs); QStringList selectedCertificates() const; void setSelectedCertificate(const QString &cert); QString selectedCertificate() const; Q_SIGNALS: void selectedCertificatesChanged(const QStringList &certs); private: class Private; Private *d; Q_PRIVATE_SLOT(d, void slotButtonClicked()) Q_PRIVATE_SLOT(d, void slotCommandFinished()) }; } } -#endif /* __LIBKLEOPATRACLIENT_GUI_CERTIFICATEREQUESTER_H__ */ diff --git a/src/libkleopatraclient/tests/test_util.h b/src/libkleopatraclient/tests/test_util.h index 8e154d94f..fd3442332 100644 --- a/src/libkleopatraclient/tests/test_util.h +++ b/src/libkleopatraclient/tests/test_util.h @@ -1,17 +1,15 @@ -#ifndef __LIBKLEOPATRACLIENT_TESTS_TEST_UTIL_H__ -#define __LIBKLEOPATRACLIENT_TESTS_TEST_UTIL_H__ +#pragma once #include #include #include static QStringList filePathsFromArgs(int argc, char *argv[]) { QStringList result; for (int i = 1; i < argc; ++i) { result.push_back(QFileInfo(QFile::decodeName(argv[i])).absoluteFilePath()); } return result; } -#endif /* __LIBKLEOPATRACLIENT_TESTS_TEST_UTIL_H__ */ diff --git a/src/mainwindow.h b/src/mainwindow.h index f2ffe6247..96f73bf1c 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -1,61 +1,59 @@ /* -*- mode: c++; c-basic-offset:4 -*- mainwindow.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2007 Klarälvdalens Datakonsult AB SPDX-FileCopyrightText: 2016 Bundesamt für Sicherheit in der Informationstechnik SPDX-FileContributor: Intevation GmbH SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_MAINWINDOW_DESKTOP_H__ -#define __KLEOPATRA_MAINWINDOW_DESKTOP_H__ +#pragma once #include #include class MainWindow : public KXmlGuiWindow { Q_OBJECT public: explicit MainWindow(QWidget *parent = nullptr, Qt::WindowFlags f = {}); ~MainWindow() override; public Q_SLOTS: void importCertificatesFromFile(const QStringList &files); protected: QByteArray savedGeometry; void closeEvent(QCloseEvent *e) override; void showEvent(QShowEvent *e) override; void hideEvent(QHideEvent *e) override; void dragEnterEvent(QDragEnterEvent *) override; void dropEvent(QDropEvent *) override; void readProperties(const KConfigGroup &cg) override; void saveProperties(KConfigGroup &cg) override; private: class Private; kdtools::pimpl_ptr d; Q_PRIVATE_SLOT(d, void closeAndQuit()) Q_PRIVATE_SLOT(d, void selfTest()) Q_PRIVATE_SLOT(d, void configureBackend()) Q_PRIVATE_SLOT(d, void configureToolbars()) Q_PRIVATE_SLOT(d, void configureGroups()) Q_PRIVATE_SLOT(d, void editKeybindings()) Q_PRIVATE_SLOT(d, void gnupgLogViewer()) Q_PRIVATE_SLOT(d, void slotConfigCommitted()) Q_PRIVATE_SLOT(d, void slotContextMenuRequested(QAbstractItemView *, QPoint)) Q_PRIVATE_SLOT(d, void slotFocusQuickSearch()) Q_PRIVATE_SLOT(d, void showCertificateView()) Q_PRIVATE_SLOT(d, void showPadView()) Q_PRIVATE_SLOT(d, void showSmartcardView()) Q_PRIVATE_SLOT(d, void forceUpdateCheck()) Q_PRIVATE_SLOT(d, void openCompendium()) }; -#endif /* __KLEOPATRA_MAINWINDOW_DESKTOP_H__ */ diff --git a/src/newcertificatewizard/listwidget.h b/src/newcertificatewizard/listwidget.h index fcfd6a9ea..db9f097c3 100644 --- a/src/newcertificatewizard/listwidget.h +++ b/src/newcertificatewizard/listwidget.h @@ -1,63 +1,61 @@ /* -*- mode: c++; c-basic-offset:4 -*- newcertificatewizard/listwidget.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2008 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_NEWCERTIFICATEWIZARD_LISTWIDGET_H__ -#define __KLEOPATRA_NEWCERTIFICATEWIZARD_LISTWIDGET_H__ +#pragma once #include #include class QRegExp; class QString; #include namespace Kleo { namespace NewCertificateUi { class ListWidget : public QWidget { Q_OBJECT Q_PROPERTY(QStringList items READ items WRITE setItems USER true NOTIFY itemsChanged) Q_PROPERTY(QRegExp regExpFilter READ regExpFilter WRITE setRegExpFilter) Q_PROPERTY(QString defaultValue READ defaultValue WRITE setDefaultValue) public: explicit ListWidget(QWidget *parent = nullptr); ~ListWidget(); void setDefaultValue(const QString &defaultValue); QString defaultValue() const; void setRegExpFilter(const QRegExp &rx); QRegExp regExpFilter() const; QStringList items() const; public Q_SLOTS: void setItems(const QStringList &items); Q_SIGNALS: void itemsChanged(); private: class Private; kdtools::pimpl_ptr d; Q_PRIVATE_SLOT(d, void slotAdd()) Q_PRIVATE_SLOT(d, void slotRemove()) Q_PRIVATE_SLOT(d, void slotUp()) Q_PRIVATE_SLOT(d, void slotDown()) Q_PRIVATE_SLOT(d, void slotSelectionChanged()) }; } } -#endif /* __KLEOPATRA_NEWCERTIFICATEWIZARD_LISTWIDGET_H__ */ diff --git a/src/newcertificatewizard/newcertificatewizard.h b/src/newcertificatewizard/newcertificatewizard.h index 6cc2333b4..8bae513b2 100644 --- a/src/newcertificatewizard/newcertificatewizard.h +++ b/src/newcertificatewizard/newcertificatewizard.h @@ -1,55 +1,53 @@ /* -*- mode: c++; c-basic-offset:4 -*- newcertificatewizard/newcertificatewizard.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2008 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_NEWCERTIFICATEWIZARD_NEWCERTIFICATEWIZARD_H__ -#define __KLEOPATRA_NEWCERTIFICATEWIZARD_NEWCERTIFICATEWIZARD_H__ +#pragma once #include #include #include namespace Kleo { namespace NewCertificateUi { class WizardPage; } class NewCertificateWizard : public QWizard { Q_OBJECT public: explicit NewCertificateWizard(QWidget *parent = nullptr); ~NewCertificateWizard(); void setProtocol(GpgME::Protocol protocol); GpgME::Protocol protocol() const; enum Pages { ChooseProtocolPageId, EnterDetailsPageId, OverviewPageId, KeyCreationPageId, ResultPageId, NumPages }; private: class Private; kdtools::pimpl_ptr d; friend class ::Kleo::NewCertificateUi::WizardPage; }; } -#endif /* __KLEOPATRA_NEWCERTIFICATEWIZARD_NEWCERTIFICATEWIZARD_H__ */ diff --git a/src/selftest/enginecheck.h b/src/selftest/enginecheck.h index bb57251e0..566be0bfb 100644 --- a/src/selftest/enginecheck.h +++ b/src/selftest/enginecheck.h @@ -1,28 +1,26 @@ /* -*- mode: c++; c-basic-offset:4 -*- selftest/enginecheck.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2008 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_SELFTEST_ENGINECHECK_H__ -#define __KLEOPATRA_SELFTEST_ENGINECHECK_H__ +#pragma once #include #include namespace Kleo { class SelfTest; std::shared_ptr makeGpgEngineCheckSelfTest(); std::shared_ptr makeGpgSmEngineCheckSelfTest(); std::shared_ptr makeGpgConfEngineCheckSelfTest(); } -#endif /* __KLEOPATRA_SELFTEST_ENGINECHECK_H__ */ diff --git a/src/selftest/gpgagentcheck.h b/src/selftest/gpgagentcheck.h index d3c8b718c..a7bfa7068 100644 --- a/src/selftest/gpgagentcheck.h +++ b/src/selftest/gpgagentcheck.h @@ -1,26 +1,24 @@ /* -*- mode: c++; c-basic-offset:4 -*- selftest/gpgagentcheck.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2009 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_SELFTEST_GPGAGENTCHECK_H__ -#define __KLEOPATRA_SELFTEST_GPGAGENTCHECK_H__ +#pragma once #include #include namespace Kleo { class SelfTest; std::shared_ptr makeGpgAgentConnectivitySelfTest(); } -#endif /* __KLEOPATRA_SELFTEST_GPGAGENTCHECK_H__ */ diff --git a/src/selftest/gpgconfcheck.h b/src/selftest/gpgconfcheck.h index a58186b1b..9afdb07fb 100644 --- a/src/selftest/gpgconfcheck.h +++ b/src/selftest/gpgconfcheck.h @@ -1,26 +1,24 @@ /* -*- mode: c++; c-basic-offset:4 -*- selftest/gpgconfcheck.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2008 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_SELFTEST_GPGCONFCHECK_H__ -#define __KLEOPATRA_SELFTEST_GPGCONFCHECK_H__ +#pragma once #include #include namespace Kleo { class SelfTest; std::shared_ptr makeGpgConfCheckConfigurationSelfTest(const char *component = nullptr); } -#endif /* __KLEOPATRA_SELFTEST_GPGCONFCHECK_H__ */ diff --git a/src/selftest/implementation_p.h b/src/selftest/implementation_p.h index a921db777..b057ef874 100644 --- a/src/selftest/implementation_p.h +++ b/src/selftest/implementation_p.h @@ -1,71 +1,69 @@ /* -*- mode: c++; c-basic-offset:4 -*- selftest/implementation_p.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2008 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_SELFTEST_IMPLEMENTATION_P_H__ -#define __KLEOPATRA_SELFTEST_IMPLEMENTATION_P_H__ +#pragma once #include #include #include namespace Kleo { namespace _detail { class SelfTestImplementation : public SelfTest { public: explicit SelfTestImplementation(const QString &name); ~SelfTestImplementation() override; QString name() const override { return m_name; } QString shortError() const override { return m_error; } QString longError() const override { return m_explanation; } QString proposedFix() const override { return m_proposedFix; } bool skipped() const override { return m_skipped; } bool passed() const override { return m_passed; } protected: bool ensureEngineVersion(GpgME::Engine, int major, int minor, int patch); protected: const QString m_name; QString m_error; QString m_explanation; QString m_proposedFix; bool m_skipped : 1; bool m_passed : 1; }; } } -#endif /* __KLEOPATRA_SELFTEST_IMPLEMENTATION_P_H__ */ diff --git a/src/selftest/libkleopatrarccheck.h b/src/selftest/libkleopatrarccheck.h index 2bca2a1a0..9b179ed7c 100644 --- a/src/selftest/libkleopatrarccheck.h +++ b/src/selftest/libkleopatrarccheck.h @@ -1,26 +1,24 @@ /* -*- mode: c++; c-basic-offset:4 -*- selftest/libkleopatrarccheck.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2010 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_SELFTEST_LIBKLEOPATRARCCHECK_H__ -#define __KLEOPATRA_SELFTEST_LIBKLEOPATRARCCHECK_H__ +#pragma once #include #include namespace Kleo { class SelfTest; std::shared_ptr makeLibKleopatraRcSelfTest(); } -#endif /* __KLEOPATRA_SELFTEST_LIBKLEOPATRARCCHECK_H__ */ diff --git a/src/selftest/registrycheck.h b/src/selftest/registrycheck.h index fcb749e8a..a4ff04b5e 100644 --- a/src/selftest/registrycheck.h +++ b/src/selftest/registrycheck.h @@ -1,26 +1,24 @@ /* -*- mode: c++; c-basic-offset:4 -*- selftest/registrycheck.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2008 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_SELFTEST_REGISTRYCHECK_H__ -#define __KLEOPATRA_SELFTEST_REGISTRYCHECK_H__ +#pragma once #include #include namespace Kleo { class SelfTest; std::shared_ptr makeGpgProgramRegistryCheckSelfTest(); } -#endif /* __KLEOPATRA_SELFTEST_REGISTRYCHECK_H__ */ diff --git a/src/selftest/selftest.h b/src/selftest/selftest.h index ed090cc9d..c54a62263 100644 --- a/src/selftest/selftest.h +++ b/src/selftest/selftest.h @@ -1,41 +1,39 @@ /* -*- mode: c++; c-basic-offset:4 -*- selftest/selftest.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2008 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_SELFTEST_SELFTEST_H__ -#define __KLEOPATRA_SELFTEST_SELFTEST_H__ +#pragma once class QString; namespace Kleo { class SelfTest { public: virtual ~SelfTest(); virtual QString name() const = 0; virtual QString shortError() const = 0; virtual QString longError() const = 0; virtual QString proposedFix() const = 0; virtual bool passed() const = 0; virtual bool skipped() const = 0; virtual bool canFixAutomatically() const; virtual bool fix(); bool failed() const { return !skipped() && !passed(); } }; } -#endif /* __KLEOPATRA_SELFTEST_SELFTEST_H__ */ diff --git a/src/selftest/uiservercheck.h b/src/selftest/uiservercheck.h index 730da9557..a24314c14 100644 --- a/src/selftest/uiservercheck.h +++ b/src/selftest/uiservercheck.h @@ -1,26 +1,24 @@ /* -*- mode: c++; c-basic-offset:4 -*- selftest/uiservercheck.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2008 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_SELFTEST_UISERVERCHECK_H__ -#define __KLEOPATRA_SELFTEST_UISERVERCHECK_H__ +#pragma once #include #include namespace Kleo { class SelfTest; std::shared_ptr makeUiServerConnectivitySelfTest(); } -#endif /* __KLEOPATRA_SELFTEST_UISERVERCHECK_H__ */ diff --git a/src/smartcard/card.h b/src/smartcard/card.h index 72f99ad42..fa792f218 100644 --- a/src/smartcard/card.h +++ b/src/smartcard/card.h @@ -1,131 +1,129 @@ -#ifndef SMARTCARD_CARD_H -#define SMARTCARD_CARD_H +#pragma once /* smartcard/card.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2017 Bundesamt für Sicherheit in der Informationstechnik SPDX-FileContributor: Intevation GmbH SPDX-License-Identifier: GPL-2.0-or-later */ #include "keypairinfo.h" #include #include #include namespace Kleo { namespace SmartCard { /** Class representing an application on a smartcard or similar hardware token. */ class Card { public: enum PinState { UnknownPinState, NullPin, PinBlocked, NoPin, PinOk, NumPinStates }; enum Status { NoCard, CardPresent, CardActive, CardUsable, _NumScdStates, CardError = _NumScdStates, NumStates }; Card(); virtual ~Card(); virtual bool operator == (const Card &other) const; bool operator != (const Card &other) const; void setStatus(Status s); Status status() const; void setSerialNumber(const std::string &sn); std::string serialNumber() const; QString displaySerialNumber() const; void setDisplaySerialNumber(const QString &sn); std::string appName() const; void setAppVersion(int version); int appVersion() const; QString displayAppVersion() const; std::string cardType() const; int cardVersion() const; QString displayCardVersion() const; QString cardHolder() const; void setSigningKeyRef(const std::string &keyRef); std::string signingKeyRef() const; bool hasSigningKey() const; void setEncryptionKeyRef(const std::string &keyRef); std::string encryptionKeyRef() const; bool hasEncryptionKey() const; std::vector pinStates() const; void setPinStates(const std::vector &pinStates); bool hasNullPin() const; void setHasNullPin(bool value); bool canLearnKeys() const; void setCanLearnKeys(bool value); QString errorMsg() const; void setErrorMsg(const QString &msg); const std::vector & keyInfos() const; const KeyPairInfo & keyInfo(const std::string &keyRef) const; protected: void setAppName(const std::string &name); void setInitialKeyInfos(const std::vector &infos); bool parseCardInfo(const std::string &name, const std::string &value); private: void updateKeyInfo(const KeyPairInfo &keyPairInfo); private: bool mCanLearn = false; bool mHasNullPin = false; Status mStatus = NoCard; std::string mSerialNumber; QString mDisplaySerialNumber; std::string mAppName; int mAppVersion = -1; std::string mCardType; int mCardVersion = -1; QString mCardHolder; std::string mSigningKeyRef; std::string mEncryptionKeyRef; std::vector mPinStates; QString mErrMsg; std::vector mKeyInfos; }; } // namespace Smartcard } // namespace Kleopatra -#endif // SMARTCARD_CARD_H diff --git a/src/smartcard/deviceinfowatcher.h b/src/smartcard/deviceinfowatcher.h index 32d43dba8..704645110 100644 --- a/src/smartcard/deviceinfowatcher.h +++ b/src/smartcard/deviceinfowatcher.h @@ -1,41 +1,39 @@ /* smartcard/deviceinfowatcher.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2020 g10 Code GmbH SPDX-FileContributor: Ingo Klöcker SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_SMARTCARD_DEVICEINFOWATCHER_H__ -#define __KLEOPATRA_SMARTCARD_DEVICEINFOWATCHER_H__ +#pragma once #include namespace Kleo { class DeviceInfoWatcher : public QObject { Q_OBJECT public: explicit DeviceInfoWatcher(QObject *parent = nullptr); ~DeviceInfoWatcher(); static bool isSupported(); void start(); Q_SIGNALS: void statusChanged(const QByteArray &details); private: class Worker; private: class Private; Private * const d; }; } -#endif // __KLEOPATRA_SMARTCARD_DEVICEINFOWATCHER_H__ diff --git a/src/smartcard/deviceinfowatcher_p.h b/src/smartcard/deviceinfowatcher_p.h index 98d0e5304..22e044e3e 100644 --- a/src/smartcard/deviceinfowatcher_p.h +++ b/src/smartcard/deviceinfowatcher_p.h @@ -1,63 +1,61 @@ /* smartcard/deviceinfowatcher_p.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2020 g10 Code GmbH SPDX-FileContributor: Ingo Klöcker SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_SMARTCARD_DEVICEINFOWATCHER_P_H__ -#define __KLEOPATRA_SMARTCARD_DEVICEINFOWATCHER_P_H__ +#pragma once #include #include #include #include namespace Kleo { class DeviceInfoWatcher::Worker : public QObject, public GpgME::StatusConsumer { Q_OBJECT public: ~Worker(); public Q_SLOTS: void start(); Q_SIGNALS: void statusChanged(const QByteArray &details); private: Q_INVOKABLE void poll(); void status(const char *status, const char *details) override; private: int mRetryDelay = 100; std::unique_ptr mContext; }; class DeviceInfoWatcher::Private { friend class ::Kleo::DeviceInfoWatcher; DeviceInfoWatcher *const q; public: explicit Private(DeviceInfoWatcher *qq); ~Private(); private: void start(); private: QThread workerThread; }; } -#endif // __KLEOPATRA_SMARTCARD_DEVICEINFOWATCHER_P_H__ diff --git a/src/smartcard/keypairinfo.h b/src/smartcard/keypairinfo.h index 344ceb569..6abe97dfc 100644 --- a/src/smartcard/keypairinfo.h +++ b/src/smartcard/keypairinfo.h @@ -1,37 +1,35 @@ /* smartcard/keypairinfo.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2020 g10 Code GmbH SPDX-FileContributor: Ingo Klöcker SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef SMARTCARD_KEYPAIRINFO_H -#define SMARTCARD_KEYPAIRINFO_H +#pragma once #include namespace Kleo { namespace SmartCard { struct KeyPairInfo { static KeyPairInfo fromStatusLine(const std::string &s); bool canAuthenticate() const; bool canCertify() const; bool canEncrypt() const; bool canSign() const; void update(const KeyPairInfo &other); std::string keyRef; std::string grip; std::string usage; std::string keyTime; std::string algorithm; }; } // namespace Smartcard } // namespace Kleopatra -#endif // SMARTCARD_PIVCARD_H diff --git a/src/smartcard/netkeycard.h b/src/smartcard/netkeycard.h index 5ebc62458..2808bbb5a 100644 --- a/src/smartcard/netkeycard.h +++ b/src/smartcard/netkeycard.h @@ -1,49 +1,47 @@ -#ifndef SMARTCARD_NETKEYCARD_H -#define SMARTCARD_NETKEYCARD_H +#pragma once /* smartcard/netkeycard.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2017 Intevation GmbH SPDX-License-Identifier: GPL-2.0-or-later */ #include "card.h" #include namespace Kleo { namespace SmartCard { struct KeyPairInfo; /** Class to work with NetKey smartcards or compatible tokens */ class NetKeyCard: public Card { public: explicit NetKeyCard(const Card &card); static const std::string AppName; static std::string nksPinKeyRef(); static std::string sigGPinKeyRef(); void setCardInfo(const std::vector< std::pair > &infos); bool hasSigGNullPin() const; bool hasNKSNullPin() const; std::vector keys() const; private: void setKeyPairInfo(const std::vector &infos); private: std::vector mKeys; }; } // namespace Smartcard } // namespace Kleopatra -#endif // SMARTCARD_CARD_H diff --git a/src/smartcard/openpgpcard.h b/src/smartcard/openpgpcard.h index dd6f1ece9..f11a47f73 100644 --- a/src/smartcard/openpgpcard.h +++ b/src/smartcard/openpgpcard.h @@ -1,62 +1,60 @@ /* smartcard/openpgpcard.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2017 Bundesamt für Sicherheit in der Informationstechnik SPDX-FileContributor: Intevation GmbH SPDX-FileCopyrightText: 2020 g10 Code GmbH SPDX-FileContributor: Ingo Klöcker SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef SMARTCARD_OPENPGPCARD_H -#define SMARTCARD_OPENPGPCARD_H +#pragma once #include "card.h" #include namespace Kleo { namespace SmartCard { struct KeyPairInfo; /** Class to work with OpenPGP smartcards or compatible tokens */ class OpenPGPCard: public Card { public: explicit OpenPGPCard(const Card &card); static const std::string AppName; static std::string pgpSigKeyRef(); static std::string pgpEncKeyRef(); static std::string pgpAuthKeyRef(); static std::string pinKeyRef(); static std::string adminPinKeyRef(); static std::string resetCodeKeyRef(); static const std::vector & supportedKeys(); static QString keyDisplayName(const std::string &keyRef); void setCardInfo(const std::vector< std::pair > &infos); std::string keyFingerprint(const std::string &keyRef) const; bool operator == (const Card& other) const override; void setManufacturer(const std::string &manufacturer); std::string manufacturer() const; std::string pubkeyUrl() const; private: QMap mMetaInfo; std::string mManufacturer; }; } // namespace Smartcard } // namespace Kleopatra -#endif // SMARTCARD_CARD_H diff --git a/src/smartcard/pivcard.h b/src/smartcard/pivcard.h index 3f17c2ea0..87a367343 100644 --- a/src/smartcard/pivcard.h +++ b/src/smartcard/pivcard.h @@ -1,58 +1,56 @@ /* smartcard/pivcard.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2020 g10 Code GmbH SPDX-FileContributor: Ingo Klöcker SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef SMARTCARD_PIVCARD_H -#define SMARTCARD_PIVCARD_H +#pragma once #include "card.h" #include namespace Kleo { namespace SmartCard { struct KeyPairInfo; /** Class to work with PIV smartcards or compatible tokens */ class PIVCard: public Card { public: explicit PIVCard(const Card &card); static const std::string AppName; static std::string pivAuthenticationKeyRef(); static std::string cardAuthenticationKeyRef(); static std::string digitalSignatureKeyRef(); static std::string keyManagementKeyRef(); static std::string pinKeyRef(); static std::string pukKeyRef(); static const std::vector & supportedKeys(); static QString keyDisplayName(const std::string &keyRef); static std::vector< std::pair > supportedAlgorithms(const std::string &keyRef); void setCardInfo(const std::vector< std::pair > &infos); std::string keyAlgorithm(const std::string &keyRef) const; void setKeyAlgorithm(const std::string &keyRef, const std::string &algorithm); std::string certificateData(const std::string &keyRef) const; void setCertificateData(const std::string &keyRef, const std::string &data); bool operator == (const Card& other) const override; private: QMap mMetaInfo; }; } // namespace Smartcard } // namespace Kleopatra -#endif // SMARTCARD_PIVCARD_H diff --git a/src/smartcard/readerstatus.h b/src/smartcard/readerstatus.h index af52a048a..5613926ba 100644 --- a/src/smartcard/readerstatus.h +++ b/src/smartcard/readerstatus.h @@ -1,87 +1,85 @@ /* -*- mode: c++; c-basic-offset:4 -*- smartcard/readerstatus.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2009 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA__SMARTCARD__READERSTATUS_H___ -#define __KLEOPATRA__SMARTCARD__READERSTATUS_H___ +#pragma once #include #include #include "card.h" #include #include namespace GpgME { class AssuanTransaction; class Context; class Error; } namespace Kleo { namespace SmartCard { class ReaderStatus : public QObject { Q_OBJECT public: explicit ReaderStatus(QObject *parent = nullptr); ~ReaderStatus(); static const ReaderStatus *instance(); static ReaderStatus *mutableInstance(); void startSimpleTransaction(const std::shared_ptr &card, const QByteArray &cmd, QObject *receiver, const char *slot); void startTransaction(const std::shared_ptr &card, const QByteArray &cmd, QObject *receiver, const char *slot, std::unique_ptr transaction); Card::Status cardStatus(unsigned int slot) const; std::string firstCardWithNullPin() const; bool anyCardCanLearnKeys() const; std::vector > getCards() const; std::shared_ptr getCard(const std::string &serialNumber, const std::string &appName) const; template std::shared_ptr getCard(const std::string &serialNumber) const { return std::dynamic_pointer_cast(getCard(serialNumber, T::AppName)); } static std::string switchCard(std::shared_ptr &ctx, const std::string &serialNumber, GpgME::Error &err); static std::string switchApp(std::shared_ptr &ctx, const std::string &serialNumber, const std::string &appName, GpgME::Error &err); static GpgME::Error switchCardAndApp(const std::string &serialNumber, const std::string &appName); public Q_SLOTS: void updateStatus(); void startMonitoring(); Q_SIGNALS: void firstCardWithNullPinChanged(const std::string &serialNumber); void anyCardCanLearnKeysChanged(bool); void cardAdded(const std::string &serialNumber, const std::string &appName); void cardChanged(const std::string &serialNumber, const std::string &appName); void cardRemoved(const std::string &serialNumber, const std::string &appName); private: class Private; std::shared_ptr d; }; } // namespace SmartCard } // namespace Kleo Q_DECLARE_METATYPE(Kleo::SmartCard::Card::Status) -#endif /* __KLEOPATRA__SMARTCARD__READERSTATUS_H___ */ diff --git a/src/smartcard/utils.h b/src/smartcard/utils.h index b7552f108..18877aa27 100644 --- a/src/smartcard/utils.h +++ b/src/smartcard/utils.h @@ -1,26 +1,24 @@ /* smartcard/utils.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2020 g10 Code GmbH SPDX-FileContributor: Ingo Klöcker SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef SMARTCARD_UTILS_H -#define SMARTCARD_UTILS_H +#pragma once #include class QString; namespace Kleo { namespace SmartCard { QString displayAppName(const std::string &appName); } // namespace Smartcard } // namespace Kleopatra -#endif // SMARTCARD_UTILS_H diff --git a/src/systrayicon.h b/src/systrayicon.h index 61235d658..7e7646900 100644 --- a/src/systrayicon.h +++ b/src/systrayicon.h @@ -1,51 +1,49 @@ /* -*- mode: c++; c-basic-offset:4 -*- systrayicon.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2007 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_SYSTRAYICON_H__ -#define __KLEOPATRA_SYSTRAYICON_H__ +#pragma once #include #ifndef QT_NO_SYSTEMTRAYICON #include class MainWindow; class QDialog; class SysTrayIcon : public Kleo::SystemTrayIcon { Q_OBJECT public: explicit SysTrayIcon(QObject *parent = nullptr); ~SysTrayIcon() override; MainWindow *mainWindow() const; QDialog *attentionWindow() const; void setLearningInProgress(bool value); public Q_SLOTS: void setFirstCardWithNullPin(const std::string &serialNumber); void setAnyCardCanLearnKeys(bool); private: void doActivated() override; void slotEnableDisableActions() override; private: class Private; kdtools::pimpl_ptr d; Q_PRIVATE_SLOT(d, void slotAbout()) Q_PRIVATE_SLOT(d, void slotSetInitialPin()) Q_PRIVATE_SLOT(d, void slotLearnCertificates()) }; #endif // QT_NO_SYSTEMTRAYICON -#endif /* __KLEOPATRA_SYSTRAYICON_H__ */ diff --git a/src/uiserver/assuancommand.h b/src/uiserver/assuancommand.h index bc215f4e7..8a63027a9 100644 --- a/src/uiserver/assuancommand.h +++ b/src/uiserver/assuancommand.h @@ -1,387 +1,385 @@ /* -*- mode: c++; c-basic-offset:4 -*- uiserver/assuancommand.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2007 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_UISERVER_ASSUANCOMMAND_H__ -#define __KLEOPATRA_UISERVER_ASSUANCOMMAND_H__ +#pragma once #include #include #include #include #ifdef HAVE_ASSUAN2 #include #endif #include #include // for WId #include #include #include #include class QVariant; class QObject; #include struct assuan_context_s; namespace Kleo { class Input; class Output; class AssuanCommandFactory; /*! \brief Base class for GnuPG UI Server commands \note large parts of this are outdated by now!

Implementing a new AssuanCommand

You do not directly inherit AssuanCommand, unless you want to deal with implementing low-level, repetitive things like name() in terms of staticName(). Assuming you don't, then you inherit your command class from AssuanCommandMixin, passing your class as the template argument to AssuanCommandMixin, like this: \code class MyFooCommand : public AssuanCommandMixin { \endcode (http://en.wikipedia.org/wiki/Curiously_recurring_template_pattern) You then choose a command name, and return that from the static method staticName(), which is by convention queried by both AssuanCommandMixin<> and GenericAssuanCommandFactory<>: \code static const char * staticName() { return "MYFOO"; } \endcode The string should be all-uppercase by convention, but the UiServer implementation doesn't enforce this. The next step is to implement start(), the starting point of command execution:

Executing the command

\code int start( const std::string & line ) { \endcode This should set everything up and check the parameters in \a line and any options this command understands. If there's an error, choose one of the gpg-error codes and create a gpg_error_t from it using the protected makeError() function: \code return makeError( GPG_ERR_NOT_IMPLEMENTED ); \endcode But usually, you will want to create a dialog, or call some GpgME function from here. In case of errors from GpgME, you shouldn't pipe them through makeError(), but return them as-is. This will preserve the error source. Error created using makeError() will have Kleopatra as their error source, so watch out what you're doing :) In addition to options and the command line, your command might require bulk data input or output. That's what the bulk input and output channels are for. You can check whether the client handed you an input channel by checking that bulkInputDevice() isn't NULL, likewise for bulkOutputDevice(). If everything is ok, you return 0. This indicates to the client that the command has been accepted and is now in progress. In this mode (start() returned 0), there are a bunch of options for your command to do. Some commands may require additional information from the client. The options passed to start() are designed to be persistent across commands, and rather limited in length (there's a strict line length limit in the assuan protocol with no line continuation mechanism). The same is true for command line arguments, which, in addition, you have to parse yourself. Those usually apply only to this command, and not to following ones. If you need data that might be larger than the line length limit, you can either expect it on the bulkInputDevice(), or, if you have the need for more than one such data channel, or the data is optional or conditional on some condition that can only be determined during command execution, you can \em inquire the missing information from the client. As an example, a VERIFY command would expect the signed data on the bulkInputDevice(). But if the input stream doesn't contain an embedded (opaque) signature, indicating a \em detached signature, it would go and inquire that data from the client. Here's how it works: \code const int err = inquire( "DETACHED_SIGNATURE", this, SLOT(slotDetachedSignature(int,QByteArray,QByteArray)) ); if ( err ) done( err ); \endcode This should be self-explanatory: You give a slot to call when the data has arrived. The slot's first argument is an error code. The second the data (if any), and the third is just repeating what you gave as inquire()'s first argument. As usual, you can leave argument off of the end, if you are not interested in them. You can do as many inquiries as you want, but only one at a time. You should periodically send status updates to the client. You do that by calling sendStatus(). Once your command has finished executing, call done(). If it's with an error code, call done(err) like above. Do not forget to call done() when done!. It will close bulkInputDevice(), bulkOutputDevice(), and send an OK or ERR message back to the client. At that point, your command has finished executing, and a new one can be accepted, or the connection closed. Apropos connection closed. The only way for the client to cancel an operation is to shut down the connection. In this case, the canceled() function will be called. At that point, the connection to the client will have been broken already, and all you can do is pack your things and go down gracefully. If _you_ detect that the user has canceled (your dialog contains a cancel button, doesn't it?), then you should instead call done( GPG_ERR_CANCELED ), like for normal operation.

Registering the command with UiServer

To register a command, you implement a AssuanCommandFactory for your AssuanCommand subclass, and register it with the UiServer. This can be made considerably easier using GenericAssuanCommandFactory: \code UiServer server; server.registerCommandFactory( shared_ptr( new GenericAssuanCommandFactory ) ); // more registerCommandFactory calls... server.start(); \endcode */ class AssuanCommand : public ExecutionContext, public std::enable_shared_from_this { // defined in assuanserverconnection.cpp! public: AssuanCommand(); virtual ~AssuanCommand(); int start(); void canceled(); virtual const char *name() const = 0; class Memento { public: virtual ~Memento() {} }; template class TypedMemento : public Memento { T m_t; public: explicit TypedMemento(const T &t) : m_t(t) {} const T &get() const { return m_t; } T &get() { return m_t; } }; template static std::shared_ptr< TypedMemento > make_typed_memento(const T &t) { return std::shared_ptr< TypedMemento >(new TypedMemento(t)); } static int makeError(int code); // convenience methods: enum Mode { NoMode, EMail, FileManager }; Mode checkMode() const; enum CheckProtocolOption { AllowProtocolMissing = 0x01 }; GpgME::Protocol checkProtocol(Mode mode, int options = 0) const; void applyWindowID(QWidget *w) const override { doApplyWindowID(w); } WId parentWId() const; void setNohup(bool on); bool isNohup() const; bool isDone() const; QString sessionTitle() const; unsigned int sessionId() const; bool informativeRecipients() const; bool informativeSenders() const; const std::vector &recipients() const; const std::vector &senders() const; bool hasMemento(const QByteArray &tag) const; std::shared_ptr memento(const QByteArray &tag) const; template std::shared_ptr mementoAs(const QByteArray &tag) const { return std::dynamic_pointer_cast(this->memento(tag)); } QByteArray registerMemento(const std::shared_ptr &mem); QByteArray registerMemento(const QByteArray &tag, const std::shared_ptr &mem); void removeMemento(const QByteArray &tag); template T mementoContent(const QByteArray &tag) const { if (std::shared_ptr< TypedMemento > m = mementoAs< TypedMemento >(tag)) { return m->get(); } else { return T(); } } bool hasOption(const char *opt) const; QVariant option(const char *opt) const; const std::map &options() const; const std::vector< std::shared_ptr > &inputs() const; const std::vector< std::shared_ptr > &messages() const; const std::vector< std::shared_ptr > &outputs() const; QStringList fileNames() const; unsigned int numFiles() const; void sendStatus(const char *keyword, const QString &text); void sendStatusEncoded(const char *keyword, const std::string &text); void sendData(const QByteArray &data, bool moreToCome = false); int inquire(const char *keyword, QObject *receiver, const char *slot, unsigned int maxSize = 0); void done(const GpgME::Error &err = GpgME::Error()); void done(const GpgME::Error &err, const QString &details); void done(int err) { done(GpgME::Error(err)); } void done(int err, const QString &details) { done(GpgME::Error(err), details); } private: virtual void doCanceled() = 0; virtual int doStart() = 0; private: void doApplyWindowID(QWidget *w) const; private: const std::map< QByteArray, std::shared_ptr > &mementos() const; private: friend class ::Kleo::AssuanCommandFactory; class Private; kdtools::pimpl_ptr d; }; class AssuanCommandFactory { public: virtual ~AssuanCommandFactory() {} virtual std::shared_ptr create() const = 0; virtual const char *name() const = 0; #ifndef HAVE_ASSUAN2 typedef int(*_Handler)(assuan_context_s *, char *); #else typedef gpg_error_t(*_Handler)(assuan_context_s *, char *); #endif virtual _Handler _handler() const = 0; #ifndef HAVE_ASSUAN2 static int _handle(assuan_context_s *, char *, const char *); #else static gpg_error_t _handle(assuan_context_s *, char *, const char *); #endif }; template class GenericAssuanCommandFactory : public AssuanCommandFactory { AssuanCommandFactory::_Handler _handler() const override { return &GenericAssuanCommandFactory::_handle; } #ifndef HAVE_ASSUAN2 static int _handle(assuan_context_s *_ctx, char *_line) { #else static gpg_error_t _handle(assuan_context_s *_ctx, char *_line) { #endif return AssuanCommandFactory::_handle(_ctx, _line, Command::staticName()); } std::shared_ptr create() const override { return make(); } const char *name() const override { return Command::staticName(); } public: static std::shared_ptr make() { return std::shared_ptr(new Command); } }; template class AssuanCommandMixin : public Base { protected: /* reimp */ const char *name() const override { return Derived::staticName(); } }; } -#endif /* __KLEOPATRA_UISERVER_ASSUANCOMMAND_H__ */ diff --git a/src/uiserver/assuanserverconnection.h b/src/uiserver/assuanserverconnection.h index 5f322a402..25770b041 100644 --- a/src/uiserver/assuanserverconnection.h +++ b/src/uiserver/assuanserverconnection.h @@ -1,51 +1,49 @@ /* -*- mode: c++; c-basic-offset:4 -*- uiserver/assuanserverconnection.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2007 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_UISERVER_ASSUANSERVERCONNECTION_H__ -#define __KLEOPATRA_UISERVER_ASSUANSERVERCONNECTION_H__ +#pragma once #include #include // for assuan_fd_t #include #include #include #include namespace Kleo { class AssuanCommandFactory; class AssuanServerConnection : public QObject { Q_OBJECT public: AssuanServerConnection(assuan_fd_t fd, const std::vector< std::shared_ptr > &factories, QObject *parent = nullptr); ~AssuanServerConnection(); public Q_SLOTS: void enableCryptoCommands(bool enable = true); Q_SIGNALS: void closed(Kleo::AssuanServerConnection *which); void startKeyManagerRequested(); void startConfigDialogRequested(); public: class Private; private: kdtools::pimpl_ptr d; }; } -#endif /* __KLEOPATRA_UISERVER_ASSUANSERVERCONNECTION_H__ */ diff --git a/src/uiserver/createchecksumscommand.h b/src/uiserver/createchecksumscommand.h index 945974626..e9d095bdf 100644 --- a/src/uiserver/createchecksumscommand.h +++ b/src/uiserver/createchecksumscommand.h @@ -1,50 +1,48 @@ /* -*- mode: c++; c-basic-offset:4 -*- uiserver/createchecksumscommand.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2010 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_UISERVER_CREATECHECKSUMSCOMMAND_H__ -#define __KLEOPATRA_UISERVER_CREATECHECKSUMSCOMMAND_H__ +#pragma once #include "assuancommand.h" #include #include namespace Kleo { class CreateChecksumsCommand : public QObject, public AssuanCommandMixin { Q_OBJECT public: CreateChecksumsCommand(); ~CreateChecksumsCommand() override; static const char *staticName() { return "CHECKSUM_CREATE_FILES"; } private: int doStart() override; void doCanceled() override; #ifdef Q_MOC_RUN private Q_SLOTS: void done(); void done(int, QString); #endif private: class Private; kdtools::pimpl_ptr d; }; } -#endif /* __KLEOPATRA_UISERVER_CREATECHECKSUMSCOMMAND_H__ */ diff --git a/src/uiserver/decryptcommand.h b/src/uiserver/decryptcommand.h index 21b122513..78c9b511c 100644 --- a/src/uiserver/decryptcommand.h +++ b/src/uiserver/decryptcommand.h @@ -1,42 +1,40 @@ /* -*- mode: c++; c-basic-offset:4 -*- uiserver/decryptemailcommand.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2007 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_UISERVER_DECRYPTCOMMAND_H__ -#define __KLEOPATRA_UISERVER_DECRYPTCOMMAND_H__ +#pragma once #include namespace Kleo { class DecryptCommand : public AssuanCommandMixin { public: //DecryptCommand(); //~DecryptCommand(); private: DecryptVerifyOperation operation() const override { if (hasOption("no-verify")) { return Decrypt; } else { return DecryptVerify; } } public: static const char *staticName() { return "DECRYPT"; } }; } -#endif // __KLEOPATRA_UISERVER_DECRYPTCOMMAND_H__ diff --git a/src/uiserver/decryptfilescommand.h b/src/uiserver/decryptfilescommand.h index c9427b5a1..9227e5234 100644 --- a/src/uiserver/decryptfilescommand.h +++ b/src/uiserver/decryptfilescommand.h @@ -1,38 +1,36 @@ /* -*- mode: c++; c-basic-offset:4 -*- uiserver/decryptemailcommand.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2007 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_UISERVER_DECRYPTFILESCOMMAND_H__ -#define __KLEOPATRA_UISERVER_DECRYPTFILESCOMMAND_H__ +#pragma once #include namespace Kleo { class DecryptFilesCommand : public AssuanCommandMixin { public: //DecryptFilesCommand(); //~DecryptFilesCommand(); private: DecryptVerifyOperation operation() const override { return Decrypt; } public: static const char *staticName() { return "DECRYPT_FILES"; } }; } -#endif // __KLEOPATRA_UISERVER_DECRYPTFILESCOMMAND_H__ diff --git a/src/uiserver/decryptverifycommandemailbase.h b/src/uiserver/decryptverifycommandemailbase.h index 1ed9023ff..9a098cd64 100644 --- a/src/uiserver/decryptverifycommandemailbase.h +++ b/src/uiserver/decryptverifycommandemailbase.h @@ -1,66 +1,64 @@ /* -*- mode: c++; c-basic-offset:4 -*- uiserver/decryptverifycommand.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2008 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_UISERVER_DECRYPTVERIFYCOMMANDEMAILBASE_H__ -#define __KLEOPATRA_UISERVER_DECRYPTVERIFYCOMMANDEMAILBASE_H__ +#pragma once #include "assuancommand.h" #include #include namespace Kleo { class DecryptVerifyCommandEMailBase : public AssuanCommandMixin { public: explicit DecryptVerifyCommandEMailBase(); ~DecryptVerifyCommandEMailBase() override; private: virtual DecryptVerifyOperation operation() const = 0; virtual Mode mode() const { return EMail; } private: int doStart() override; void doCanceled() override; public: static const char *staticName() { return ""; } class Private; private: kdtools::pimpl_ptr d; }; class DecryptVerifyCommand : public AssuanCommandMixin { public: private: DecryptVerifyOperation operation() const override { return DecryptVerify; } public: static const char *staticName() { return "DECRYPT_VERIFY"; } }; } -#endif // __KLEOPATRA_UISERVER_DECRYPTCOMMAND_H__ diff --git a/src/uiserver/decryptverifycommandfilesbase.h b/src/uiserver/decryptverifycommandfilesbase.h index 934273b24..6d5d9235e 100644 --- a/src/uiserver/decryptverifycommandfilesbase.h +++ b/src/uiserver/decryptverifycommandfilesbase.h @@ -1,60 +1,58 @@ /* -*- mode: c++; c-basic-offset:4 -*- uiserver/decryptverifycommandfilesbase.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2008 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_UISERVER_DECRYPTVERIFYCOMMANDFILESBASE_H__ -#define __KLEOPATRA_UISERVER_DECRYPTVERIFYCOMMANDFILESBASE_H__ +#pragma once #include "assuancommand.h" #include #include namespace Kleo { class DecryptVerifyCommandFilesBase : public AssuanCommandMixin { public: enum Flags { DecryptOff = 0x0, DecryptOn = 0x1, DecryptImplied = 0x2, DecryptMask = 0x3, VerifyOff = 0x00, //VerifyOn = 0x10, // non-sensical VerifyImplied = 0x20, VerifyMask = 0x30 }; explicit DecryptVerifyCommandFilesBase(); ~DecryptVerifyCommandFilesBase() override; private: virtual DecryptVerifyOperation operation() const = 0; private: int doStart() override; void doCanceled() override; public: // ### FIXME fix this static const char *staticName() { return ""; } class Private; private: kdtools::pimpl_ptr d; }; } -#endif // __KLEOPATRA_UISERVER_DECRYPTCOMMAND_H__ diff --git a/src/uiserver/decryptverifyfilescommand.h b/src/uiserver/decryptverifyfilescommand.h index f932a99fb..47be9cebd 100644 --- a/src/uiserver/decryptverifyfilescommand.h +++ b/src/uiserver/decryptverifyfilescommand.h @@ -1,38 +1,36 @@ /* -*- mode: c++; c-basic-offset:4 -*- uiserver/decryptemailcommand.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2007 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_UISERVER_DECRYPTVERIFYFILESCOMMAND_H__ -#define __KLEOPATRA_UISERVER_DECRYPTVERIFYFILESCOMMAND_H__ +#pragma once #include namespace Kleo { class DecryptVerifyFilesCommand : public AssuanCommandMixin { public: //DecryptVerifyFilesCommand(); //~DecryptVerifyFilesCommand(); private: DecryptVerifyOperation operation() const override { return DecryptVerify; } public: static const char *staticName() { return "DECRYPT_VERIFY_FILES"; } }; } -#endif // __KLEOPATRA_UISERVER_DECRYPTVERIFYFILESCOMMAND_H__ diff --git a/src/uiserver/echocommand.h b/src/uiserver/echocommand.h index f104a78f3..0f42a9b3b 100644 --- a/src/uiserver/echocommand.h +++ b/src/uiserver/echocommand.h @@ -1,69 +1,67 @@ /* -*- mode: c++; c-basic-offset:4 -*- uiserver/echocommand.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2007 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_UISERVER_ECHOCOMMAND_H__ -#define __KLEOPATRA_UISERVER_ECHOCOMMAND_H__ +#pragma once #include "assuancommand.h" #include namespace Kleo { /*! \brief GnuPG UI Server command for testing

Usage

\code ECHO [--inquire ] [--nohup] \endcode

Description

The ECHO command is a simple tool for testing. If a bulk input channel has been set up by the client, ECHO will read data from it, and pipe it right back into the bulk output channel. It is an error for an input channel to exist without an output channel. ECHO will also send back any non-option command line arguments in a status message. If the --inquire command line option has been given, ECHO will inquire with that keyword, and send the received data back on the status channel. */ class EchoCommand : public QObject, public AssuanCommandMixin { Q_OBJECT public: EchoCommand(); ~EchoCommand() override; static const char *staticName() { return "ECHO"; } private: int doStart() override; void doCanceled() override; private Q_SLOTS: void slotInquireData(int, const QByteArray &); void slotInputReadyRead(); void slotOutputBytesWritten(); private: class Private; kdtools::pimpl_ptr d; }; } -#endif /* __KLEOPATRA_UISERVER_ECHOCOMMAND_H__ */ diff --git a/src/uiserver/encryptcommand.h b/src/uiserver/encryptcommand.h index a32b3277a..147482302 100644 --- a/src/uiserver/encryptcommand.h +++ b/src/uiserver/encryptcommand.h @@ -1,41 +1,39 @@ /* -*- mode: c++; c-basic-offset:4 -*- uiserver/encryptcommand.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2007 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEO_UISERVER_ENCRYPTCOMMAND_H__ -#define __KLEO_UISERVER_ENCRYPTCOMMAND_H__ +#pragma once #include "assuancommand.h" #include namespace Kleo { class EncryptCommand : public Kleo::AssuanCommandMixin { public: EncryptCommand(); ~EncryptCommand() override; private: int doStart() override; void doCanceled() override; public: static const char *staticName() { return "ENCRYPT"; } class Private; private: kdtools::pimpl_ptr d; }; } -#endif /*__KLEO_UISERVER_ENCRYPTCOMMAND_H__*/ diff --git a/src/uiserver/importfilescommand.h b/src/uiserver/importfilescommand.h index 777ea9c23..31233a821 100644 --- a/src/uiserver/importfilescommand.h +++ b/src/uiserver/importfilescommand.h @@ -1,44 +1,42 @@ /* -*- mode: c++; c-basic-offset:4 -*- uiserver/importfilescommand.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2008 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_UISERVER_IMPORTFILESCOMMAND_H__ -#define __KLEOPATRA_UISERVER_IMPORTFILESCOMMAND_H__ +#pragma once #include "assuancommand.h" #include namespace Kleo { class ImportFilesCommand : public QObject, public AssuanCommandMixin { Q_OBJECT public: ImportFilesCommand(); ~ImportFilesCommand() override; static const char *staticName() { return "IMPORT_FILES"; } private: int doStart() override; void doCanceled() override; private: class Private; kdtools::pimpl_ptr d; Q_PRIVATE_SLOT(d, void slotCommandFinished()) Q_PRIVATE_SLOT(d, void slotCommandCanceled()) }; } -#endif /* __KLEOPATRA_UISERVER_IMPORTFILESCOMMAND_H__ */ diff --git a/src/uiserver/prepencryptcommand.h b/src/uiserver/prepencryptcommand.h index 864b9c24a..873af7ab7 100644 --- a/src/uiserver/prepencryptcommand.h +++ b/src/uiserver/prepencryptcommand.h @@ -1,41 +1,39 @@ /* -*- mode: c++; c-basic-offset:4 -*- uiserver/prepencryptcommand.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2007 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEO_UISERVER_PREPENCRYPTCOMMAND_H__ -#define __KLEO_UISERVER_PREPENCRYPTCOMMAND_H__ +#pragma once #include "assuancommand.h" #include namespace Kleo { class PrepEncryptCommand : public Kleo::AssuanCommandMixin { public: PrepEncryptCommand(); ~PrepEncryptCommand() override; private: int doStart() override; void doCanceled() override; public: static const char *staticName() { return "PREP_ENCRYPT"; } class Private; private: kdtools::pimpl_ptr d; }; } -#endif /*__KLEO_UISERVER_PREPENCRYPTCOMMAND_H__*/ diff --git a/src/uiserver/prepsigncommand.h b/src/uiserver/prepsigncommand.h index fae41b19a..b040416c6 100644 --- a/src/uiserver/prepsigncommand.h +++ b/src/uiserver/prepsigncommand.h @@ -1,41 +1,39 @@ /* -*- mode: c++; c-basic-offset:4 -*- uiserver/prepsigncommand.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2010 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEO_UISERVER_PREPSIGNCOMMAND_H__ -#define __KLEO_UISERVER_PREPSIGNCOMMAND_H__ +#pragma once #include "assuancommand.h" #include namespace Kleo { class PrepSignCommand : public Kleo::AssuanCommandMixin { public: PrepSignCommand(); virtual ~PrepSignCommand(); private: int doStart() override; void doCanceled() override; public: static const char *staticName() { return "PREP_SIGN"; } class Private; private: kdtools::pimpl_ptr d; }; } -#endif /*__KLEO_UISERVER_PREPSIGNCOMMAND_H__*/ diff --git a/src/uiserver/selectcertificatecommand.h b/src/uiserver/selectcertificatecommand.h index ec2dac6ef..25e335791 100644 --- a/src/uiserver/selectcertificatecommand.h +++ b/src/uiserver/selectcertificatecommand.h @@ -1,45 +1,43 @@ /* -*- mode: c++; c-basic-offset:4 -*- uiserver/selectcertificatecommand.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2007 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_UISERVER_SELECTCERTIFICATECOMMAND_H__ -#define __KLEOPATRA_UISERVER_SELECTCERTIFICATECOMMAND_H__ +#pragma once #include "assuancommand.h" #include namespace Kleo { class SelectCertificateCommand : public QObject, public AssuanCommandMixin { Q_OBJECT public: SelectCertificateCommand(); ~SelectCertificateCommand() override; static const char *staticName() { return "SELECT_CERTIFICATE"; } private: int doStart() override; void doCanceled() override; private: class Private; kdtools::pimpl_ptr d; Q_PRIVATE_SLOT(d, void slotSelectedCertificates(int, QByteArray)) Q_PRIVATE_SLOT(d, void slotDialogAccepted()) Q_PRIVATE_SLOT(d, void slotDialogRejected()) }; } -#endif /* __KLEOPATRA_UISERVER_SELECTCERTIFICATECOMMAND_H__ */ diff --git a/src/uiserver/sessiondata.h b/src/uiserver/sessiondata.h index 0b13fdecd..509870895 100644 --- a/src/uiserver/sessiondata.h +++ b/src/uiserver/sessiondata.h @@ -1,68 +1,66 @@ /* -*- mode: c++; c-basic-offset:4 -*- uiserver/sessiondata.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2009 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_UISERVER_SESSIONDATA_H__ -#define __KLEOPATRA_UISERVER_SESSIONDATA_H__ +#pragma once #include #include "assuancommand.h" #include #include #include namespace Kleo { class SessionDataHandler; class SessionData { public: std::map< QByteArray, std::shared_ptr > mementos; private: friend class ::Kleo::SessionDataHandler; SessionData(); int ref; bool ripe; }; class SessionDataHandler : public QObject { Q_OBJECT public: static std::shared_ptr instance(); void enterSession(unsigned int id); void exitSession(unsigned int id); std::shared_ptr sessionData(unsigned int) const; void clear(); private Q_SLOTS: void slotCollectGarbage(); private: mutable std::map< unsigned int, std::shared_ptr > data; QTimer timer; private: std::shared_ptr sessionDataInternal(unsigned int) const; SessionDataHandler(); }; } -#endif /* __KLEOPATRA_UISERVER_SESSIONDATA_H__ */ diff --git a/src/uiserver/signcommand.h b/src/uiserver/signcommand.h index 97a0bfa56..6c7ea0db5 100644 --- a/src/uiserver/signcommand.h +++ b/src/uiserver/signcommand.h @@ -1,42 +1,40 @@ /* -*- mode: c++; c-basic-offset:4 -*- uiserver/signcommand.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2007 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEO_UISERVER_SIGNCOMMAND_H__ -#define __KLEO_UISERVER_SIGNCOMMAND_H__ +#pragma once #include "assuancommand.h" #include namespace Kleo { class SignCommand : public Kleo::AssuanCommandMixin { public: SignCommand(); ~SignCommand() override; private: int doStart() override; void doCanceled() override; public: static const char *staticName() { return "SIGN"; } class Private; private: kdtools::pimpl_ptr d; }; } -#endif /*__KLEO_UISERVER_SIGNCOMMAND_H__*/ diff --git a/src/uiserver/signencryptfilescommand.h b/src/uiserver/signencryptfilescommand.h index bfdf29f90..76ad6dcba 100644 --- a/src/uiserver/signencryptfilescommand.h +++ b/src/uiserver/signencryptfilescommand.h @@ -1,97 +1,95 @@ /* -*- mode: c++; c-basic-offset:4 -*- uiserver/signencryptfilescommand.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2007 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEO_UISERVER_SIGNENCRYPTFILESCOMMAND_H__ -#define __KLEO_UISERVER_SIGNENCRYPTFILESCOMMAND_H__ +#pragma once #include "assuancommand.h" #include namespace Kleo { class SignEncryptFilesCommand : public Kleo::AssuanCommandMixin { public: SignEncryptFilesCommand(); virtual ~SignEncryptFilesCommand(); protected: enum Operation { SignDisallowed = 0, SignAllowed = 1, SignSelected = 2, SignMask = SignAllowed | SignSelected, EncryptDisallowed = 0, EncryptAllowed = 4, EncryptSelected = 8, EncryptMask = EncryptAllowed | EncryptSelected }; private: virtual unsigned int operation() const { return SignSelected | EncryptSelected; } private: int doStart() override; void doCanceled() override; public: static const char *staticName() { return "SIGN_ENCRYPT_FILES"; } class Private; private: kdtools::pimpl_ptr d; }; class EncryptSignFilesCommand : public Kleo::AssuanCommandMixin { public: static const char *staticName() { return "ENCRYPT_SIGN_FILES"; } }; class EncryptFilesCommand : public Kleo::AssuanCommandMixin { public: static const char *staticName() { return "ENCRYPT_FILES"; } unsigned int operation() const override { return SignAllowed | EncryptSelected; } }; class SignFilesCommand : public Kleo::AssuanCommandMixin { public: static const char *staticName() { return "SIGN_FILES"; } unsigned int operation() const override { return SignSelected | EncryptAllowed; } }; } -#endif /*__KLEO_UISERVER_SIGNENCRYPTFILESCOMMAND_H__*/ diff --git a/src/uiserver/uiserver.h b/src/uiserver/uiserver.h index db57852a9..72e48c587 100644 --- a/src/uiserver/uiserver.h +++ b/src/uiserver/uiserver.h @@ -1,62 +1,60 @@ /* -*- mode: c++; c-basic-offset:4 -*- uiserver/uiserver.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2007 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_UISERVER_UISERVER_H__ -#define __KLEOPATRA_UISERVER_UISERVER_H__ +#pragma once #include #include #include #include class QString; namespace Kleo { class AssuanCommandFactory; class UiServer : public QObject { Q_OBJECT public: explicit UiServer(const QString &socket, QObject *parent = nullptr); ~UiServer(); static void setLogStream(FILE *file); bool registerCommandFactory(const std::shared_ptr &cmdFactory); bool waitForStopped(unsigned int ms = 0xFFFFFFFF); bool isStopped() const; bool isStopping() const; QString socketName() const; public Q_SLOTS: void start(); void stop(); void enableCryptoCommands(bool enable = true); Q_SIGNALS: void stopped(); void startKeyManagerRequested(); void startConfigDialogRequested(); private: class Private; kdtools::pimpl_ptr d; }; } -#endif /* __KLEOPATRA_UISERVER_UISERVER_H__ */ diff --git a/src/uiserver/uiserver_p.h b/src/uiserver/uiserver_p.h index 9be3fe91c..4dfd61618 100644 --- a/src/uiserver/uiserver_p.h +++ b/src/uiserver/uiserver_p.h @@ -1,76 +1,74 @@ /* -*- mode: c++; c-basic-offset:4 -*- uiserver/uiserver_p.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2007 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_UISERVER_UISERVER_P_H__ -#define __KLEOPATRA_UISERVER_UISERVER_P_H__ +#pragma once #include "uiserver.h" #include "assuanserverconnection.h" #include "assuancommand.h" #include #include #include #include #include #include #include namespace { template void throw_(const QString &message) { throw Ex(message.toUtf8().constData()); } } namespace Kleo { class UiServer::Private : public QTcpServer { Q_OBJECT friend class ::Kleo::UiServer; UiServer *const q; public: explicit Private(UiServer *qq); static bool isStaleAssuanSocket(const QString &socketName); private: void makeListeningSocket(); // platform-specific creation impl for makeListeningSocket(): void doMakeListeningSocket(const QByteArray &encodedFileName); QString makeFileName(const QString &hint = QString()) const; void ensureDirectoryExists(const QString &path) const; static QString systemErrorString(); protected: void incomingConnection(qintptr fd) override; private Q_SLOTS: void slotConnectionClosed(Kleo::AssuanServerConnection *conn); private: QFile file; std::vector< std::shared_ptr > factories; std::vector< std::shared_ptr > connections; QString suggestedSocketName; QString actualSocketName; assuan_sock_nonce_t nonce; const WSAStarter _wsastarter; bool cryptoCommandsEnabled; }; } -#endif /* __KLEOPATRA_UISERVER_UISERVER_P_H__ */ diff --git a/src/uiserver/verifychecksumscommand.h b/src/uiserver/verifychecksumscommand.h index acddf6e79..d0d91e254 100644 --- a/src/uiserver/verifychecksumscommand.h +++ b/src/uiserver/verifychecksumscommand.h @@ -1,55 +1,53 @@ /* -*- mode: c++; c-basic-offset:4 -*- uiserver/verifychecksumscommand.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2010 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_UISERVER_VERIFYCHECKSUMSCOMMAND_H__ -#define __KLEOPATRA_UISERVER_VERIFYCHECKSUMSCOMMAND_H__ +#pragma once #include "assuancommand.h" #ifndef QT_NO_DIRMODEL #include namespace Kleo { class VerifyChecksumsCommand : public QObject, public AssuanCommandMixin { Q_OBJECT public: VerifyChecksumsCommand(); ~VerifyChecksumsCommand(); static const char *staticName() { return "CHECKSUM_VERIFY_FILES"; } private: int doStart() override; void doCanceled() override; #ifdef Q_MOC_RUN private Q_SLOTS: void done(); void done(int, QString); #endif private: class Private; kdtools::pimpl_ptr d; //Q_PRIVATE_SLOT( this, void done() ) //Q_PRIVATE_SLOT( this, void done(int,QString) ) }; } #endif // QT_NO_DIRMODEL -#endif /* __KLEOPATRA_UISERVER_VERIFYCHECKSUMSCOMMAND_H__ */ diff --git a/src/uiserver/verifycommand.h b/src/uiserver/verifycommand.h index c965b6888..d90c8078f 100644 --- a/src/uiserver/verifycommand.h +++ b/src/uiserver/verifycommand.h @@ -1,43 +1,41 @@ /* -*- mode: c++; c-basic-offset:4 -*- uiserver/verifycommand.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2007 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_UISERVER_VERIFYCOMMAND_H__ -#define __KLEOPATRA_UISERVER_VERIFYCOMMAND_H__ +#pragma once #include "assuancommand.h" #include namespace Kleo { class VerifyCommand : public AssuanCommandMixin { public: //VerifyCommand(); //~VerifyCommand(); private: DecryptVerifyOperation operation() const override { return Verify; } Mode mode() const override { return EMail; } public: static const char *staticName() { return "VERIFY"; } }; } -#endif // __KLEOPATRA_UISERVER_VERIFYCOMMAND_H__ diff --git a/src/uiserver/verifyfilescommand.h b/src/uiserver/verifyfilescommand.h index 811750c58..61437ca7e 100644 --- a/src/uiserver/verifyfilescommand.h +++ b/src/uiserver/verifyfilescommand.h @@ -1,39 +1,37 @@ /* -*- mode: c++; c-basic-offset:4 -*- uiserver/verifyfilescommand.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2007 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_UISERVER_VERIFYFILESCOMMAND_H__ -#define __KLEOPATRA_UISERVER_VERIFYFILESCOMMAND_H__ +#pragma once #include namespace Kleo { class VerifyFilesCommand : public AssuanCommandMixin { public: //VerifyFilesCommand(); //~VerifyFilesCommand(); private: DecryptVerifyOperation operation() const override { return Verify; } public: static const char *staticName() { return "VERIFY_FILES"; } }; } -#endif // __KLEOPATRA_UISERVER_VERIFYFILESCOMMAND_H__ diff --git a/src/utils/action_data.h b/src/utils/action_data.h index 5706b1c65..9a5c0e787 100644 --- a/src/utils/action_data.h +++ b/src/utils/action_data.h @@ -1,46 +1,44 @@ /* -*- mode: c++; c-basic-offset:4 -*- utils/action_data.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2007 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_UTILS_ACTIONDATA_H__ -#define __KLEOPATRA_UTILS_ACTIONDATA_H__ +#pragma once #include class QObject; class QAction; class KActionCollection; namespace Kleo { struct action_data { const char *name; QString text; QString tooltip; const char *icon; const QObject *receiver; const char *slot; QString shortcut; bool toggle; bool enabled; }; void make_actions_from_data(const action_data *data, unsigned int numData, KActionCollection *collection); template inline void make_actions_from_data(const action_data(&data)[N], KActionCollection *collection) { make_actions_from_data(data, N, collection); } QAction *make_action_from_data(const action_data &ad, KActionCollection *coll); QAction *createAction(const action_data &ad, KActionCollection *coll); } -#endif /* __KLEOPATRA_UTILS_ACTIONDATA_H__ */ diff --git a/src/utils/archivedefinition.h b/src/utils/archivedefinition.h index 6cf0b45d7..2497c0410 100644 --- a/src/utils/archivedefinition.h +++ b/src/utils/archivedefinition.h @@ -1,111 +1,109 @@ /* -*- mode: c++; c-basic-offset:4 -*- utils/archivedefinition.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2009 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_UTILS_ARCHIVEDEFINITION_H__ -#define __KLEOPATRA_UTILS_ARCHIVEDEFINITION_H__ +#pragma once #include #include #include #include // GpgME::Protocol #include #include class QDir; namespace Kleo { class Input; class Output; } namespace Kleo { class ArchiveDefinition { protected: ArchiveDefinition(const QString &id, const QString &label); public: virtual ~ArchiveDefinition(); enum ArgumentPassingMethod { CommandLine, NewlineSeparatedInputFile, NullSeparatedInputFile, NumArgumentPassingMethods }; QString id() const { return m_id; } QString label() const { return m_label; } const QStringList &extensions(GpgME::Protocol p) const { checkProtocol(p); return m_extensions[p]; } std::shared_ptr createInputFromPackCommand(GpgME::Protocol p, const QStringList &files) const; ArgumentPassingMethod packCommandArgumentPassingMethod(GpgME::Protocol p) const { checkProtocol(p); return m_packCommandMethod[p]; } std::shared_ptr createOutputFromUnpackCommand(GpgME::Protocol p, const QString &file, const QDir &wd) const; // unpack-command must use CommandLine ArgumentPassingMethod static QString installPath(); static void setInstallPath(const QString &ip); static std::vector< std::shared_ptr > getArchiveDefinitions(); static std::vector< std::shared_ptr > getArchiveDefinitions(QStringList &errors); protected: void setPackCommandArgumentPassingMethod(GpgME::Protocol p, ArgumentPassingMethod method) { checkProtocol(p); m_packCommandMethod[p] = method; } void setExtensions(GpgME::Protocol p, const QStringList &extensions) { checkProtocol(p); m_extensions[p] = extensions; } void checkProtocol(GpgME::Protocol p) const; private: virtual QString doGetPackCommand(GpgME::Protocol p) const = 0; virtual QString doGetUnpackCommand(GpgME::Protocol p) const = 0; virtual QStringList doGetPackArguments(GpgME::Protocol p, const QStringList &files) const = 0; virtual QStringList doGetUnpackArguments(GpgME::Protocol p, const QString &file) const = 0; private: const QString m_id; const QString m_label; /*const*/ QStringList m_extensions[2]; ArgumentPassingMethod m_packCommandMethod[2]; // m_unpackCommandMethod[2] <- must always be CommandLine }; } Q_DECLARE_METATYPE(std::shared_ptr) -#endif /* __KLEOPATRA_UTILS_ARCHIVEDEFINITION_H__ */ diff --git a/src/utils/auditlog.h b/src/utils/auditlog.h index 96ddd7d03..855da3540 100644 --- a/src/utils/auditlog.h +++ b/src/utils/auditlog.h @@ -1,56 +1,54 @@ /* -*- mode: c++; c-basic-offset:4 -*- utils/auditlog.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2008 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_UTILS_AUDITLOG_H__ -#define __KLEOPATRA_UTILS_AUDITLOG_H__ +#pragma once #include #include #include class QUrl; namespace QGpgME { class Job; } namespace Kleo { class AuditLog { public: AuditLog() : m_text(), m_error() {} explicit AuditLog(const GpgME::Error &error) : m_text(), m_error(error) {} AuditLog(const QString &text, const GpgME::Error &error) : m_text(text), m_error(error) {} static AuditLog fromJob(const QGpgME::Job *); GpgME::Error error() const { return m_error; } QString text() const { return m_text; } QString formatLink(const QUrl &urlTemplate, const QString &caption = QString()) const; private: QString m_text; GpgME::Error m_error; }; } -#endif /* __KLEOPATRA_UTILS_HEX_H__ */ diff --git a/src/utils/cached.h b/src/utils/cached.h index a4e97bb1d..f76ade8c1 100644 --- a/src/utils/cached.h +++ b/src/utils/cached.h @@ -1,60 +1,58 @@ /* -*- mode: c++; c-basic-offset:4 -*- utils/cached.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2009 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_UTILS_CACHED_H__ -#define __KLEOPATRA_UTILS_CACHED_H__ +#pragma once #include namespace Kleo { template class cached { T m_value; bool m_dirty; using CallType = const typename std::conditional::value, T, T&>::type; public: cached() : m_value(), m_dirty(true) {} /* implicit */ cached(const CallType value) : m_value(value), m_dirty(false) {} operator T() const { return m_value; } cached &operator=(T value) { m_value = value; m_dirty = false; return *this; } bool dirty() const { return m_dirty; } T value() const { return m_value; } void set_dirty() { m_dirty = true; } }; } -#endif /* __KLEOPATRA_UTILS_CACHED_H__ */ diff --git a/src/utils/checker.h b/src/utils/checker.h index dbb6fc909..76f840e75 100644 --- a/src/utils/checker.h +++ b/src/utils/checker.h @@ -1,124 +1,122 @@ /**************************************************************************** ** SPDX-FileCopyrightText: 2001-2007 Klarälvdalens Datakonsult AB. All rights reserved. ** ** This file is part of the KD Tools library. ** ** SPDX-License-Identifier: GPL-2.0-only ** **********************************************************************/ -#ifndef __KDABTOOLS__CPP__CHECKER_H__ -#define __KDABTOOLS__CPP__CHECKER_H__ +#pragma once #include "kdtoolsglobal.h" #include /** Usage: \code class Foo ... { KDAB_MAKE_CHECKABLE( Foo ) public: // ... }; Foo::Foo() { KDAB_CHECK_CTOR; // ... } Foo::~Foo() { KDAB_CHECK_DTOR; // ... } KDAB_DEFINE_CHECKS( Foo ) { Q_ASSERT( something ); Q_ASSERT( another thing ); } void Foo::setBar( int bar ) { KDAB_CHECK_THIS; // include as first line in every method // ... } int Foo::bar() const { KDAB_CHECK_THIS; // ... } \endcode */ class __KDAB__CheckerImplBase { public: virtual ~__KDAB__CheckerImplBase() {} virtual void checkInvariants() const = 0; }; template class __KDAB__CheckerImpl : public __KDAB__CheckerImplBase { KDAB_DISABLE_COPY(__KDAB__CheckerImpl); const T_Class *const p; public: __KDAB__CheckerImpl(const T_Class *t) : __KDAB__CheckerImplBase(), p(t) {} void checkInvariants() const { try { p->__KDAB_Checker__checkInvariants__(); } catch (...) { std::abort(); } } }; template class __KDAB__Checker { KDAB_DISABLE_COPY(__KDAB__Checker); const __KDAB__CheckerImplBase *const checker; public: template __KDAB__Checker(const T_Class *t) : checker(new __KDAB__CheckerImpl(t)) { if (check_in_ctor) { checker->checkInvariants(); } } ~__KDAB__Checker() { if (check_in_dtor) { checker->checkInvariants(); } delete checker; } }; #define KDAB_MAKE_CHECKABLE( Class ) \ private: \ void __KDAB_Checker__checkInvariants__() const; \ friend class __KDAB__CheckerImpl; #define KDAB_DEFINE_CHECKS( Class ) \ void Class::__KDAB_Checker__checkInvariants__() const #ifndef NDEBUG # define __KDAB_CHECK_HELPER__( ctor, dtor ) \ const __KDAB__Checker __checker_uglified__( this ) #else # define __KDAB_CHECK_HELPER__( ctor, dtor ) \ do {} while (0) #endif #define KDAB_CHECK_THIS __KDAB_CHECK_HELPER__( true, true ) #define KDAB_CHECK_CTOR __KDAB_CHECK_HELPER__( false, true ) #define KDAB_CHECK_DTOR __KDAB_CHECK_HELPER__( true, false ) -#endif /* __KDABTOOLS__CPP__CHECKER_H__ */ diff --git a/src/utils/clipboardmenu.h b/src/utils/clipboardmenu.h index bd40bdf49..30f7668fc 100644 --- a/src/utils/clipboardmenu.h +++ b/src/utils/clipboardmenu.h @@ -1,49 +1,47 @@ /* SPDX-FileCopyrightText: 2014-2021 Laurent Montel SPDX-License-Identifier: GPL-2.0-only */ -#ifndef CLIPBOARDMENU_H -#define CLIPBOARDMENU_H +#pragma once #include class KActionMenu; class QAction; class MainWindow; namespace Kleo { class Command; } class ClipboardMenu : public QObject { Q_OBJECT public: explicit ClipboardMenu(QObject *parent = nullptr); ~ClipboardMenu(); void setMainWindow(MainWindow *window); KActionMenu *clipboardMenu() const; private Q_SLOTS: void slotImportClipboard(); void slotEncryptClipboard(); void slotOpenPGPSignClipboard(); void slotSMIMESignClipboard(); void slotDecryptVerifyClipboard(); void slotEnableDisableActions(); private: void startCommand(Kleo::Command *cmd); KActionMenu *mClipboardMenu; QAction *mImportClipboardAction; QAction *mEncryptClipboardAction; QAction *mSmimeSignClipboardAction; QAction *mOpenPGPSignClipboardAction; QAction *mDecryptVerifyClipboardAction; MainWindow *mWindow; }; -#endif // CLIPBOARDMENU_H diff --git a/src/utils/detail_p.h b/src/utils/detail_p.h index 2343e2ec2..8bf4ddf74 100644 --- a/src/utils/detail_p.h +++ b/src/utils/detail_p.h @@ -1,90 +1,88 @@ /* -*- mode: c++; c-basic-offset:4 -*- utils/detail_p.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2007 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __KLEOPATRA_UTILS_DETAIL_P_H__ -#define __KLEOPATRA_UTILS_DETAIL_P_H__ +#pragma once #include #ifdef _WIN32 #include #endif namespace Kleo { namespace _detail { template