[entry] blocked select, select all in an empty entry
authorMyungjae Lee <mjae.lee@samsung.com>
Fri, 18 Feb 2011 08:07:14 +0000 (17:07 +0900)
committerMyungjae Lee <mjae.lee@samsung.com>
Fri, 18 Feb 2011 08:07:14 +0000 (17:07 +0900)
src/lib/elm_entry.c
src/modules/ctxpopup_copypasteUI/copypaste.c
src/modules/ctxpopup_copypasteshareUI/copypaste.c

index 8fb0f09..1d3d597 100644 (file)
@@ -2779,6 +2779,8 @@ elm_entry_is_empty(const Evas_Object *obj)
    Evas_Textblock_Cursor *cur;
    Eina_Bool ret;
    if (!wd) return EINA_TRUE;
+
+#if 0   
    /* It's a hack until we get the support suggested above.
     * We just create a cursor, point it to the begining, and then
     * try to advance it, if it can advance, the tb is not empty,
@@ -2792,6 +2794,14 @@ elm_entry_is_empty(const Evas_Object *obj)
    evas_textblock_cursor_free(cur);
 
    return !ret;
+#endif
+
+   char *str = elm_entry_markup_to_utf8(elm_entry_entry_get(obj));
+   if (!str) return EINA_TRUE;
+
+   ret = (strlen(str) == 0);
+
+   return ret;
 }
 
 /**
index 8272b1c..958a67a 100644 (file)
@@ -175,8 +175,11 @@ obj_longpress(Evas_Object *obj)
                {       
                        if (!ext_mod->password)
                        {
-                               elm_ctxpopup_item_append(ext_mod->popup, "Select", NULL, _select, obj );
-                               elm_ctxpopup_item_append(ext_mod->popup, "Select All", NULL, _select_all, obj );
+                               if (!elm_entry_is_empty(obj))
+                               {
+                                       elm_ctxpopup_item_append(ext_mod->popup, "Select", NULL, _select, obj );
+                                       elm_ctxpopup_item_append(ext_mod->popup, "Select All", NULL, _select_all, obj );
+                               }
                        }
                        if (1) // need way to detect if someone has a selection
                                {
@@ -210,8 +213,11 @@ obj_longpress(Evas_Object *obj)
                                        else
                                                {
                                                        _cancel(obj,ext_mod->popup,NULL);               
-                                                       elm_ctxpopup_item_append(ext_mod->popup, "Select", NULL, _select, obj );
-                                                       elm_ctxpopup_item_append(ext_mod->popup, "Select All", NULL, _select_all, obj );
+                                                       if (!elm_entry_is_empty(obj))
+                                                       {
+                                                               elm_ctxpopup_item_append(ext_mod->popup, "Select", NULL, _select, obj );
+                                                               elm_ctxpopup_item_append(ext_mod->popup, "Select All", NULL, _select_all, obj );
+                                                       }
                                                        if (1) // need way to detect if someone has a selection
                                                                {
                                                                        if (ext_mod->editable)
index fbf3165..e64b6f0 100644 (file)
@@ -198,8 +198,11 @@ obj_longpress(Evas_Object *obj)
                {       
                        if (!ext_mod->password)
                        {
-                               elm_ctxpopup_item_append(ext_mod->popup, "Select", NULL, _select, obj );
-                               elm_ctxpopup_item_append(ext_mod->popup, "Select All", NULL, _select_all, obj );
+                               if (!elm_entry_is_empty(obj))
+                               {
+                                       elm_ctxpopup_item_append(ext_mod->popup, "Select", NULL, _select, obj );
+                                       elm_ctxpopup_item_append(ext_mod->popup, "Select All", NULL, _select_all, obj );
+                               }
                        }
                        if (1) // need way to detect if someone has a selection
                                {
@@ -235,8 +238,11 @@ obj_longpress(Evas_Object *obj)
                                        else
                                                {
                                                        _cancel(obj,ext_mod->popup,NULL);               
-                                                       elm_ctxpopup_item_append(ext_mod->popup, "Select", NULL, _select, obj );
-                                                       elm_ctxpopup_item_append(ext_mod->popup, "Select All", NULL, _select_all, obj );
+                                                       if (!elm_entry_is_empty(obj))
+                                                       {
+                                                               elm_ctxpopup_item_append(ext_mod->popup, "Select", NULL, _select, obj );
+                                                               elm_ctxpopup_item_append(ext_mod->popup, "Select All", NULL, _select_all, obj );
+                                                       }
                                                        if (1) // need way to detect if someone has a selection
                                                                {
                                                                        if (ext_mod->editable)