[evolution] I#1787 - Hint when user name contains non-ASCII letters



commit a6403fe45566825dccbfbf8aa137604c458a4115
Author: Milan Crha <mcrha redhat com>
Date:   Fri Feb 11 13:32:21 2022 +0100

    I#1787 - Hint when user name contains non-ASCII letters
    
    Closes https://gitlab.gnome.org/GNOME/evolution/-/issues/1787

 src/e-util/e-collection-account-wizard.c           | 28 ++++++++++++++++++----
 .../evolution-book-config-google.c                 |  4 +++-
 .../book-config-ldap/evolution-book-config-ldap.c  |  4 +++-
 .../cal-config-google/e-cal-config-google.c        |  4 +++-
 .../cal-config-google/e-cal-config-gtasks.c        |  4 +++-
 .../mail-config/e-mail-config-remote-accounts.c    |  4 +++-
 .../mail-config/e-mail-config-smtp-backend.c       |  5 +++-
 7 files changed, 43 insertions(+), 10 deletions(-)
---
diff --git a/src/e-util/e-collection-account-wizard.c b/src/e-util/e-collection-account-wizard.c
index b1581f5b8f..b691945111 100644
--- a/src/e-util/e-collection-account-wizard.c
+++ b/src/e-util/e-collection-account-wizard.c
@@ -658,6 +658,15 @@ collection_account_wizard_try_again_clicked_cb (GtkButton *button,
        gtk_widget_hide (ppd->popover);
 }
 
