aboutsummaryrefslogtreecommitdiffstats
path: root/src/ui/widgets/KeyList.h
diff options
context:
space:
mode:
authorSaturn&Eric <[email protected]>2022-01-05 20:02:19 +0000
committerGitHub <[email protected]>2022-01-05 20:02:19 +0000
commita3ca1bf1d4404327d68d3d49127085638c272152 (patch)
treedeb10c33977e5002fa6e9b434f2b07d2719a4e31 /src/ui/widgets/KeyList.h
parentMerge pull request #37 from saturneric/document (diff)
parent<doc>(navbar): take repository and GitHub apart. (diff)
downloadGpgFrontend-a3ca1bf1d4404327d68d3d49127085638c272152.tar.gz
GpgFrontend-a3ca1bf1d4404327d68d3d49127085638c272152.zip
Merge pull request #36 from saturneric/developv2.0.4
v2.0.4
Diffstat (limited to 'src/ui/widgets/KeyList.h')
-rw-r--r--src/ui/widgets/KeyList.h29
1 files changed, 24 insertions, 5 deletions
diff --git a/src/ui/widgets/KeyList.h b/src/ui/widgets/KeyList.h
index 617bb274..4b41decd 100644
--- a/src/ui/widgets/KeyList.h
+++ b/src/ui/widgets/KeyList.h
@@ -53,12 +53,24 @@ struct KeyListColumn {
static constexpr InfoType FingerPrint = 1 << 5;
};
+struct KeyMenuAbility {
+ using AbilityType = unsigned int;
+
+ static constexpr AbilityType ALL = ~0;
+ static constexpr AbilityType NONE = 0;
+ static constexpr AbilityType REFRESH = 1 << 0;
+ static constexpr AbilityType SYNC_PUBLIC_KEY = 1 << 1;
+ static constexpr AbilityType UNCHECK_ALL = 1 << 3;
+ static constexpr AbilityType CHECK_ALL = 1 << 5;
+};
+
struct KeyTable {
QTableWidget* key_list;
KeyListRow::KeyType select_type;
KeyListColumn::InfoType info_type;
std::vector<GpgKey> buffered_keys;
std::function<bool(const GpgKey&)> filter;
+ KeyIdArgsListPtr checked_key_ids_;
KeyTable(
QTableWidget* _key_list, KeyListRow::KeyType _select_type,
@@ -73,16 +85,21 @@ struct KeyTable {
void Refresh(KeyLinkListPtr m_keys = nullptr);
- KeyIdArgsListPtr GetChecked();
+ KeyIdArgsListPtr& GetChecked();
+
+ void UncheckALL() const;
+
+ void CheckALL() const;
- void SetChecked(const KeyIdArgsListPtr& key_ids);
+ void SetChecked(KeyIdArgsListPtr key_ids);
};
class KeyList : public QWidget {
Q_OBJECT
public:
- explicit KeyList(bool menu, QWidget* parent = nullptr);
+ explicit KeyList(KeyMenuAbility::AbilityType menu_ability,
+ QWidget* parent = nullptr);
void addListGroupTab(
const QString& name,
@@ -102,7 +119,7 @@ class KeyList : public QWidget {
static KeyIdArgsListPtr getChecked(const KeyTable& key_table);
KeyIdArgsListPtr getPrivateChecked();
KeyIdArgsListPtr getAllPrivateKeys();
- void setChecked(const KeyIdArgsListPtr& keyIds);
+ void setChecked(KeyIdArgsListPtr key_ids);
static void setChecked(const KeyIdArgsListPtr& keyIds,
const KeyTable& key_table);
KeyIdArgsListPtr getSelected();
@@ -123,6 +140,8 @@ class KeyList : public QWidget {
private:
void init();
void importKeys(const QByteArray& inBuffer);
+ void slotUncheckALL();
+ void slotCheckALL();
static int key_list_id;
int _m_key_list_id;
@@ -134,7 +153,7 @@ class KeyList : public QWidget {
QMenu* popupMenu{};
GpgFrontend::KeyLinkListPtr _buffered_keys_list;
std::function<void(const GpgKey&, QWidget*)> mAction = nullptr;
- bool menu_status = false;
+ KeyMenuAbility::AbilityType menu_ability_ = KeyMenuAbility::ALL;
private slots: