Use SECURE_LOGD
[platform/core/uifw/inputdelegator.git] / src / w-input-selector.cpp
index e22274d..53576e0 100755 (executable)
@@ -210,7 +210,6 @@ static void _keyboard_clicked_cb(void *data, Evas_Object * obj, void *event_info
 
 static void __ise_smartreply_gl_sel(void *data, Evas_Object *obj, void *event_info)
 {
-       App_Data* app_data = (App_Data*) data;
        Elm_Object_Item *item = (Elm_Object_Item *) event_info;
 
        if (item) {
@@ -222,7 +221,7 @@ static void __ise_smartreply_gl_sel(void *data, Evas_Object *obj, void *event_in
                char *reply = input_smartreply_get_nth_item(index, &type);
                if (reply) {
                        input_smartreply_send_feedback(reply);
-                       reply_to_sender_by_callback(reply, "smartreply", NULL);
+                       reply_to_sender_by_callback(reply, "smartreply", NULL, NULL);
                        free(reply);
                        elm_exit();
                }
@@ -241,7 +240,7 @@ static void __ise_template_gl_sel(void *data, Evas_Object *obj, void *event_info
                const std::vector<TemplateData>  template_list = input_template_get_list();
 
                if (index < (int)template_list.size()) {
-                       reply_to_sender_by_callback(gettext(template_list[index].text.c_str()), "template", NULL);
+                       reply_to_sender_by_callback(gettext(template_list[index].text.c_str()), "template", NULL, NULL);
                        ui_app_exit();
                }
        }
@@ -480,7 +479,7 @@ void set_source_caller_app_id(app_control_h app_control)
        }
 }
 
-void reply_to_sender_by_callback(const char *value, const char *type, const char *path[])
+void reply_to_sender_by_callback(const char *value, const char *type, const char *path[], const char *cursor_position)
 {
        PRINTFUNC(DLOG_DEBUG, "");
 
@@ -499,6 +498,9 @@ void reply_to_sender_by_callback(const char *value, const char *type, const char
                        app_control_add_extra_data_array(app_control, APP_CONTROL_DATA_PATH, path, 1);
                }
 
+               if (cursor_position != NULL)
+                       app_control_add_extra_data(app_control, "cursor_position_get", cursor_position);
+
                set_source_caller_app_id(app_control);
 
                ret = app_control_reply_to_launch_request(app_control, app_data->source_app_control, APP_CONTROL_RESULT_SUCCEEDED);
@@ -628,7 +630,7 @@ void _back_to_genlist_for_selector()
        }
        if (app_data->app_type == APP_TYPE_STT || app_data->app_type == APP_TYPE_EMOTICON || app_data->app_type == APP_TYPE_KEYBOARD){
                PRINTFUNC(DLOG_DEBUG, "launched as STT/EMOTICON/KEYBOARD mode, So exit here.");
-               reply_to_sender_by_callback(NULL, NULL, NULL);
+               reply_to_sender_by_callback(NULL, NULL, NULL, NULL);
                ui_app_exit();
        }
 }
@@ -841,8 +843,6 @@ unsigned int _update_smartreply_items(void *user_data)
        App_Data* app_data;
 
        Elm_Object_Item *first;
-       Elm_Object_Item *menu;
-       Elm_Object_Item *pos;
 
        unsigned int i = 0;
        unsigned int len = 0;
@@ -863,7 +863,7 @@ unsigned int _update_smartreply_items(void *user_data)
 
        /* Move to smartreply */
        first = elm_genlist_first_item_get(app_data->genlist);
-       menu = elm_genlist_item_next_get(first);
+       elm_genlist_item_next_get(first);
 
        if (input_smartreply_is_enabled() == false)
                return item_size;
@@ -883,10 +883,8 @@ unsigned int _update_smartreply_items(void *user_data)
                itc->func.state_get = NULL;
                itc->func.del = NULL;
 
-               pos = menu;
-
                for (i = 0; i < len; i++) {
-                       char *reply = "hello";
+                       char *reply = (char *)"hello";
                        unsigned int j;
                        bool matched;
 
@@ -896,8 +894,7 @@ unsigned int _update_smartreply_items(void *user_data)
                        reply = input_smartreply_get_nth_item(i, &type);
                        if (reply == NULL)
                                continue;
-                       PRINTFUNC(DLOG_DEBUG, "SmartReply = [%d]%s", i, reply);
-
+                       SECURE_LOGD("SmartReply = [%d]%s", i, reply);
 
                        for (j = 0; j < template_list.size(); j++) {
                                const char *template_str;
@@ -916,7 +913,7 @@ unsigned int _update_smartreply_items(void *user_data)
                        if (matched == true)
                                continue;
 
-                       pos = elm_genlist_item_append(app_data->genlist,
+                       elm_genlist_item_append(app_data->genlist,
                                                itc,
                                                (void *)(uintptr_t)i,
                                                NULL,
@@ -1117,6 +1114,7 @@ void _app_service(app_control_h service, void* user_data)
 
        app_control_clone(&(app_data->source_app_control), service);
        app_data->reply_type = REPLY_APP_NORMAL;
+       app_data->mime_type = MIME_TYPE_ALL;
 
        ret = app_control_get_mime(service, &mime_type);
        if (ret != APP_CONTROL_ERROR_NONE) {
@@ -1125,13 +1123,21 @@ void _app_service(app_control_h service, void* user_data)
                if (mime_type) {
                        LOGD("mime type = %s", mime_type);
                        if (!strncmp(mime_type, "image/", strlen("image/"))) {
-
-                       } else if(!strncmp(mime_type, "audio/", strlen("audio/"))) {
+                               app_data->mime_type = MIME_TYPE_IMAGE;
+                               app_data->app_type = APP_TYPE_DRAWING;
+                               launch_drawing_app((void *)app_data);
+                               if (mime_type)
+                                       free(mime_type);
+                               goto ACTIVATE;
+                       } else if (!strncmp(mime_type, "audio/", strlen("audio/"))) {
+                               app_data->mime_type = MIME_TYPE_AUDIO;
                                app_data->app_type = APP_TYPE_STT;
                                _stt_clicked_cb((void *)app_data, NULL, NULL);
                                if (mime_type)
                                        free(mime_type);
                                goto ACTIVATE;
+                       } else if (!strncmp(mime_type, "text/", strlen("text/"))) {
+                               app_data->mime_type = MIME_TYPE_TEXT;
                        }
                }
        }
@@ -1205,6 +1211,7 @@ void _app_pause(void* user_data)
 void _app_resume(void* user_data)
 {
        PRINTFUNC(DLOG_DEBUG, "");
+       resume_voice();
 }
 
 void _app_terminate(void* user_data)