From ec3cb831858ca95e247492f245cc755a26ca8eb2 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Tue, 10 May 2016 13:20:56 -0400 Subject: [PATCH] Revert "elm entry: remove unused funtions" This reverts commit 2e68debe7b6853dff2d58e1fa89ba7939708871f. ref T3455 --- src/lib/elementary/elm_entry.c | 74 ++++++++++++++++++++++++++++++++++++++++++ src/lib/elementary/elm_priv.h | 3 ++ 2 files changed, 77 insertions(+) diff --git a/src/lib/elementary/elm_entry.c b/src/lib/elementary/elm_entry.c index f26e803..008a6e6 100644 --- a/src/lib/elementary/elm_entry.c +++ b/src/lib/elementary/elm_entry.c @@ -1398,6 +1398,80 @@ _hover_selected_cb(void *data, elm_widget_scroll_hold_push(data); } +static char * +_item_tags_remove(const char *str) +{ + char *ret; + Eina_Strbuf *buf; + + if (!str) + return NULL; + + buf = eina_strbuf_new(); + if (!buf) + return NULL; + + if (!eina_strbuf_append(buf, str)) + { + eina_strbuf_free(buf); + return NULL; + } + + while (EINA_TRUE) + { + const char *temp = eina_strbuf_string_get(buf); + char *start_tag = NULL; + char *end_tag = NULL; + size_t sindex; + size_t eindex; + + start_tag = strstr(temp, ""); + else + break; + if (!end_tag || start_tag > end_tag) + break; + + sindex = start_tag - temp; + eindex = end_tag - temp + 1; + if (!eina_strbuf_remove(buf, sindex, eindex)) + break; + } + + ret = eina_strbuf_string_steal(buf); + eina_strbuf_free(buf); + + return ret; +} + +void +_elm_entry_entry_paste(Evas_Object *obj, + const char *entry) +{ + char *str = NULL; + + if (!entry) return; + + ELM_ENTRY_CHECK(obj); + ELM_ENTRY_DATA_GET(obj, sd); + + if (sd->cnp_mode == ELM_CNP_MODE_NO_IMAGE) + { + str = _item_tags_remove(entry); + if (!str) str = strdup(entry); + } + else + str = strdup(entry); + if (!str) str = (char *)entry; + + _edje_entry_user_insert(obj, str); + + if (str != entry) free(str); +} + static void _paste_cb(void *data, Evas_Object *obj EINA_UNUSED, diff --git a/src/lib/elementary/elm_priv.h b/src/lib/elementary/elm_priv.h index 90789bb..21c510f 100644 --- a/src/lib/elementary/elm_priv.h +++ b/src/lib/elementary/elm_priv.h @@ -600,6 +600,9 @@ _elm_dgettext(const char *string) #endif +/* Used by the paste handler */ +void _elm_entry_entry_paste(Evas_Object *obj, const char *entry); + double _elm_atof(const char *s); #endif -- 2.7.4