GpgFrontend Project
A Free, Powerful, Easy-to-Use, Compact, Cross-Platform, and Installation-Free OpenPGP(pgp) Crypto Tool.
|
34 #include "core/GpgContext.h"
35 #include "ui/import_export/KeyImportDetailDialog.h"
46 using KeyType =
unsigned int;
48 static const KeyType SECRET_OR_PUBLIC_KEY = 0;
49 static const KeyType ONLY_SECRET_KEY = 1;
57 using InfoType =
unsigned int;
59 static constexpr InfoType ALL = ~0;
60 static constexpr InfoType TYPE = 1 << 0;
61 static constexpr InfoType NAME = 1 << 1;
62 static constexpr InfoType EmailAddress = 1 << 2;
63 static constexpr InfoType Usage = 1 << 3;
64 static constexpr InfoType Validity = 1 << 4;
65 static constexpr InfoType FingerPrint = 1 << 5;
73 using AbilityType =
unsigned int;
75 static constexpr AbilityType ALL = ~0;
76 static constexpr AbilityType NONE = 0;
77 static constexpr AbilityType REFRESH = 1 << 0;
78 static constexpr AbilityType SYNC_PUBLIC_KEY = 1 << 1;
79 static constexpr AbilityType UNCHECK_ALL = 1 << 3;
80 static constexpr AbilityType CHECK_ALL = 1 << 5;
88 QTableWidget* key_list_;
89 KeyListRow::KeyType select_type_;
90 KeyListColumn::InfoType info_type_;
91 std::vector<GpgKey> buffered_keys_;
92 std::function<bool(
const GpgKey&)> filter_;
93 KeyIdArgsListPtr checked_key_ids_;
104 QTableWidget* _key_list, KeyListRow::KeyType _select_type,
105 KeyListColumn::InfoType _info_type,
106 std::function<
bool(
const GpgKey&)> _filter = [](
const GpgKey&) ->
bool {
109 : key_list_(_key_list),
110 select_type_(_select_type),
111 info_type_(_info_type),
112 filter_(std::move(_filter)) {}
119 void Refresh(KeyLinkListPtr m_keys =
nullptr);
132 void UncheckALL()
const;
138 void CheckALL()
const;
162 explicit KeyList(KeyMenuAbility::AbilityType menu_ability,
163 QWidget* parent =
nullptr);
175 KeyListRow::KeyType selectType = KeyListRow::SECRET_OR_PUBLIC_KEY,
176 KeyListColumn::InfoType infoType = KeyListColumn::ALL,
177 const std::function<
bool(
const GpgKey&)>& filter =
178 [](
const GpgKey&) ->
bool {
return true; });
186 std::function<
void(
const GpgKey&, QWidget*)> action);
251 static void SetChecked(
const KeyIdArgsListPtr& keyIds,
273 [[maybe_unused]]
static void MarkKeys(QStringList* keyIds);
296 void SignalRefreshDatabase();
332 std::mutex buffered_key_list_mutex_;
334 std::shared_ptr<Ui_KeyList> ui_;
335 QTableWidget* m_key_list_{};
336 std::vector<KeyTable> m_key_tables_;
337 QMenu* popup_menu_{};
338 GpgFrontend::KeyLinkListPtr buffered_keys_list_;
339 std::function<void(
const GpgKey&, QWidget*)> m_action_ =
nullptr;
340 KeyMenuAbility::AbilityType menu_ability_ = KeyMenuAbility::ALL;
355 void slot_refresh_ui();
361 void slot_sync_with_key_server();
383 void dropEvent(QDropEvent* event)
override;
388 #endif // __KEYLIST_H__
Definition: VerifyDetailsDialog.cpp:33
KeyList(KeyMenuAbility::AbilityType menu_ability, QWidget *parent=nullptr)
Construct a new Key List object.
Definition: KeyList.cpp:43
KeyTable(QTableWidget *_key_list, KeyListRow::KeyType _select_type, KeyListColumn::InfoType _info_type, std::function< bool(const GpgKey &)> _filter=[](const GpgKey &) -> bool { return true;})
Construct a new Key Table object.
Definition: KeyList.h:103
void SyncSettings() noexcept
sync the settings to the file
Definition: GlobalSettingStation.cpp:33
static KeyListPtr GetKeysCopy(const KeyListPtr &keys)
Get the Keys Copy object.
Definition: GpgKeyGetter.cpp:97
void dragEnterEvent(QDragEnterEvent *event) override
Definition: KeyList.cpp:375
void SetColumnWidth(int row, int size)
Set the Column Width object.
Definition: KeyList.cpp:283
static GpgKeyGetter & GetInstance(int channel=GpgFrontend::GPGFRONTEND_DEFAULT_CHANNEL)
Get the Instance object.
Definition: GpgFunctionObject.h:57
std::string GetSelectedKey()
Get the Selected Key object.
Definition: KeyList.cpp:409
void dropEvent(QDropEvent *event) override
Definition: KeyList.cpp:303
libconfig::Setting & GetUISettings() noexcept
Definition: GlobalSettingStation.h:68
void SetChecked(KeyIdArgsListPtr key_ids)
Set the Checked object.
Definition: KeyList.cpp:240
void AddListGroupTab(const QString &name, KeyListRow::KeyType selectType=KeyListRow::SECRET_OR_PUBLIC_KEY, KeyListColumn::InfoType infoType=KeyListColumn::ALL, const std::function< bool(const GpgKey &)> &filter=[](const GpgKey &) -> bool { return true;})
Definition: KeyList.cpp:95
void SetChecked(KeyIdArgsListPtr key_ids)
Set the Checked object.
Definition: KeyList.cpp:513
void slot_double_clicked(const QModelIndex &index)
Definition: KeyList.cpp:393
KeyIdArgsListPtr GetAllPrivateKeys()
Get the All Private Keys object.
Definition: KeyList.cpp:196
KeyIdArgsListPtr GetChecked()
Get the Checked object.
Definition: KeyList.cpp:182
void Refresh(KeyLinkListPtr m_keys=nullptr)
Definition: KeyList.cpp:518
KeyLinkListPtr FetchKey()
Definition: GpgKeyGetter.cpp:58
void AddMenuAction(QAction *act)
Definition: KeyList.cpp:301
void import_keys(const QByteArray &inBuffer)
Definition: KeyList.cpp:386
Definition: KeyImportDetailDialog.h:42
KeyIdArgsListPtr & GetChecked()
Get the Checked object.
Definition: KeyList.cpp:498
bool ContainsPrivateKeys()
Definition: KeyList.cpp:271
KeyIdArgsListPtr GetSelected()
Get the Selected object.
Definition: KeyList.cpp:254
KeyIdArgsListPtr GetPrivateChecked()
Get the Private Checked object.
Definition: KeyList.cpp:210
void SetDoubleClickedAction(std::function< void(const GpgKey &, QWidget *)> action)
Set the Double Clicked Action object.
Definition: KeyList.cpp:404
void SlotImportKeyFromKeyServer(QWidget *parent)
Definition: UserInterfaceUtils.cpp:172
Definition: KeyList.h:152
static SignalStation * GetInstance()
Get the Instance object.
Definition: SignalStation.cpp:35
void SignalRefreshStatusBar(const QString &message, int timeout)
GpgImportInformation ImportKey(StdBypeArrayPtr inBuffer)
Definition: GpgKeyImportExporter.cpp:42
static void MarkKeys(QStringList *keyIds)
Definition: KeyList.cpp:382
GpgKey GetKey(const std::string &fpr)
Get the Key object.
Definition: GpgKeyGetter.cpp:38
std::unique_ptr< std::vector< GpgUID > > GetUIDs() const
Definition: GpgKey.cpp:163
void contextMenuEvent(QContextMenuEvent *event) override
Definition: KeyList.cpp:290
void SignalRefreshStatusBar(const QString &message, int timeout)