Fixes NB#110998, do not ask for saving changes when there is no modification of accou...
authorSergio Villar Senin <svillar@igalia.com>
Wed, 15 Apr 2009 11:42:30 +0000 (11:42 +0000)
committerSergio Villar Senin <svillar@igalia.com>
Wed, 15 Apr 2009 11:42:30 +0000 (11:42 +0000)
Fixes the parsing of outgoing port numbers for preset providers

pmo-trunk-r8813

src/hildon2/modest-default-account-settings-dialog.c
src/hildon2/modest-easysetup-wizard-dialog.c
src/widgets/modest-security-options-view.c

index f0c19a3..8a61537 100644 (file)
@@ -1153,9 +1153,6 @@ modest_default_account_settings_dialog_load_settings (ModestAccountSettingsDialo
        priv = MODEST_DEFAULT_ACCOUNT_SETTINGS_DIALOG_GET_PRIVATE (dialog);
        protocol_registry = modest_runtime_get_protocol_registry ();
 
        priv = MODEST_DEFAULT_ACCOUNT_SETTINGS_DIALOG_GET_PRIVATE (dialog);
        protocol_registry = modest_runtime_get_protocol_registry ();
 
-       incoming_account = modest_account_settings_get_store_settings (settings);
-       outgoing_account = modest_account_settings_get_transport_settings (settings);
-
        account_name = modest_account_settings_get_account_name (settings);
 
        /* Save the account name so we can refer to it later: */
        account_name = modest_account_settings_get_account_name (settings);
 
        /* Save the account name so we can refer to it later: */
@@ -1194,6 +1191,7 @@ modest_default_account_settings_dialog_load_settings (ModestAccountSettingsDialo
        hildon_check_button_set_active (HILDON_CHECK_BUTTON (priv->checkbox_leave_messages), 
                                        modest_account_settings_get_leave_messages_on_server (settings));
 
        hildon_check_button_set_active (HILDON_CHECK_BUTTON (priv->checkbox_leave_messages), 
                                        modest_account_settings_get_leave_messages_on_server (settings));
 
+       incoming_account = modest_account_settings_get_store_settings (settings);
        if (incoming_account) {
                const gchar *username, *password, *hostname, *proto_str, *account_title;
                gchar *proto_name, *title;
        if (incoming_account) {
                const gchar *username, *password, *hostname, *proto_str, *account_title;
                gchar *proto_name, *title;
index 5db6e4c..68ec558 100644 (file)
@@ -2172,6 +2172,7 @@ save_to_settings (ModestEasysetupWizardDialog *self)
        if (provider_id) {
                ModestProtocolType transport_provider_server_type;
                ModestProtocolType transport_provider_security;
        if (provider_id) {
                ModestProtocolType transport_provider_server_type;
                ModestProtocolType transport_provider_security;
+               gboolean is_secure;
 
                /* Use presets */
                transport_hostname = modest_presets_get_server (priv->presets, provider_id,
 
                /* Use presets */
                transport_hostname = modest_presets_get_server (priv->presets, provider_id,
@@ -2187,21 +2188,26 @@ save_to_settings (ModestEasysetupWizardDialog *self)
                /* Note: We need something as default, or modest_account_mgr_add_server_account will fail. */
                transport_protocol = transport_provider_server_type;
                transport_security = transport_provider_security;
                /* Note: We need something as default, or modest_account_mgr_add_server_account will fail. */
                transport_protocol = transport_provider_server_type;
                transport_security = transport_provider_security;
-               if (transport_security == MODEST_PROTOCOLS_CONNECTION_SSL) {
-                       /* printf("DEBUG: %s: using secure SMTP\n", __FUNCTION__); */
-                       /* we check if there is a *special* port */
-                       special_port = modest_presets_get_port (priv->presets, provider_id,
-                                                               FALSE /* transport */);
-                       if (special_port != 0)
-                               transport_port = special_port;
-                       else
-                               transport_port = 465;
-                       transport_auth_protocol = MODEST_PROTOCOLS_AUTH_PASSWORD;
+               is_secure = modest_protocol_registry_protocol_type_is_secure (modest_runtime_get_protocol_registry (),
+                                                                             transport_security);
+
+               /* we check if there is a *special* port */
+               special_port = modest_presets_get_port (priv->presets, provider_id,
+                                                       FALSE /* transport */);
+               if (special_port != 0) {
+                       transport_port = special_port;
                } else {
                } else {
-                       /* printf("DEBUG: %s: using non-secure SMTP\n", __FUNCTION__); */
-                       transport_auth_protocol = MODEST_PROTOCOLS_AUTH_NONE;
+                       gboolean use_alternate_port = FALSE;
+                       if (transport_security == MODEST_PROTOCOLS_CONNECTION_SSL)
+                               use_alternate_port = TRUE;
+                       transport_port = get_port_from_protocol(transport_provider_server_type, use_alternate_port);
                }
 
                }
 
+               if (is_secure)
+                       transport_auth_protocol = MODEST_PROTOCOLS_AUTH_PASSWORD;
+               else
+                       transport_auth_protocol = MODEST_PROTOCOLS_AUTH_NONE;
+
                modest_server_account_settings_set_security_protocol (transport_settings,
                                                                      transport_security);
                modest_server_account_settings_set_auth_protocol (transport_settings,
                modest_server_account_settings_set_security_protocol (transport_settings,
                                                                      transport_security);
                modest_server_account_settings_set_auth_protocol (transport_settings,
index 2e87c10..9f88f09 100644 (file)
@@ -234,11 +234,15 @@ get_current_state (ModestSecurityOptionsView* self,
 
        /* Get security */
 #ifdef MODEST_TOOLKIT_HILDON2
 
        /* Get security */
 #ifdef MODEST_TOOLKIT_HILDON2
-       state->security = 
+       state->security =
                modest_serversecurity_picker_get_active_serversecurity (MODEST_SERVERSECURITY_PICKER (priv->security_view));
                modest_serversecurity_picker_get_active_serversecurity (MODEST_SERVERSECURITY_PICKER (priv->security_view));
+       state->port =
+               modest_serversecurity_picker_get_active_serversecurity_port (MODEST_SERVERSECURITY_PICKER (priv->security_view));
 #else
 #else
-       state->security = 
+       state->security =
                modest_serversecurity_combo_box_get_active_serversecurity (MODEST_SERVERSECURITY_COMBO_BOX (priv->security_view));
                modest_serversecurity_combo_box_get_active_serversecurity (MODEST_SERVERSECURITY_COMBO_BOX (priv->security_view));
+       state->port =
+               modest_serversecurity_combo_box_get_active_serversecurity_port (MODEST_SERVERSECURITY_COMBO_BOX (priv->security_view));
 #endif
 
        /* Get auth */
 #endif
 
        /* Get auth */