aboutsummaryrefslogtreecommitdiffstats
path: root/src/m_key_server_sync
diff options
context:
space:
mode:
authorsaturneric <[email protected]>2026-07-23 21:08:38 +0200
committersaturneric <[email protected]>2026-07-23 21:08:38 +0200
commit21ffe3f37272196bc38dbe2fd6c7cc536fbd801e (patch)
tree7d82ede250d942d22ba5e558bfda3ef4a9e0be74 /src/m_key_server_sync
parentfeat(keyserver): improve keyserver search and dialog UX (diff)
downloadmodules-21ffe3f37272196bc38dbe2fd6c7cc536fbd801e.tar.gz
modules-21ffe3f37272196bc38dbe2fd6c7cc536fbd801e.zip
feat(keyserver): show info for empty searches
- add slot_set_info_message to show neutral (non-red) notices - treat HKP 404 (ContentNotFoundError) as no-keys info - clear and reset table rows before populating results - return early on empty key lists to avoid alarmist errors - add slot declaration in header
Diffstat (limited to 'src/m_key_server_sync')
-rw-r--r--src/m_key_server_sync/SearchKeyDialog.cpp19
-rw-r--r--src/m_key_server_sync/SearchKeyDialog.h1
2 files changed, 20 insertions, 0 deletions
diff --git a/src/m_key_server_sync/SearchKeyDialog.cpp b/src/m_key_server_sync/SearchKeyDialog.cpp
index 93ee703..8e42515 100644
--- a/src/m_key_server_sync/SearchKeyDialog.cpp
+++ b/src/m_key_server_sync/SearchKeyDialog.cpp
@@ -204,6 +204,11 @@ void SearchKeyDialog::slot_set_error_message(const QString& message) {
ui_->errorLabel->setText("<h4 style='color:red;'>" + message + "</h4>");
}
+void SearchKeyDialog::slot_set_info_message(const QString& message) {
+ // Neutral (non-red) status line for benign outcomes such as an empty result.
+ ui_->errorLabel->setText("<h4>" + message + "</h4>");
+}
+
void SearchKeyDialog::slot_set_loading(bool loading) {
ui_->progressBar->setVisible(loading);
ui_->searchButton->setDisabled(loading);
@@ -216,14 +221,28 @@ void SearchKeyDialog::slot_search_finished_pks(
QNetworkReply::NetworkError error, const QString& error_string,
const QList<KeyServerKeyInfo>& keys) {
ui_->tableWidget->clearContents();
+ ui_->tableWidget->setRowCount(0);
slot_set_error_message("");
slot_set_loading(false);
+ // HKP keyservers answer /pks/lookup with 404 (ContentNotFoundError) when the
+ // search matched no keys. That is an empty result, not a transfer failure, so
+ // show a plain notice instead of the alarming raw transport error + URL.
+ if (error == QNetworkReply::ContentNotFoundError) {
+ slot_set_info_message(tr("No keys found matching your search."));
+ return;
+ }
+
if (error != QNetworkReply::NoError) {
slot_set_error_message(error_string);
return;
}
+ if (keys.isEmpty()) {
+ slot_set_info_message(tr("No keys found matching your search."));
+ return;
+ }
+
ui_->tableWidget->setRowCount(static_cast<int>(keys.size()));
int row = 0;
diff --git a/src/m_key_server_sync/SearchKeyDialog.h b/src/m_key_server_sync/SearchKeyDialog.h
index d493d5f..30b8879 100644
--- a/src/m_key_server_sync/SearchKeyDialog.h
+++ b/src/m_key_server_sync/SearchKeyDialog.h
@@ -47,6 +47,7 @@ class SearchKeyDialog : public QDialog {
private slots:
void slot_search();
void slot_set_error_message(const QString& message);
+ void slot_set_info_message(const QString& message);
void slot_set_loading(bool loading);
void slot_search_finished_pks(QNetworkReply::NetworkError error,