Fix mismatch between log format and actual parameter
[platform/core/uifw/inputdelegator.git] / src / w-input-emoticon.cpp
old mode 100755 (executable)
new mode 100644 (file)
index a7f9a9c..146e4b2
@@ -280,7 +280,7 @@ static Eina_Bool _custom_back_cb2(void *data, Elm_Object_Item *it)
             lazy_loading_timer_for_contents = NULL;
         }
 
-        if(emoticon_drawing_pool.used == 0){
+        if (emoticon_drawing_pool.used == 0){
             evas_object_del(emoticon_drawing_pool.content);
         }
         emoticon_drawing_pool.content = NULL;
@@ -368,18 +368,19 @@ void set_recent_emoticons(vector <int> &emoticon_list, int val)
     if (PREFERENCE_ERROR_NONE != ret) {
         PRINTFUNC(DLOG_ERROR, "preference_set_string error!(%d)", ret);
     }
-
 }
 
 static void _drawing_app_control_reply_cb(app_control_h request, app_control_h reply, app_control_result_e result, void *user_data)
 {
     char* path = NULL;
-    app_control_get_extra_data(reply, APP_CONTROL_DATA_PATH, &path);
-
-    if(path){
-        PRINTFUNC(DLOG_DEBUG, "path=%s", path);
-        free(path);
-        reply_to_sender_by_callback((const char*)path, "image", NULL);
+    int ret = app_control_get_extra_data(reply, APP_CONTROL_DATA_PATH, &path);
+    if (ret == APP_CONTROL_ERROR_NONE) {
+        if (path){
+            PRINTFUNC(DLOG_DEBUG, "path=%s", path);
+            char *pathes[] = {path, };
+            reply_to_sender_by_callback(NULL, "image", (const char **)pathes, NULL);
+            free(path);
+        }
     }
     ui_app_exit();
 }
@@ -398,8 +399,7 @@ static void _drawing_item_clicked_cb(void *data, Evas_Object * obj, void *event_
     /* launch */
     app_control_h request = NULL;
     app_control_create(&request);
-    app_control_set_app_id(request, "com.samsung.sketch");
-    //app_control_set_app_id(request, "wearable-input.sketch");
+    app_control_set_app_id(request, "org.tizen.sketch");
 
     int ret = app_control_send_launch_request(request, _drawing_app_control_reply_cb, NULL);
     if (ret != APP_CONTROL_ERROR_NONE) {
@@ -421,7 +421,7 @@ static void _emoticon_item_clicked_cb(void *data, Evas_Object * obj, void *event
     const Eina_Unicode unicode_event[2] = { (Eina_Unicode)emoticon_info[index].code, 0 };
     char* utf_8 = eina_unicode_unicode_to_utf8(unicode_event, &length);
 
-    reply_to_sender_by_callback((const char*)utf_8, "emoticon", NULL);
+    reply_to_sender_by_callback((const char*)utf_8, "emoticon", NULL, NULL);
 
     PRINTFUNC(SECURE_DEBUG, "[%d]%s", index, utf_8);
     if (utf_8)
@@ -566,7 +566,7 @@ static Evas_Object * __emoticon_gl_1_content_get(void *data, Evas_Object *obj, c
         emoticon_drawing_pool.content = btn;
         emoticon_drawing_pool.used = 0;
         return btn;
-    } else if(!strcmp(part, "base")){
+    } else if (!strcmp(part, "base")){
         Evas_Object* btn = elm_button_add(obj);
         elm_object_style_set(btn, "ime/transparent");
         return btn;
@@ -883,12 +883,15 @@ void _update_emoticon_items(void *data)
     itc_dummy->func.state_get = NULL;
     itc_dummy->func.del = NULL;
 
-    Elm_Genlist_Item_Class *itc_1text_1icon = elm_genlist_item_class_new();
-    itc_1text_1icon->item_style = "drawing";
-    itc_1text_1icon->func.text_get = __emoticon_gl_text_get;
-    itc_1text_1icon->func.content_get = __emoticon_gl_1_content_get;
-    itc_1text_1icon->func.state_get = NULL;
-    itc_1text_1icon->func.del = NULL;
+    Elm_Genlist_Item_Class *itc_1text_1icon = NULL;
+    if (app_data->mime_type == MIME_TYPE_ALL) {
+        itc_1text_1icon = elm_genlist_item_class_new();
+        itc_1text_1icon->item_style = "drawing";
+        itc_1text_1icon->func.text_get = __emoticon_gl_text_get;
+        itc_1text_1icon->func.content_get = __emoticon_gl_1_content_get;
+        itc_1text_1icon->func.state_get = NULL;
+        itc_1text_1icon->func.del = NULL;
+    }
 
     Elm_Genlist_Item_Class *itc_group = elm_genlist_item_class_new();
     itc_group->item_style = "groupindex";
@@ -915,8 +918,10 @@ void _update_emoticon_items(void *data)
     it_emoticon_empty = elm_genlist_item_append(gl, itc_dummy, NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
 
     // Drawing
-    it_drawing = elm_genlist_item_append(gl, itc_1text_1icon, "Doodle", NULL, ELM_GENLIST_ITEM_NONE, _drawing_item_clicked_cb, (void *)app_data);
-    first_it = it_drawing;
+    if (app_data->mime_type == MIME_TYPE_ALL) {
+        it_drawing = elm_genlist_item_append(gl, itc_1text_1icon, (void*)"WDS_IME_MBODY_DRAWING_M_EMOTICON_ABB", NULL, ELM_GENLIST_ITEM_NONE, _drawing_item_clicked_cb, (void *)app_data);
+        first_it = it_drawing;
+    }
 
     if (recent_emoji_list.size() > 0) {
         if (is_content_reuse_on) {
@@ -924,12 +929,12 @@ void _update_emoticon_items(void *data)
         }
 
         // Group Recents
-        it_emoticon_recent_group = elm_genlist_item_append(gl, itc_group, (void*)"IDS_IME_HEADER_RECENT_M_RECETLY_SENT_EMOJIS_ABB", NULL, ELM_GENLIST_ITEM_NONE, NULL, (void *)2);
+        it_emoticon_recent_group = elm_genlist_item_append(gl, itc_group, (void*)"WDS_IME_HEADER_RECENT_M_RECETLY_SENT_EMOJIS_ABB", NULL, ELM_GENLIST_ITEM_NONE, NULL, (void *)2);
         elm_genlist_item_select_mode_set(it, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
         if (first_it == NULL)
             first_it = it_emoticon_recent_group;
 
-        PRINTFUNC(DLOG_DEBUG, "size = %d", recent_emoji_list.size());
+        PRINTFUNC(DLOG_DEBUG, "size = %zu", recent_emoji_list.size());
 
         for (i=0;i < recent_emoji_list.size();i=i+3)
         {
@@ -938,7 +943,7 @@ void _update_emoticon_items(void *data)
     }
 
     // Group Emoticons
-    it_emoticon_emoji_group = elm_genlist_item_append(gl, itc_group, (void*)"IDS_IME_HEADER_EMOJIS_ABB", NULL, ELM_GENLIST_ITEM_NONE, NULL, (void *)2);
+    it_emoticon_emoji_group = elm_genlist_item_append(gl, itc_group, (void*)"WDS_IME_HEADER_EMOJIS_ABB", NULL, ELM_GENLIST_ITEM_NONE, NULL, (void *)2);
     elm_genlist_item_select_mode_set(it, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
     if (first_it == NULL)
         first_it = it_emoticon_emoji_group;
@@ -989,3 +994,12 @@ void ise_show_emoticon_list(void *data)
     }
     _update_emoticon_items(emoticon_list);
 }
+
+void launch_drawing_app(void *data)
+{
+    App_Data* ad = (App_Data*) data;
+    if (!ad)
+        return;
+
+    _drawing_item_clicked_cb(ad, NULL, NULL);
+}