35 #include "core/GpgContext.h"
36 #include "ui/dialog/import_export/KeyImportDetailDialog.h"
47 using KeyType =
unsigned int;
49 static const KeyType SECRET_OR_PUBLIC_KEY = 0;
50 static const KeyType ONLY_SECRET_KEY = 1;
58 using InfoType =
unsigned int;
60 static constexpr InfoType ALL = ~0;
61 static constexpr InfoType TYPE = 1 << 0;
62 static constexpr InfoType NAME = 1 << 1;
63 static constexpr InfoType EmailAddress = 1 << 2;
64 static constexpr InfoType Usage = 1 << 3;
65 static constexpr InfoType Validity = 1 << 4;
66 static constexpr InfoType FingerPrint = 1 << 5;
74 using AbilityType =
unsigned int;
76 static constexpr AbilityType ALL = ~0;
77 static constexpr AbilityType NONE = 0;
78 static constexpr AbilityType REFRESH = 1 << 0;
79 static constexpr AbilityType SYNC_PUBLIC_KEY = 1 << 1;
80 static constexpr AbilityType UNCHECK_ALL = 1 << 3;
81 static constexpr AbilityType CHECK_ALL = 1 << 5;
82 static constexpr AbilityType SEARCH_BAR = 1 << 6;
90 using KeyTableFilter = std::function<bool(
const GpgKey&,
const KeyTable&)>;
92 QTableWidget* key_list_;
93 KeyListRow::KeyType select_type_;
94 KeyListColumn::InfoType info_type_;
95 std::vector<GpgKey> buffered_keys_;
96 KeyTableFilter filter_;
97 KeyIdArgsListPtr checked_key_ids_;
98 KeyMenuAbility::AbilityType ability_;
110 QTableWidget* _key_list, KeyListRow::KeyType _select_type,
111 KeyListColumn::InfoType _info_type,
112 KeyTableFilter _filter = [](
const GpgKey&,
const KeyTable&) ->
bool {
115 : key_list_(_key_list),
116 select_type_(_select_type),
117 info_type_(_info_type),
118 filter_(std::move(_filter)) {}
125 void Refresh(KeyLinkListPtr m_keys =
nullptr);
138 void UncheckALL()
const;
144 void CheckALL()
const;
157 void SetMenuAbility(KeyMenuAbility::AbilityType ability);
163 void SetFilterKeyword(std::string keyword);
180 explicit KeyList(KeyMenuAbility::AbilityType menu_ability,
181 QWidget* parent =
nullptr);
192 const QString& name,
const QString&
id,
193 KeyListRow::KeyType selectType = KeyListRow::SECRET_OR_PUBLIC_KEY,
194 KeyListColumn::InfoType infoType = KeyListColumn::ALL,
195 const KeyTable::KeyTableFilter filter =
204 std::function<
void(
const GpgKey&, QWidget*)> action);
269 static void SetChecked(
const KeyIdArgsListPtr& keyIds,
291 [[maybe_unused]]
static void MarkKeys(QStringList* keyIds);
314 void SignalRefreshDatabase();
328 void SlotRefreshUI();
360 void filter_by_keyword();
362 std::mutex buffered_key_list_mutex_;
364 std::shared_ptr<Ui_KeyList> ui_;
365 QTableWidget* m_key_list_{};
366 std::vector<KeyTable> m_key_tables_;
367 QMenu* popup_menu_{};
368 GpgFrontend::KeyLinkListPtr buffered_keys_list_;
369 std::function<void(
const GpgKey&, QWidget*)> m_action_ =
nullptr;
370 KeyMenuAbility::AbilityType menu_ability_ = KeyMenuAbility::ALL;
385 void slot_refresh_ui();
391 void slot_sync_with_key_server();
413 void dropEvent(QDropEvent* event)
override;
Definition: KeyList.h:170
KeyIdArgsListPtr GetSelected()
Get the Selected object.
Definition: KeyList.cpp:275
bool ContainsPrivateKeys()
Definition: KeyList.cpp:292
void dropEvent(QDropEvent *event) override
Definition: KeyList.cpp:348
static void MarkKeys(QStringList *keyIds)
Definition: KeyList.cpp:422
void SetChecked(KeyIdArgsListPtr key_ids)
Set the Checked object.
Definition: KeyList.cpp:261
void slot_double_clicked(const QModelIndex &index)
Definition: KeyList.cpp:435
KeyList(KeyMenuAbility::AbilityType menu_ability, QWidget *parent=nullptr)
Construct a new Key List object.
Definition: KeyList.cpp:46
void SetDoubleClickedAction(std::function< void(const GpgKey &, QWidget *)> action)
Set the Double Clicked Action object.
Definition: KeyList.cpp:446
KeyIdArgsListPtr GetAllPrivateKeys()
Get the All Private Keys object.
Definition: KeyList.cpp:217
KeyIdArgsListPtr GetPrivateChecked()
Get the Private Checked object.
Definition: KeyList.cpp:231
void contextMenuEvent(QContextMenuEvent *event) override
Definition: KeyList.cpp:311
void SignalRefreshStatusBar(const QString &message, int timeout)
void AddMenuAction(QAction *act)
Definition: KeyList.cpp:346
void SetColumnWidth(int row, int size)
Set the Column Width object.
Definition: KeyList.cpp:304
std::string GetSelectedKey()
Get the Selected Key object.
Definition: KeyList.cpp:451
void import_keys(const QByteArray &inBuffer)
Definition: KeyList.cpp:428
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 GetChecked()
Get the Checked object.
Definition: KeyList.cpp:203
void dragEnterEvent(QDragEnterEvent *event) override
Definition: KeyList.cpp:415
Definition: FileReadTask.cpp:29
KeyIdArgsListPtr & GetChecked()
Get the Checked object.
Definition: KeyList.cpp:558
void Refresh(KeyLinkListPtr m_keys=nullptr)
Definition: KeyList.cpp:577
void SetChecked(KeyIdArgsListPtr key_ids)
Set the Checked object.
Definition: KeyList.cpp:573
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:109