[PATCH] efl: convert pinentry description to markup

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH] efl: convert pinentry description to markup

Bertrand Jacquin
elm_object_text_set() is expecting markup text as input, leading all \n
to not be displayed as new line, making the EFL pinentry box more
difficult to read
---
 efl/pinentry-efl.c | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/efl/pinentry-efl.c b/efl/pinentry-efl.c
index ca9969365dd9..f1fb8b8149f8 100644
--- a/efl/pinentry-efl.c
+++ b/efl/pinentry-efl.c
@@ -249,8 +249,8 @@ create_window (void)
 
   if (pinentry->title)
     {
-      txt = pinentry_utf8_to_local (pinentry->lc_ctype,
-                                    pinentry->title);
+      txt = elm_entry_utf8_to_markup(pinentry_utf8_to_local (pinentry->lc_ctype,
+                                                             pinentry->title));
       elm_win_title_set ( win, txt );
       free (txt);
     }
@@ -263,7 +263,7 @@ create_window (void)
 
       obj = elm_label_add(table);
       elm_label_line_wrap_set (obj, ELM_WRAP_WORD);
-      txt = pinentry_utf8_to_local (pinentry->lc_ctype, pinentry->description);
+      txt = elm_entry_utf8_to_markup(pinentry_utf8_to_local (pinentry->lc_ctype, pinentry->description));
       len = strlen(txt)+20; // 20 chars for align tag
       aligned = calloc(len+1,sizeof(char));
       if(aligned)
