Fix issue uninitialized pointer was used
[platform/core/uifw/inputdelegator.git] / src / w-input-selector.cpp
index 021f6cd..cc1d389 100755 (executable)
@@ -20,7 +20,6 @@
 #include <dlog.h>
 #include <Eina.h>
 #include <string>
-#include <efl_assist.h>
 #include <vconf.h>
 #include <vconf-keys.h>
 
@@ -43,15 +42,12 @@ InputTypeData g_input_type_data;
 
 static Elm_Object_Item *it_empty;
 static Elm_Object_Item *it_title;
-static Elm_Object_Item *it_plus;
 
 Evas_Coord last_step; // 0 ~ 9 for gesture, 10~11 for rotary
 
 void _init_app_data(App_Data* app_data);
 static void _app_language_changed(app_event_info_h event_info, void *user_data);
 
-static char *_genlist_text_set_theme_color(const char *str, const char *code);
-
 Evas_Object* _create_genlist(Evas_Object* parent);
 void _create_genlist_items(void* user_data);
 static void _popup_close_cb(void *data, Evas_Object *obj, void *event_info);
@@ -112,9 +108,9 @@ void init_customizing_theme(void)
 
 static Eina_Bool back_cb(void *data, Elm_Object_Item *it)
 {
-    reply_to_sender_by_callback_for_back();
-    elm_exit();
-    return EINA_FALSE;
+       reply_to_sender_by_callback_for_back();
+       ui_app_exit();
+       return EINA_FALSE;
 }
 
 static void _stt_clicked_cb(void *data, Evas_Object * obj, void *event_info)
@@ -151,8 +147,7 @@ static void _emoticon_clicked_cb(void *data, Evas_Object * obj, void *event_info
        if(!ad)
                return;
 
-//     ise_show_emoticon_popup(ad);
-       ise_show_emoticon_popup_rotary(ad);
+    ise_show_emoticon_list(ad);
 }
 
 static void _keyboard_clicked_cb(void *data, Evas_Object * obj, void *event_info)
@@ -167,26 +162,6 @@ static void _keyboard_clicked_cb(void *data, Evas_Object * obj, void *event_info
        input_keyboard_launch(ad->win_main, data);
 }
 