+static void
+collection_account_wizard_update_entry_hint (GtkWidget *entry)
+{
+       const gchar *user = gtk_entry_get_text (GTK_ENTRY (entry));
+
+       e_util_set_entry_issue_hint (entry, (!user || !*user || camel_string_is_all_ascii (user)) ? NULL :
+               _("User name contains letters, which can prevent log in. Make sure the server accepts such 
written user name."));
+}
+
 static void
 collection_account_wizard_show_password_prompt (ECollectionAccountWizard *wizard,
                                                EConfigLookupWorker *worker,
@@ -688,6 +697,9 @@ collection_account_wizard_show_password_prompt (ECollectionAccountWizard *wizard
        gtk_grid_attach (grid, widget, 1, 0, 1, 1);
        user_entry = widget;
 
+       g_signal_connect (user_entry, "changed",
+               G_CALLBACK (collection_account_wizard_update_entry_hint), NULL);
+
        widget = gtk_label_new_with_mnemonic (_("_Password:"));
        gtk_widget_set_halign (widget, GTK_ALIGN_END);
        gtk_grid_attach (grid, widget, 0, 1, 1, 1);
@@ -1561,6 +1573,17 @@ collection_account_wizard_finish_cancel_clicked_cb (GtkButton *button,
                g_cancellable_cancel (wizard->priv->finish_cancellable);
 }
 
+static void
+collection_account_wizard_email_entry_changed (ECollectionAccountWizard *wizard,
+                                              GtkWidget *entry)
+{
+
+       collection_account_wizard_notify_can_run (G_OBJECT (wizard));
+       collection_account_wizard_mark_changed (wizard);
+
+       collection_account_wizard_update_entry_hint (entry);
+}
+
 static void
 collection_account_wizard_set_registry (ECollectionAccountWizard *wizard,
                                        ESourceRegistry *registry)
@@ -1714,10 +1737,7 @@ collection_account_wizard_constructed (GObject *object)
        gtk_grid_attach (grid, widget, 1, 0, 1, 1);
 
        g_signal_connect_swapped (wizard->priv->email_entry, "changed",
-               G_CALLBACK (collection_account_wizard_notify_can_run), wizard);
-
-       g_signal_connect_swapped (wizard->priv->email_entry, "changed",
-               G_CALLBACK (collection_account_wizard_mark_changed), wizard);
+               G_CALLBACK (collection_account_wizard_email_entry_changed), wizard);
 
        expander = gtk_expander_new_with_mnemonic (_("_Advanced Options"));
        gtk_widget_show (expander);
diff --git a/src/modules/book-config-google/evolution-book-config-google.c 
b/src/modules/book-config-google/evolution-book-config-google.c
index 850c502ab3..6a794a3df7 100644
--- a/src/modules/book-config-google/evolution-book-config-google.c
+++ b/src/modules/book-config-google/evolution-book-config-google.c
@@ -97,7 +97,9 @@ book_config_google_check_complete (ESourceConfigBackend *backend,
 
        correct = user != NULL && *user != '\0';
 
-       e_util_set_entry_issue_hint (context->user_entry, correct ? NULL : _("User name cannot be empty"));
+       e_util_set_entry_issue_hint (context->user_entry, correct ?
+               (camel_string_is_all_ascii (user) ? NULL : _("User name contains letters, which can prevent 
log in. Make sure the server accepts such written user name."))
+               : _("User name cannot be empty"));
 
        return correct;
 }
diff --git a/src/modules/book-config-ldap/evolution-book-config-ldap.c 
b/src/modules/book-config-ldap/evolution-book-config-ldap.c
index 1d3015d8ba..3896fd2669 100644
--- a/src/modules/book-config-ldap/evolution-book-config-ldap.c
+++ b/src/modules/book-config-ldap/evolution-book-config-ldap.c
@@ -1066,7 +1066,9 @@ book_config_ldap_check_complete (ESourceConfigBackend *backend,
 
        complete = complete && correct;
 
-       e_util_set_entry_issue_hint (context->auth_entry, correct ? NULL : _("User name cannot be empty"));
+       e_util_set_entry_issue_hint (context->auth_entry, correct ?
+               (camel_string_is_all_ascii (user) ? NULL : _("User name contains letters, which can prevent 
log in. Make sure the server accepts such written user name."))
+               : _("User name cannot be empty"));
 
        return complete;
 }
diff --git a/src/modules/cal-config-google/e-cal-config-google.c 
b/src/modules/cal-config-google/e-cal-config-google.c
index ede4d8a495..2431abae31 100644
--- a/src/modules/cal-config-google/e-cal-config-google.c
+++ b/src/modules/cal-config-google/e-cal-config-google.c
@@ -184,7 +184,9 @@ cal_config_google_check_complete (ESourceConfigBackend *backend,
 
        correct = (user != NULL);
 
-       e_util_set_entry_issue_hint (context->user_entry, correct ? NULL : _("User name cannot be empty"));
+       e_util_set_entry_issue_hint (context->user_entry, correct ?
+               (camel_string_is_all_ascii (user) ? NULL : _("User name contains letters, which can prevent 
log in. Make sure the server accepts such written user name."))
+               : _("User name cannot be empty"));
 
        return correct;
 }
diff --git a/src/modules/cal-config-google/e-cal-config-gtasks.c 
b/src/modules/cal-config-google/e-cal-config-gtasks.c
index 99bdc271a0..cf7463fb1e 100644
--- a/src/modules/cal-config-google/e-cal-config-gtasks.c
+++ b/src/modules/cal-config-google/e-cal-config-gtasks.c
@@ -112,7 +112,9 @@ cal_config_gtasks_check_complete (ESourceConfigBackend *backend,
 
        correct = user && *user;
 
-       e_util_set_entry_issue_hint (context->user_entry, correct ? NULL : _("User name cannot be empty"));
+       e_util_set_entry_issue_hint (context->user_entry, correct ?
+               (camel_string_is_all_ascii (user) ? NULL : _("User name contains letters, which can prevent 
log in. Make sure the server accepts such written user name."))
+               : _("User name cannot be empty"));
 
        return correct;
 }
diff --git a/src/modules/mail-config/e-mail-config-remote-accounts.c 
b/src/modules/mail-config/e-mail-config-remote-accounts.c
index f74ee0d5cb..60bf907e25 100644
--- a/src/modules/mail-config/e-mail-config-remote-accounts.c
+++ b/src/modules/mail-config/e-mail-config-remote-accounts.c
@@ -441,7 +441,9 @@ mail_config_remote_backend_check_complete (EMailConfigServiceBackend *backend)
                correct = FALSE;
 
        complete = complete && correct;
-       e_util_set_entry_issue_hint (remote_backend->user_entry, correct ? NULL : _("User name cannot be 
empty"));
+       e_util_set_entry_issue_hint (remote_backend->user_entry, correct ?
+               (camel_string_is_all_ascii (user) ? NULL : _("User name contains letters, which can prevent 
log in. Make sure the server accepts such written user name."))
+               : _("User name cannot be empty"));
 
        return complete;
 }
diff --git a/src/modules/mail-config/e-mail-config-smtp-backend.c 
b/src/modules/mail-config/e-mail-config-smtp-backend.c
index 9d22caf386..052f0430f1 100644
--- a/src/modules/mail-config/e-mail-config-smtp-backend.c
+++ b/src/modules/mail-config/e-mail-config-smtp-backend.c
@@ -479,7 +479,10 @@ mail_config_smtp_backend_check_complete (EMailConfigServiceBackend *backend)
                        correct = FALSE;
 
        complete = complete && correct;
-       e_util_set_entry_issue_hint (priv->user_entry, correct ? NULL : _("User name cannot be empty"));
+       e_util_set_entry_issue_hint (priv->user_entry, correct ?
+               ((!gtk_toggle_button_get_active (toggle_button) || camel_string_is_all_ascii (user)) ? NULL :
+               _("User name contains letters, which can prevent log in. Make sure the server accepts such 
written user name."))
+               : _("User name cannot be empty"));
 
        return complete;
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]