From: SubodhKumar Date: Fri, 30 Dec 2016 09:31:38 +0000 (+0530) Subject: copypaste: Add cbhm item type get to prevent paste option to show when entry X-Git-Tag: accepted/tizen/common/20170102.152333~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4c3c9c1eab9fc5acf4ef3942b1e61c972c837856;p=platform%2Fupstream%2Felementary.git copypaste: Add cbhm item type get to prevent paste option to show when entry mode in plain text and selection is image Change-Id: I2499570b9a9a3f3708a676bb96788a3c82f2f523 --- diff --git a/src/modules/copypasteUI_ctxpopup/cbhm_helper.c b/src/modules/copypasteUI_ctxpopup/cbhm_helper.c index bd57dbf..c7715c1 100644 --- a/src/modules/copypasteUI_ctxpopup/cbhm_helper.c +++ b/src/modules/copypasteUI_ctxpopup/cbhm_helper.c @@ -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 diff --git a/src/modules/copypasteUI_ctxpopup/cbhm_helper.h b/src/modules/copypasteUI_ctxpopup/cbhm_helper.h index 57cfd58..10c459d 100644 --- a/src/modules/copypasteUI_ctxpopup/cbhm_helper.h +++ b/src/modules/copypasteUI_ctxpopup/cbhm_helper.h @@ -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 diff --git a/src/modules/copypasteUI_ctxpopup/copypaste.c b/src/modules/copypasteUI_ctxpopup/copypaste.c index 3164622..0fda844 100644 --- a/src/modules/copypasteUI_ctxpopup/copypaste.c +++ b/src/modules/copypasteUI_ctxpopup/copypaste.c @@ -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