@@ -284,7 +284,7 @@ create_window (void)
     {
     /* Error Label */
     if (pinentry->error)
-        txt = pinentry_utf8_to_local (pinentry->lc_ctype, pinentry->error);
+        txt = elm_entry_utf8_to_markup(pinentry_utf8_to_local (pinentry->lc_ctype, pinentry->error));
       else
         txt = "";
       obj = elm_label_add(table);
@@ -312,7 +312,7 @@ create_window (void)
       {
         /* Entry/Prompt Label */
         obj = elm_label_add(table);
-        txt = pinentry_utf8_to_local (pinentry->lc_ctype, pinentry->prompt);
+        txt = elm_entry_utf8_to_markup(pinentry_utf8_to_local (pinentry->lc_ctype, pinentry->prompt));
         elm_object_text_set(obj,txt);
         free (txt);
         evas_object_size_hint_weight_set(obj, 0, EVAS_HINT_EXPAND);
@@ -356,8 +356,8 @@ create_window (void)
  {
           /* Quality Bar Label */
   obj = elm_label_add(table);
-          txt = pinentry_utf8_to_local (pinentry->lc_ctype,
-                                        pinentry->quality_bar);
+          txt = elm_entry_utf8_to_markup(pinentry_utf8_to_local (pinentry->lc_ctype,
+                                                                 pinentry->quality_bar));
           elm_object_text_set(obj,txt);
           free (txt);
           evas_object_size_hint_weight_set(obj, 0, EVAS_HINT_EXPAND);
@@ -381,8 +381,8 @@ create_window (void)
         {
           /* Repeat Label */
   obj = elm_label_add(table);
-          txt = pinentry_utf8_to_local (pinentry->lc_ctype,
-                                        pinentry->repeat_passphrase);
+          txt = elm_entry_utf8_to_markup(pinentry_utf8_to_local (pinentry->lc_ctype,
+                                                                 pinentry->repeat_passphrase));
           elm_object_text_set(obj,txt);
           free (txt);
           evas_object_size_hint_weight_set(obj, 0, EVAS_HINT_EXPAND);
@@ -440,10 +440,10 @@ create_window (void)
       if (pinentry->cancel || pinentry->default_cancel)
         {
           if(pinentry->cancel)
-            txt = pinentry_utf8_to_local (pinentry->lc_ctype, pinentry->cancel);
+            txt = elm_entry_utf8_to_markup(pinentry_utf8_to_local (pinentry->lc_ctype, pinentry->cancel));
           else
-            txt = pinentry_utf8_to_local (pinentry->lc_ctype,
-                                          pinentry->default_cancel);
+            txt = elm_entry_utf8_to_markup(pinentry_utf8_to_local (pinentry->lc_ctype,
+                                                                   pinentry->default_cancel));
           if(txt[0]=='_')
             elm_object_text_set(obj,txt+1);
           else
@@ -488,9 +488,9 @@ create_window (void)
   if (pinentry->ok || pinentry->default_ok)
     {
       if(pinentry->ok)
-        txt = pinentry_utf8_to_local (pinentry->lc_ctype, pinentry->ok);
+        txt = elm_entry_utf8_to_markup(pinentry_utf8_to_local (pinentry->lc_ctype, pinentry->ok));
       else
-        txt = pinentry_utf8_to_local (pinentry->lc_ctype, pinentry->default_ok);
+        txt = elm_entry_utf8_to_markup(pinentry_utf8_to_local (pinentry->lc_ctype, pinentry->default_ok));
       if(txt[0]=='_')
         elm_object_text_set(obj,txt+1);
       else

_______________________________________________
Gnupg-devel mailing list
[hidden email]
http://lists.gnupg.org/mailman/listinfo/gnupg-devel
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] efl: convert pinentry description to markup

GnuPG - Dev mailing list
Hi,

On Sat, Feb 13, 2021 at 03:37:54PM +0000, Bertrand Jacquin wrote:
>+      txt = elm_entry_utf8_to_markup(pinentry_utf8_to_local
>(pinentry->lc_ctype, pinentry->title));

Not familiar with EFL, but shouldn’t it be the other way around? If the
elm_entry_utf8_to_markup function expects UTF8 input (as the name
implies), calling it *after* pinentry_utf8_to_local doesn’t look right…

It seems to me that you should first convert to markup (which leaves the
string in the original UTF-8 encoding), and *then* convert to the local
encoding.

Cheers,

- Damien

_______________________________________________
Gnupg-devel mailing list
[hidden email]
http://lists.gnupg.org/mailman/listinfo/gnupg-devel

signature.asc (235 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] efl: convert pinentry description to markup

Bertrand Jacquin
Hi

On Monday, February 15 2021 at 12:27:56 +0000, Damien Goutte-Gattat wrote:
> Hi,
>
> On Sat, Feb 13, 2021 at 03:37:54PM +0000, Bertrand Jacquin wrote:
> >+      txt = elm_entry_utf8_to_markup(pinentry_utf8_to_local
> >(pinentry->lc_ctype, pinentry->title));
>
> Not familiar with EFL, but shouldn’t it be the other way around? If the
> elm_entry_utf8_to_markup function expects UTF8 input (as the name
> implies), calling it *after* pinentry_utf8_to_local doesn’t look right…

pinentry->description is inherited from SETDESC send by gpg-agent to
pinentry. SETDESC content is defined from i18n_localegettext() which
assume UTF-8 is used for encoding, however since this function a wrapper
around gettext(), the encoding of libgpg-error .po file is authoritative
here (which all are in git master).

Which means, indeed there is no need to perform pinentry_utf8_to_local()
at all since elm_entry_utf8_to_markup() is indeed expecting all input to
be UTF-8 which we have guaranteed.

Please find attached an updated patch, no change in behaviour.

Cheers,
Bertrand

--
Bertrand

_______________________________________________
Gnupg-devel mailing list
[hidden email]
http://lists.gnupg.org/mailman/listinfo/gnupg-devel

0001-efl-convert-pinentry-description-to-markup.patch (4K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] efl: convert pinentry description to markup

GnuPG - Dev mailing list
Hi,

On Tue, Feb 16, 2021 at 12:09:28AM +0000, Bertrand Jacquin wrote:
>Please find attached an updated patch, no change in behaviour.

Looks good, merged. Thanks!

Cheers,

- Damien

_______________________________________________
Gnupg-devel mailing list
[hidden email]
http://lists.gnupg.org/mailman/listinfo/gnupg-devel

signature.asc (235 bytes) Download Attachment