TizenRefApp-7783 [Call UI] Reimplement popup logic in application 90/102290/2 submit/tizen_3.0/20161205.123214
authorIgor Olshevskyi <i.olshevskyi@samsung.com>
Mon, 5 Dec 2016 09:48:01 +0000 (11:48 +0200)
committerIgor Olshevskyi <i.olshevskyi@samsung.com>
Mon, 5 Dec 2016 09:51:38 +0000 (11:51 +0200)
Change-Id: I56b422509bf866f0328f4fca491bef1c05ddf264

inc/callui-view-elements.h
inc/callui-view-manager.h
inc/callui.h
src/callui-action-bar.c
src/callui-common.c
src/callui-view-elements.c
src/callui-view-incoming-call.c
src/callui-view-manager.c
src/callui.c

index 4374d80..820f74b 100644 (file)
@@ -116,23 +116,27 @@ void _callui_caller_info_set_caller_image(Evas_Object *content, const callui_cal
  *
  * @return Created more menu context popup on success or NULL otherwise
  */
-Evas_Object *_callui_load_more_menu_popup(Evas_Object *parent, callui_app_data_t *ad);
+Evas_Object *_callui_create_more_menu_popup(Evas_Object *parent, callui_app_data_t *ad);
 
 /**
  * @brief Creates popup after second call to choose needed action
  *
+ * @param[in]    parent       Parent Evas object
  * @param[in]    ad           Application data
  *
+ * @return Created second call popup on success or NULL otherwise
  */
-void _callui_load_second_call_popup(callui_app_data_t *ad);
+Evas_Object *_callui_create_second_call_popup(Evas_Object *parent, callui_app_data_t *ad);
 
 /**
  * @brief Creates bluetooth popup
  *
+ * @param[in]    parent       Parent Evas object
  * @param[in]    ad           Application data
  *
+ * @return Created bluetooth popup on success or NULL otherwise
  */
-void _callui_load_bluetooth_popup(callui_app_data_t *ad);
+Evas_Object *_callui_create_bluetooth_popup(Evas_Object *parent, callui_app_data_t *ad);
 
 
 #endif //__CALLUI_VIEW_ELEMENTS_H_
index dbd30be..f828823 100644 (file)
@@ -42,6 +42,12 @@ typedef enum {
        CALLUI_UF_DATA_REFRESH  = 0x02
 } callui_update_type_e;
 
+typedef enum {
+       CALLUI_ACTION_POPUP_UNDEFINED,
+       CALLUI_ACTION_POPUP_SECOND_CALL,
+       CALLUI_ACTION_POPUP_BLUETOOTH
+} callui_action_popup_type_e;
+
 struct _view_data;
 typedef struct appdata callui_app_data_t;
 
@@ -91,7 +97,7 @@ void _callui_vm_destroy(callui_vm_h vm);
  *
  * @param[in]  vm              View manager handle
  *
- * @return result CALLUI_RESULT_OK on success
+ * @return CALLUI_RESULT_OK on success or other result otherwise
  */
 callui_result_e _callui_vm_activate(callui_vm_h vm);
 
@@ -118,7 +124,7 @@ Evas_Object *_callui_vm_get_main_ly(callui_vm_h vm);
  * @param[in]  vm              View manager handle
  * @param[in]  type    View type
  *
- * @return result CALLUI_RESULT_OK on success
+ * @return CALLUI_RESULT_OK on success or other result otherwise
  */
 callui_result_e _callui_vm_change_view(callui_vm_h vm, callui_view_type_e type);
 
@@ -127,7 +133,7 @@ callui_result_e _callui_vm_change_view(callui_vm_h vm, callui_view_type_e type);
  *
  * @param[in]  vm              View manager handle
  *
- * @return result CALLUI_RESULT_OK on success
+ * @return CALLUI_RESULT_OK on success or other result otherwise
  */
 callui_result_e _callui_vm_auto_change_view(callui_vm_h vm);
 
@@ -145,7 +151,7 @@ callui_view_type_e _callui_vm_get_cur_view_type(callui_vm_h vm);
  *
  * @param[in]  vm              View manager handle
  *
- * @return result CALLUI_RESULT_OK on success
+ * @return CALLUI_RESULT_OK on success or other result otherwise
  */
 callui_result_e _callui_vm_pause(callui_vm_h vm);
 
@@ -154,7 +160,7 @@ callui_result_e _callui_vm_pause(callui_vm_h vm);
  *
  * @param[in]  vm              View manager handle
  *
- * @return result CALLUI_RESULT_OK on success
+ * @return CALLUI_RESULT_OK on success or other result otherwise
  */
 callui_result_e _callui_vm_resume(callui_vm_h vm);
 
@@ -163,8 +169,27 @@ callui_result_e _callui_vm_resume(callui_vm_h vm);
  *
  * @param[in]  vm              View manager handle
  *
- * @return result CALLUI_RESULT_OK on success
+ * @return CALLUI_RESULT_OK on success or other result otherwise
  */
 callui_result_e _callui_vm_update_language(callui_vm_h vm);
 
+/**
+ * @brief Shows action popup by set type
+ *
+ * @param[in]  vm              View manager handle
+ * @param[in]  type    Action popup type
+ *
+ * @return CALLUI_RESULT_OK on success or other result otherwise
+ */
+callui_result_e _callui_vm_show_action_popup(callui_vm_h vm, callui_action_popup_type_e type);
+
+/**
+ * @brief Gets visible action popup type
+ *
+ * @param[in]  vm              View manager handle
+ *
+ * @return Visible popup type or CALLUI_ACTION_POPUP_UNDEFINED if no action popup is shown
+ */
+callui_action_popup_type_e _callui_vm_get_visible_action_popup_type(callui_vm_h vm);
+
 #endif /* __CALLUI_VIEW_MANAGER_H__ */
index e16b9cb..7a6bf98 100755 (executable)
@@ -42,12 +42,7 @@ struct appdata {
 
        callui_qp_mc_h qp_minicontrol;
        callui_display_h display;
-
-       Evas_Object *second_call_popup;
-       Evas_Object *bt_popup;
-
        callui_vm_h view_manager;
-
        callui_lock_manager_h lock_manager;
 
        bool on_background;
index 935d034..bb4856a 100644 (file)
@@ -192,7 +192,7 @@ static void __bluetooth_btn_click_cb(void *data, Evas_Object *obj, void *event_i
                        if (ret_code == BT_ERROR_NONE) {
                                info("BT status value: %d", bt_state);
                                if (bt_state == BT_ADAPTER_DISABLED) {
-                                       _callui_load_bluetooth_popup(ad);
+                                       _callui_vm_show_action_popup(ad->view_manager, CALLUI_ACTION_POPUP_BLUETOOTH);
                                } else {
                                        _callui_common_launch_setting_bluetooth(ad);
                                }
index bfeff24..2ca8359 100755 (executable)
@@ -1187,8 +1187,10 @@ void _callui_common_process_accept_incoming_call(void *appdata)
 
        if (_callui_stp_get_call_data(ad->state_provider, CALLUI_CALL_DATA_INCOMING)) {
                if (_callui_stp_get_call_data(ad->state_provider, CALLUI_CALL_DATA_ACTIVE)) {
-                       dbg("Active call available. Show 2nd call popup");
-                       _callui_load_second_call_popup(ad);
+                       if (_callui_vm_get_visible_action_popup_type(ad->view_manager) != CALLUI_ACTION_POPUP_SECOND_CALL) {
+                               dbg("Active call available. Show 2nd call popup");
+                               _callui_vm_show_action_popup(ad->view_manager, CALLUI_ACTION_POPUP_SECOND_CALL);
+                       }
                } else {
                        dbg("No active call. Answer on incoming call");
                        callui_result_e ret = _callui_manager_answer_call(ad->call_manager, CALLUI_CALL_ANSWER_NORMAL);
index 20d11be..d8517b4 100755 (executable)
 
 #define CALLUI_PART_SWALLOW_END_BTN "swallow.end_btn"
 
+#define CALLUI_EO_DATA_NAME_POPUP   "popup"
+
 typedef struct {
        int index;
-       char option_msg[512];
+       char option_msg[CALLUI_BUFF_SIZE_HUG];
 } callui_sec_call_popup_data_t;
 
 static int _g_cid_size[CALLUI_CID_SIZE_COUNT] = {
@@ -64,25 +66,28 @@ static int _g_cid_size[CALLUI_CID_SIZE_COUNT] = {
                CALLUI_CID_THUMBN_SIZE_BIG
 };
 
-static void __callui_unload_second_call_popup(callui_app_data_t *ad);
-static char *__callui_gl_second_call_option_label_get(void *data, Evas_Object *obj, const char *part);
-static void __callui_gl_second_call_option_del_cb(void *data, Evas_Object *obj);
-static void __callui_gl_second_call_option_sel(void *data, Evas_Object *obj, void *event_info);
-static void __callui_second_call_cancel_btn_response_cb(void *data, Evas_Object *obj, void *event_info);
-static void __callui_unload_bt_popup(callui_app_data_t *ad);
-static void __callui_bt_popup_cancel_btn_cb(void *data, Evas_Object *obj, void *event_info);
-static void __callui_bt_popup_ok_btn_cb(void *data, Evas_Object *obj, void *event_info);
-static void __callui_get_displayed_caller_info_string(const callui_call_data_t *call_data, char *display_string, int display_string_size);
-static Evas_Object *__callui_create_style_layout(Evas_Object *parent, const char *style);
-
-static void __callui_ctxpopup_item_hold_cb(void *data, Evas_Object *obj, void *event_info);
-static void __callui_ctxpopup_item_unhold_cb(void *data, Evas_Object *obj, void *event_info);
-static void __callui_move_more_ctxpopup(Evas_Object *ctxpopup, callui_app_data_t *ad);
-static void __callui_more_ctxpopup_dismiss_cb(void *data, Evas_Object *obj, void *event_info);
-static void __callui_more_ctxpopup_delete_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
-static void __callui_destroy_more_ctxpopup(Evas_Object *ctxpopup, callui_app_data_t *ad);
-
-static Evas_Object *__callui_create_style_layout(Evas_Object *parent, const char *style)
+static void __get_displayed_caller_info_string(const callui_call_data_t *call_data, char *display_string, int display_string_size);
+static Evas_Object *__create_style_layout(Evas_Object *parent, const char *style);
+/* Second call popup */
+static Evas_Object *__second_call_popup_del(Evas_Object *popup);
+static char *__second_call_gl_option_txt_get(void *data, Evas_Object *obj, const char *part);
+static void __second_call_gl_option_del_cb(void *data, Evas_Object *obj);
+static void __second_call_gl_option_sel_cb(void *data, Evas_Object *obj, void *event_info);
+static void __second_call_cancel_btn_response_cb(void *data, Evas_Object *obj, void *event_info);
+/* Bluetooth popup */
+static Evas_Object *__bt_popup_del(Evas_Object *popup);
+static void __bt_popup_cancel_btn_cb(void *data, Evas_Object *obj, void *event_info);
+static void __bt_popup_ok_btn_cb(void *data, Evas_Object *obj, void *event_info);
+/* More menu popup */
+static Evas_Object *__more_ctxpopup_del(Evas_Object *ctxpopup);
+static void __more_ctxpopup_item_hold_cb(void *data, Evas_Object *obj, void *event_info);
+static void __more_ctxpopup_item_unhold_cb(void *data, Evas_Object *obj, void *event_info);
+static void __more_ctxpopup_move(Evas_Object *ctxpopup, callui_app_data_t *ad);
+static void __more_ctxpopup_dismiss_cb(void *data, Evas_Object *obj, void *event_info);
+static void __more_ctxpopup_delete_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
+static void __more_ctxpopup_destroy(Evas_Object *ctxpopup, callui_app_data_t *ad);
+
+static Evas_Object *__create_style_layout(Evas_Object *parent, const char *style)
 {
        Evas_Object *eo = elm_layout_add(parent);
        CALLUI_RETURN_NULL_IF_FAIL(eo);
@@ -93,7 +98,7 @@ static Evas_Object *__callui_create_style_layout(Evas_Object *parent, const char
 
 Evas_Object *_callui_create_layout(Evas_Object *parent, const char *style)
 {
-       return __callui_create_style_layout(parent, style);
+       return __create_style_layout(parent, style);
 }
 
 Evas_Object *_callui_edje_object_part_get(Evas_Object *parent, const char *part)
@@ -140,7 +145,7 @@ Evas_Object *_callui_create_cid_thumbnail_with_size(Evas_Object *parent,
        CALLUI_RETURN_NULL_IF_FAIL(type >= CALLUI_CID_TYPE_SINGLE && type < CALLUI_CID_TYPE_COUNT);
        CALLUI_RETURN_NULL_IF_FAIL(size >= CALLUI_CID_SIZE_DEFAULT && size < CALLUI_CID_SIZE_COUNT);
 
-       Evas_Object *layout = __callui_create_style_layout(parent, "caller_id");
+       Evas_Object *layout = __create_style_layout(parent, "caller_id");
        CALLUI_RETURN_NULL_IF_FAIL(layout);
        evas_object_show(layout);
 
@@ -222,17 +227,15 @@ void _callui_caller_info_set_caller_image(Evas_Object *contents, const callui_ca
        elm_object_part_content_set(contents, "swallow.caller_id", thumbnail);
 }
 
-static void __callui_unload_second_call_popup(callui_app_data_t *ad)
+static Evas_Object *__second_call_popup_del(Evas_Object *popup)
 {
-       dbg("..");
-       CALLUI_RETURN_IF_FAIL(ad);
-       if (ad->second_call_popup) {
-               evas_object_del(ad->second_call_popup);
-               ad->second_call_popup = NULL;
+       if (popup) {
+               evas_object_del(popup);
        }
+       return NULL;
 }
 
-static char *__callui_gl_second_call_option_label_get(void *data, Evas_Object *obj, const char *part)
+static char *__second_call_gl_option_txt_get(void *data, Evas_Object *obj, const char *part)
 {
        CALLUI_RETURN_VALUE_IF_FAIL(part, NULL);
        CALLUI_RETURN_VALUE_IF_FAIL(data, NULL);
@@ -244,13 +247,13 @@ static char *__callui_gl_second_call_option_label_get(void *data, Evas_Object *o
        }
 }
 
-static void __callui_gl_second_call_option_del_cb(void *data, Evas_Object *obj EINA_UNUSED)
+static void __second_call_gl_option_del_cb(void *data, Evas_Object *obj EINA_UNUSED)
 {
        callui_sec_call_popup_data_t *item_data = (callui_sec_call_popup_data_t *)data;
        free(item_data);
 }
 
-static void __callui_gl_second_call_option_sel(void *data, Evas_Object *obj, void *event_info)
+static void __second_call_gl_option_sel_cb(void *data, Evas_Object *obj, void *event_info)
 {
        CALLUI_RETURN_IF_FAIL(data);
        CALLUI_RETURN_IF_FAIL(event_info);
@@ -259,7 +262,7 @@ static void __callui_gl_second_call_option_sel(void *data, Evas_Object *obj, voi
        callui_sec_call_popup_data_t *item_data = NULL;
        callui_app_data_t *ad = (callui_app_data_t *)data;
 
-       __callui_unload_second_call_popup(ad);
+       __second_call_popup_del(evas_object_data_get(obj, CALLUI_EO_DATA_NAME_POPUP));
 
        if (item != NULL) {
                item_data = (callui_sec_call_popup_data_t *) elm_object_item_data_get(item);
@@ -300,18 +303,18 @@ static void __callui_gl_second_call_option_sel(void *data, Evas_Object *obj, voi
        }
 }
 
-static void __callui_second_call_cancel_btn_response_cb(void *data, Evas_Object *obj, void *event_info)
+static void __second_call_cancel_btn_response_cb(void *data, Evas_Object *obj, void *event_info)
 {
-       dbg("..");
+       CALLUI_RETURN_IF_FAIL(data);
+       CALLUI_RETURN_IF_FAIL(obj);
 
-       callui_app_data_t *ad = (callui_app_data_t*) data;
-       __callui_unload_second_call_popup(ad);
-       _callui_vm_change_view(ad->view_manager, CALLUI_VIEW_INCOMING_CALL);
+       __second_call_popup_del(obj);
 
-       return;
+       callui_app_data_t *ad = (callui_app_data_t *)data;
+       _callui_vm_change_view(ad->view_manager, CALLUI_VIEW_INCOMING_CALL);
 }
 
-static void __callui_get_displayed_caller_info_string(const callui_call_data_t *call_data, char *display_string, int display_string_size)
+static void __get_displayed_caller_info_string(const callui_call_data_t *call_data, char *display_string, int display_string_size)
 {
        CALLUI_RETURN_IF_FAIL(call_data);
        CALLUI_RETURN_IF_FAIL(display_string);
@@ -337,314 +340,264 @@ static void __callui_get_displayed_caller_info_string(const callui_call_data_t *
        }
 }
 
-void _callui_load_second_call_popup(callui_app_data_t *ad)
+Evas_Object *_callui_create_second_call_popup(Evas_Object *parent, callui_app_data_t *ad)
 {
-       dbg("..");
-
-       CALLUI_RETURN_IF_FAIL(ad);
+       CALLUI_RETURN_NULL_IF_FAIL(parent);
+       CALLUI_RETURN_NULL_IF_FAIL(ad);
 
-       Evas_Object *box = NULL;
        char hold_call_name[CALLUI_BUFF_SIZE_HUG] = { '\0' };
        char unhold_call_name[CALLUI_BUFF_SIZE_HUG] = { '\0' };
        const char *temp_str = NULL;
        callui_sec_call_popup_data_t *item_data = NULL;
-       Elm_Genlist_Item_Class *itc = NULL;
-       Evas_Object *genlist = NULL;
 
        const callui_call_data_t *hold_call_data = _callui_stp_get_call_data(ad->state_provider, CALLUI_CALL_DATA_HELD);
        const callui_call_data_t *unhold_call_data = _callui_stp_get_call_data(ad->state_provider, CALLUI_CALL_DATA_ACTIVE);
 
-       if (unhold_call_data == NULL) {
-               err("active call data is null");
-               return;
+       if (!unhold_call_data) {
+               err("Active call data is null");
+               return NULL;
        }
 
-       __callui_unload_second_call_popup(ad);
-
-       ad->second_call_popup = elm_popup_add(_callui_window_get_eo(ad->window));
-       CALLUI_RETURN_IF_FAIL(ad->second_call_popup);
-       elm_object_style_set(ad->second_call_popup, "theme_bg");
-       elm_popup_align_set(ad->second_call_popup, ELM_NOTIFY_ALIGN_FILL, 1.0);
-       elm_object_translatable_part_text_set(ad->second_call_popup, "title,text", "IDS_CALL_HEADER_ANSWER_CALL_ABB");
-       evas_object_size_hint_weight_set(ad->second_call_popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       Evas_Object *popup = elm_popup_add(parent);
+       CALLUI_RETURN_NULL_IF_FAIL(popup);
+       elm_object_style_set(popup, "theme_bg");
+       elm_popup_align_set(popup, ELM_NOTIFY_ALIGN_FILL, 1.0);
+       elm_object_translatable_part_text_set(popup, "title,text", "IDS_CALL_HEADER_ANSWER_CALL_ABB");
+       evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
 
-       box = elm_box_add(ad->second_call_popup);
-       CALLUI_RETURN_IF_FAIL(box);
+       Evas_Object *box = elm_box_add(popup);
+       CALLUI_RETURN_VALUE_IF_FAIL(box, __second_call_popup_del(popup));
        evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
 
-       genlist = elm_genlist_add(box);
-       CALLUI_RETURN_IF_FAIL(genlist);
+       Evas_Object *genlist = elm_genlist_add(box);
+       CALLUI_RETURN_VALUE_IF_FAIL(genlist, __second_call_popup_del(popup));
        evas_object_size_hint_weight_set(genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
        evas_object_size_hint_align_set(genlist, EVAS_HINT_FILL, EVAS_HINT_FILL);
+       evas_object_data_set(genlist, CALLUI_EO_DATA_NAME_POPUP, popup);
 
-       itc = elm_genlist_item_class_new();
-       CALLUI_RETURN_IF_FAIL(itc);
+       static Elm_Genlist_Item_Class itc = {
+               ELM_GEN_ITEM_CLASS_HEADER,
+               .item_style = "type1",
+               .func.text_get = __second_call_gl_option_txt_get,
+               .func.del = __second_call_gl_option_del_cb,
+       };
 
-       itc->item_style = "type1";
-       itc->func.text_get = __callui_gl_second_call_option_label_get;
-       itc->func.content_get = NULL;
-       itc->func.state_get = NULL;
-       itc->func.del = __callui_gl_second_call_option_del_cb;
-
-       __callui_get_displayed_caller_info_string(hold_call_data, hold_call_name, CALLUI_BUFF_SIZE_HUG);
-       __callui_get_displayed_caller_info_string(unhold_call_data, unhold_call_name, CALLUI_BUFF_SIZE_HUG);
+       __get_displayed_caller_info_string(hold_call_data, hold_call_name, CALLUI_BUFF_SIZE_HUG);
+       __get_displayed_caller_info_string(unhold_call_data, unhold_call_name, CALLUI_BUFF_SIZE_HUG);
 
        if ((unhold_call_data) && (unhold_call_data->conf_member_count == 1) && (hold_call_data == NULL)) {
                dbg("1 active call");
+
                /* First option */
                item_data = (callui_sec_call_popup_data_t *) calloc(1, sizeof(callui_sec_call_popup_data_t));
-               if (item_data == NULL) {
-                       elm_genlist_item_class_free(itc);
-                       return;
-               }
+               CALLUI_RETURN_VALUE_IF_FAIL(item_data, __second_call_popup_del(popup));
                item_data->index = 0;
-               memset(item_data->option_msg, 0x00, 512);
                temp_str = _("IDS_CALL_OPT_PUT_PS_ON_HOLD_ABB");
-               snprintf(item_data->option_msg, 512, temp_str, unhold_call_name);
-               elm_genlist_item_append(genlist, itc, (void *)item_data, NULL, ELM_GENLIST_ITEM_NONE, __callui_gl_second_call_option_sel, ad);
+               snprintf(item_data->option_msg, CALLUI_BUFF_SIZE_HUG, temp_str, unhold_call_name);
+               elm_genlist_item_append(genlist, &itc, (void *)item_data, NULL, ELM_GENLIST_ITEM_NONE, __second_call_gl_option_sel_cb, ad);
 
                /* Second option */
                item_data = (callui_sec_call_popup_data_t *) calloc(1, sizeof(callui_sec_call_popup_data_t));
-               if (item_data == NULL) {
-                       elm_genlist_item_class_free(itc);
-                       return;
-               }
+               CALLUI_RETURN_VALUE_IF_FAIL(item_data, __second_call_popup_del(popup));
                item_data->index = 1;
-               memset(item_data->option_msg, 0x00, 512);
                temp_str = _("IDS_CALL_OPT_END_CALL_WITH_PS");
-               snprintf(item_data->option_msg, 512, temp_str, unhold_call_name);
-               elm_genlist_item_append(genlist, itc, (void *)item_data, NULL, ELM_GENLIST_ITEM_NONE, __callui_gl_second_call_option_sel, ad);
+               snprintf(item_data->option_msg, CALLUI_BUFF_SIZE_HUG, temp_str, unhold_call_name);
+               elm_genlist_item_append(genlist, &itc, (void *)item_data, NULL, ELM_GENLIST_ITEM_NONE, __second_call_gl_option_sel_cb, ad);
+
        } else if ((unhold_call_data)
                        && (unhold_call_data->conf_member_count > 1)
                        && (hold_call_data == NULL)) {
                dbg("1 active conference call");
+
                /* First option */
                item_data = (callui_sec_call_popup_data_t *) calloc(1, sizeof(callui_sec_call_popup_data_t));
-               if (item_data == NULL) {
-                       elm_genlist_item_class_free(itc);
-                       return;
-               }
+               CALLUI_RETURN_VALUE_IF_FAIL(item_data, __second_call_popup_del(popup));
                item_data->index = 0;
-               memset(item_data->option_msg, 0x00, 512);
-               strncpy(item_data->option_msg, _("IDS_CALL_BODY_HOLD_ACTIVE_CALL_ABB"), 512-1);
-               elm_genlist_item_append(genlist, itc, (void *)item_data, NULL, ELM_GENLIST_ITEM_NONE, __callui_gl_second_call_option_sel, ad);
+               strncpy(item_data->option_msg, _("IDS_CALL_BODY_HOLD_ACTIVE_CALL_ABB"), CALLUI_BUFF_SIZE_HUG-1);
+               elm_genlist_item_append(genlist, &itc, (void *)item_data, NULL, ELM_GENLIST_ITEM_NONE, __second_call_gl_option_sel_cb, ad);
 
                /* Second option */
                item_data = (callui_sec_call_popup_data_t *) calloc(1, sizeof(callui_sec_call_popup_data_t));
-               if (item_data == NULL) {
-                       elm_genlist_item_class_free(itc);
-                       return;
-               }
+               CALLUI_RETURN_VALUE_IF_FAIL(item_data, __second_call_popup_del(popup));
                item_data->index = 1;
-               memset(item_data->option_msg, 0x00, 512);
-               strncpy(item_data->option_msg, _("IDS_CALL_OPT_END_CONFERENCE_CALL"), 512-1);
-               elm_genlist_item_append(genlist, itc, (void *)item_data, NULL, ELM_GENLIST_ITEM_NONE, __callui_gl_second_call_option_sel, ad);
+               strncpy(item_data->option_msg, _("IDS_CALL_OPT_END_CONFERENCE_CALL"), CALLUI_BUFF_SIZE_HUG-1);
+               elm_genlist_item_append(genlist, &itc, (void *)item_data, NULL, ELM_GENLIST_ITEM_NONE, __second_call_gl_option_sel_cb, ad);
+
        } else if ((unhold_call_data)
                        && (hold_call_data) && (unhold_call_data->conf_member_count == 1)
                        && (hold_call_data->conf_member_count == 1)) {
                dbg("1 active call + 1 held call");
+
                /* First option */
                item_data = (callui_sec_call_popup_data_t *) calloc(1, sizeof(callui_sec_call_popup_data_t));
-               if (item_data == NULL) {
-                       elm_genlist_item_class_free(itc);
-                       return;
-               }
+               CALLUI_RETURN_VALUE_IF_FAIL(item_data, __second_call_popup_del(popup));
                item_data->index = 0;
-               memset(item_data->option_msg, 0x00, 512);
                temp_str = _("IDS_CALL_OPT_END_CALL_WITH_PS");
-               snprintf(item_data->option_msg, 512, temp_str, unhold_call_name);
-               elm_genlist_item_append(genlist, itc, (void *)item_data, NULL, ELM_GENLIST_ITEM_NONE, __callui_gl_second_call_option_sel, ad);
+               snprintf(item_data->option_msg, CALLUI_BUFF_SIZE_HUG, temp_str, unhold_call_name);
+               elm_genlist_item_append(genlist, &itc, (void *)item_data, NULL, ELM_GENLIST_ITEM_NONE, __second_call_gl_option_sel_cb, ad);
 
                /* Second option */
                item_data = (callui_sec_call_popup_data_t *) calloc(1, sizeof(callui_sec_call_popup_data_t));
-               if (item_data == NULL) {
-                       elm_genlist_item_class_free(itc);
-                       return;
-               }
+               CALLUI_RETURN_VALUE_IF_FAIL(item_data, __second_call_popup_del(popup));
                item_data->index = 1;
-               memset(item_data->option_msg, 0x00, 512);
                temp_str = _("IDS_CALL_OPT_END_CALL_WITH_PS");
-               snprintf(item_data->option_msg, 512, temp_str, hold_call_name);
-               elm_genlist_item_append(genlist, itc, (void *)item_data, NULL, ELM_GENLIST_ITEM_NONE, __callui_gl_second_call_option_sel, ad);
+               snprintf(item_data->option_msg, CALLUI_BUFF_SIZE_HUG, temp_str, hold_call_name);
+               elm_genlist_item_append(genlist, &itc, (void *)item_data, NULL, ELM_GENLIST_ITEM_NONE, __second_call_gl_option_sel_cb, ad);
 
                /* Third option */
                item_data = (callui_sec_call_popup_data_t *) calloc(1, sizeof(callui_sec_call_popup_data_t));
-               if (item_data == NULL) {
-                       elm_genlist_item_class_free(itc);
-                       return;
-               }
+               CALLUI_RETURN_VALUE_IF_FAIL(item_data, __second_call_popup_del(popup));
                item_data->index = 2;
-               memset(item_data->option_msg, 0x00, 512);
-               strncpy(item_data->option_msg, _("IDS_CALL_OPT_END_ALL_CURRENT_CALLS"), 512-1);
-               elm_genlist_item_append(genlist, itc, (void *)item_data, NULL, ELM_GENLIST_ITEM_NONE, __callui_gl_second_call_option_sel, ad);
+               strncpy(item_data->option_msg, _("IDS_CALL_OPT_END_ALL_CURRENT_CALLS"), CALLUI_BUFF_SIZE_HUG-1);
+               elm_genlist_item_append(genlist, &itc, (void *)item_data, NULL, ELM_GENLIST_ITEM_NONE, __second_call_gl_option_sel_cb, ad);
+
        } else if ((unhold_call_data) && (hold_call_data)
                        && (unhold_call_data->conf_member_count > 1)
                        && (hold_call_data->conf_member_count == 1)) {
                dbg("1 active conf call + 1 held call");
+
                /* First option */
                item_data = (callui_sec_call_popup_data_t *) calloc(1, sizeof(callui_sec_call_popup_data_t));
-               if (item_data == NULL) {
-                       elm_genlist_item_class_free(itc);
-                       return;
-               }
+               CALLUI_RETURN_VALUE_IF_FAIL(item_data, __second_call_popup_del(popup));
                item_data->index = 0;
-               memset(item_data->option_msg, 0x00, 512);
-               strncpy(item_data->option_msg, "End conference call", 512-1);
-               elm_genlist_item_append(genlist, itc, (void *)item_data, NULL, ELM_GENLIST_ITEM_NONE, __callui_gl_second_call_option_sel, ad);
+               strncpy(item_data->option_msg, "End conference call", CALLUI_BUFF_SIZE_HUG-1);
+               elm_genlist_item_append(genlist, &itc, (void *)item_data, NULL, ELM_GENLIST_ITEM_NONE, __second_call_gl_option_sel_cb, ad);
 
                /* Second option */
                item_data = (callui_sec_call_popup_data_t *) calloc(1, sizeof(callui_sec_call_popup_data_t));
-               if (item_data == NULL) {
-                       elm_genlist_item_class_free(itc);
-                       return;
-               }
+               CALLUI_RETURN_VALUE_IF_FAIL(item_data, __second_call_popup_del(popup));
                item_data->index = 1;
-               memset(item_data->option_msg, 0x00, 512);
                temp_str = _("IDS_CALL_OPT_END_CALL_WITH_PS");
-               snprintf(item_data->option_msg, 512, temp_str, hold_call_name);
-               elm_genlist_item_append(genlist, itc, (void *)item_data, NULL, ELM_GENLIST_ITEM_NONE, __callui_gl_second_call_option_sel, ad);
+               snprintf(item_data->option_msg, CALLUI_BUFF_SIZE_HUG, temp_str, hold_call_name);
+               elm_genlist_item_append(genlist, &itc, (void *)item_data, NULL, ELM_GENLIST_ITEM_NONE, __second_call_gl_option_sel_cb, ad);
 
                /* Third option */
                item_data = (callui_sec_call_popup_data_t *) calloc(1, sizeof(callui_sec_call_popup_data_t));
-               if (item_data == NULL) {
-                       elm_genlist_item_class_free(itc);
-                       return;
-               }
+               CALLUI_RETURN_VALUE_IF_FAIL(item_data, __second_call_popup_del(popup));
                item_data->index = 2;
-               memset(item_data->option_msg, 0x00, 512);
-               strncpy(item_data->option_msg, _("IDS_CALL_OPT_END_ALL_CURRENT_CALLS"), 512-1);
-               elm_genlist_item_append(genlist, itc, (void *)item_data, NULL, ELM_GENLIST_ITEM_NONE, __callui_gl_second_call_option_sel, ad);
+               strncpy(item_data->option_msg, _("IDS_CALL_OPT_END_ALL_CURRENT_CALLS"), CALLUI_BUFF_SIZE_HUG-1);
+               elm_genlist_item_append(genlist, &itc, (void *)item_data, NULL, ELM_GENLIST_ITEM_NONE, __second_call_gl_option_sel_cb, ad);
+
        } else if ((unhold_call_data) && (hold_call_data)
                        && (unhold_call_data->conf_member_count == 1)
                        && (hold_call_data->conf_member_count > 1)) {
                dbg("1 active call + 1 held conf call");
+
                /* First option */
                item_data = (callui_sec_call_popup_data_t *) calloc(1, sizeof(callui_sec_call_popup_data_t));
-               if (item_data == NULL) {
-                       elm_genlist_item_class_free(itc);
-                       return;
-               }
+               CALLUI_RETURN_VALUE_IF_FAIL(item_data, __second_call_popup_del(popup));
                item_data->index = 0;
-               memset(item_data->option_msg, 0x00, 512);
                temp_str = _("IDS_CALL_OPT_END_CALL_WITH_PS");
-               snprintf(item_data->option_msg, 512, temp_str, unhold_call_name);
-               elm_genlist_item_append(genlist, itc, (void *)item_data, NULL, ELM_GENLIST_ITEM_NONE, __callui_gl_second_call_option_sel, ad);
+               snprintf(item_data->option_msg, CALLUI_BUFF_SIZE_HUG, temp_str, unhold_call_name);
+               elm_genlist_item_append(genlist, &itc, (void *)item_data, NULL, ELM_GENLIST_ITEM_NONE, __second_call_gl_option_sel_cb, ad);
 
                /* Second option */
                item_data = (callui_sec_call_popup_data_t *) calloc(1, sizeof(callui_sec_call_popup_data_t));
-               if (item_data == NULL) {
-                       elm_genlist_item_class_free(itc);
-                       return;
-               }
+               CALLUI_RETURN_VALUE_IF_FAIL(item_data, __second_call_popup_del(popup));
                item_data->index = 1;
-               memset(item_data->option_msg, 0x00, 512);
-               strncpy(item_data->option_msg, _("IDS_CALL_OPT_END_CONFERENCE_CALL"), 512-1);
-               elm_genlist_item_append(genlist, itc, (void *)item_data, NULL, ELM_GENLIST_ITEM_NONE, __callui_gl_second_call_option_sel, ad);
+               strncpy(item_data->option_msg, _("IDS_CALL_OPT_END_CONFERENCE_CALL"), CALLUI_BUFF_SIZE_HUG-1);
+               elm_genlist_item_append(genlist, &itc, (void *)item_data, NULL, ELM_GENLIST_ITEM_NONE, __second_call_gl_option_sel_cb, ad);
 
                /* Third option */
                item_data = (callui_sec_call_popup_data_t *) calloc(1, sizeof(callui_sec_call_popup_data_t));
-               if (item_data == NULL) {
-                       elm_genlist_item_class_free(itc);
-                       return;
-               }
+               CALLUI_RETURN_VALUE_IF_FAIL(item_data, __second_call_popup_del(popup));
                item_data->index = 2;
-               memset(item_data->option_msg, 0x00, 512);
-               strncpy(item_data->option_msg, _("IDS_CALL_OPT_END_ALL_CURRENT_CALLS"), 512-1);
-               elm_genlist_item_append(genlist, itc, (void *)item_data, NULL, ELM_GENLIST_ITEM_NONE, __callui_gl_second_call_option_sel, ad);
+               strncpy(item_data->option_msg, _("IDS_CALL_OPT_END_ALL_CURRENT_CALLS"), CALLUI_BUFF_SIZE_HUG-1);
+               elm_genlist_item_append(genlist, &itc, (void *)item_data, NULL, ELM_GENLIST_ITEM_NONE, __second_call_gl_option_sel_cb, ad);
+
        } else {
                err("invalid call data!!");
-               elm_genlist_item_class_free(itc);
-               return;
+               return __second_call_popup_del(popup);
        }
 
-       evas_object_smart_callback_add(ad->second_call_popup, "response",
-                               __callui_second_call_cancel_btn_response_cb, ad);
-       eext_object_event_callback_add(ad->second_call_popup, EEXT_CALLBACK_BACK,
-                               __callui_second_call_cancel_btn_response_cb, ad);
-       evas_object_smart_callback_add(ad->second_call_popup, "block,clicked",
-                               __callui_second_call_cancel_btn_response_cb, ad);
+       evas_object_smart_callback_add(popup, "response", __second_call_cancel_btn_response_cb, ad);
+       eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, __second_call_cancel_btn_response_cb, ad);
+       evas_object_smart_callback_add(popup, "block,clicked", __second_call_cancel_btn_response_cb, ad);
 
        elm_box_pack_end(box, genlist);
        evas_object_show(genlist);
-       elm_genlist_item_class_free(itc);
 
-       evas_object_size_hint_min_set(box, ELM_SCALE_SIZE(CALLUI_POPUP_LIST_W), ELM_SCALE_SIZE(CALLUI_POPUP_LIST_ITEM_H * (item_data->index + 1)));
+       evas_object_size_hint_min_set(box,
+                       ELM_SCALE_SIZE(CALLUI_POPUP_LIST_W),
+                       ELM_SCALE_SIZE(CALLUI_POPUP_LIST_ITEM_H * (item_data->index + 1)));
        evas_object_show(box);
-       elm_object_content_set(ad->second_call_popup, box);
+       elm_object_content_set(popup, box);
 
-       evas_object_show(ad->second_call_popup);
+       evas_object_show(popup);
+
+       return popup;
 }
 
-static void __callui_unload_bt_popup(callui_app_data_t *ad)
+static Evas_Object *__bt_popup_del(Evas_Object *popup)
 {
-       dbg("..");
-       CALLUI_RETURN_IF_FAIL(ad);
-       if (ad->bt_popup) {
-               evas_object_del(ad->bt_popup);
-               ad->bt_popup = NULL;
+       if (popup) {
+               evas_object_del(popup);
        }
-       return;
+       return NULL;
 }
 
-static void __callui_bt_popup_cancel_btn_cb(void *data, Evas_Object *obj, void *event_info)
+static void __bt_popup_cancel_btn_cb(void *data, Evas_Object *obj, void *event_info)
 {
-       dbg("..");
+       CALLUI_RETURN_IF_FAIL(data);
 
-       __callui_unload_bt_popup(data);
-       return;
+       Evas_Object *eo = (Evas_Object *)evas_object_data_get(obj, CALLUI_EO_DATA_NAME_POPUP);
+       __bt_popup_del(eo);
 }
 
-static void __callui_bt_popup_ok_btn_cb(void *data, Evas_Object *obj, void *event_info)
+static void __bt_popup_ok_btn_cb(void *data, Evas_Object *obj, void *event_info)
 {
-       dbg("..");
+       CALLUI_RETURN_IF_FAIL(data);
+
        callui_app_data_t *ad = (callui_app_data_t *)data;
        CALLUI_RETURN_IF_FAIL(ad);
 
-       __callui_unload_bt_popup(ad);
-       /* Launch the BT App Control */
+       evas_object_del((Evas_Object *)evas_object_data_get(obj, CALLUI_EO_DATA_NAME_POPUP));
+
        _callui_common_launch_setting_bluetooth(ad);
-       return;
 }
 
-void _callui_load_bluetooth_popup(callui_app_data_t *ad)
+Evas_Object *_callui_create_bluetooth_popup(Evas_Object *parent, callui_app_data_t *ad)
 {
-       Evas_Object *btn_ok = NULL;
-       Evas_Object *btn_cancel = NULL;
-       CALLUI_RETURN_IF_FAIL(ad);
+       CALLUI_RETURN_NULL_IF_FAIL(parent);
+       CALLUI_RETURN_NULL_IF_FAIL(ad);
 
-       __callui_unload_bt_popup(ad);
-       ad->bt_popup = elm_popup_add(_callui_window_get_eo(ad->window));
-       elm_popup_align_set(ad->bt_popup, ELM_NOTIFY_ALIGN_FILL, 1.0);
-       evas_object_size_hint_weight_set(ad->bt_popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       Evas_Object *popup = elm_popup_add(parent);
+       elm_popup_align_set(popup, ELM_NOTIFY_ALIGN_FILL, 1.0);
+       evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
 
-       elm_object_translatable_part_text_set(ad->bt_popup, "title,text", "IDS_CALL_HEADER_TURN_ON_BLUETOOTH_ABB");
-       elm_object_translatable_text_set(ad->bt_popup, "IDS_CALL_POP_TO_SWITCH_TO_USING_YOUR_BLUETOOTH_DEVICE_BLUETOOTH_WILL_BE_TURNED_ON");
+       elm_object_translatable_part_text_set(popup, "title,text", "IDS_CALL_HEADER_TURN_ON_BLUETOOTH_ABB");
+       elm_object_translatable_text_set(popup, "IDS_CALL_POP_TO_SWITCH_TO_USING_YOUR_BLUETOOTH_DEVICE_BLUETOOTH_WILL_BE_TURNED_ON");
 
-       btn_cancel = elm_button_add(ad->bt_popup);
+       Evas_Object *btn_cancel = elm_button_add(popup);
+       CALLUI_RETURN_VALUE_IF_FAIL(btn_cancel, __bt_popup_del(popup));
        elm_object_style_set(btn_cancel, "popup");
        elm_object_translatable_text_set(btn_cancel, "IDS_COM_SK_CANCEL");
-       elm_object_part_content_set(ad->bt_popup, "button1", btn_cancel);
-       evas_object_smart_callback_add(btn_cancel, "clicked", __callui_bt_popup_cancel_btn_cb, ad);
+       evas_object_smart_callback_add(btn_cancel, "clicked", __bt_popup_cancel_btn_cb, ad);
+       evas_object_data_set(btn_cancel, CALLUI_EO_DATA_NAME_POPUP, popup);
+       elm_object_part_content_set(popup, "button1", btn_cancel);
 
-       btn_ok = elm_button_add(ad->bt_popup);
+       Evas_Object *btn_ok = elm_button_add(popup);
+       CALLUI_RETURN_VALUE_IF_FAIL(btn_cancel, __bt_popup_del(popup));
        elm_object_style_set(btn_ok, "popup");
        elm_object_translatable_text_set(btn_ok, "IDS_COM_SK_OK");
-       elm_object_part_content_set(ad->bt_popup, "button2", btn_ok);
-       evas_object_smart_callback_add(btn_ok, "clicked", __callui_bt_popup_ok_btn_cb, ad);
+       evas_object_smart_callback_add(btn_ok, "clicked", __bt_popup_ok_btn_cb, ad);
+       evas_object_data_set(btn_ok, CALLUI_EO_DATA_NAME_POPUP, popup);
+       elm_object_part_content_set(popup, "button2", btn_ok);
 
-       eext_object_event_callback_add(ad->bt_popup, EEXT_CALLBACK_BACK, __callui_bt_popup_cancel_btn_cb, ad);
+       eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, __bt_popup_cancel_btn_cb, ad);
 
-       evas_object_show(ad->bt_popup);
-       return;
+       evas_object_show(popup);
+
+       return popup;
 }
 
-static void __callui_ctxpopup_item_hold_cb(void *data, Evas_Object *obj, void *event_info)
+static void __more_ctxpopup_item_hold_cb(void *data, Evas_Object *obj, void *event_info)
 {
        CALLUI_RETURN_IF_FAIL(data);
 
        callui_app_data_t *ad = (callui_app_data_t *)data;
 
-       __callui_destroy_more_ctxpopup(obj, ad);
+       __more_ctxpopup_destroy(obj, ad);
 
        callui_result_e res = _callui_manager_hold_call(ad->call_manager);
        if (res != CALLUI_RESULT_OK) {
@@ -652,13 +605,13 @@ static void __callui_ctxpopup_item_hold_cb(void *data, Evas_Object *obj, void *e
        }
 }
 
-static void __callui_ctxpopup_item_unhold_cb(void *data, Evas_Object *obj, void *event_info)
+static void __more_ctxpopup_item_unhold_cb(void *data, Evas_Object *obj, void *event_info)
 {
        CALLUI_RETURN_IF_FAIL(data);
 
        callui_app_data_t *ad = (callui_app_data_t *)data;
 
-       __callui_destroy_more_ctxpopup(obj, ad);
+       __more_ctxpopup_destroy(obj, ad);
 
        callui_result_e res = _callui_manager_unhold_call(ad->call_manager);
        if (res != CALLUI_RESULT_OK) {
@@ -666,7 +619,7 @@ static void __callui_ctxpopup_item_unhold_cb(void *data, Evas_Object *obj, void
        }
 }
 
-static void __callui_move_more_ctxpopup(Evas_Object *ctxpopup, callui_app_data_t *ad)
+static void __more_ctxpopup_move(Evas_Object *ctxpopup, callui_app_data_t *ad)
 {
        Evas_Coord w = 0, h = 0;
        _callui_window_get_screen_size(ad->window, NULL, NULL, &w, &h);
@@ -683,21 +636,21 @@ static void __callui_move_more_ctxpopup(Evas_Object *ctxpopup, callui_app_data_t
        }
 }
 
-static void __callui_more_ctxpopup_dismiss_cb(void *data, Evas_Object *obj, void *event_info)
+static void __more_ctxpopup_dismiss_cb(void *data, Evas_Object *obj, void *event_info)
 {
        CALLUI_RETURN_IF_FAIL(data);
 
-       __callui_destroy_more_ctxpopup(obj, data);
+       __more_ctxpopup_destroy(obj, data);
 }
 
-static void __callui_more_ctxpopup_delete_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
+static void __more_ctxpopup_delete_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
 {
        CALLUI_RETURN_IF_FAIL(data);
 
-       __callui_destroy_more_ctxpopup(obj, data);
+       __more_ctxpopup_destroy(obj, data);
 }
 
-Evas_Object *_callui_load_more_menu_popup(Evas_Object *parent, callui_app_data_t *ad)
+Evas_Object *_callui_create_more_menu_popup(Evas_Object *parent, callui_app_data_t *ad)
 {
        CALLUI_RETURN_NULL_IF_FAIL(parent);
        CALLUI_RETURN_NULL_IF_FAIL(ad);
@@ -706,34 +659,44 @@ Evas_Object *_callui_load_more_menu_popup(Evas_Object *parent, callui_app_data_t
        CALLUI_RETURN_NULL_IF_FAIL(ctxpopup);
        elm_object_style_set(ctxpopup, "more/default");
        elm_ctxpopup_auto_hide_disabled_set(ctxpopup, EINA_FALSE);
-       evas_object_smart_callback_add(ctxpopup, "dismissed", __callui_more_ctxpopup_dismiss_cb, ad);
-       evas_object_event_callback_add(ctxpopup, EVAS_CALLBACK_DEL, __callui_more_ctxpopup_delete_cb, ad);
-       eext_object_event_callback_add(ctxpopup, EEXT_CALLBACK_BACK, eext_ctxpopup_back_cb, NULL);
-       eext_object_event_callback_add(ctxpopup, EEXT_CALLBACK_MORE, eext_ctxpopup_back_cb, NULL);
 
        Elm_Object_Item *ctxpopup_item = NULL;
        if (_callui_stp_get_call_data(ad->state_provider, CALLUI_CALL_DATA_ACTIVE)) {
-               ctxpopup_item = elm_ctxpopup_item_append(ctxpopup, "IDS_CALL_BUTTON_HOLD", NULL, __callui_ctxpopup_item_hold_cb, ad);
+               ctxpopup_item = elm_ctxpopup_item_append(ctxpopup, "IDS_CALL_BUTTON_HOLD", NULL, __more_ctxpopup_item_hold_cb, ad);
        } else {
-               ctxpopup_item = elm_ctxpopup_item_append(ctxpopup, "IDS_CALL_BUTTON_RESUME_ABB", NULL, __callui_ctxpopup_item_unhold_cb, ad);
+               ctxpopup_item = elm_ctxpopup_item_append(ctxpopup, "IDS_CALL_BUTTON_RESUME_ABB", NULL, __more_ctxpopup_item_unhold_cb, ad);
        }
+       CALLUI_RETURN_VALUE_IF_FAIL(ctxpopup_item, __more_ctxpopup_del(ctxpopup));
        elm_object_item_domain_text_translatable_set(ctxpopup_item, CALLUI_TEXT_DOMAIN, EINA_TRUE);
 
+       evas_object_smart_callback_add(ctxpopup, "dismissed", __more_ctxpopup_dismiss_cb, ad);
+       evas_object_event_callback_add(ctxpopup, EVAS_CALLBACK_DEL, __more_ctxpopup_delete_cb, ad);
+       eext_object_event_callback_add(ctxpopup, EEXT_CALLBACK_BACK, eext_ctxpopup_back_cb, NULL);
+       eext_object_event_callback_add(ctxpopup, EEXT_CALLBACK_MORE, eext_ctxpopup_back_cb, NULL);
+
        elm_ctxpopup_direction_priority_set(ctxpopup, ELM_CTXPOPUP_DIRECTION_UP, ELM_CTXPOPUP_DIRECTION_UNKNOWN,
                        ELM_CTXPOPUP_DIRECTION_UNKNOWN, ELM_CTXPOPUP_DIRECTION_UNKNOWN);
 
-       __callui_move_more_ctxpopup(ctxpopup, ad);
+       __more_ctxpopup_move(ctxpopup, ad);
 
        evas_object_show(ctxpopup);
 
        return ctxpopup;
 }
 
-static void __callui_destroy_more_ctxpopup(Evas_Object *ctxpopup, callui_app_data_t *ad)
+static Evas_Object *__more_ctxpopup_del(Evas_Object *ctxpopup)
+{
+       if (ctxpopup) {
+               evas_object_del(ctxpopup);
+       }
+       return NULL;
+}
+
+static void __more_ctxpopup_destroy(Evas_Object *ctxpopup, callui_app_data_t *ad)
 {
        if (ctxpopup) {
-               evas_object_smart_callback_del_full(ctxpopup, "dismissed", __callui_more_ctxpopup_dismiss_cb, ad);
-               evas_object_event_callback_del_full(ctxpopup, EVAS_CALLBACK_DEL, __callui_more_ctxpopup_delete_cb, ad);
+               evas_object_smart_callback_del_full(ctxpopup, "dismissed", __more_ctxpopup_dismiss_cb, ad);
+               evas_object_event_callback_del_full(ctxpopup, EVAS_CALLBACK_DEL, __more_ctxpopup_delete_cb, ad);
                eext_object_event_callback_del(ctxpopup, EEXT_CALLBACK_BACK, eext_ctxpopup_back_cb);
                eext_object_event_callback_del(ctxpopup, EEXT_CALLBACK_MORE, eext_ctxpopup_back_cb);
                evas_object_del(ctxpopup);
index c93fa1e..0f7f1de 100644 (file)
@@ -179,8 +179,6 @@ static callui_result_e __callui_view_incoming_call_ondestroy(call_view_data_base
        }
 #endif
 
-       DELETE_EVAS_OBJECT(ad->second_call_popup);
-
        DELETE_EVAS_OBJECT(vd->base_view.contents);
 
        _callui_window_unset_keygrab_mode(ad->window, CALLUI_KEY_HOME);
@@ -829,13 +827,6 @@ static callui_result_e __update_displayed_data(callui_view_incoming_call_h vd)
        const callui_call_data_t *incom = _callui_stp_get_call_data(ad->state_provider, CALLUI_CALL_DATA_INCOMING);
        CALLUI_RETURN_VALUE_IF_FAIL(incom, CALLUI_RESULT_FAIL);
 
-       const callui_call_data_t *active = _callui_stp_get_call_data(ad->state_provider, CALLUI_CALL_DATA_ACTIVE);
-       const callui_call_data_t *held = _callui_stp_get_call_data(ad->state_provider, CALLUI_CALL_DATA_HELD);
-
-       if (ad->second_call_popup && (!active && !held)) {
-               DELETE_EVAS_OBJECT(ad->second_call_popup);
-       }
-
        elm_object_translatable_part_text_set(vd->base_view.contents, "call_txt_status", "IDS_CALL_BODY_INCOMING_CALL");
 
        if (STRING_EMPTY(incom->call_num)) {
index 3ea732b..fce20b2 100644 (file)
@@ -48,6 +48,9 @@ struct _callui_vm {
        bool is_activated;
        Evas_Object *more_ctxpopup;
 
+       Evas_Object *action_popup;
+       callui_action_popup_type_e action_popup_type;
+
        callui_lock_manager_lock_state_e cur_lock_state;
 };
 typedef struct _callui_vm callui_vm_t;
@@ -60,6 +63,7 @@ static callui_result_e __create_update_view(callui_vm_h vm, callui_view_type_e t
 static call_view_data_base_t *__allocate_view(callui_view_type_e view_type);
 static callui_result_e __change_view(callui_vm_h vm, callui_view_type_e type);
 static void __update_cur_view(callui_vm_h vm);
+static void __update_vm(callui_vm_h vm);
 static callui_result_e __auto_change_view(callui_vm_h vm, callui_call_data_t *call_data, callui_sim_slot_type_e sim_slot);
 static void __call_state_event_cb(void *user_data,
                callui_call_event_type_e call_event_type,
@@ -72,12 +76,15 @@ static void __deactivate_vm(callui_vm_h vm);
 static void __lock_state_change_cb(void *data, callui_lock_manager_type_e type, callui_lock_manager_lock_state_e lock_state);
 static void __more_btn_click_cb(void *data, Evas_Object *obj, void *event_info);
 static void __more_menu_popup_delete_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
-static void __close_more_menu_popup(callui_vm_h vm);
+static void __delete_more_menu_popup(callui_vm_h vm);
+static void __action_popup_del_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
+static void __delete_action_popup(callui_vm_h vm);
 
-static void __close_more_menu_popup(callui_vm_h vm)
+static void __delete_more_menu_popup(callui_vm_h vm)
 {
        if (vm->more_ctxpopup) {
-               evas_object_del(vm->more_ctxpopup);
+               evas_object_event_callback_del_full(vm->more_ctxpopup, EVAS_CALLBACK_DEL, __more_menu_popup_delete_cb, vm);
+               DELETE_EVAS_OBJECT(vm->more_ctxpopup);
        }
 }
 
@@ -99,22 +106,27 @@ static void __more_btn_click_cb(void *data, Evas_Object *obj, void *event_info)
        if ((_callui_common_is_proximity_sensor_supported() ?
                        _callui_lock_manager_is_lcd_off(vm->ad->lock_manager) :
                        _callui_lock_manager_is_running(vm->ad->lock_manager))) {
-               dbg("Lock screen active. Do not show more menu popup");
+               dbg("Lock screen active. Do not show more menu action popup");
                return;
        }
 
        if (!(vm->cur_view_type == CALLUI_VIEW_SINGLECALL || vm->cur_view_type == CALLUI_VIEW_MULTICALL_CONF)) {
-               dbg("More menu popup not supported for view [%d]", vm->cur_view_type);
+               dbg("More menu action_popup not supported for view [%d]", vm->cur_view_type);
+               return;
+       }
+
+       if (vm->action_popup) {
+               dbg("Action popup [%d] is shown. Can not show more menu popup", vm->action_popup_type);
                return;
        }
 
        if (vm->more_ctxpopup) {
-               dbg("More menu popup already shown. Dismiss popup");
+               dbg("More menu action_popup already shown. Dismiss action popup");
                elm_ctxpopup_dismiss(vm->more_ctxpopup);
                return;
        }
 
-       vm->more_ctxpopup = _callui_load_more_menu_popup(vm->main_ly, vm->ad);
+       vm->more_ctxpopup = _callui_create_more_menu_popup(vm->main_ly, vm->ad);
        CALLUI_RETURN_IF_FAIL(vm->more_ctxpopup);
        evas_object_event_callback_add(vm->more_ctxpopup, EVAS_CALLBACK_DEL, __more_menu_popup_delete_cb, vm);
 }
@@ -297,7 +309,7 @@ static void __lock_state_change_cb(void *data, callui_lock_manager_type_e type,
        if (lock_state == CALLUI_LOCK_MNG_STATE_LOCKED) {
 
                if (type == CALLUI_LOCK_MNG_TYPE_TOUCH) {
-                       __close_more_menu_popup(vm);
+                       __delete_more_menu_popup(vm);
                }
 
                if (vm->cur_view->lock) {
@@ -339,6 +351,7 @@ static callui_result_e __callui_vm_init(callui_vm_h vm, callui_app_data_t *ad)
        vm->cur_view_type = CALLUI_VIEW_UNDEFINED;
        vm->ad = ad;
        vm->paused = true;
+       vm->action_popup_type = CALLUI_ACTION_POPUP_UNDEFINED;
 
        vm->main_ly = __create_eo_layout(_callui_window_get_content_parent(ad->window));
        CALLUI_RETURN_VALUE_IF_FAIL(vm->main_ly, CALLUI_RESULT_FAIL);
@@ -424,10 +437,8 @@ static void __deactivate_vm(callui_vm_h vm)
        }
 
        eext_object_event_callback_del(vm->main_ly, EEXT_CALLBACK_MORE, __more_btn_click_cb);
-       if (vm->more_ctxpopup) {
-               evas_object_event_callback_del_full(vm->more_ctxpopup, EVAS_CALLBACK_DEL, __more_menu_popup_delete_cb, vm);
-               DELETE_EVAS_OBJECT(vm->more_ctxpopup);
-       }
+       __delete_more_menu_popup(vm);
+       __delete_action_popup(vm);
 
        _callui_lock_manager_remove_state_change_cb(vm->ad->lock_manager, __lock_state_change_cb, vm);
        _callui_manager_remove_end_call_called_cb(vm->ad->call_manager, __end_call_called_cb, vm);
@@ -550,7 +561,7 @@ static callui_result_e __create_update_view(callui_vm_h vm, callui_view_type_e t
        } else {
                vm->cur_view->update_flags |= CALLUI_UF_DATA_REFRESH;
                if (!vm->paused) {
-                       __update_cur_view(vm);
+                       __update_vm(vm);
                }
        }
        return CALLUI_RESULT_OK;
@@ -579,7 +590,8 @@ static callui_result_e __change_view(callui_vm_h vm, callui_view_type_e type)
 
        if ((last_view_type != CALLUI_VIEW_UNDEFINED) && (last_view_type != type)) {
                dbg("Destroy view [%d]", last_view_type);
-               __close_more_menu_popup(vm);
+               __delete_more_menu_popup(vm);
+               __delete_action_popup(vm);
                res = __destroy_cur_view(vm);
                CALLUI_RETURN_VALUE_IF_FAIL(res == CALLUI_RESULT_OK, res);
        }
@@ -639,13 +651,23 @@ callui_result_e _callui_vm_auto_change_view(callui_vm_h vm)
        return __auto_change_view(vm, NULL, CALLUI_SIM_SLOT_DEFAULT);
 }
 
-static void __update_cur_view(callui_vm_h vm)
+static void __update_vm(callui_vm_h vm)
 {
-       call_view_data_base_t *cur_view = vm->cur_view;
+       if (vm->cur_view_type == CALLUI_VIEW_INCOMING_CALL) {
+               const callui_call_data_t *active = _callui_stp_get_call_data(vm->ad->state_provider, CALLUI_CALL_DATA_ACTIVE);
+               const callui_call_data_t *held = _callui_stp_get_call_data(vm->ad->state_provider, CALLUI_CALL_DATA_HELD);
+               if (vm->action_popup_type == CALLUI_ACTION_POPUP_SECOND_CALL && !active && !held) {
+                       __delete_action_popup(vm);
+               }
+       }
+       __update_cur_view(vm);
+}
 
-       if (cur_view && cur_view->update && cur_view->update_flags) {
-               cur_view->update(vm->cur_view);
-               cur_view->update_flags = 0;
+static void __update_cur_view(callui_vm_h vm)
+{
+       if (vm->cur_view && vm->cur_view->update && vm->cur_view->update_flags) {
+               vm->cur_view->update(vm->cur_view);
+               vm->cur_view->update_flags = 0;
        }
 }
 
@@ -687,7 +709,7 @@ callui_result_e _callui_vm_resume(callui_vm_h vm)
        if (cur_view && cur_view->resume) {
                cur_view->resume(vm->cur_view);
        }
-       __update_cur_view(vm);
+       __update_vm(vm);
        return CALLUI_RESULT_OK;
 }
 
@@ -706,8 +728,83 @@ callui_result_e _callui_vm_update_language(callui_vm_h vm)
        if (cur_view) {
                cur_view->update_flags |= CALLUI_UF_LANG_CHANGE;
                if (!vm->paused) {
-                       __update_cur_view(vm);
+                       __update_vm(vm);
                }
        }
        return CALLUI_RESULT_OK;
 }
+
+static void __action_popup_del_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+       CALLUI_RETURN_IF_FAIL(data);
+
+       callui_vm_h vm = (callui_vm_h)data;
+       evas_object_event_callback_del_full(vm->action_popup, EVAS_CALLBACK_DEL, __action_popup_del_cb, vm);
+       vm->action_popup = NULL;
+       vm->action_popup_type = CALLUI_ACTION_POPUP_UNDEFINED;
+}
+
+static void __delete_action_popup(callui_vm_h vm)
+{
+       if (vm->action_popup) {
+               evas_object_event_callback_del_full(vm->action_popup, EVAS_CALLBACK_DEL, __action_popup_del_cb, vm);
+               DELETE_EVAS_OBJECT(vm->action_popup);
+               vm->action_popup_type = CALLUI_ACTION_POPUP_UNDEFINED;
+       }
+}
+
+/**
+ * @brief Shows action popup by set type
+ *
+ * @param[in]  vm              View manager handle
+ * @param[in]  type    Action popup type
+ *
+ * @return result CALLUI_RESULT_OK on success
+ */
+callui_result_e _callui_vm_show_action_popup(callui_vm_h vm, callui_action_popup_type_e type)
+{
+       CALLUI_RETURN_VALUE_IF_FAIL(vm, CALLUI_RESULT_INVALID_PARAM);
+       CALLUI_RETURN_VALUE_IF_FAIL((type > CALLUI_ACTION_POPUP_UNDEFINED
+                       && type <= CALLUI_ACTION_POPUP_BLUETOOTH),
+                       CALLUI_RESULT_INVALID_PARAM);
+
+       if (vm->action_popup && type == vm->action_popup_type) {
+               dbg("Ignored. Request on show same popup type [%d]", type);
+               return CALLUI_RESULT_OK;
+       }
+
+       __delete_action_popup(vm);
+
+       Evas_Object *eo = NULL;
+       switch(type) {
+       case CALLUI_ACTION_POPUP_SECOND_CALL:
+               eo = _callui_create_second_call_popup(_callui_window_get_eo(vm->ad->window), vm->ad);
+               break;
+       case CALLUI_ACTION_POPUP_BLUETOOTH:
+               eo = _callui_create_bluetooth_popup(_callui_window_get_eo(vm->ad->window), vm->ad);
+               break;
+       default:
+               return CALLUI_RESULT_FAIL;
+       }
+       CALLUI_RETURN_VALUE_IF_FAIL(eo, CALLUI_RESULT_FAIL);
+
+       vm->action_popup = eo;
+       vm->action_popup_type = type;
+       evas_object_event_callback_add(vm->action_popup, EVAS_CALLBACK_DEL, __action_popup_del_cb, vm);
+
+       return CALLUI_RESULT_OK;
+}
+
+/**
+ * @brief Gets visible action popup type
+ *
+ * @param[in]  vm              View manager handle
+ *
+ * @return Visible action_popup type or CALLUI_ACTION_POPUP_UNDEFINED if no action popup is shown
+ */
+callui_action_popup_type_e _callui_vm_get_visible_action_popup_type(callui_vm_h vm)
+{
+       CALLUI_RETURN_VALUE_IF_FAIL(vm, CALLUI_ACTION_POPUP_UNDEFINED);
+
+       return vm->action_popup_type;
+}
index 73e05a7..684eb62 100755 (executable)
@@ -849,9 +849,9 @@ static void __process_home_key_up(callui_app_data_t *ad)
                                        _callui_common_unlock_swipe_lock();
                                }
                        } else {
-                               if (!ad->second_call_popup) {
+                               if (_callui_vm_get_visible_action_popup_type(ad->view_manager) != CALLUI_ACTION_POPUP_SECOND_CALL) {
                                        dbg("Show 2nd MT call popup");
-                                       _callui_load_second_call_popup(ad);
+                                       _callui_vm_show_action_popup(ad->view_manager, CALLUI_ACTION_POPUP_SECOND_CALL);
                                }
                                _callui_window_set_keygrab_mode(ad->window, CALLUI_KEY_HOME, CALLUI_WIN_KEYGRAB_EXCLUSIVE);
                        }