remove the legacy code for sms appcontrol
[platform/core/uifw/inputdelegator.git] / src / w-input-keyboard.cpp
index 6951c2e..486ffd8 100755 (executable)
@@ -36,9 +36,9 @@ static void input_keyboard_app_control_send_reply_cb(app_control_h request, app_
 static void input_keyboard_app_control_send_reply_cb(app_control_h request, app_control_h reply,
                                                app_control_result_e result, void *user_data)
 {
-    char *feedback = NULL;
+       char *feedback = NULL;
        if (result == APP_CONTROL_RESULT_SUCCEEDED) {
-        if (reply) {
+               if (reply) {
                        int ret;
                        ret = app_control_get_extra_data(reply,
                                        "template_feedback", &feedback);
@@ -50,7 +50,7 @@ static void input_keyboard_app_control_send_reply_cb(app_control_h request, app_
                        }
                }
                reply_to_sender_by_callback(feedback, "keyboard");
-        free(feedback);
+               free(feedback);
                elm_exit();
        }
 }
@@ -59,194 +59,84 @@ static void input_keyboard_app_control_send_reply_cb(app_control_h request, app_
 bool input_keyboard_init(app_control_h app_control)
 {
        int ret = -1;
-
-       char *app_id = NULL;
-       char **data_array = NULL;
-       int data_array_len = -1;
-    char *default_text = NULL;
-    char *guide_text = NULL;
+       char *default_text = NULL;
+       char *guide_text = NULL;
 
        input_keyboard_deinit();
 
-    ret = app_control_get_extra_data(app_control, APP_CONTROL_DATA_INPUT_DEFAULT_TEXT, &default_text);
-    if (ret == APP_CONTROL_ERROR_NONE) {
-        g_input_keyboard_data.default_text = default_text;
-    }
-    ret = app_control_get_extra_data(app_control, APP_CONTROL_DATA_INPUT_GUIDE_TEXT, &guide_text);
-    if (ret == APP_CONTROL_ERROR_NONE) {
-        g_input_keyboard_data.guide_text = guide_text;
-    }
-
-       ret = app_control_get_extra_data(app_control,
-                                       "selector_keyboard_app_id",
-                                       &app_id);
-
-       if (ret != APP_CONTROL_ERROR_NONE) {
-               PRINTFUNC(DLOG_WARN, "can not get selector_keyboard_app_id: %d", ret);
-               return false;
+       ret = app_control_get_extra_data(app_control, APP_CONTROL_DATA_INPUT_DEFAULT_TEXT, &default_text);
+       if (ret == APP_CONTROL_ERROR_NONE) {
+               g_input_keyboard_data.default_text = default_text;
        }
-
-       ret = app_control_get_extra_data_array(app_control,
-                                       "selector_keyboard_data_array",
-                                       &data_array, &data_array_len);
-
-
-       if (ret != APP_CONTROL_ERROR_NONE) {
-               if (app_id)
-                       free(app_id);
-
-               PRINTFUNC(DLOG_WARN, "can not get selector_keyboard_data_array : %d", ret);
-               return false;
+       ret = app_control_get_extra_data(app_control, APP_CONTROL_DATA_INPUT_GUIDE_TEXT, &guide_text);
+       if (ret == APP_CONTROL_ERROR_NONE) {
+               g_input_keyboard_data.guide_text = guide_text;
        }
 
-       if (app_id)
-               g_input_keyboard_data.app_id = app_id;
-
-       if (data_array)
-               g_input_keyboard_data.data_array = data_array;
-
-       g_input_keyboard_data.data_array_len = data_array_len;
-
-       PRINTFUNC(DLOG_WARN, "app_id = %s", app_id);
-       PRINTFUNC(DLOG_WARN, "data_array = %s", data_array);
-
        return true;
 }
 
 void input_keyboard_deinit(void)
 {
-       int i = 0;
-       char **data_array = NULL;
-
        if (g_input_keyboard_data.guide_text)
                free(g_input_keyboard_data.guide_text);
 
        if (g_input_keyboard_data.default_text)
                free(g_input_keyboard_data.default_text);
 
-       if (g_input_keyboard_data.app_id)
-               free(g_input_keyboard_data.app_id);
-
-       data_array = g_input_keyboard_data.data_array;
-       if (data_array) {
-               for (i = 0; i < g_input_keyboard_data.data_array_len; i++) {
-                       if (*(data_array + i))
-                               free(*(data_array + i));
-               }
-
-               free(data_array);
-       }
-
-       g_input_keyboard_data.app_id = NULL;
-       g_input_keyboard_data.data_array = NULL;
-       g_input_keyboard_data.data_array_len = 0;
+       g_input_keyboard_data.default_text = NULL;
+       g_input_keyboard_data.guide_text = NULL;
 
        return;
 }
 
-bool input_keyboard_launch(Evas_Object *window)
-{
-       int ret;
-
-       char *app_id;
-
-       app_control_h app_control;
-
-       if (window == NULL) {
-               PRINTFUNC(DLOG_ERROR, "Can not get window");
-               return false;
-       }
-
-       ret = app_control_create(&app_control);
-       if (ret != APP_CONTROL_ERROR_NONE) {
-               PRINTFUNC(DLOG_ERROR, "Can not create app_control : %d", ret);
-               return false;
-       }
-
-       app_id = g_input_keyboard_data.app_id;
-       if (app_id == NULL) {
-               PRINTFUNC(DLOG_INFO, "app id is undefined, use defualt");
-               app_id = "com.samsung.message.appcontrol.compose";
-       }
-
-       app_control_set_app_id(app_control, app_id);
-       app_control_set_operation(app_control, APP_CONTROL_OPERATION_DEFAULT);
-/*
-       ret =  app_control_set_window(app_control,
-                               elm_win_xwindow_get(window));
-       if (ret != APP_CONTROL_ERROR_NONE) {
-               PRINTFUNC(DLOG_ERROR, "Can not app control set window : %d", ret);
-               app_control_destroy(app_control);
-               return false;
-       }
-*/
-       if (g_input_keyboard_data.data_array && g_input_keyboard_data.data_array_len > 0) {
-                app_control_add_extra_data_array(app_control,
-                                                "selector_keyboard_data_array",
-                                                (const char**)(g_input_keyboard_data.data_array),
-                                                g_input_keyboard_data.data_array_len);
-       }
-
-       set_source_caller_app_id(app_control);
-
-       ret = app_control_send_launch_request(app_control,
-                                       input_keyboard_app_control_send_reply_cb,
-                                       NULL);
-       if (ret != APP_CONTROL_ERROR_NONE)
-               PRINTFUNC(DLOG_ERROR, "Can not launch app_control: %d", ret);
-
-       app_control_destroy(app_control);
-
-       return true;
-}
-
 void btn_clicked_cb(void *data, Evas_Object *obj, void *event_info)
 {
-    app_control_h app_control;
-    int ret = app_control_create(&app_control);
+       app_control_h app_control;
+       int ret = app_control_create(&app_control);
        if (ret != APP_CONTROL_ERROR_NONE) {
                PRINTFUNC(DLOG_ERROR, "Can not create app_control : %d", ret);
                return;
        }
 
-    const char *getText = elm_entry_entry_get(entry);
-    LOGD("button key clicked!! : getText = %s", getText);
+       const char *getText = elm_entry_entry_get(entry);
+       LOGD("button key clicked!! : getText = %s", getText);
 
-    if (getText)
-        input_smartreply_send_feedback(getText);
+       if (getText)
+               input_smartreply_send_feedback(getText);
 
-    char *app_id = NULL;
-    app_control_get_caller(app_data->source_app_control, &app_id);
-    if (app_id != NULL)
-       app_control_set_app_id(app_control, app_id);
+       char *app_id = NULL;
+       app_control_get_caller(app_data->source_app_control, &app_id);
+       if (app_id != NULL)
+               app_control_set_app_id(app_control, app_id);
        app_control_set_operation(app_control, APP_CONTROL_OPERATION_DEFAULT);
-    set_source_caller_app_id(app_control);
-    free(app_id);
+       set_source_caller_app_id(app_control);
+       free(app_id);
        reply_to_sender_by_callback(getText, "keyboard");
        elm_exit();
 }
 
 static Eina_Bool custom_back_cb(void *data, Elm_Object_Item *it)
 {
-    _back_to_genlist_for_selector();
-    return EINA_TRUE;
+       _back_to_genlist_for_selector();
+       return EINA_TRUE;
 }
 
 void create_fullscreen_editor(void *data)
 {
        App_Data *ad = (App_Data *)data;
 
-    Evas_Object *box = elm_box_add(ad->naviframe);
-    evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-    evas_object_show(box);
-    elm_win_resize_object_add(ad->naviframe, box);
+       Evas_Object *box = elm_box_add(ad->naviframe);
+       evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       evas_object_show(box);
+       elm_win_resize_object_add(ad->naviframe, box);
 
-    entry = elm_entry_add(box);
+       entry = elm_entry_add(box);
        elm_entry_single_line_set(entry, EINA_TRUE);
        elm_entry_scrollable_set(entry, EINA_TRUE);
        elm_scroller_policy_set(entry, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
        elm_object_part_text_set(entry, "elm.guide", g_input_keyboard_data.guide_text);
-    elm_entry_entry_set(entry, g_input_keyboard_data.default_text);
+       elm_entry_entry_set(entry, g_input_keyboard_data.default_text);
        elm_entry_cursor_end_set(entry);
        evas_object_size_hint_weight_set(entry, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
        evas_object_size_hint_align_set(entry, EVAS_HINT_FILL, EVAS_HINT_FILL);
@@ -263,16 +153,16 @@ void create_fullscreen_editor(void *data)
        evas_object_resize(ad->naviframe, 360, 360);
        evas_object_show(ad->naviframe);
 
-    Elm_Object_Item *nf_item = elm_naviframe_item_push(ad->naviframe, NULL, NULL, NULL, box, "empty");
-    elm_naviframe_item_pop_cb_set(nf_item, custom_back_cb, NULL);
+       Elm_Object_Item *nf_item = elm_naviframe_item_push(ad->naviframe, NULL, NULL, NULL, box, "empty");
+       elm_naviframe_item_pop_cb_set(nf_item, custom_back_cb, NULL);
 }
 
-bool input_keyboard_launch_with_ui(Evas_Object *window, void *data) {
+bool input_keyboard_launch(Evas_Object *window, void *data) {
        if (window == NULL) {
                PRINTFUNC(DLOG_ERROR, "Can not get window");
                return false;
        }
-    create_fullscreen_editor(data);
-    return true;
+       create_fullscreen_editor(data);
+       return true;
 }