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

Closes https://gitlab.gnome.org/GNOME/evolution/-/issues/1787
This commit is contained in:
Milan Crha
2022-02-11 13:32:21 +01:00
parent dcc22c6e44
commit a6403fe455
7 changed files with 43 additions and 10 deletions

View File

@ -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);

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}