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) <noreply@anthropic.com>
This commit is contained in:
parent
dcf0fd00a0
commit
7c2ea76c63
3 changed files with 29 additions and 3 deletions
|
|
@ -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 ------------------------------------------------- */
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue