aboutsummaryrefslogtreecommitdiffstats
path: root/src/ui/widgets/KeyList.cpp
diff options
context:
space:
mode:
authorSaturneric <[email protected]>2021-05-28 19:21:46 +0000
committerSaturneric <[email protected]>2021-05-28 19:21:46 +0000
commita5c3aa5ceff300cad9203f3620f16920e726a762 (patch)
treebb375530f126f29746f4f4aa10985831beefec79 /src/ui/widgets/KeyList.cpp
parentAdjust part of the text of the UI interface of the UID operation tab. (diff)
downloadGpgFrontend-a5c3aa5ceff300cad9203f3620f16920e726a762.tar.gz
GpgFrontend-a5c3aa5ceff300cad9203f3620f16920e726a762.zip
Make eligible keys enter the signature candidate list.
Added delete UID interface and function. Added setting as the main UID function. Added the delete key signature menu and function (there is a problem). Improve the presentation of key list items Improve the page function of KeyList. Added pop-up menu for UID list operation on UIDTab interface. Signed-off-by: Saturneric <[email protected]>
Diffstat (limited to 'src/ui/widgets/KeyList.cpp')
-rw-r--r--src/ui/widgets/KeyList.cpp29
1 files changed, 21 insertions, 8 deletions
diff --git a/src/ui/widgets/KeyList.cpp b/src/ui/widgets/KeyList.cpp
index d8e4a094..2082bbc9 100644
--- a/src/ui/widgets/KeyList.cpp
+++ b/src/ui/widgets/KeyList.cpp
@@ -42,6 +42,7 @@ KeyList::KeyList(GpgME::GpgContext *ctx,
mKeyList->setShowGrid(false);
mKeyList->sortByColumn(2, Qt::AscendingOrder);
mKeyList->setSelectionBehavior(QAbstractItemView::SelectRows);
+ mKeyList->setSelectionMode( QAbstractItemView::SingleSelection );
// tableitems not editable
mKeyList->setEditTriggers(QAbstractItemView::NoEditTriggers);
@@ -105,16 +106,24 @@ void KeyList::slotRefresh()
int row_count = 0;
while (it != keys.end()) {
+ if(mFilter != nullptr) {
+ if(!mFilter(*it)) {
+ it = keys.erase(it);
+ continue;
+ }
+ }
if(!excluded_key_ids.isEmpty()){
- bool if_find = false;
- for(const auto &key_id : excluded_key_ids) {
- if(it->id == key_id) {
- it = keys.erase(it);
- if_find = true;
- break;
- }
+
+ auto iterator = std::find_if(excluded_key_ids.begin(), excluded_key_ids.end(),
+ [it] (const auto &key_id) -> bool {
+ if(it->id == key_id) return true;
+ else return false;
+ });
+
+ if(iterator != excluded_key_ids.end()) {
+ it = keys.erase(it);
+ continue;
}
- if(if_find) continue;
}
if (mSelectType == KeyListRow::ONLY_SECRET_KEY && !it->is_private_key) {
it = keys.erase(it);
@@ -423,3 +432,7 @@ void KeyList::setExcludeKeys(std::initializer_list<QString> key_ids) {
excluded_key_ids.push_back(key_id);
}
}
+
+void KeyList::setFilter(std::function<bool(const GpgKey &)> filter) {
+ this->mFilter = filter;
+}