Added mime_type_accept_set interface 01/131501/3
authorInHong Han <inhong1.han@samsung.com>
Mon, 22 May 2017 02:03:59 +0000 (11:03 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Fri, 9 Jun 2017 07:48:05 +0000 (07:48 +0000)
Change-Id: I1a3dcf9c6ffb5d44e5e3bc2fb46b893d56d39faa

src/sclconnection-isf.cpp
src/sclcorecallback.h

index ae769cd..ae5ef80 100644 (file)
@@ -163,8 +163,13 @@ static void slot_ise_show(const scim::HelperAgent *agent, int ic, char *buf, siz
                 memcpy(&ise_context, buf, sizeof(ise_context));
 
                 if (ise_context.imdata_size > 0) {
-                    callback->on_set_imdata(buf + sizeof(ise_context), ise_context.imdata_size);
+                    char imdata[1024] = {0};
+                    memcpy((void *)imdata, buf + sizeof(ise_context), ise_context.imdata_size);
+                    callback->on_set_imdata(imdata, ise_context.imdata_size);
                 }
+
+                if (len >= (sizeof(Ise_Context) + ise_context.imdata_size))
+                    callback->on_set_mime_type(buf + sizeof(ise_context) + ise_context.imdata_size);
             } else {
                 LOGD("\n-=-= WARNING - buf %p len %d size %d \n", buf, len, sizeof(ise_context));
             }
@@ -597,6 +602,16 @@ static void slot_set_prediction_hint(const scim::HelperAgent *agent, const scim:
     }
 }
 
+static void slot_set_mime_type(const scim::HelperAgent *agent, const scim::String &mime_type) {
+    CSCLCoreImpl *impl = CSCLCoreImpl::get_instance();
+    if (impl) {
+        ISCLCoreEventCallback *callback = impl->get_core_event_callback();
+        if (callback) {
+            callback->on_set_mime_type(mime_type.c_str());
+        }
+    }
+}
+
 /* Internal input handler function */
 Eina_Bool input_handler(void *data, Ecore_Fd_Handler *fd_handler)
 {
@@ -689,6 +704,7 @@ sclboolean CSCLConnectionISF::init()
         m_helper_agent.signal_connect_candidate_hide(scim::slot(slot_candidate_hide));
         m_helper_agent.signal_connect_process_input_device_event(scim::slot(slot_process_input_device_event));
         m_helper_agent.signal_connect_set_prediction_hint(scim::slot(slot_set_prediction_hint));
+        m_helper_agent.signal_connect_set_mime_type(scim::slot(slot_set_mime_type));
 
         m_initialized = TRUE;
     }
index 054049a..5a44f99 100644 (file)
@@ -90,6 +90,7 @@ struct ISCLCoreEventCallback {
     virtual void on_process_input_device_event(sclu32 &type, sclchar *data, size_t &len, sclu32 *ret) {}
 
     virtual void on_set_prediction_hint(const sclchar *prediction_hint) {}
+    virtual void on_set_mime_type(const sclchar *mime_type) {}
 
     ISCLCoreEventCallback() {
         /* Current callback interface version is 1.1 */