aboutsummaryrefslogtreecommitdiffstats
path: root/src/core/model/GpgKeyTreeModel.cpp
diff options
context:
space:
mode:
authorsaturneric <[email protected]>2025-04-19 01:39:02 +0000
committersaturneric <[email protected]>2025-04-19 02:17:36 +0000
commitbe1f218314242fdf7c0fac76d32e2b9f16b5b6fe (patch)
tree2a56f13ca42170fab7837d03921155f621ad764b /src/core/model/GpgKeyTreeModel.cpp
parentfix: find pinentry under /app/bin in flatpak container (diff)
downloadGpgFrontend-be1f218314242fdf7c0fac76d32e2b9f16b5b6fe.tar.gz
GpgFrontend-be1f218314242fdf7c0fac76d32e2b9f16b5b6fe.zip
fix: find out adsk problem of flatpak
Diffstat (limited to '')
-rw-r--r--src/core/model/GpgKeyTreeModel.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/core/model/GpgKeyTreeModel.cpp b/src/core/model/GpgKeyTreeModel.cpp
index f521e8c9..0f5fbd25 100644
--- a/src/core/model/GpgKeyTreeModel.cpp
+++ b/src/core/model/GpgKeyTreeModel.cpp
@@ -222,9 +222,13 @@ auto GpgKeyTreeModel::create_gpg_key_tree_items(const GpgAbstractKeyPtr &key)
auto i_key = QSharedPointer<GpgKeyTreeItem>::create(key, columns);
i_key->SetEnable(true);
i_key->SetCheckable(checkable_detector_(i_key->Key()));
+ i_key->SetChecked(false);
cached_items_.push_back(i_key);
for (const auto &s_key : g_key->SubKeys()) {
+ // avoid bugs due to duplicate key ids
+ if (g_key->ID() == s_key.ID() || s_key.IsADSK()) continue;
+
QVariantList columns;
columns << "/";
columns << (s_key.IsHasCertCap() ? "primary" : "sub");
@@ -239,6 +243,7 @@ auto GpgKeyTreeModel::create_gpg_key_tree_items(const GpgAbstractKeyPtr &key)
QSharedPointer<GpgSubKey>::create(s_key), columns);
i_s_key->SetEnable(true);
i_s_key->SetCheckable(checkable_detector_(i_s_key->Key()));
+ i_s_key->SetChecked(false);
i_key->AppendChild(i_s_key);
cached_items_.push_back(i_s_key);
}
@@ -254,6 +259,10 @@ auto GpgKeyTreeModel::GetAllCheckedSubKey() -> QContainer<GpgSubKey> {
continue;
}
+ LOG_D() << "subkey checked: " << i->Key()->ID()
+ << "uid: " << i->Key()->UID() << "checkable: " << i->Checkable()
+ << "checked: " << i->Checked();
+
auto *s_key = dynamic_cast<GpgSubKey *>(i->Key());
if (s_key == nullptr) continue;
@@ -267,6 +276,7 @@ auto GpgKeyTreeModel::GetKeyByIndex(QModelIndex index) -> GpgAbstractKey * {
const auto *item =
static_cast<const GpgKeyTreeItem *>(index.internalPointer());
+ assert(item != nullptr);
return item->Key();
}