diff options
author | saturneric <[email protected]> | 2025-04-12 14:00:42 +0000 |
---|---|---|
committer | saturneric <[email protected]> | 2025-04-12 14:00:42 +0000 |
commit | 1f393a50c60d94a4ae23875b31e0e07ad3d64375 (patch) | |
tree | e4e4597dfca48a38c73779fe577e22e3550ee993 /src/core/model/GpgKeyTableModel.h | |
parent | fix: avoid accessing invalid pointers of structs related to gpgme_key (diff) | |
download | GpgFrontend-1f393a50c60d94a4ae23875b31e0e07ad3d64375.tar.gz GpgFrontend-1f393a50c60d94a4ae23875b31e0e07ad3d64375.zip |
fix: issues on adsk operations
Diffstat (limited to 'src/core/model/GpgKeyTableModel.h')
-rw-r--r-- | src/core/model/GpgKeyTableModel.h | 44 |
1 files changed, 42 insertions, 2 deletions
diff --git a/src/core/model/GpgKeyTableModel.h b/src/core/model/GpgKeyTableModel.h index 0529bf7b..69118f56 100644 --- a/src/core/model/GpgKeyTableModel.h +++ b/src/core/model/GpgKeyTableModel.h @@ -110,6 +110,36 @@ inline auto operator&(GpgKeyTableDisplayMode lhs, return (static_cast<T>(lhs) & static_cast<T>(rhs)) != 0; } +class GPGFRONTEND_CORE_EXPORT GpgKeyTableItem { + public: + GpgKeyTableItem() = default; + + explicit GpgKeyTableItem(const GpgKey &key); + + GpgKeyTableItem(const GpgKeyTableItem &); + + [[nodiscard]] auto Key() const -> GpgKey; + + /** + * @brief + * + * @return bool + */ + [[nodiscard]] auto Checked() const -> bool; + + /** + * @brief Set the Checked object + * + * @return true + * @return false + */ + void SetChecked(bool); + + private: + GpgKey key_; + bool checked_; +}; + class GPGFRONTEND_CORE_EXPORT GpgKeyTableModel : public QAbstractTableModel { Q_OBJECT public: @@ -125,6 +155,17 @@ class GPGFRONTEND_CORE_EXPORT GpgKeyTableModel : public QAbstractTableModel { /** * @brief * + * @param row + * @param column + * @param parent + * @return QModelIndex + */ + [[nodiscard]] auto index(int row, int column, const QModelIndex &parent) const + -> QModelIndex override; + + /** + * @brief + * * @param parent * @return int */ @@ -212,11 +253,10 @@ class GPGFRONTEND_CORE_EXPORT GpgKeyTableModel : public QAbstractTableModel { [[nodiscard]] auto GetGpgContextChannel() const -> int; private: - GpgKeyList buffered_keys_; QStringList column_headers_; int gpg_context_channel_; - QContainer<bool> key_check_state_; + QContainer<GpgKeyTableItem> cached_items_; }; } // namespace GpgFrontend
\ No newline at end of file |