}
static void
-on_entry_invalid_character (ModestValidatingEntry *self, const gchar* character, gpointer user_data)
+on_entry_invalid_account_title_character (ModestValidatingEntry *self, const gchar* character, gpointer user_data)
{
- /* ModestEasysetupWizardDialog *dialog = MODEST_EASYSETUP_WIZARD_DIALOG (user_data); */
- /* We could add a special case for whitespace here
- if (character == NULL) ...
- */
- /* TODO: Should this show just this one bad character or all the not-allowed characters? */
- gchar *message = g_strdup_printf (_CS("ckdg_ib_illegal_characters_entered"), character);
+ gchar *message = g_strdup_printf (_CS("ckdg_ib_illegal_characters_entered"),
+ "\\ / : * ? \" < > | ^");
+ show_error (GTK_WIDGET (self), message);
+}
+
+static void
+on_entry_invalid_fullname_character (ModestValidatingEntry *self, const gchar* character, gpointer user_data)
+{
+ gchar *message = g_strdup_printf (_CS("ckdg_ib_illegal_characters_entered"),
+ "< >");
show_error (GTK_WIDGET (self), message);
}
+
+
static void
on_entry_max (ModestValidatingEntry *self, gpointer user_data)
{
list_prevent = g_list_append (list_prevent, ":");
list_prevent = g_list_append (list_prevent, "*");
list_prevent = g_list_append (list_prevent, "?");
- list_prevent = g_list_append (list_prevent, "\""); /* The UI spec mentions “, but maybe means ", maybe both. */
- list_prevent = g_list_append (list_prevent, "“");
+ list_prevent = g_list_append (list_prevent, "\"");
list_prevent = g_list_append (list_prevent, "<");
list_prevent = g_list_append (list_prevent, ">");
list_prevent = g_list_append (list_prevent, "|");
MODEST_VALIDATING_ENTRY (self->entry_account_title), list_prevent);
g_list_free (list_prevent);
modest_validating_entry_set_func(MODEST_VALIDATING_ENTRY(self->entry_account_title),
- on_entry_invalid_character, self);
+ on_entry_invalid_account_title_character, self);
/* Set max length as in the UI spec:
* The UI spec seems to want us to show a dialog if we hit the maximum. */
/* The name widgets: */
self->entry_user_name = GTK_WIDGET (modest_validating_entry_new ());
+
/* Auto-capitalization is the default, so let's turn it off: */
hildon_gtk_entry_set_input_mode (GTK_ENTRY (self->entry_user_name), HILDON_GTK_INPUT_MODE_FULL);
/* Set max length as in the UI spec:
connect_for_modified (self, self->entry_user_name);
gtk_box_pack_start (GTK_BOX (box), caption, FALSE, FALSE, MODEST_MARGIN_HALF);
gtk_widget_show (caption);
-
+
+
/* Prevent the use of some characters in the name,
* as required by our UI specification: */
GList *list_prevent = NULL;
modest_validating_entry_set_unallowed_characters (
MODEST_VALIDATING_ENTRY (self->entry_user_name), list_prevent);
g_list_free (list_prevent);
+ modest_validating_entry_set_func(MODEST_VALIDATING_ENTRY(self->entry_user_name),
+ on_entry_invalid_fullname_character, self);
/* The username widgets: */
self->entry_user_username = GTK_WIDGET (modest_validating_entry_new ());
/* The port widgets: */
/* TODO: There are various rules about this in the UI spec. */
if (!self->entry_incoming_port)
- self->entry_incoming_port = GTK_WIDGET (hildon_number_editor_new (0, 65535));
+ self->entry_incoming_port = GTK_WIDGET (hildon_number_editor_new (1, 65535));
caption = hildon_caption_new (sizegroup, _("mcen_fi_emailsetup_port"),
self->entry_incoming_port, NULL, HILDON_CAPTION_OPTIONAL);
gtk_widget_show (self->entry_incoming_port);
/* The port widgets: */
if (!self->entry_outgoing_port)
- self->entry_outgoing_port = GTK_WIDGET (hildon_number_editor_new (0, 65535));
+ self->entry_outgoing_port = GTK_WIDGET (hildon_number_editor_new (1, 65535));
caption = hildon_caption_new (sizegroup, _("mcen_fi_emailsetup_port"),
self->entry_outgoing_port, NULL, HILDON_CAPTION_OPTIONAL);
gtk_widget_show (self->entry_outgoing_port);
return GTK_WIDGET (scrollwin);
}
+
+
+
static gboolean
check_data (ModestAccountSettingsDialog *self)
{
}
}
- /* Check that the email address is valud: */
+ /* Check that the email address is valid: */
const gchar* email_address = gtk_entry_get_text (GTK_ENTRY (self->entry_user_email));
if ((!email_address) || (strlen(email_address) == 0))
return FALSE;
return FALSE;
}
- /* Find a suitable authentication method when secure authentication is desired */
+ /* make sure the domain name for the incoming server is valid */
const gchar* hostname = gtk_entry_get_text (GTK_ENTRY (self->entry_incomingserver));
+ if ((!hostname) || (strlen(hostname) == 0))
+ return FALSE;
+ if (!modest_text_utils_validate_domain_name (hostname)) {
+ /* Warn the user via a dialog: */
+ /*show_error (GTK_WINDOW (self), _("mcen_ib_invalid_email"));*/
+ hildon_banner_show_information (NULL, NULL, _("mcen_ib_invalid_servername"));
+
+ /* Return focus to the email address entry: */
+ gtk_widget_grab_focus (self->entry_incomingserver);
+ gtk_editable_select_region (GTK_EDITABLE (self->entry_incomingserver), 0, -1);
+ return FALSE;
+ }
+
+ /* make sure the domain name for the outgoing server is valid */
+ const gchar* hostname2 = gtk_entry_get_text (GTK_ENTRY (self->entry_outgoingserver));
+ if ((!hostname2) || (strlen(hostname2) == 0))
+ return FALSE;
+ if (!modest_text_utils_validate_domain_name (hostname2)) {
+ /* Warn the user via a dialog: */
+ /*show_error (GTK_WINDOW (self), _("mcen_ib_invalid_email"));*/
+ hildon_banner_show_information (NULL, NULL, _("mcen_ib_invalid_servername"));
+
+ /* Return focus to the email address entry: */
+ gtk_widget_grab_focus (self->entry_outgoingserver);
+ gtk_editable_select_region (GTK_EDITABLE (self->entry_outgoingserver), 0, -1);
+ return FALSE;
+ }
+
+
+ /* Find a suitable authentication method when secure authentication is desired */
+
gint port_num = hildon_number_editor_get_value (
HILDON_NUMBER_EDITOR (self->entry_incoming_port));
const gchar* username = gtk_entry_get_text (GTK_ENTRY (self->entry_user_username));
}
}
}
+
+
- /* TODO: The UI Spec wants us to check that the servernames are valid,
- * but does not specify how.
- */
-
+
return TRUE;
}
/*