From 7c2ea76c63968696ed0313a73845d503cba9bb69 Mon Sep 17 00:00:00 2001 From: Pierre-Olivier Mercier Date: Thu, 9 Apr 2026 12:03:23 +0700 Subject: [PATCH] ui/wifi_auth: surface security label in passphrase prompt wifi_auth_prompt now takes an optional human-readable security string ("WPA", "WEP", ...) shown above the entry, so the user knows what kind of credential is being asked for. Popup passes the network's security type when issuing the prompt. Co-Authored-By: Claude Opus 4.6 (1M context) --- src/e_mod_popup.c | 13 ++++++++++++- src/ui/wifi_auth.c | 12 ++++++++++++ src/ui/wifi_auth.h | 7 +++++-- 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/src/e_mod_popup.c b/src/e_mod_popup.c index 4062fe3..99f7aaf 100644 --- a/src/e_mod_popup.c +++ b/src/e_mod_popup.c @@ -190,7 +190,18 @@ _on_passphrase_request(void *data EINA_UNUSED, Iwd_Agent_Request *req, const cha if (n && n->ssid) ssid = n->ssid; } } - wifi_auth_prompt(_popup ? _popup->box : e_comp->elm, ssid, _on_auth_done, NULL); + const char *sec = NULL; + if (e_iwd && e_iwd->manager) + { + const Eina_Hash *h = iwd_manager_networks(e_iwd->manager); + if (h) + { + Iwd_Network *n = eina_hash_find(h, netpath); + if (n) sec = _sec_label(n->security); + } + } + wifi_auth_prompt(_popup ? _popup->box : e_comp->elm, ssid, sec, + _on_auth_done, NULL); } /* ----- popup lifecycle ------------------------------------------------- */ diff --git a/src/ui/wifi_auth.c b/src/ui/wifi_auth.c index f5e8842..8fdb1e5 100644 --- a/src/ui/wifi_auth.c +++ b/src/ui/wifi_auth.c @@ -43,6 +43,7 @@ _on_del(void *data, Evas *e EINA_UNUSED, Evas_Object *o EINA_UNUSED, void *ev EI Evas_Object * wifi_auth_prompt(Evas_Object *parent EINA_UNUSED, const char *ssid, + const char *security, Wifi_Auth_Cb cb, void *data) { Auth_Ctx *c = calloc(1, sizeof(*c)); @@ -71,6 +72,17 @@ wifi_auth_prompt(Evas_Object *parent EINA_UNUSED, const char *ssid, Evas_Object *box = elm_box_add(p); elm_box_padding_set(box, 0, 6); + if (security && *security) + { + char buf[128]; + snprintf(buf, sizeof(buf), "Security: %s", security); + Evas_Object *lbl = elm_label_add(box); + elm_object_text_set(lbl, buf); + evas_object_size_hint_align_set(lbl, 0.0, 0.5); + elm_box_pack_end(box, lbl); + evas_object_show(lbl); + } + Evas_Object *entry = elm_entry_add(box); elm_entry_single_line_set(entry, EINA_TRUE); elm_entry_password_set(entry, EINA_TRUE); diff --git a/src/ui/wifi_auth.h b/src/ui/wifi_auth.h index 19a738b..684cdf2 100644 --- a/src/ui/wifi_auth.h +++ b/src/ui/wifi_auth.h @@ -5,9 +5,12 @@ typedef void (*Wifi_Auth_Cb)(void *data, const char *passphrase, Eina_Bool ok); -/* Show a modal passphrase dialog. cb is called exactly once with ok=EINA_TRUE - * + passphrase, or ok=EINA_FALSE on cancel. The dialog destroys itself. */ +/* Show a modal passphrase dialog. security is an optional human label + * (e.g. "WPA", "WEP") shown alongside the SSID; pass NULL to omit it. + * cb is called exactly once with ok=EINA_TRUE + passphrase, or + * ok=EINA_FALSE on cancel. The dialog destroys itself. */ Evas_Object *wifi_auth_prompt(Evas_Object *parent, const char *ssid, + const char *security, Wifi_Auth_Cb cb, void *data); #endif