copypaste: Add cbhm item type get to prevent paste option to show when entry
authorSubodhKumar <s7158.kumar@samsung.com>
Fri, 30 Dec 2016 09:31:38 +0000 (15:01 +0530)
committerWonki Kim <wonki_.kim@samsung.com>
Mon, 2 Jan 2017 05:37:13 +0000 (14:37 +0900)
mode in plain text and selection is image

Change-Id: I2499570b9a9a3f3708a676bb96788a3c82f2f523

src/modules/copypasteUI_ctxpopup/cbhm_helper.c
src/modules/copypasteUI_ctxpopup/cbhm_helper.h
src/modules/copypasteUI_ctxpopup/copypaste.c

index bd57dbf..c7715c1 100644 (file)
@@ -392,3 +392,53 @@ _cbhm_serial_number_get()
 #endif
    return senum;
 }
+
+#ifdef HAVE_ELEMENTARY_WAYLAND
+int
+_cbhm_item_type_get(Evas_Object *obj, int item_index)
+{
+   Eldbus_Message *reply, *req;
+   Eldbus_Proxy *cbhm_proxy = cbhm_proxy_get(obj);
+   const char *errname = NULL, *errmsg = NULL;
+   int type = -1;
+
+   EINA_LOG_ERR("eldbus proxy call to get count ");
+
+   if (!cbhm_proxy)
+   {
+      EINA_LOG_ERR("eldbus proxy is NULL");
+      return -1;
+   }
+
+   if (!(req = eldbus_proxy_method_call_new(cbhm_proxy, "CbhmGetItemType")))
+     {
+        EINA_LOG_ERR("Failed to create method call on org.freedesktop.DBus.Properties.Get");
+        return -1;
+     }
+
+   eldbus_message_ref(req);
+
+   eldbus_message_arguments_append(req, "i", item_index);
+   reply = eldbus_proxy_send_and_block(cbhm_proxy, req, 100);
+
+   if (!reply || eldbus_message_error_get(reply, &errname, &errmsg))
+     {
+        EINA_LOG_ERR("Unable to call method org.freedesktop.DBus.Properties.Get: %s %s",
+              errname, errmsg);
+        eldbus_message_unref(req);
+        return -1;
+     }
+
+   if (!eldbus_message_arguments_get(reply, "i", &type))
+     {
+        EINA_LOG_ERR("Cannot get arguments from eldbus");
+        eldbus_message_unref(req);
+        return -1;
+     }
+
+   eldbus_message_unref(req);
+   EINA_LOG_DBG("cbhm item type(%d) of index(%d)", type, item_index);
+
+   return type;
+}
+#endif
index 57cfd58..10c459d 100644 (file)
@@ -29,6 +29,20 @@ enum ATOM_INDEX_CBHM_COUNT {
        ATOM_INDEX_CBHM_COUNT_MAX = 3
 };
 
+#ifdef HAVE_ELEMENTARY_WAYLAND
+enum _Atom_Index_Cbhm_Item_Type {
+       ATOM_INDEX_CBHM_TARGET = 0,
+       ATOM_INDEX_CBHM_TEXT = 1,
+       ATOM_INDEX_CBHM_HTML = 2,
+       ATOM_INDEX_CBHM_EFL = 3,
+       ATOM_INDEX_CBHM_IMAGE = 4,
+       ATOM_INDEX_CBHM_POLARIS = 5,
+       ATOM_INDEX_CBHM_MAX = 6
+};
+typedef enum _Atom_Index_Cbhm_Item_Type Atom_Index_Cbhm_Item_Type;
+int _cbhm_item_type_get(Evas_Object *obj, int item_index);
+#endif
+
 Eina_Bool _cbhm_msg_send(Evas_Object* obj, char *msg);
 int _cbhm_item_count_get(Evas_Object *obj EINA_UNUSED, int atom_index);
 #ifdef HAVE_ELEMENTARY_X
index 3164622..0fda844 100644 (file)
@@ -1373,6 +1373,9 @@ obj_longpress(Evas_Object *obj)
                            !(first_cbhm_item_type == ecore_x_atom_get("text/uri")) &&
                            !(first_cbhm_item_type == ecore_x_atom_get("text/uri-list")))
 #endif
+#ifdef HAVE_ELEMENTARY_WAYLAND
+                       if (ext_mod->editable && (_cbhm_item_type_get(obj, 0) != ATOM_INDEX_CBHM_IMAGE))
+#endif
                          {
                             CP_ICON_ADD(icon, "paste");
 #ifdef TIZEN_PROFILE_WEARABLE
@@ -1557,6 +1560,9 @@ obj_longpress(Evas_Object *obj)
                                   if (!(first_cbhm_item_type == ecore_x_atom_get("text/uri")) &&
                                       !(first_cbhm_item_type == ecore_x_atom_get("text/uri-list")))
 #endif
+#ifdef HAVE_ELEMENTARY_WAYLAND
+                                  if ((_cbhm_item_type_get(obj, 0) != ATOM_INDEX_CBHM_IMAGE))
+#endif
                                     {
                                        CP_ICON_ADD(icon, "paste");
 #ifdef TIZEN_PROFILE_WEARABLE