static void
on_entry_invalid_account_title_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);
+ gchar *tmp, *msg;
+
+ tmp = g_strndup (account_title_forbidden_chars, ACCOUNT_TITLE_FORBIDDEN_CHARS_LENGTH);
+ msg = g_strdup_printf (_CS("ckdg_ib_illegal_characters_entered"), tmp);
+
+ show_error (GTK_WIDGET (self), msg);
+
+ g_free (msg);
+ g_free (tmp);
}
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);
-}
+ gchar *tmp, *msg;
+
+ tmp = g_strndup (user_name_forbidden_chars, USER_NAME_FORBIDDEN_CHARS_LENGTH);
+ msg = g_strdup_printf (_CS("ckdg_ib_illegal_characters_entered"), tmp);
+
+ show_error (GTK_WIDGET (self), msg);
+ g_free (msg);
+ g_free (tmp);
+}
static void
create_page_account_details (ModestAccountSettingsDialog *self)
{
GtkWidget *box = gtk_vbox_new (FALSE, MODEST_MARGIN_NONE);
- GtkWidget *label = gtk_label_new(_("mcen_ia_accountdetails"));
- gtk_box_pack_start (GTK_BOX (box), label, FALSE, FALSE, MODEST_MARGIN_HALF);
- gtk_widget_show (label);
+ GtkAdjustment *focus_adjustment = NULL;
/* Create a size group to be used by all captions.
* Note that HildonCaption does not create a default size group if we do not specify one.
* We use GTK_SIZE_GROUP_HORIZONTAL, so that the widths are the same. */
GtkSizeGroup* sizegroup = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
+ GtkWidget *scrollwin = gtk_scrolled_window_new (NULL, NULL);
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrollwin),
+ GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
/* The description widgets: */
self->entry_account_title = GTK_WIDGET (modest_validating_entry_new ());
gtk_widget_show (GTK_WIDGET (box));
- return GTK_WIDGET (box);
+ gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrollwin), box);
+ gtk_widget_show (scrollwin);
+
+ focus_adjustment = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (scrollwin));
+ gtk_container_set_focus_vadjustment (GTK_CONTAINER (box), focus_adjustment);
+
+ return GTK_WIDGET (scrollwin);
+}
+
+static gchar*
+get_entered_account_title (ModestAccountSettingsDialog *dialog)
+{
+ const gchar* account_title =
+ gtk_entry_get_text (GTK_ENTRY (dialog->entry_account_title));
+ if (!account_title || (strlen (account_title) == 0))
+ return NULL;
+ else {
+ /* Strip it of whitespace at the start and end: */
+ gchar *result = g_strdup (account_title);
+ result = g_strstrip (result);
+
+ if (!result)
+ return NULL;
+
+ if (strlen (result) == 0) {
+ g_free (result);
+ return NULL;
+ }
+
+ return result;
+ }
}
+
static void
on_button_signature (GtkButton *button, gpointer user_data)
{
gboolean use_signature = FALSE;
gchar *signature = modest_account_mgr_get_signature(self->account_manager, self->account_name,
&use_signature);
- const gchar* account_title = gtk_entry_get_text (GTK_ENTRY (self->entry_account_title));
+ gchar* account_title = get_entered_account_title (self);
modest_signature_editor_dialog_set_settings (
MODEST_SIGNATURE_EDITOR_DIALOG (self->signature_dialog),
use_signature, signature, account_title);
+ g_free (account_title);
+ account_title = NULL;
g_free (signature);
signature = NULL;
}
if (!(self->specific_window)) {
self->specific_window = GTK_WIDGET (modest_connection_specific_smtp_window_new ());
modest_connection_specific_smtp_window_fill_with_connections (
- MODEST_CONNECTION_SPECIFIC_SMTP_WINDOW (self->specific_window), self->account_manager,
- self->account_name);
+ MODEST_CONNECTION_SPECIFIC_SMTP_WINDOW (self->specific_window), self->account_manager);
}
/* Show the window: */
check_data (ModestAccountSettingsDialog *self)
{
/* Check that the title is not already in use: */
- const gchar* account_title = gtk_entry_get_text (GTK_ENTRY (self->entry_account_title));
- if ((!account_title) || (strlen(account_title) == 0))
+ gchar* account_title = get_entered_account_title (self);
+ if (!account_title)
return FALSE; /* Should be prevented already anyway. */
if (strcmp(account_title, self->original_account_title) != 0) {
/* Warn the user via a dialog: */
hildon_banner_show_information(NULL, NULL, _("mail_ib_account_name_already_existing"));
+ g_free (account_title);
return FALSE;
}
}
+
+ g_free (account_title);
+ account_title = NULL;
/* 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))
+ if ((!email_address) || (strlen(email_address) == 0)) {
return FALSE;
+ }
if (!modest_text_utils_validate_email_address (email_address, NULL)) {
/* Warn the user via a dialog: */
/* 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))
+ 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);
+ /* 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))
+ 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"));*/
/* Check that the port numbers are acceptable: */
if (!check_hildon_number_editor_and_warn_value_not_in_range (
- HILDON_NUMBER_EDITOR (self->entry_incoming_port), PORT_MIN, PORT_MAX)){
+ HILDON_NUMBER_EDITOR (self->entry_incoming_port), PORT_MIN, PORT_MAX)) {
return FALSE;
}
HILDON_NUMBER_EDITOR (self->entry_incoming_port));
const gchar* username = gtk_entry_get_text (GTK_ENTRY (self->entry_user_username));
+ /*
const ModestConnectionProtocol protocol_security_incoming = modest_serversecurity_combo_box_get_active_serversecurity (
MODEST_SERVERSECURITY_COMBO_BOX (self->combo_incoming_security));
-
+ */
/* If we use an encrypted protocol then there is no need to encrypt the password */
- if (!modest_protocol_info_is_secure(protocol_security_incoming))
+ /* I don't think this is a good assumption. It overrides the user's request. murrayc:
+ * if (!modest_protocol_info_is_secure(protocol_security_incoming)) */
+ if (TRUE)
{
if (gtk_toggle_button_get_active (
GTK_TOGGLE_BUTTON (self->checkbox_incoming_auth))) {
GError *error = NULL;
+
GList *list_auth_methods =
modest_maemo_utils_get_supported_secure_authentication_methods (self->incoming_protocol,
hostname, port_num, username, GTK_WINDOW (self), &error);
GList* method;
for (method = list_auth_methods; method != NULL; method = g_list_next(method))
{
- ModestAuthProtocol proto = (ModestAuthProtocol)(GPOINTER_TO_INT(list_auth_methods->data));
+ ModestAuthProtocol proto = (ModestAuthProtocol)(GPOINTER_TO_INT(method->data));
// Allow secure methods, e.g MD5 only
if (modest_protocol_info_auth_is_secure(proto))
{
}
}
-
-
-
return TRUE;
}
/*
gtk_widget_show (GTK_WIDGET (self->notebook));
/* Add the buttons: */
- gtk_dialog_add_button (GTK_DIALOG(self), GTK_STOCK_OK, GTK_RESPONSE_OK);
- gtk_dialog_add_button (GTK_DIALOG(self), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
+ gtk_dialog_add_button (GTK_DIALOG(self), _("mcen_bd_dialog_ok"), GTK_RESPONSE_OK);
+ gtk_dialog_add_button (GTK_DIALOG(self), _("mcen_bd_dialog_cancel"), GTK_RESPONSE_CANCEL);
/* Connect to the dialog's response signal: */
/* We use connect-before
const ModestAuthProtocol secure_auth = modest_server_account_get_secure_auth(
dialog->account_manager, incoming_account->account_name);
dialog->protocol_authentication_incoming = secure_auth;
- if (modest_protocol_info_is_secure(security) ||
- modest_protocol_info_auth_is_secure(secure_auth))
+ if (modest_protocol_info_auth_is_secure(secure_auth))
{
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON (dialog->checkbox_incoming_auth),
TRUE);
}
const gboolean has_specific =
- modest_account_mgr_get_has_connection_specific_smtp (
- dialog->account_manager,
- account_name);
+ modest_account_mgr_get_use_connection_specific_smtp (
+ dialog->account_manager, account_name);
gtk_toggle_button_set_active (
GTK_TOGGLE_BUTTON (dialog->checkbox_outgoing_smtp_specific),
has_specific);
/* Set the changed account title last, to simplify the previous code: */
- const gchar* account_title = gtk_entry_get_text (GTK_ENTRY (dialog->entry_account_title));
- if ((!account_title) || (strlen(account_title) == 0))
+ gchar* account_title = get_entered_account_title (dialog);
+ if (!account_title)
return FALSE; /* Should be prevented already anyway. */
if (strcmp(account_title, account_name) != 0) {
/* Change the title: */
- gboolean test = modest_account_mgr_set_string (dialog->account_manager, account_name,
+ const gboolean test = modest_account_mgr_set_string (dialog->account_manager, account_name,
MODEST_ACCOUNT_DISPLAY_NAME, account_title, FALSE /* not server account */);
- if (!test)
+ if (!test) {
+ g_free (account_title);
return FALSE;
+ }
}
+ g_free (account_title);
+ account_title = NULL;
+
/* Save connection-specific SMTP server accounts: */
+ modest_account_mgr_set_use_connection_specific_smtp(dialog->account_manager, account_name,
+ gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->checkbox_outgoing_smtp_specific)));
if (dialog->specific_window) {
return modest_connection_specific_smtp_window_save_server_accounts (
- MODEST_CONNECTION_SPECIFIC_SMTP_WINDOW (dialog->specific_window), account_name);
+ MODEST_CONNECTION_SPECIFIC_SMTP_WINDOW (dialog->specific_window));
}
else
return TRUE;
const gchar* text = gtk_entry_get_text (GTK_ENTRY (entry));
if ((!text) || (strlen(text) == 0))
return TRUE;
- else
- return FALSE;
+ else {
+ /* Strip it of whitespace at the start and end: */
+ gchar *stripped = g_strdup (text);
+ stripped = g_strstrip (stripped);
+
+ if (!stripped)
+ return TRUE;
+
+ const gboolean result = (strlen (stripped) == 0);
+
+ g_free (stripped);
+ return result;
+ }
}
static void