diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/gpg/GpgContext.h | 25 | ||||
-rwxr-xr-x | include/ui/FileEncryptionDialog.h | 2 | ||||
-rwxr-xr-x | include/ui/KeyMgmt.h | 2 | ||||
-rw-r--r-- | include/ui/KeyServerImportDialog.h | 2 | ||||
-rwxr-xr-x | include/ui/SettingsDialog.h | 2 | ||||
-rw-r--r-- | include/ui/VerifyKeyDetailBox.h | 2 | ||||
-rw-r--r-- | include/ui/widgets/KeyList.h (renamed from include/ui/KeyList.h) | 37 |
7 files changed, 53 insertions, 19 deletions
diff --git a/include/gpg/GpgContext.h b/include/gpg/GpgContext.h index e8ae9feb..92a8200c 100644 --- a/include/gpg/GpgContext.h +++ b/include/gpg/GpgContext.h @@ -60,14 +60,14 @@ public: } int considered; - [[maybe_unused]] int no_user_id; + int no_user_id; int imported; - [[maybe_unused]] int imported_rsa; + int imported_rsa; int unchanged; - [[maybe_unused]] int new_user_ids; - [[maybe_unused]] int new_sub_keys; - [[maybe_unused]] int new_signatures; - [[maybe_unused]] int new_revocations; + int new_user_ids; + int new_sub_keys; + int new_signatures; + int new_revocations; int secret_read; int secret_imported; int secret_unchanged; @@ -81,13 +81,13 @@ namespace GpgME { Q_OBJECT public: - GpgContext(); // Constructor + GpgContext(); - ~GpgContext() override; // Destructor + ~GpgContext() override; GpgImportInformation importKey(QByteArray inBuffer); - const GpgKeyList &getKeys() const; + [[nodiscard]] const GpgKeyList &getKeys() const; bool exportKeys(QStringList *uidList, QByteArray *outBuffer); @@ -106,6 +106,8 @@ namespace GpgME { void getKeyDetails(const QString &uid, GpgKey& key); + void getSigners(QVector<GpgKey> &signer); + void signKey(const QVector<GpgKey> &signer, const GpgKey &target, const QString& uid); gpgme_signature_t verify(QByteArray *inBuffer, QByteArray *sigBuffer = nullptr); @@ -151,16 +153,17 @@ namespace GpgME { private: gpgme_ctx_t mCtx{}; gpgme_data_t in{}; - [[maybe_unused]] gpgme_data_t out{}; gpgme_error_t err; + bool debug; static gpgme_error_t readToBuffer(gpgme_data_t dataIn, QByteArray *outBuffer); QByteArray mPasswordCache; QSettings settings; - [[maybe_unused]] bool debug; GpgKeyList mKeyList; + QMap<QString, GpgKey> mKeyMap; + void fetch_keys(); static void checkErr(gpgme_error_t gpgmeError); diff --git a/include/ui/FileEncryptionDialog.h b/include/ui/FileEncryptionDialog.h index 52ef523e..f4adb18f 100755 --- a/include/ui/FileEncryptionDialog.h +++ b/include/ui/FileEncryptionDialog.h @@ -26,7 +26,7 @@ #define __FILEENCRYPTIONDIALOG_H__ #include "gpg/GpgContext.h" -#include "KeyList.h" +#include "ui/widgets/KeyList.h" #include "VerifyDetailsDialog.h" diff --git a/include/ui/KeyMgmt.h b/include/ui/KeyMgmt.h index d98bf084..c709fa86 100755 --- a/include/ui/KeyMgmt.h +++ b/include/ui/KeyMgmt.h @@ -25,7 +25,7 @@ #ifndef __KEYMGMT_H__ #define __KEYMGMT_H__ -#include "KeyList.h" +#include "ui/widgets/KeyList.h" #include "KeygenThread.h" #include "ui/keypair_details/KeyDetailsDialog.h" #include "KeyImportDetailDialog.h" diff --git a/include/ui/KeyServerImportDialog.h b/include/ui/KeyServerImportDialog.h index ef83bc7e..f514368b 100644 --- a/include/ui/KeyServerImportDialog.h +++ b/include/ui/KeyServerImportDialog.h @@ -27,7 +27,7 @@ #include "gpg/GpgContext.h" #include "KeyImportDetailDialog.h" -#include "KeyList.h" +#include "ui/widgets/KeyList.h" class KeyServerImportDialog : public QDialog { diff --git a/include/ui/SettingsDialog.h b/include/ui/SettingsDialog.h index 55c74064..b3a70976 100755 --- a/include/ui/SettingsDialog.h +++ b/include/ui/SettingsDialog.h @@ -25,7 +25,7 @@ #ifndef __SETTINGSDIALOG_H__ #define __SETTINGSDIALOG_H__ -#include "ui/KeyList.h" +#include "ui/widgets/KeyList.h" class GeneralTab : public QWidget { Q_OBJECT diff --git a/include/ui/VerifyKeyDetailBox.h b/include/ui/VerifyKeyDetailBox.h index 220b810b..b0452e43 100644 --- a/include/ui/VerifyKeyDetailBox.h +++ b/include/ui/VerifyKeyDetailBox.h @@ -25,7 +25,7 @@ #ifndef __VERIFYKEYDETAILBOX_H__ #define __VERIFYKEYDETAILBOX_H__ -#include "ui/KeyList.h" +#include "ui/widgets/KeyList.h" #include "ui/KeyServerImportDialog.h" class VerifyKeyDetailBox : public QGroupBox { diff --git a/include/ui/KeyList.h b/include/ui/widgets/KeyList.h index 71bdfe6b..6af54518 100644 --- a/include/ui/KeyList.h +++ b/include/ui/widgets/KeyList.h @@ -26,14 +26,42 @@ #define __KEYLIST_H__ #include "gpg/GpgContext.h" -#include "KeyImportDetailDialog.h" +#include "ui/KeyImportDetailDialog.h" + + +struct KeyListRow { + + using KeyType = unsigned int; + + static const KeyType SECRET_OR_PUBLIC_KEY = 0; + static const KeyType ONLY_SECRET_KEY = 1; + +}; + +struct KeyListColumn { + + using InfoType = unsigned int; + + static constexpr InfoType ALL = ~0; + static constexpr InfoType TYPE = 1 << 0; + static constexpr InfoType NAME = 1 << 1; + static constexpr InfoType EmailAddress = 1 << 2; + static constexpr InfoType Usage = 1 << 3; + static constexpr InfoType Validity = 1 << 4; + static constexpr InfoType FingerPrint = 1 << 5; + +}; class KeyList : public QWidget { Q_OBJECT public: - explicit KeyList(GpgME::GpgContext *ctx, QWidget *parent = nullptr); + + explicit KeyList(GpgME::GpgContext *ctx, + KeyListRow::KeyType selectType = KeyListRow::SECRET_OR_PUBLIC_KEY, + KeyListColumn::InfoType infoType = KeyListColumn::ALL, + QWidget *parent = nullptr); void setColumnWidth(int row, int size); @@ -67,13 +95,16 @@ private: QTableWidget *mKeyList; QMenu *popupMenu; QNetworkAccessManager *qnam{}; - QVector<GpgKey> buffered_keys; + KeyListRow::KeyType mSelectType; + KeyListColumn::InfoType mInfoType; + private slots: void uploadFinished(); + protected: void contextMenuEvent(QContextMenuEvent *event) override; |