-static void __bt_connection_result_cb(app_control_h request, app_control_h reply, app_control_result_e result, void *user_data)
-{
-       char *val = NULL;
-
-       if (reply == NULL) {
-               PRINTFUNC(DLOG_ERROR, "service_h is NULL");
-               return;
-       }
-
-       app_control_get_extra_data(reply, "__BT_CONNECTION__", &val);
-       if (val) {
-               if ( strcmp(val, "Connected") == 0 ) {
-                       PRINTFUNC(DLOG_ERROR, "BT Connected");
-               } else {
-                       PRINTFUNC(DLOG_ERROR, "BT Not Connected");
-               }
-               free(val);
-       }
-}
-
 static Evas_Object * __ise_gl_2button_content_get(void *data, Evas_Object *obj, const char *part)
 {
        char *first_input_type = *(g_input_type_data.input_type_array + 0);
@@ -201,15 +176,15 @@ static Evas_Object * __ise_gl_2button_content_get(void *data, Evas_Object *obj,
                elm_image_resizable_set(ic, EINA_TRUE, EINA_TRUE);
                string path = get_resource_path();
                if (!strcmp(part, "elm.icon.1")) {
-                       elm_object_style_set(btn, "anchor");
                        string path_ic;
                        if(!strcmp(first_input_type, "input_voice")) {
+                               elm_object_style_set(btn, "ime_button_stt");
                                path_ic = path + "images/w_mode_stt_ic.png";
-                       }
-                       else if(!strcmp(first_input_type, "input_emoticon")) {
+                       } else if (!strcmp(first_input_type, "input_emoticon")) {
+                               elm_object_style_set(btn, "ime_button_emoticon");
                                path_ic = path + "images/Delta_w_mode_emoticon_ic.png";
-                       }
-                       else if(!strcmp(first_input_type, "input_keyboard")) {
+                       } else if (!strcmp(first_input_type, "input_keyboard")) {
+                               elm_object_style_set(btn, "ime_button_keyboard");
                                path_ic = path + "images/w_mode_keyboard_ic.png";
                                evas_object_propagate_events_set(btn, EINA_FALSE);
                        }
@@ -217,15 +192,15 @@ static Evas_Object * __ise_gl_2button_content_get(void *data, Evas_Object *obj,
                        elm_object_content_set(btn, ic);
                        evas_object_layer_set(btn, 32000);
                } else if (!strcmp(part, "elm.icon.2")){
-                       elm_object_style_set(btn, "anchor");
                        string path_ic;
                        if(!strcmp(second_input_type, "input_voice")) {
+                               elm_object_style_set(btn, "ime_button_stt");
                                path_ic = path + "images/w_mode_stt_ic.png";
-                       }
-                       else if(!strcmp(second_input_type, "input_emoticon")) {
+                       } else if (!strcmp(second_input_type, "input_emoticon")) {
+                               elm_object_style_set(btn, "ime_button_emoticon");
                                path_ic = path + "images/Delta_w_mode_emoticon_ic.png";
-                       }
-                       else if(!strcmp(second_input_type, "input_keyboard")) {
+                       } else if (!strcmp(second_input_type, "input_keyboard")) {
+                               elm_object_style_set(btn, "ime_button_keyboard");
                                path_ic = path + "images/w_mode_keyboard_ic.png";
                                evas_object_propagate_events_set(btn, EINA_FALSE);
                        }
@@ -244,11 +219,9 @@ static Evas_Object * __ise_gl_2button_content_get(void *data, Evas_Object *obj,
                        evas_object_layer_set(btn, 32000);
                        if(!strcmp(first_input_type, "input_voice")) {
                                evas_object_smart_callback_add(btn, "clicked", _stt_clicked_cb, app_data);
-                       }
-                       else if(!strcmp(first_input_type, "input_emoticon")) {
+                       } else if (!strcmp(first_input_type, "input_emoticon")) {
                                evas_object_smart_callback_add(btn, "clicked", _emoticon_clicked_cb, app_data);
-                       }
-                       else if(!strcmp(first_input_type, "input_keyboard")) {
+                       } else if (!strcmp(first_input_type, "input_keyboard")) {
                                evas_object_propagate_events_set(btn, EINA_FALSE);
                                evas_object_smart_callback_add(btn, "clicked", _keyboard_clicked_cb, app_data);
                        }
@@ -256,11 +229,9 @@ static Evas_Object * __ise_gl_2button_content_get(void *data, Evas_Object *obj,
                        evas_object_layer_set(btn, 32000);
                        if(!strcmp(second_input_type, "input_voice")) {
                                evas_object_smart_callback_add(btn, "clicked", _stt_clicked_cb, app_data);
-                       }
-                       else if(!strcmp(second_input_type, "input_emoticon")) {
+                       } else if (!strcmp(second_input_type, "input_emoticon")) {
                                evas_object_smart_callback_add(btn, "clicked", _emoticon_clicked_cb, app_data);
-                       }
-                       else if(!strcmp(second_input_type, "input_keyboard")) {
+                       } else if (!strcmp(second_input_type, "input_keyboard")) {
                                evas_object_propagate_events_set(btn, EINA_FALSE);
                                evas_object_smart_callback_add(btn, "clicked", _keyboard_clicked_cb, app_data);
                        }
@@ -284,21 +255,21 @@ static Evas_Object * __ise_gl_3button_content_get(void *data, Evas_Object *obj,
                elm_image_resizable_set(ic, EINA_TRUE, EINA_TRUE);
                string path = get_resource_path();
                if (!strcmp(part, "elm.icon.1")) {
-                       elm_object_style_set(btn, "anchor");
+                       elm_object_style_set(btn, "ime_button_stt");
                        string path_ic = path + "images/w_mode_stt_ic.png";
                        elm_image_file_set(ic, path_ic.c_str(), NULL);
                        elm_object_content_set(btn, ic);
                        evas_object_layer_set(btn, 32000);
 
                } else if (!strcmp(part, "elm.icon.2")){
-                       elm_object_style_set(btn, "anchor");
+                       elm_object_style_set(btn, "ime_button_emoticon");
                        string path_ic = path + "images/Delta_w_mode_emoticon_ic.png";
                        elm_image_file_set(ic, path_ic.c_str(), NULL);
                        elm_object_content_set(btn, ic);
                        evas_object_layer_set(btn, 32000);
 
                } else if (!strcmp(part, "elm.icon.3")){
-                       elm_object_style_set(btn, "anchor");
+                       elm_object_style_set(btn, "ime_button_keyboard");
                        string path_ic = path + "images/w_mode_keyboard_ic.png";
                        elm_image_file_set(ic, path_ic.c_str(), NULL);
                        elm_object_content_set(btn, ic);
@@ -342,46 +313,6 @@ static void __ise_gl_lang_changed(void *data, Evas_Object *obj, void *event_info
        elm_genlist_realized_items_update(obj);
 }
 
-
-static char *_genlist_text_set_theme_color(const char *str, const char *code)
-{
-       int r, g, b, a;
-       Eina_Strbuf *buf = NULL;
-       char *colored = NULL;
-
-       if (code == NULL)
-               return NULL;
-
-       buf = eina_strbuf_new();
-       if (buf == NULL) {
-               PRINTFUNC(DLOG_ERROR, "Can not get create strbuf");
-               return NULL;
-       }
-
-//     ea_theme_color_get(code,
-//                     &r, &g, &b, &a,
-//                     NULL, NULL, NULL, NULL,
-//                     NULL, NULL, NULL, NULL);
-
-       eina_strbuf_append_printf(buf, "<color=#%02x%02x%02x%02x>%s</color>",
-                       r, g, b, a, str);
-
-       colored = eina_strbuf_string_steal(buf);
-
-       eina_strbuf_free(buf);
-
-       return colored;
-}
-
-
-static void _app_control_send_reply_cb(app_control_h request, app_control_h reply,
-                                               app_control_result_e result, void *user_data)
-{
-               PRINTFUNC(DLOG_DEBUG, "");
-               reply_to_sender_by_callback(NULL, NULL);
-               elm_exit();
-}
-
 void set_source_caller_app_id(app_control_h app_control)
 {
        if(!app_control){
@@ -409,7 +340,7 @@ void reply_to_sender_by_callback(const char *value, const char *type)
                int ret;
 
                if (value)
-                       app_control_add_extra_data(app_control, "selected_context", value);
+                       app_control_add_extra_data(app_control, APP_CONTROL_DATA_TEXT, value);
 
                if (type)
                        app_control_add_extra_data(app_control, "reply_type", type);
@@ -534,7 +465,7 @@ void _back_to_genlist_for_selector()
        if(app_data->app_type == APP_TYPE_STT || app_data->app_type == APP_TYPE_EMOTICON){
                PRINTFUNC(DLOG_DEBUG, "launched as STT/EMOTICON mode, So exit here.");
                reply_to_sender_by_callback(NULL, NULL);
-               elm_exit();
+               ui_app_exit();
        }
 
        Evas_Object *circle_genlist = (Evas_Object *) evas_object_data_get(app_data->genlist, "circle");
@@ -554,7 +485,6 @@ Evas_Object* _create_genlist(Evas_Object* navi)
                return NULL;
 
        elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS);
-       elm_genlist_scroller_policy_set(genlist, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
 
        Evas_Object* circle_object_genlist = eext_circle_object_genlist_add(genlist, app_data->circle_surface);
        eext_circle_object_genlist_scroller_policy_set(circle_object_genlist, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
@@ -647,13 +577,13 @@ void _create_genlist_items(void* user_data)
 
        Elm_Genlist_Item_Class * itc1 = elm_genlist_item_class_new();
        if(g_input_type_data.input_type_array_len == 2){
-               itc1->item_style = "2button";
+               itc1->item_style = "2button_flat";
                itc1->func.text_get = NULL;
                itc1->func.content_get = __ise_gl_2button_content_get;
                itc1->func.state_get = NULL;
                itc1->func.del = NULL;
-       }else{
-               itc1->item_style = "3button";
+       } else {
+               itc1->item_style = "3button_flat";
                itc1->func.text_get = NULL;
                itc1->func.content_get = __ise_gl_3button_content_get;
                itc1->func.state_get = NULL;
@@ -691,7 +621,7 @@ bool _app_create(void* user_data)
        Evas_Object* conform = NULL;
        Evas_Object* bg = NULL;
        Evas_Object* window = NULL;
-       Eext_Circle_Surface *surface;
+       Eext_Circle_Surface *surface = NULL;
 
        if (!user_data) {
                return false;
@@ -757,7 +687,6 @@ bool _app_create(void* user_data)
 void _app_service(app_control_h service, void* user_data)
 {
        int ret;
-       bool b_ret;
        char *context = NULL;
        char **input_type_array = NULL;
        int input_type_array_len = -1;
@@ -771,7 +700,7 @@ void _app_service(app_control_h service, void* user_data)
                ret = app_control_get_extra_data_array(service, APP_CONTROL_DATA_INPUT_TYPE, &input_type_array, &input_type_array_len);
                g_input_type_data.input_type_array = input_type_array;
                g_input_type_data.input_type_array_len = input_type_array_len;
-       }else{
+       } else {
                ret = app_control_get_extra_data(service, APP_CONTROL_DATA_INPUT_TYPE, &context);
                if (ret == APP_CONTROL_ERROR_NONE) {
                        if (!strcmp(context, "input_voice")) {
@@ -895,7 +824,7 @@ void input_type_deinit(void)
        g_input_type_data.input_type_array_len = 0;
 }
 
-int main(int argc, char* argv[])
+EXPORTED int main(int argc, char* argv[])
 {
        App_Data app_data = {0, };
        ui_app_lifecycle_callback_s event_callback = {0, };