aboutsummaryrefslogtreecommitdiffstats
path: root/src/ui/dialog/keypair_details/KeyPairUIDTab.cpp
diff options
context:
space:
mode:
authorsaturneric <[email protected]>2024-10-26 13:43:14 +0000
committersaturneric <[email protected]>2024-10-26 13:43:14 +0000
commit24c28eb752aa611dd1670f3fa7ab6b358b052f1b (patch)
tree6a4f9af003fa4a86b7d7e29a965e37a231951092 /src/ui/dialog/keypair_details/KeyPairUIDTab.cpp
parentfix: thread concurrent crash issue (diff)
downloadGpgFrontend-24c28eb752aa611dd1670f3fa7ab6b358b052f1b.tar.gz
GpgFrontend-24c28eb752aa611dd1670f3fa7ab6b358b052f1b.zip
fix: test basic operations of multi key db and solve issues
Diffstat (limited to 'src/ui/dialog/keypair_details/KeyPairUIDTab.cpp')
-rw-r--r--src/ui/dialog/keypair_details/KeyPairUIDTab.cpp28
1 files changed, 19 insertions, 9 deletions
diff --git a/src/ui/dialog/keypair_details/KeyPairUIDTab.cpp b/src/ui/dialog/keypair_details/KeyPairUIDTab.cpp
index f45e1799..4846f58a 100644
--- a/src/ui/dialog/keypair_details/KeyPairUIDTab.cpp
+++ b/src/ui/dialog/keypair_details/KeyPairUIDTab.cpp
@@ -37,8 +37,14 @@
namespace GpgFrontend::UI {
-KeyPairUIDTab::KeyPairUIDTab(const QString& key_id, QWidget* parent)
- : QWidget(parent), m_key_(GpgKeyGetter::GetInstance().GetKey(key_id)) {
+KeyPairUIDTab::KeyPairUIDTab(int channel, const QString& key_id,
+ QWidget* parent)
+ : QWidget(parent),
+ current_gpg_context_channel_(channel),
+ m_key_(GpgKeyGetter::GetInstance(current_gpg_context_channel_)
+ .GetKey(key_id)) {
+ assert(m_key_.IsGood());
+
create_uid_list();
create_sign_list();
create_manage_uid_menu();
@@ -306,8 +312,8 @@ void KeyPairUIDTab::slot_add_sign() {
return;
}
- auto* key_sign_dialog =
- new KeyUIDSignDialog(m_key_, std::move(selected_uids), this);
+ auto* key_sign_dialog = new KeyUIDSignDialog(
+ current_gpg_context_channel_, m_key_, std::move(selected_uids), this);
key_sign_dialog->show();
}
@@ -337,7 +343,8 @@ void KeyPairUIDTab::create_manage_uid_menu() {
}
void KeyPairUIDTab::slot_add_uid() {
- auto* key_new_uid_dialog = new KeyNewUIDDialog(m_key_.GetId(), this);
+ auto* key_new_uid_dialog =
+ new KeyNewUIDDialog(current_gpg_context_channel_, m_key_.GetId(), this);
connect(key_new_uid_dialog, &KeyNewUIDDialog::finished, this,
&KeyPairUIDTab::slot_add_uid_result);
connect(key_new_uid_dialog, &KeyNewUIDDialog::finished, key_new_uid_dialog,
@@ -484,8 +491,8 @@ void KeyPairUIDTab::slot_add_sign_single() {
return;
}
- auto* key_sign_dialog =
- new KeyUIDSignDialog(m_key_, std::move(selected_uids), this);
+ auto* key_sign_dialog = new KeyUIDSignDialog(
+ current_gpg_context_channel_, m_key_, std::move(selected_uids), this);
key_sign_dialog->show();
}
@@ -541,7 +548,7 @@ void KeyPairUIDTab::slot_del_sign() {
return;
}
- if (!GpgKeyGetter::GetInstance()
+ if (!GpgKeyGetter::GetInstance(current_gpg_context_channel_)
.GetKey(selected_signs->front().first)
.IsGood()) {
QMessageBox::critical(
@@ -573,7 +580,10 @@ void KeyPairUIDTab::slot_del_sign() {
}
void KeyPairUIDTab::slot_refresh_key() {
// refresh the key
- GpgKey refreshed_key = GpgKeyGetter::GetInstance().GetKey(m_key_.GetId());
+ GpgKey refreshed_key = GpgKeyGetter::GetInstance(current_gpg_context_channel_)
+ .GetKey(m_key_.GetId());
+ assert(refreshed_key.IsGood());
+
std::swap(this->m_key_, refreshed_key);
this->slot_refresh_uid_list();