Page Menu
Home
GnuPG
Search
Configure Global Search
Log In
Files
F34606614
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Size
43 KB
Subscribers
None
View Options
diff --git a/src/commands/command.h b/src/commands/command.h
index 89b088e53..6ee0785f7 100644
--- a/src/commands/command.h
+++ b/src/commands/command.h
@@ -1,139 +1,137 @@
/*
This file is part of Kleopatra, the KDE keymanager
SPDX-FileCopyrightText: 2007 Klarälvdalens Datakonsult AB
SPDX-License-Identifier: GPL-2.0-or-later
*/
#pragma once
#include <QObject>
#include <qwindowdefs.h> // for WId
#include <utils/types.h> // for ExecutionContext
#include <memory>
#include <vector>
-class QModelIndex;
template<typename T>
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<GpgME::Key> &keys);
~Command() override;
enum Restriction {
// clang-format off
NoRestriction = 0x0000,
NeedSelection = 0x0001,
OnlyOneKey = 0x0002,
NeedSecretKey = 0x0004, //< command performs secret key operations
NeedSecretPrimaryKeyData = 0x0008, //< command needs access to the secret key data of the primary key
NeedSecretSubkeyData = 0x0010, //< command needs access to the secret key data of one or more subkeys
// esoteric:
MayOnlyBeSecretKeyIfOwnerTrustIsNotYetUltimate = 0x0040, // for set-owner-trust
AnyCardHasNullPin = 0x0080,
SuitableForCard = 0x0100,
MustBeRoot = 0x0200,
MustBeTrustedRoot = 0x0400 | MustBeRoot,
MustBeUntrustedRoot = 0x0800 | MustBeRoot,
MustBeValid = 0x1000, //< key is neither revoked nor expired nor otherwise "bad"
MustBeOpenPGP = 0x2000,
MustBeCMS = 0x4000,
_AllRestrictions_Helper,
AllRestrictions = 2 * (_AllRestrictions_Helper - 1) - 1,
// clang-format on
};
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 QList<Command *> commandsForFiles(const QStringList &files, KeyListController *controller);
/** 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);
// Prefer Command::setParentWidget over Command::setParentWId; QWidget::winId can cause unexpected problems
// when called on non-toplevel widgets
void setParentWId(WId wid);
void setView(QAbstractItemView *view);
void setKey(const GpgME::Key &key);
void setKeys(const std::vector<GpgME::Key> &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(int current, int total);
void finished(QPrivateSignal);
void canceled(QPrivateSignal);
private:
virtual void doStart() = 0;
virtual void doCancel() = 0;
private:
void applyWindowID(QWidget *wid) const override;
protected:
class Private;
const std::unique_ptr<Private> d;
protected:
explicit Command(Private *pp);
explicit Command(QAbstractItemView *view, Private *pp);
explicit Command(const std::vector<GpgME::Key> &keys, Private *pp);
explicit Command(const GpgME::Key &key, Private *pp);
};
Q_DECLARE_OPERATORS_FOR_FLAGS(Command::Restrictions)
}
diff --git a/src/commands/exportpaperkeycommand.h b/src/commands/exportpaperkeycommand.h
index 55a767173..5117c2918 100644
--- a/src/commands/exportpaperkeycommand.h
+++ b/src/commands/exportpaperkeycommand.h
@@ -1,47 +1,45 @@
/*
This file is part of Kleopatra, the KDE keymanager
SPDX-FileCopyrightText: 2016 Bundesamt für Sicherheit in der Informationstechnik
SPDX-FileContributor: Intevation GmbH
SPDX-License-Identifier: GPL-2.0-or-later
*/
#pragma once
#include <commands/command.h>
#include <QProcess>
#include <QString>
-class QWidget;
-
namespace Kleo
{
namespace Commands
{
class ExportPaperKeyCommand : public Command
{
Q_OBJECT
public:
explicit ExportPaperKeyCommand(QAbstractItemView *view, KeyListController *parent);
explicit ExportPaperKeyCommand(const GpgME::Key &key);
static Restrictions restrictions()
{
return OnlyOneKey | NeedSecretPrimaryKeyData | MustBeOpenPGP;
}
bool success() const;
private:
class Private;
inline Private *d_func();
inline const Private *d_func() const;
void doStart() override;
void doCancel() override;
};
}
}
diff --git a/src/conf/cryptooperationsconfigwidget.h b/src/conf/cryptooperationsconfigwidget.h
index d552356d1..8e3405622 100644
--- a/src/conf/cryptooperationsconfigwidget.h
+++ b/src/conf/cryptooperationsconfigwidget.h
@@ -1,60 +1,59 @@
/*
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
*/
#pragma once
#include "labelledwidget.h"
#include <QWidget>
class QCheckBox;
class QComboBox;
-class QBoxLayout;
class QPushButton;
namespace Kleo
{
class Settings;
class ClassifyConfig;
namespace Config
{
class CryptoOperationsConfigWidget : public QWidget
{
Q_OBJECT
public:
explicit CryptoOperationsConfigWidget(QWidget *parent = nullptr, Qt::WindowFlags f = {});
~CryptoOperationsConfigWidget() override;
void load();
void save();
void defaults();
Q_SIGNALS:
void changed();
private:
void setupGui();
void load(const Kleo::Settings &settings, const Kleo::ClassifyConfig &classifyConfig);
private:
QCheckBox *mPGPFileExtCB = nullptr;
QCheckBox *mTreatP7mEmailCB = nullptr;
QCheckBox *mAutoExtractArchivesCB = nullptr;
QCheckBox *mASCIIArmorCB = nullptr;
QCheckBox *mTmpDirCB = nullptr;
QCheckBox *mSymmetricOnlyCB = nullptr;
QCheckBox *mPublicKeyOnlyCB = nullptr;
Kleo::LabelledWidget<QComboBox> mChecksumDefinitionCB;
Kleo::LabelledWidget<QComboBox> mArchiveDefinitionCB;
QPushButton *mApplyBtn = nullptr;
};
}
}
diff --git a/src/crypto/decryptverifytask.h b/src/crypto/decryptverifytask.h
index b492ae4ec..ba5957747 100644
--- a/src/crypto/decryptverifytask.h
+++ b/src/crypto/decryptverifytask.h
@@ -1,277 +1,274 @@
/*
This file is part of Kleopatra, the KDE keymanager
SPDX-FileCopyrightText: 2008 Klarälvdalens Datakonsult AB
SPDX-License-Identifier: GPL-2.0-or-later
*/
#pragma once
#include "task.h"
#include <utils/types.h>
#include <gpgme++/verificationresult.h>
#include <memory>
namespace KMime
{
namespace Types
{
class Mailbox;
}
}
namespace GpgME
{
class DecryptionResult;
class VerificationResult;
-class Key;
class Signature;
}
namespace QGpgME
{
class Job;
}
namespace Kleo
{
class Input;
class Output;
class AuditLogEntry;
}
namespace Kleo
{
namespace Crypto
{
class DecryptVerifyResult;
class AbstractDecryptVerifyTask : public Task
{
Q_OBJECT
public:
explicit AbstractDecryptVerifyTask(QObject *parent = nullptr);
~AbstractDecryptVerifyTask() override;
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;
public Q_SLOTS:
void cancel() override;
protected:
std::shared_ptr<DecryptVerifyResult> fromDecryptResult(const GpgME::DecryptionResult &dr, const QByteArray &plaintext, const AuditLogEntry &auditLog);
std::shared_ptr<DecryptVerifyResult> fromDecryptResult(const GpgME::Error &err, const QString &details, const AuditLogEntry &auditLog);
std::shared_ptr<DecryptVerifyResult> fromDecryptVerifyResult(const GpgME::DecryptionResult &dr,
const GpgME::VerificationResult &vr,
const QByteArray &plaintext,
const QString &fileName,
const AuditLogEntry &auditLog);
std::shared_ptr<DecryptVerifyResult> fromDecryptVerifyResult(const GpgME::Error &err, const QString &what, const AuditLogEntry &auditLog);
std::shared_ptr<DecryptVerifyResult>
fromVerifyOpaqueResult(const GpgME::VerificationResult &vr, const QByteArray &plaintext, const AuditLogEntry &auditLog);
std::shared_ptr<DecryptVerifyResult> fromVerifyOpaqueResult(const GpgME::Error &err, const QString &details, const AuditLogEntry &auditLog);
std::shared_ptr<DecryptVerifyResult> fromVerifyDetachedResult(const GpgME::VerificationResult &vr, const AuditLogEntry &auditLog);
std::shared_ptr<DecryptVerifyResult> fromVerifyDetachedResult(const GpgME::Error &err, const QString &details, const AuditLogEntry &auditLog);
public:
// public to allow access from the Private classes of the concrete tasks
QGpgME::Job *job() const;
void setJob(QGpgME::Job *job);
void setDataSource(Task::DataSource dataSource);
Task::DataSource dataSource() const;
private:
class Private;
const std::unique_ptr<Private> d;
};
class DecryptTask : public AbstractDecryptVerifyTask
{
Q_OBJECT
public:
explicit DecryptTask(QObject *parent = nullptr);
~DecryptTask() override;
void setInput(const std::shared_ptr<Input> &input);
void setOutput(const std::shared_ptr<Output> &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;
private:
void doStart() override;
unsigned long long inputSize() const override;
private:
class Private;
const std::unique_ptr<Private> 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> &input);
void setSignedData(const std::shared_ptr<Input> &signedData);
void setSignatureFile(const QString &path);
void setSignedFile(const QString &path);
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;
private:
void doStart() override;
unsigned long long inputSize() const override;
private:
class Private;
const std::unique_ptr<Private> 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> &input);
void setOutput(const std::shared_ptr<Output> &output);
void setProtocol(GpgME::Protocol prot);
void autodetectProtocolFromInput() override;
QString label() const override;
GpgME::Protocol protocol() const override;
void setExtractArchive(bool extract);
void setInputFile(const QString &path);
// for files
void setOutputFile(const QString &path);
// for archives
void setOutputDirectory(const QString &directory);
QString inputLabel() const override;
QString outputLabel() const override;
private:
void doStart() override;
unsigned long long inputSize() const override;
private:
class Private;
const std::unique_ptr<Private> 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> &input);
void setOutput(const std::shared_ptr<Output> &output);
void setProtocol(GpgME::Protocol prot);
void autodetectProtocolFromInput() override;
QString label() const override;
GpgME::Protocol protocol() const override;
void setIgnoreMDCError(bool value);
void setExtractArchive(bool extract);
void setInputFile(const QString &path);
// for files
void setOutputFile(const QString &path);
// for archives
void setOutputDirectory(const QString &directory);
QString inputLabel() const override;
QString outputLabel() const override;
private:
void doStart() override;
unsigned long long inputSize() const override;
private:
class Private;
const std::unique_ptr<Private> 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;
GpgME::Error error() const override;
QString errorString() const override;
AuditLogEntry auditLog() const override;
QPointer<Task> parentTask() const override;
Task::Result::ContentType viewableContentType() const override;
QList<Task::Result::ResultListItem> detailsList() const override;
GpgME::VerificationResult verificationResult() const;
GpgME::DecryptionResult decryptionResult() const;
QString fileName() const;
private:
DecryptVerifyResult();
DecryptVerifyResult(const DecryptVerifyResult &);
DecryptVerifyResult &operator=(const DecryptVerifyResult &other);
DecryptVerifyResult(const GpgME::VerificationResult &vr,
const GpgME::DecryptionResult &dr,
const QByteArray &stuff,
const QString &fileName,
const GpgME::Error &error,
const QString &errString,
const QString &inputLabel,
const QString &outputLabel,
const AuditLogEntry &auditLog,
Task *parentTask,
const KMime::Types::Mailbox &informativeSender,
Task::DataSource dataSource);
private:
class Private;
const std::unique_ptr<Private> d;
};
}
}
diff --git a/src/crypto/encryptemailcontroller.h b/src/crypto/encryptemailcontroller.h
index e68bf253c..87b0bd8a6 100644
--- a/src/crypto/encryptemailcontroller.h
+++ b/src/crypto/encryptemailcontroller.h
@@ -1,81 +1,73 @@
/*
This file is part of Kleopatra, the KDE keymanager
SPDX-FileCopyrightText: 2007 Klarälvdalens Datakonsult AB
SPDX-License-Identifier: GPL-2.0-or-later
*/
#pragma once
#include <crypto/controller.h>
#include <gpgme++/global.h>
#include <memory>
#include <vector>
-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<ExecutionContext> &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();
GpgME::Protocol protocol();
void startResolveRecipients();
void setInputAndOutput(const std::shared_ptr<Kleo::Input> &input, const std::shared_ptr<Kleo::Output> &output);
void setInputsAndOutputs(const std::vector<std::shared_ptr<Kleo::Input>> &inputs, const std::vector<std::shared_ptr<Kleo::Output>> &outputs);
void start();
public Q_SLOTS:
void cancel();
Q_SIGNALS:
void recipientsResolved();
private:
void doTaskDone(const Task *task, const std::shared_ptr<const Kleo::Crypto::Task::Result> &) override;
class Private;
const std::unique_ptr<Private> d;
};
} // Crypto
} // Kleo
diff --git a/src/crypto/signemailcontroller.h b/src/crypto/signemailcontroller.h
index 396b8b983..f5988958e 100644
--- a/src/crypto/signemailcontroller.h
+++ b/src/crypto/signemailcontroller.h
@@ -1,82 +1,74 @@
/*
This file is part of Kleopatra, the KDE keymanager
SPDX-FileCopyrightText: 2007 Klarälvdalens Datakonsult AB
SPDX-License-Identifier: GPL-2.0-or-later
*/
#pragma once
#include <crypto/controller.h>
#include <gpgme++/global.h>
#include <memory>
#include <vector>
-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<ExecutionContext> &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 setDetachedSignature(bool detached);
void setInputAndOutput(const std::shared_ptr<Kleo::Input> &input, const std::shared_ptr<Kleo::Output> &output);
void setInputsAndOutputs(const std::vector<std::shared_ptr<Kleo::Input>> &inputs, const std::vector<std::shared_ptr<Kleo::Output>> &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<const Task::Result> &result) override;
class Private;
const std::unique_ptr<Private> d;
Q_PRIVATE_SLOT(d, void slotWizardSignersResolved())
Q_PRIVATE_SLOT(d, void slotWizardCanceled())
Q_PRIVATE_SLOT(d, void schedule())
};
} // Crypto
} // Kleo
diff --git a/src/dialogs/useridswidget.h b/src/dialogs/useridswidget.h
index 56151b496..e6c14f0d7 100644
--- a/src/dialogs/useridswidget.h
+++ b/src/dialogs/useridswidget.h
@@ -1,40 +1,39 @@
// SPDX-FileCopyrightText: 2024 g10 Code GmbH
// SPDX-FileContributor: Tobias Fella <tobias.fella@gnupg.com>
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include <QWidget>
#include <memory>
namespace GpgME
{
class Key;
-class KeyListResult;
}
namespace Kleo
{
class UserIdsWidget : public QWidget
{
Q_OBJECT
public:
explicit UserIdsWidget(QWidget *parent = nullptr);
~UserIdsWidget() override;
void setKey(const GpgME::Key &key);
GpgME::Key key() const;
void setUpdateInProgress(bool updateInProgress);
Q_SIGNALS:
void updateKey();
private:
class Private;
const std::unique_ptr<Private> d;
};
} // namespace Kleo
diff --git a/src/kleopatraapplication.h b/src/kleopatraapplication.h
index 5d9e2972d..74c4ebdf6 100644
--- a/src/kleopatraapplication.h
+++ b/src/kleopatraapplication.h
@@ -1,125 +1,124 @@
/*
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
*/
#pragma once
#include <QApplication>
#include <QCommandLineParser>
#include <QElapsedTimer>
#include <gpgme++/global.h>
#include <memory>
extern QElapsedTimer startupTimer;
#define STARTUP_TIMING qCDebug(KLEOPATRA_LOG) << "Startup timing:" << startupTimer.elapsed() << "ms:"
#define STARTUP_TRACE qCDebug(KLEOPATRA_LOG) << "Startup timing:" << startupTimer.elapsed() << "ms:" << SRCNAME << __func__ << __LINE__;
class MainWindow;
-class SysTrayIcon;
class QSettings;
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() override;
/** By default, Kleopatra is started as unique application. This can be changed
* by calling setIsStandalone with \c true. A standalone Kleopatra instance doesn't
* have a system tray icon.
*/
void setIsStandalone(bool standalone);
bool isStandalone() const;
/** 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<KleopatraApplication *>(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();
void setIgnoreNewInstance(bool on);
bool ignoreNewInstance() const;
void toggleMainWindowVisibility();
void restoreMainWindow();
void openConfigDialogWithForeignParent(WId parentWId);
void showAboutDialog();
/* Add optional signed settings for specialized distributions */
void setDistributionSettings(const std::shared_ptr<QSettings> &settings);
std::shared_ptr<QSettings> distributionSettings() const;
public Q_SLOTS:
void openOrRaiseMainWindow();
void openOrRaiseSmartCardWindow();
void openOrRaiseConfigDialog();
void openOrRaiseGroupsConfigDialog(QWidget *parent);
#ifndef QT_NO_SYSTEMTRAYICON
void startMonitoringSmartCard();
#endif
void importCertificatesFromFile(const QStringList &files, GpgME::Protocol proto);
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);
void handleFiles(const QStringList &files, WId parentId = 0);
Q_SIGNALS:
/* Emitted from slotActivateRequested to enable setting the
* correct exitValue */
void setExitValue(int value);
void configurationChanged();
void distributionSettingsChanged();
private Q_SLOTS:
// used as URL handler for URLs with schemes that shall be blocked
void blockUrl(const QUrl &url);
void startGpgAgent();
private:
class Private;
const std::unique_ptr<Private> d;
};
diff --git a/src/smartcard/utils.h b/src/smartcard/utils.h
index a2560c966..a7d01c025 100644
--- a/src/smartcard/utils.h
+++ b/src/smartcard/utils.h
@@ -1,46 +1,45 @@
/*
This file is part of Kleopatra, the KDE keymanager
SPDX-FileCopyrightText: 2020 g10 Code GmbH
SPDX-FileContributor: Ingo Klöcker <dev@ingo-kloecker.de>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#pragma once
#include <memory>
#include <string>
#include <vector>
class QString;
namespace Kleo
{
namespace SmartCard
{
enum class AppType;
struct AlgorithmInfo;
-class OpenPGPCard;
std::string appName(Kleo::SmartCard::AppType appType);
QString displayAppName(const std::string &appName);
/**
* Returns a human-readable name for the key slot \p keyRef if such a name is
* known. Otherwise, returns an empty string.
*/
QString cardKeyDisplayName(const std::string &keyRef);
/**
* Returns the subset of algorithms \p supportedAlgorithms that are compliant.
*/
std::vector<AlgorithmInfo> getAllowedAlgorithms(const std::vector<AlgorithmInfo> &supportedAlgorithms);
/**
* Returns the ID of the algorithm in the list \p candidates that is preferred
* over the other candidates.
*/
std::string getPreferredAlgorithm(const std::vector<AlgorithmInfo> &candidates);
} // namespace Smartcard
} // namespace Kleopatra
diff --git a/src/utils/accessibility.h b/src/utils/accessibility.h
index 5481cd8e1..b64a09f83 100644
--- a/src/utils/accessibility.h
+++ b/src/utils/accessibility.h
@@ -1,101 +1,100 @@
/*
This file is part of Kleopatra, the KDE keymanager
SPDX-FileCopyrightText: 2022 g10 Code GmbH
SPDX-FileContributor: Ingo Klöcker <dev@ingo-kloecker.de>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#pragma once
#include <QAccessible>
#include <QPointer>
class QAction;
class QLabel;
-class QObject;
class QString;
namespace Kleo
{
QString getAccessibleName(QWidget *widget);
QString getAccessibleDescription(QWidget *widget);
/**
* Sets the accessible name of the action \p action.
*
* \note Qt does not provide an accessible object for a QAction. Therefore,
* we store the accessible name as custom property of the action.
* \sa getAccessibleName
*/
void setAccessibleName(QAction *action, const QString &name);
/**
* Returns the accessible name of the action \p action.
* \sa setAccessibleName
*/
QString getAccessibleName(const QAction *action);
/**
* Sets \p value as accessible value of \p widget.
*
* Stores the string \p value as custom property of the widget \p widget
* for retrieval by a QAccessibleWidget.
*
* \sa getAccessibleValue
*/
void setAccessibleValue(QWidget *widget, const QString &value);
/**
* Returns the accessible value of \p widget.
*
* \sa setAccessibleValue
*/
QString getAccessibleValue(const QWidget *widget);
/**
* Mark \p widget as being represented as AccessibleValueWidget.
*
* This is useful, if you want Windows UI Automation to treat the widget
* as labelled value, i.e. a custom widget with a value and a name.
*
* \note: Don't use this on other platforms than Windows, unless you made
* sure that it works as expected.
* \sa representAsAccessibleValueWidget
*/
void setRepresentAsAccessibleValueWidget(QWidget *widget, bool);
/**
* Returns whether \p widget is marked as being represented as
* AccessibleValueWidget.
*
* \sa setRepresentAsAccessibleValueWidget
*/
bool representAsAccessibleValueWidget(const QWidget *widget);
QString invalidEntryText();
QString requiredText();
/**
* Selects the text displayed by the label. Only \ref QLabel with text format
* \c Qt::PlainText or \c Qt::RichText are supported.
*/
void selectLabelText(QLabel *label);
/**
* Simple helper that sets the focus policy of the associated labels
* to \c Qt::StrongFocus if an assistive tool is active.
*/
class LabelHelper : public QAccessible::ActivationObserver
{
public:
LabelHelper();
~LabelHelper() override;
Q_DISABLE_COPY_MOVE(LabelHelper)
void addLabel(QLabel *label);
private:
void accessibilityActiveChanged(bool active) override;
std::vector<QPointer<QLabel>> mLabels;
};
void installAccessibleEventLogger();
}
diff --git a/src/utils/certificatepair.h b/src/utils/certificatepair.h
index dd1aeb78b..66408596e 100644
--- a/src/utils/certificatepair.h
+++ b/src/utils/certificatepair.h
@@ -1,23 +1,21 @@
/*
This file is part of Kleopatra, the KDE keymanager
SPDX-FileCopyrightText: 2022 g10 Code GmbH
SPDX-FileContributor: Ingo Klöcker <dev@ingo-kloecker.de>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#pragma once
#include <gpgme++/key.h>
-class QDate;
-
namespace Kleo
{
struct CertificatePair {
GpgME::Key openpgp;
GpgME::Key cms;
};
}
diff --git a/src/utils/csrutils.h b/src/utils/csrutils.h
index be01fd5cb..66857d1e2 100644
--- a/src/utils/csrutils.h
+++ b/src/utils/csrutils.h
@@ -1,20 +1,19 @@
/*
This file is part of Kleopatra, the KDE keymanager
SPDX-FileCopyrightText: 2025 g10 Code GmbH
SPDX-FileContributor: Ingo Klöcker <dev@ingo-kloecker.de>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#pragma once
class QByteArray;
-class QUrl;
class QWidget;
namespace Kleo
{
class KeyParameters;
void saveCSR(const QByteArray &request, const KeyParameters ¶meters, QWidget *parent);
}
diff --git a/src/view/cardkeysview.h b/src/view/cardkeysview.h
index 60f0b1e0f..ddf085074 100644
--- a/src/view/cardkeysview.h
+++ b/src/view/cardkeysview.h
@@ -1,99 +1,97 @@
/*
This file is part of Kleopatra, the KDE keymanager
SPDX-FileCopyrightText: 2024 g10 Code GmbH
SPDX-FileContributor: Ingo Klöcker <dev@ingo-kloecker.de>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#pragma once
#include <Libkleo/Predicates>
#include <QHash>
#include <QWidget>
#include <set>
#include <string>
#include <vector>
class CardKeysWidgetItem;
-class QAction;
class QToolButton;
-class QTreeWidgetItem;
namespace GpgME
{
class Key;
class KeyListResult;
}
namespace Kleo
{
class ProgressOverlay;
class TreeWidget;
namespace SmartCard
{
enum class AppType;
class Card;
struct KeyPairInfo;
}
class CardKeysView : public QWidget
{
Q_OBJECT
public:
enum Option {
// clang-format off
NoOptions = 0x0000,
ShowCreated = 0x0001, // show "Created" column by default
DefaultOptions = ShowCreated,
// clang-format on
};
Q_DECLARE_FLAGS(Options, Option)
explicit CardKeysView(QWidget *parent, Options options = DefaultOptions);
~CardKeysView() override;
void setCard(const std::shared_ptr<const SmartCard::Card> &card);
std::string currentCardSlot() const;
GpgME::Key currentCertificate() const;
Q_SIGNALS:
void currentCardSlotChanged() const;
protected:
bool eventFilter(QObject *obj, QEvent *event) override;
private:
enum UpdateKeyListOptions {
IgnoreMissingCertificates,
LearnMissingCertificates,
};
void updateKeyList(UpdateKeyListOptions options);
void insertTreeWidgetItem(int slotIndex, const SmartCard::KeyPairInfo &keyInfo, const GpgME::Subkey &subkey, int treeIndex = -1);
QToolButton *addActionsButton(CardKeysWidgetItem *item, SmartCard::AppType cardType);
void ensureCertificatesAreValidated();
void startCertificateValidation(const std::vector<GpgME::Key> &certificates);
void certificateValidationDone(const GpgME::KeyListResult &result, const std::vector<GpgME::Key> &keys);
void learnCard();
private:
Options mOptions;
std::shared_ptr<const Kleo::SmartCard::Card> mCard;
std::vector<GpgME::Key> mCertificates; // only S/MIME certificates
using KeySet = std::set<GpgME::Key, _detail::ByFingerprint<std::less>>;
KeySet mValidatedCertificates;
TreeWidget *mTreeWidget = nullptr;
ProgressOverlay *mTreeViewOverlay = nullptr;
};
Q_DECLARE_OPERATORS_FOR_FLAGS(CardKeysView::Options)
} // namespace Kleo
diff --git a/src/view/keytreeview.h b/src/view/keytreeview.h
index b6634df26..7e527a189 100644
--- a/src/view/keytreeview.h
+++ b/src/view/keytreeview.h
@@ -1,177 +1,175 @@
/*
This file is part of Kleopatra, the KDE keymanager
SPDX-FileCopyrightText: 2009 Klarälvdalens Datakonsult AB
SPDX-License-Identifier: GPL-2.0-or-later
*/
#pragma once
#include <QWidget>
#include <QString>
#include <QStringList>
#include <gpgme++/key.h>
#include <memory>
#include <vector>
#include <KConfigGroup>
#include <Libkleo/TreeView>
-class QTreeView;
-
namespace Kleo
{
class KeyFilter;
class AbstractKeyListModel;
class AbstractKeyListSortFilterProxyModel;
class KeyListSortFilterProxyModel;
class SearchBar;
class KeyTreeView : public QWidget
{
Q_OBJECT
Q_FLAGS(Options)
public:
enum Option {
Default = 0x0,
NoDefaultContextMenu = 0x1,
};
Q_DECLARE_FLAGS(Options, Option)
explicit KeyTreeView(QWidget *parent = nullptr);
KeyTreeView(const QString &stringFilter,
const std::shared_ptr<KeyFilter> &keyFilter,
AbstractKeyListSortFilterProxyModel *additionalProxy,
QWidget *parent,
const KConfigGroup &group,
Options options = Option::Default);
~KeyTreeView() override;
TreeView *view() const
{
return m_view;
}
AbstractKeyListModel *model() const
{
return m_isHierarchical ? hierarchicalModel() : flatModel();
}
AbstractKeyListModel *flatModel() const
{
return m_flatModel;
}
AbstractKeyListModel *hierarchicalModel() const
{
return m_hierarchicalModel;
}
void setFlatModel(AbstractKeyListModel *model);
void setHierarchicalModel(AbstractKeyListModel *model);
// extraOrigins contains additional origin information for the keys. It must be in the same order as the keys themselves.
// For this reason, setKeys will NOT perform any sorting and filtering if extraOrigins is not empty.
void setKeys(const std::vector<GpgME::Key> &keys, const std::vector<GpgME::Key::Origin> &extraOrigins = {});
const std::vector<GpgME::Key> &keys() const
{
return m_keys;
}
void selectKeys(const std::vector<GpgME::Key> &keys);
std::vector<GpgME::Key> selectedKeys() const;
void addKeysUnselected(const std::vector<GpgME::Key> &keys);
void addKeysSelected(const std::vector<GpgME::Key> &keys);
void removeKeys(const std::vector<GpgME::Key> &keys);
#if 0
void setToolTipOptions(int options);
int toolTipOptions() const;
#endif
QString stringFilter() const
{
return m_stringFilter;
}
const std::shared_ptr<KeyFilter> &keyFilter() const
{
return m_keyFilter;
}
bool isHierarchicalView() const
{
return m_isHierarchical;
}
void setColumnSizes(const std::vector<int> &sizes);
std::vector<int> columnSizes() const;
void setSortColumn(int sortColumn, Qt::SortOrder sortOrder);
int sortColumn() const;
Qt::SortOrder sortOrder() const;
virtual KeyTreeView *clone() const
{
return new KeyTreeView(*this);
}
void disconnectSearchBar();
bool connectSearchBar(const SearchBar *bar);
void restoreLayout(const KConfigGroup &group);
public Q_SLOTS:
virtual void setStringFilter(const QString &text);
virtual void setKeyFilter(const std::shared_ptr<Kleo::KeyFilter> &filter);
virtual void setHierarchicalView(bool on);
Q_SIGNALS:
void stringFilterChanged(const QString &filter);
void keyFilterChanged(const std::shared_ptr<Kleo::KeyFilter> &filter);
void hierarchicalChanged(bool on);
protected:
KeyTreeView(const KeyTreeView &);
private:
void init();
void initializeColumnSizes();
void addKeysImpl(const std::vector<GpgME::Key> &, bool);
void restoreExpandState();
void setUpTagKeys();
void updateModelConnections(AbstractKeyListModel *oldModel, AbstractKeyListModel *newModel);
void saveStateBeforeModelChange();
void restoreStateAfterModelChange();
private:
std::vector<GpgME::Key> m_keys;
KeyListSortFilterProxyModel *m_proxy;
AbstractKeyListSortFilterProxyModel *m_additionalProxy;
TreeView *m_view;
AbstractKeyListModel *m_flatModel;
AbstractKeyListModel *m_hierarchicalModel;
QString m_stringFilter;
std::shared_ptr<KeyFilter> m_keyFilter;
QStringList m_expandedKeys;
std::vector<GpgME::Key> m_selectedKeys;
GpgME::Key m_currentKey;
std::vector<QMetaObject::Connection> m_connections;
KConfigGroup m_group;
bool m_isHierarchical : 1;
bool m_onceResized : 1;
bool m_showDefaultContextMenu : 1;
};
}
diff --git a/src/view/smartcardswidget.h b/src/view/smartcardswidget.h
index 7df1cd7b3..f80498414 100644
--- a/src/view/smartcardswidget.h
+++ b/src/view/smartcardswidget.h
@@ -1,49 +1,47 @@
/*
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
*/
#pragma once
#include <QWidget>
#include <memory>
#include <vector>
-class KActionCollection;
-
namespace Kleo
{
namespace SmartCard
{
class Card;
}
/* SmartCardsWidget a generic widget to interact with smartcards */
class SmartCardsWidget : public QWidget
{
Q_OBJECT
public:
explicit SmartCardsWidget(QWidget *parent = nullptr);
~SmartCardsWidget() override;
void showCards(const std::vector<std::shared_ptr<Kleo::SmartCard::Card>> &cards);
public Q_SLOTS:
void reload();
Q_SIGNALS:
void statusMessage(const QString &message, const QByteArray &cardId);
void cardChanged(const QByteArray &cardId);
private:
void updateReloadButton();
private:
class Private;
std::unique_ptr<Private> d;
};
} // namespace Kleo
diff --git a/src/view/smartcardwidget.h b/src/view/smartcardwidget.h
index f27ee8a3a..72ac79a1c 100644
--- a/src/view/smartcardwidget.h
+++ b/src/view/smartcardwidget.h
@@ -1,79 +1,76 @@
/*
This file is part of Kleopatra, the KDE keymanager
SPDX-FileCopyrightText: 2024 g10 Code GmbH
SPDX-FileContributor: Ingo Klöcker <dev@ingo-kloecker.de>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#pragma once
#include <QPointer>
#include <QWidget>
#include <memory>
#include <string>
class KMessageWidget;
-class QGridLayout;
-class QLabel;
class QToolButton;
-class QVBoxLayout;
namespace GpgME
{
class Key;
}
namespace QGpgME
{
class Job;
}
namespace Kleo
{
class CardKeysView;
class InfoField;
}
namespace Kleo::SmartCard
{
enum class AppType;
class Card;
}
class SmartCardWidget : public QWidget
{
Q_OBJECT
protected:
SmartCardWidget(Kleo::SmartCard::AppType appType, QWidget *parent = nullptr);
public:
~SmartCardWidget() override;
void setCard(const Kleo::SmartCard::Card *card);
const Kleo::SmartCard::Card *card() const;
Kleo::SmartCard::AppType cardType() const;
std::string serialNumber() const;
std::string currentCardSlot() const;
GpgME::Key currentCertificate() const;
Q_SIGNALS:
void statusMessage(const QString &message);
private:
void retrieveOpenPGPCertificate();
private:
Kleo::SmartCard::AppType mAppType;
std::shared_ptr<const Kleo::SmartCard::Card> mCard;
QPointer<QGpgME::Job> mJob;
std::unique_ptr<Kleo::InfoField> mCardTypeField;
std::unique_ptr<Kleo::InfoField> mSerialNumberField;
std::unique_ptr<Kleo::InfoField> mCardholderField;
std::unique_ptr<Kleo::InfoField> mPublicKeyUrlField;
std::unique_ptr<Kleo::InfoField> mPinCountersField;
QToolButton *mCardActionsButton = nullptr;
KMessageWidget *mNullPinWidget = nullptr;
KMessageWidget *mErrorWidget = nullptr;
Kleo::CardKeysView *mCardKeysView = nullptr;
};
diff --git a/src/view/tabwidget.h b/src/view/tabwidget.h
index 9b7953970..9decc5547 100644
--- a/src/view/tabwidget.h
+++ b/src/view/tabwidget.h
@@ -1,90 +1,89 @@
/*
This file is part of Kleopatra, the KDE keymanager
SPDX-FileCopyrightText: 2007 Klarälvdalens Datakonsult AB
SPDX-License-Identifier: GPL-2.0-or-later
*/
#pragma once
#include "keytreeview.h"
#include <KSharedConfig>
#include <QWidget>
#include <memory>
#include <vector>
class QAbstractItemView;
class KConfigGroup;
class KActionCollection;
namespace Kleo
{
class AbstractKeyListModel;
-class AbstractKeyListSortFilterProxyModel;
class KeyFilter;
class KeyListModelInterface;
class SearchBar;
class TabWidget : public QWidget
{
Q_OBJECT
public:
enum Option {
ShowKeys = 0x00,
ShowUserIDs = 0x01,
};
Q_DECLARE_FLAGS(Options, Option)
explicit TabWidget(KeyTreeView::Options options = KeyTreeView::Option::Default, QWidget *parent = nullptr, Qt::WindowFlags f = {});
~TabWidget() override;
void setFlatModel(AbstractKeyListModel *model);
AbstractKeyListModel *flatModel() const;
void setHierarchicalModel(AbstractKeyListModel *model);
AbstractKeyListModel *hierarchicalModel() const;
QAbstractItemView *addView(const QString &title = QString(), const QString &keyFilterID = QString(), const QString &searchString = QString());
QAbstractItemView *addView(const KConfigGroup &group, Options options);
void loadViews(const KSharedConfig::Ptr &config, const QString &configKeys, Options options = ShowKeys);
void saveViews();
std::vector<QAbstractItemView *> views() const;
QAbstractItemView *currentView() const;
KeyListModelInterface *currentModel() const;
unsigned int count() const;
void createActions(KActionCollection *collection);
void connectSearchBar(SearchBar *sb);
void setMultiSelection(bool on);
QString stringFilter() const;
public Q_SLOTS:
void setKeyFilter(const std::shared_ptr<Kleo::KeyFilter> &filter);
void setStringFilter(const QString &filter);
Q_SIGNALS:
void viewAdded(QAbstractItemView *view);
void viewAboutToBeRemoved(QAbstractItemView *view);
void currentViewChanged(QAbstractItemView *view);
void stringFilterChanged(const QString &filter);
void keyFilterChanged(const std::shared_ptr<Kleo::KeyFilter> &filter);
void enableChangeStringFilter(bool enable);
void enableChangeKeyFilter(bool enable);
private:
class Private;
const std::unique_ptr<Private> d;
};
}
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Sun, Jan 18, 10:56 PM (1 d, 16 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
39/6f/6cc5d8d11aac6fce93383e11590f
Attached To
rKLEOPATRA Kleopatra
Event Timeline
Log In to Comment