TizenRefApp-5782 [Email] Fix issue with composer exit logic on Cancle button click 01/61401/1
authorIgor Nazarov <i.nazarov@samsung.com>
Mon, 7 Mar 2016 12:58:02 +0000 (14:58 +0200)
committerIgor Nazarov <i.nazarov@samsung.com>
Mon, 7 Mar 2016 12:58:02 +0000 (14:58 +0200)
Change-Id: Ica968fab545e8a2d4e3484cb8454c73df7168fe7

Project-Files/modules/composer/src/email-composer-initial-view.c
Project-Files/modules/composer/src/email-composer-send-mail.c
Project-Files/modules/composer/src/email-composer.c

index 6e1087e..2a697c1 100644 (file)
@@ -48,6 +48,8 @@
 static void _initial_view_back_button_clicked_cb(void *data, Evas_Object *obj, void *event_info);
 static void _initial_view_send_button_clicked_cb(void *data, Evas_Object *obj, void *event_info);
 
+static Eina_Bool _initial_view_exit_idler_cb(void *data);
+
 static Evas_Object *_initial_view_create_root_layout(Evas_Object *parent, EmailComposerView *view);
 static Evas_Object *_initial_view_create_composer_layout(Evas_Object *parent);
 static void _initial_view_create_naviframe_buttons(Evas_Object *parent, Evas_Object *content, EmailComposerView *view);
@@ -116,6 +118,9 @@ static void _initial_view_back_button_clicked_cb(void *data, Evas_Object *obj, v
        view->is_back_btn_clicked = EINA_TRUE;
        if (imf_state != ECORE_IMF_INPUT_PANEL_STATE_SHOW) {
                composer_exit_composer_get_contents(view);
+       } else {
+               DELETE_IDLER_OBJECT(view->idler_destroy_self);
+               view->idler_destroy_self = ecore_idler_add(_initial_view_exit_idler_cb, view);
        }
 
        debug_leave();
@@ -137,9 +142,7 @@ static void _initial_view_send_button_clicked_cb(void *data, Evas_Object *obj, v
         * Because result callback for the launching request is called after the composer is destroyed.
         */
        retm_if(view->base.module->is_launcher_busy, "is_launcher_busy = true");
-
-       /* if a user clicks 'send' button more than once. it may cause B/S */
-       retm_if(view->is_send_btn_clicked, "_initial_view_send_button_clicked_cb() return; view->is_send_btn_clicked is already clicked");
+       retm_if(view->is_back_btn_clicked || view->is_save_in_drafts_clicked || view->is_send_btn_clicked, "while destroying composer!");
 
        view->is_send_btn_clicked = EINA_TRUE;
        composer_exit_composer_get_contents(view);
@@ -147,6 +150,20 @@ static void _initial_view_send_button_clicked_cb(void *data, Evas_Object *obj, v
        debug_leave();
 }
 
+static Eina_Bool _initial_view_exit_idler_cb(void *data)
+{
+       debug_enter();
+       retvm_if(!data, ECORE_CALLBACK_CANCEL, "Invalid parameter: data is NULL!");
+
+       EmailComposerView *view = (EmailComposerView *)data;
+
+       view->idler_destroy_self = NULL;
+
+       composer_exit_composer_get_contents(view);
+
+       return ECORE_CALLBACK_CANCEL;
+}
+
 static Evas_Object *_initial_view_create_composer_box(Evas_Object *parent)
 {
        email_profiling_begin(_initial_view_create_composer_box);
index be70b22..aed928f 100644 (file)
@@ -302,10 +302,10 @@ static void _exit_composer_cb(Evas_Object *obj, const char *result, void *data)
 
        EmailComposerView *view = (EmailComposerView *)data;
 
-       if (view->is_save_in_drafts_clicked || view->is_back_btn_clicked) {
-               _exit_composer_without_sending_mail(view);
-       } else {
+       if (view->is_send_btn_clicked) {
                _exit_composer_with_sending_mail(view);
+       } else {
+               _exit_composer_without_sending_mail(view);
        }
 
        debug_leave();
index 53573fb..3ddebd3 100644 (file)
@@ -1427,11 +1427,6 @@ static void _composer_virtualkeypad_state_off_cb(void *data, Evas_Object *obj, v
 
        EmailComposerView *view = (EmailComposerView *)data;
 
-       /* When user rotate device with "Stop composing email" popup, this callback is called even though the popup has already shown. */
-       if (view->is_back_btn_clicked && !view->composer_popup) {
-               composer_exit_composer_get_contents(view);
-       }
-
        if (view->ps_box) {
                composer_ps_change_layout_size(view);
        }