aboutsummaryrefslogtreecommitdiffstats
path: root/src/m_key_server_sync/SearchKeyDialog.cpp
diff options
context:
space:
mode:
authorsaturneric <[email protected]>2026-05-09 16:04:02 +0200
committersaturneric <[email protected]>2026-05-09 16:04:02 +0200
commit7fd7445abbc250679d20040aecc2c54fe290c42a (patch)
tree6109d6678f82ff4f9f4ae883b6c547800c083515 /src/m_key_server_sync/SearchKeyDialog.cpp
parentfix(ver-check): avoid menu action use-after-free (diff)
downloadmodules-7fd7445abbc250679d20040aecc2c54fe290c42a.tar.gz
modules-7fd7445abbc250679d20040aecc2c54fe290c42a.zip
feat(key-server-sync): add fingerprint search flow
* Add an event-driven entry point to open the key search dialog with a preset fingerprint, improving UX when starting from key details * Normalize preset fingerprints (strip `0x` prefix and whitespace) and auto-select the fingerprint search type * Add SSL diagnostics logging to help troubleshoot HTTPS keyserver connectivity * Force fingerprint/keyid lookups to use Ubuntu’s keyserver for more consistent results across server URLs * Bump module version to 1.2.0
Diffstat (limited to 'src/m_key_server_sync/SearchKeyDialog.cpp')
-rw-r--r--src/m_key_server_sync/SearchKeyDialog.cpp36
1 files changed, 35 insertions, 1 deletions
diff --git a/src/m_key_server_sync/SearchKeyDialog.cpp b/src/m_key_server_sync/SearchKeyDialog.cpp
index 09da06b..ac0af95 100644
--- a/src/m_key_server_sync/SearchKeyDialog.cpp
+++ b/src/m_key_server_sync/SearchKeyDialog.cpp
@@ -39,7 +39,17 @@
#include "ui_SearchKeyDialog.h"
SearchKeyDialog::SearchKeyDialog(QWidget* parent)
- : ui_(SecureCreateSharedObject<Ui_SearchKeyDialog>()) {
+ : QDialog(parent), ui_(SecureCreateSharedObject<Ui_SearchKeyDialog>()) {
+ init_ui();
+}
+
+SearchKeyDialog::SearchKeyDialog(const QString& fingerprint, QWidget* parent)
+ : QDialog(parent), ui_(SecureCreateSharedObject<Ui_SearchKeyDialog>()) {
+ init_ui();
+ SetPresetFingerprint(fingerprint);
+}
+
+void SearchKeyDialog::init_ui() {
ui_->setupUi(this);
connect(ui_->searchButton, &QPushButton::clicked, this,
@@ -69,6 +79,30 @@ SearchKeyDialog::SearchKeyDialog(QWidget* parent)
ui_->keyServerComboBox->setCurrentIndex(0);
}
+void SearchKeyDialog::SetPresetFingerprint(const QString& fingerprint) {
+ auto fpr = fingerprint.trimmed();
+
+ if (fpr.startsWith("0x", Qt::CaseInsensitive)) {
+ fpr = fpr.mid(2);
+ }
+
+ fpr.remove(QRegularExpression(R"(\s+)"));
+
+ set_search_type("fpr");
+ ui_->searchEdit->setText(fpr);
+ ui_->searchEdit->selectAll();
+ ui_->searchEdit->setFocus();
+
+ slot_set_error_message("");
+}
+
+void SearchKeyDialog::set_search_type(const QString& type) {
+ const auto index = ui_->searchTypeComboBox->findData(type);
+ if (index >= 0) {
+ ui_->searchTypeComboBox->setCurrentIndex(index);
+ }
+}
+
void SearchKeyDialog::slot_search() {
if (ui_->searchEdit->text().isEmpty()) {
slot_set_error_message(tr("Search value is empty."));