31 #include "core/model/GpgKey.h"
42 using KeyType =
unsigned int;
44 static const KeyType SECRET_OR_PUBLIC_KEY = 0;
45 static const KeyType ONLY_SECRET_KEY = 1;
53 using InfoType =
unsigned int;
55 static constexpr InfoType ALL = ~0;
56 static constexpr InfoType TYPE = 1 << 0;
57 static constexpr InfoType NAME = 1 << 1;
58 static constexpr InfoType EmailAddress = 1 << 2;
59 static constexpr InfoType Usage = 1 << 3;
60 static constexpr InfoType Validity = 1 << 4;
61 static constexpr InfoType FingerPrint = 1 << 5;
62 static constexpr InfoType KeyID = 1 << 6;
70 using AbilityType =
unsigned int;
72 static constexpr AbilityType ALL = ~0;
73 static constexpr AbilityType NONE = 0;
74 static constexpr AbilityType REFRESH = 1 << 0;
75 static constexpr AbilityType SYNC_PUBLIC_KEY = 1 << 1;
76 static constexpr AbilityType UNCHECK_ALL = 1 << 3;
77 static constexpr AbilityType CHECK_ALL = 1 << 5;
78 static constexpr AbilityType SEARCH_BAR = 1 << 6;
86 using KeyTableFilter = std::function<bool(
const GpgKey&,
const KeyTable&)>;
88 QTableWidget* key_list_;
89 KeyListRow::KeyType select_type_;
90 KeyListColumn::InfoType info_type_;
91 std::vector<GpgKey> buffered_keys_;
92 KeyTableFilter filter_;
93 KeyIdArgsListPtr checked_key_ids_;
94 KeyMenuAbility::AbilityType ability_;
106 QTableWidget* _key_list, KeyListRow::KeyType _select_type,
107 KeyListColumn::InfoType _info_type,
108 KeyTableFilter _filter = [](
const GpgKey&,
const KeyTable&) ->
bool {
111 : key_list_(_key_list),
112 select_type_(_select_type),
113 info_type_(_info_type),
114 filter_(std::move(_filter)) {}
121 void Refresh(KeyLinkListPtr m_keys =
nullptr);
134 void UncheckALL()
const;
140 void CheckALL()
const;
153 void SetMenuAbility(KeyMenuAbility::AbilityType ability);
159 void SetFilterKeyword(QString keyword);
176 explicit KeyList(KeyMenuAbility::AbilityType menu_ability,
177 QWidget* parent =
nullptr);
188 const QString& name,
const QString&
id,
189 KeyListRow::KeyType selectType = KeyListRow::SECRET_OR_PUBLIC_KEY,
190 KeyListColumn::InfoType infoType = KeyListColumn::ALL,
191 const KeyTable::KeyTableFilter filter =
200 std::function<
void(
const GpgKey&, QWidget*)> action);
265 static void SetChecked(
const KeyIdArgsListPtr& keyIds,
303 void SignalRefreshDatabase();
317 void SlotRefreshUI();
349 void filter_by_keyword();
351 std::mutex buffered_key_list_mutex_;
353 std::shared_ptr<Ui_KeyList> ui_;
354 QTableWidget* m_key_list_{};
355 std::vector<KeyTable> m_key_tables_;
356 QMenu* popup_menu_{};
357 GpgFrontend::KeyLinkListPtr buffered_keys_list_;
358 std::function<void(
const GpgKey&, QWidget*)> m_action_ =
nullptr;
359 KeyMenuAbility::AbilityType menu_ability_ = KeyMenuAbility::ALL;
374 void slot_refresh_ui();
380 void slot_sync_with_key_server();
402 void dropEvent(QDropEvent* event)
override;
Definition: KeyList.h:166
KeyIdArgsListPtr GetSelected()
Get the Selected object.
Definition: KeyList.cpp:278
void dropEvent(QDropEvent *event) override
Definition: KeyList.cpp:351
KeyIdArgsListPtr GetPrivateChecked()
Get the Private Checked object.
Definition: KeyList.cpp:234
QString GetSelectedKey()
Get the Selected Key object.
Definition: KeyList.cpp:432
void SetChecked(KeyIdArgsListPtr key_ids)
Set the Checked object.
Definition: KeyList.cpp:264
void slot_double_clicked(const QModelIndex &index)
Definition: KeyList.cpp:416
KeyList(KeyMenuAbility::AbilityType menu_ability, QWidget *parent=nullptr)
Construct a new Key List object.
Definition: KeyList.cpp:43
void SetDoubleClickedAction(std::function< void(const GpgKey &, QWidget *)> action)
Set the Double Clicked Action object.
Definition: KeyList.cpp:427
void contextMenuEvent(QContextMenuEvent *event) override
Definition: KeyList.cpp:314
void SignalRefreshStatusBar(const QString &message, int timeout)
KeyIdArgsListPtr GetChecked()
Get the Checked object.
Definition: KeyList.cpp:206
void AddMenuAction(QAction *act)
Definition: KeyList.cpp:349
void SetColumnWidth(int row, int size)
Set the Column Width object.
Definition: KeyList.cpp:307
void import_keys(const QByteArray &inBuffer)
Definition: KeyList.cpp:410
void AddListGroupTab(const QString &name, const QString &id, KeyListRow::KeyType selectType=KeyListRow::SECRET_OR_PUBLIC_KEY, KeyListColumn::InfoType infoType=KeyListColumn::ALL, const KeyTable::KeyTableFilter filter=[](const GpgKey &, const KeyTable &) -> bool { return true;})
Definition: KeyList.cpp:114
KeyIdArgsListPtr GetAllPrivateKeys()
Get the All Private Keys object.
Definition: KeyList.cpp:220
bool ContainsPrivateKeys()
Definition: KeyList.cpp:295
void dragEnterEvent(QDragEnterEvent *event) override
Definition: KeyList.cpp:406
Definition: FileReadTask.cpp:31
KeyIdArgsListPtr & GetChecked()
Get the Checked object.
Definition: KeyList.cpp:542
void Refresh(KeyLinkListPtr m_keys=nullptr)
Definition: KeyList.cpp:561
void SetChecked(KeyIdArgsListPtr key_ids)
Set the Checked object.
Definition: KeyList.cpp:557
KeyTable(QTableWidget *_key_list, KeyListRow::KeyType _select_type, KeyListColumn::InfoType _info_type, KeyTableFilter _filter=[](const GpgKey &, const KeyTable &) -> bool { return true;})
Construct a new Key Table object.
Definition: KeyList.h:105