From: deasung.kim Date: Mon, 27 Feb 2012 14:04:30 +0000 (+0900) Subject: [C&P popup] bugfix: S1-1248, S1-1323, Search editor has tags X-Git-Tag: REL_F_I9500_20120313_1~24^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5ef953a11238c96fa2996c426817f7f2e429acfd;p=framework%2Fuifw%2Felementary.git [C&P popup] bugfix: S1-1248, S1-1323, Search editor has tags Change-Id: I80fece6468873a5405eae93cb5391e45c19b3046 --- diff --git a/src/modules/ctxpopup_copypasteUI/copypaste.c b/src/modules/ctxpopup_copypasteUI/copypaste.c index ed79473..22248b2 100644 --- a/src/modules/ctxpopup_copypasteUI/copypaste.c +++ b/src/modules/ctxpopup_copypasteUI/copypaste.c @@ -28,6 +28,50 @@ struct _Elm_Entry_Context_Menu_Item void *data; }; +static char * +_remove_tags(const char *str) +{ + char *ret; + if (!str) + return NULL; + + Eina_Strbuf *buf = eina_strbuf_new(); + if (!buf) + return NULL; + + if (!eina_strbuf_append(buf, str)) + return NULL; + + eina_strbuf_replace_all(buf, "
", " "); + eina_strbuf_replace_all(buf, "
", " "); + eina_strbuf_replace_all(buf, "", " "); + eina_strbuf_replace_all(buf, "", " "); + + while (EINA_TRUE) + { + const char *temp = eina_strbuf_string_get(buf); + + char *startTag = NULL; + char *endTag = NULL; + + startTag = strstr(temp, "<"); + if (startTag) + endTag = strstr(startTag, ">"); + else + break; + if (!endTag || startTag > endTag) + break; + + size_t sindex = startTag - temp; + size_t eindex = endTag - temp + 1; + if (!eina_strbuf_remove(buf, sindex, eindex)) + break; + } + ret = eina_strbuf_string_steal(buf); + eina_strbuf_free(buf); + return ret; +} + static void _ctxpopup_hide(Evas_Object *popup); static void _ctxpopup_position(Evas_Object *obj); static void @@ -185,9 +229,18 @@ _search_menu(void *data, Evas_Object *obj, void *event_info) appsvc_set_operation(b, APPSVC_OPERATION_SEARCH); if (ext_mod->selmode) { - char *selection = elm_entry_selection_get(ext_mod->caller); + const char *selection = elm_entry_selection_get(ext_mod->caller); if (selection) - appsvc_add_data(b, APPSVC_DATA_KEYWORD, selection); + { + char *str = _remove_tags(selection); + if (str) + { + appsvc_add_data(b, APPSVC_DATA_KEYWORD, str); + free(str); + } + else + appsvc_add_data(b, APPSVC_DATA_KEYWORD, selection); + } } appsvc_run_service(b, 0, NULL, NULL); bundle_free(b);