Support various MIME type to caller
[platform/core/uifw/inputdelegator.git] / src / w-input-selector.cpp
index d6feeec..e22274d 100755 (executable)
@@ -222,7 +222,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");
+                       reply_to_sender_by_callback(reply, "smartreply", NULL);
                        free(reply);
                        elm_exit();
                }
@@ -241,7 +241,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");
+                       reply_to_sender_by_callback(gettext(template_list[index].text.c_str()), "template", NULL);
                        ui_app_exit();
                }
        }
@@ -480,7 +480,7 @@ void set_source_caller_app_id(app_control_h app_control)
        }
 }
 
-void reply_to_sender_by_callback(const char *value, const char *type)
+void reply_to_sender_by_callback(const char *value, const char *type, const char *path[])
 {
        PRINTFUNC(DLOG_DEBUG, "");
 
@@ -495,6 +495,10 @@ void reply_to_sender_by_callback(const char *value, const char *type)
                if (type)
                        app_control_add_extra_data(app_control, "reply_type", type);
 
+               if (path != NULL) {
+                       app_control_add_extra_data_array(app_control, APP_CONTROL_DATA_PATH, path, 1);
+               }
+
                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);
@@ -624,7 +628,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);
+               reply_to_sender_by_callback(NULL, NULL, NULL);
                ui_app_exit();
        }
 }
@@ -1038,7 +1042,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;
@@ -1109,10 +1113,31 @@ void _app_service(app_control_h service, void* user_data)
        char **input_type_array = NULL;
        int input_type_array_len = -1;
        bool is_extra_data_array = false;
+       char *mime_type = NULL;
 
        app_control_clone(&(app_data->source_app_control), service);
        app_data->reply_type = REPLY_APP_NORMAL;
 
+       ret = app_control_get_mime(service, &mime_type);
+       if (ret != APP_CONTROL_ERROR_NONE) {
+               LOGD("Fail to get mime type : %d", ret);
+       } else {
+               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->app_type = APP_TYPE_STT;
+                               _stt_clicked_cb((void *)app_data, NULL, NULL);
+                               if (mime_type)
+                                       free(mime_type);
+                               goto ACTIVATE;
+                       }
+               }
+       }
+       if (mime_type)
+               free(mime_type);
+
        if (_TV || _MOBILE) {
                app_data->app_type = APP_TYPE_KEYBOARD;
                input_keyboard_init(service);