* Fixes NB#86564, merged from trunk several commits
[modest] / src / maemo / modest-account-settings-dialog.c
index 04b7e16..6bb1034 100644 (file)
@@ -1091,6 +1091,8 @@ on_response (GtkDialog *wizard_dialog,
                /* Don't let the dialog close */
                g_signal_stop_emission_by_name (wizard_dialog, "response");
                return; 
+       } else {
+               modest_tny_account_store_set_send_mail_blocked (modest_runtime_get_account_store (), FALSE);
        }
                
        if (response_id == GTK_RESPONSE_OK) {
@@ -1115,6 +1117,7 @@ on_response (GtkDialog *wizard_dialog,
                                        store_account_name = modest_server_account_settings_get_account_name (store_settings);
                                        transport_account_name = modest_server_account_settings_get_account_name (transport_settings);
                                        
+                                       modest_mail_operation_queue_cancel_all (modest_runtime_get_mail_operation_queue());
                                        if (store_account_name) {
                                                modest_account_mgr_notify_account_update (self->account_manager, 
                                                                                          store_account_name);
@@ -1126,8 +1129,7 @@ on_response (GtkDialog *wizard_dialog,
                                        g_object_unref (store_settings);
                                        g_object_unref (transport_settings);
                                        
-                                       if (!self->save_password)
-                                               hildon_banner_show_information(NULL, NULL, _("mcen_ib_advsetup_settings_saved"));
+                                       hildon_banner_show_information(NULL, NULL, _("mcen_ib_advsetup_settings_saved"));
                                }
                        } else {
                                hildon_banner_show_information (NULL, NULL, _("mail_ib_setting_failed"));
@@ -1188,13 +1190,16 @@ modest_account_settings_dialog_init (ModestAccountSettingsDialog *self)
             G_CALLBACK (on_response), self); 
             
     self->modified = FALSE;
-    self->save_password = FALSE;
 
     /* When this window is shown, hibernation should not be possible, 
         * because there is no sensible way to save the state: */
     modest_window_mgr_prevent_hibernation_while_window_is_shown (
        modest_runtime_get_window_mgr (), GTK_WINDOW (self)); 
 
+    /* Prevent sending mails while editing an account, to avoid hangs on unprotected locks
+     * while sending messages causes an error dialog and we have a lock */
+    modest_tny_account_store_set_send_mail_blocked (modest_runtime_get_account_store (), TRUE);
+
     hildon_help_dialog_help_enable (GTK_DIALOG(self), "applications_email_accountsettings",
                                    modest_maemo_utils_get_osso_context());
 }
@@ -1649,16 +1654,6 @@ modest_account_settings_dialog_set_modified (ModestAccountSettingsDialog *dialog
 
 }
 
-void
-modest_account_settings_dialog_save_password (ModestAccountSettingsDialog *dialog)
-{
-       g_return_if_fail (MODEST_IS_ACCOUNT_SETTINGS_DIALOG (dialog));
-
-       dialog->save_password = TRUE;
-       dialog->modified = TRUE;
-}
-
-
 static void
 modest_account_settings_dialog_class_init (ModestAccountSettingsDialogClass *klass)
 {