diff options
author | Saturneric <[email protected]> | 2021-05-26 18:56:05 +0000 |
---|---|---|
committer | Saturneric <[email protected]> | 2021-05-26 18:56:05 +0000 |
commit | 2f1b0b6af6c7c21134030d990a36f458d8a9600e (patch) | |
tree | e1ee1f16a0a03fe341156d2e1db3e42015fffce6 /src/ui/widgets/KeyList.cpp | |
parent | Improve the key information update mechanism (diff) | |
download | GpgFrontend-2f1b0b6af6c7c21134030d990a36f458d8a9600e.tar.gz GpgFrontend-2f1b0b6af6c7c21134030d990a36f458d8a9600e.zip |
Fix the wrong use of the signing key interface.
Fix the problem that the window or control is not deleted after it is closed.
Modify the names of some classes.
Extend the function of KeyList, add exclusion list.
Improve the message mechanism of GpgContext.
Fix the problem caused by incorrect API calls caused by incorrect understanding of the gpgme document.
Signed-off-by: Saturneric <[email protected]>
Diffstat (limited to 'src/ui/widgets/KeyList.cpp')
-rw-r--r-- | src/ui/widgets/KeyList.cpp | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/src/ui/widgets/KeyList.cpp b/src/ui/widgets/KeyList.cpp index 0e59c9a0..d8e4a094 100644 --- a/src/ui/widgets/KeyList.cpp +++ b/src/ui/widgets/KeyList.cpp @@ -85,7 +85,7 @@ KeyList::KeyList(GpgME::GpgContext *ctx, setLayout(layout); popupMenu = new QMenu(this); - connect(mCtx, SIGNAL(signalKeyDBChanged()), this, SLOT(slotRefresh())); + connect(mCtx, SIGNAL(signalKeyInfoChanged()), this, SLOT(slotRefresh())); setAcceptDrops(true); slotRefresh(); } @@ -105,6 +105,17 @@ void KeyList::slotRefresh() int row_count = 0; while (it != keys.end()) { + 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; + } + } + if(if_find) continue; + } if (mSelectType == KeyListRow::ONLY_SECRET_KEY && !it->is_private_key) { it = keys.erase(it); continue; @@ -398,12 +409,17 @@ void KeyList::uploadFinished() } void KeyList::getCheckedKeys(QVector<GpgKey> &keys) { - keys.clear(); - for (int i = 0; i < mKeyList->rowCount(); i++) { if (mKeyList->item(i, 0)->checkState() == Qt::Checked) { keys.push_back(buffered_keys[i]); } } } + +void KeyList::setExcludeKeys(std::initializer_list<QString> key_ids) { + excluded_key_ids.clear(); + for(auto &key_id : key_ids) { + excluded_key_ids.push_back(key_id); + } +} |