[password feature - merge from working git to main git]
authorshilpa singh <shilpa.singh@samsung.com>
Fri, 7 Jan 2011 05:32:54 +0000 (11:02 +0530)
committershilpa singh <shilpa.singh@samsung.com>
Fri, 7 Jan 2011 05:32:54 +0000 (11:02 +0530)
src/bin/edje_cc_handlers.c
src/lib/Edje.h
src/lib/edje_entry.c
src/lib/edje_program.c

index 8904c45..ad1fe91 100644 (file)
@@ -6765,6 +6765,7 @@ st_collections_group_programs_program_action(void)
                           "FOCUS_OBJECT", EDJE_ACTION_TYPE_FOCUS_OBJECT,
                           "PARAM_COPY", EDJE_ACTION_TYPE_PARAM_COPY,
                           "PARAM_SET", EDJE_ACTION_TYPE_PARAM_SET,
+                          "HIDE_VISIBLE_PASSWORD", EDJE_ACTION_TYPE_HIDE_VISIBLE_PASSWORD,
                           NULL);
    if (ep->action == EDJE_ACTION_TYPE_STATE_SET)
      {
@@ -6827,6 +6828,7 @@ st_collections_group_programs_program_action(void)
        /* this is implicitly set by script {} so this is here just for
         * completeness */
        break;
+      case EDJE_ACTION_TYPE_HIDE_VISIBLE_PASSWORD:
       case EDJE_ACTION_TYPE_FOCUS_OBJECT:
       case EDJE_ACTION_TYPE_FOCUS_SET:
        check_arg_count(1);
@@ -6913,6 +6915,8 @@ st_collections_group_programs_program_target(void)
          data_queue_part_lookup(pc, name, &(et->id));
        else if (ep->action == EDJE_ACTION_TYPE_FOCUS_OBJECT)
          data_queue_part_lookup(pc, name, &(et->id));
+       else if (ep->action == EDJE_ACTION_TYPE_HIDE_VISIBLE_PASSWORD)
+         data_queue_part_lookup(pc, name, &(et->id));
        else
          {
             ERR("%s: Error. parse error %s:%i. "
index c0d2d7f..2000c18 100644 (file)
@@ -148,7 +148,8 @@ typedef enum _Edje_Action_Type
    EDJE_ACTION_TYPE_FOCUS_OBJECT  = 10,
    EDJE_ACTION_TYPE_PARAM_COPY    = 11,
    EDJE_ACTION_TYPE_PARAM_SET     = 12,
-   EDJE_ACTION_TYPE_LAST          = 13
+   EDJE_ACTION_TYPE_HIDE_VISIBLE_PASSWORD = 13, 
+   EDJE_ACTION_TYPE_LAST          = 14
 } Edje_Action_Type;
 
 typedef enum _Edje_Tween_Mode
index 7911b53..3048204 100644 (file)
@@ -47,7 +47,6 @@ struct _Entry
    Evas_Textblock_Cursor *sel_start, *sel_end;
    Evas_Textblock_Cursor *cursor_user, *cursor_user_extra;
    Evas_Textblock_Cursor *preedit_start, *preedit_end;
-   Ecore_Timer *pw_timer;
    Eina_List *sel;
    Eina_List *anchors;
    Eina_List *anchorlist;
@@ -1309,6 +1308,7 @@ _delete(Evas_Textblock_Cursor *c, Evas_Object *o __UNUSED__, Entry *en __UNUSED_
 void
 _edje_entry_hide_visible_password(Edje_Real_Part *rp)
 {
+   Entry *en = rp->entry_data;/*remove this line*/
    const Evas_Object_Textblock_Node_Format *node;
    node = evas_textblock_node_format_first_get(rp->object);
    for (; node ; node = evas_textblock_node_format_next_get(node))
@@ -1325,18 +1325,9 @@ _edje_entry_hide_visible_password(Edje_Real_Part *rp)
      }
    _edje_entry_real_part_configure(rp);
    _edje_emit(rp->edje, "entry,changed", rp->part->name);
-}
-
-static Eina_Bool
-_password_timer_cb(void *data)
-{
-   Entry *en = (Entry *)data;
-   _edje_entry_hide_visible_password(en->rp);
-      /*count characters*/
+   /*remove the below 2 lines*/
    if (en->func)
       en->func(en->data, NULL);
-   en->pw_timer = NULL;
-   return ECORE_CALLBACK_CANCEL;
 }
 
 static void
@@ -1703,26 +1694,21 @@ _edje_key_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, v
              if (en->have_selection)
                 _range_del(en->cursor, rp->object, en);
              _sel_clear(en->cursor, rp->object, en);
+             //   if PASSWORD_SHOW_LAST_CHARACTER mode, appending it with password tag
              if (rp->part->entry_mode == EDJE_ENTRY_EDIT_MODE_PASSWORD_SHOW_LAST_CHARACTER)
-               {
-                  _edje_entry_hide_visible_password(en->rp);
-                  /*if inputtin text is not allowed, dont allow text input*/
+               {                                               
+                  _edje_entry_hide_visible_password(en->rp);           
+                 /*remove the below 3 lines*/
                   if (en->func)
                      if (en->func(en->data, (void *)ev->string))
                         return;
-                  evas_object_textblock_text_markup_prepend(en->cursor, "<password=off>");
-                  evas_object_textblock_text_markup_prepend(en->cursor, ev->string);
-                  evas_object_textblock_text_markup_prepend(en->cursor, "</password>");
-                  if (en->pw_timer)
-                    {
-                       ecore_timer_del(en->pw_timer);
-                       en->pw_timer = NULL;
-                    }
-                  en->pw_timer = ecore_timer_add(2.0, _password_timer_cb, en);
+                  _text_filter_markup_prepend(en, en->cursor, "<password=off>");
+                  _text_filter_markup_prepend(en, en->cursor, ev->string);
+                  _text_filter_markup_prepend(en, en->cursor, "</password>");
                }
              else
                {
-                  /*if inputtin text is not allowed, dont allow text input*/
+                  /*remove the below 3 lines*/
                   if (en->func)
                      if (en->func(en->data, (void *)ev->string))
                         return;
@@ -1732,7 +1718,7 @@ _edje_key_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, v
                   _text_filter_text_prepend(en, en->cursor, ev->string);
 
                   /*count characters*/
-                  if (en->func) en->func(en->data, NULL);
+                  if (en->func) en->func(en->data, NULL);                                      
 #if 0
 //             evas_textblock_cursor_text_prepend(en->cursor, ev->string);
              _text_filter_text_prepend(en, en->cursor, ev->string);
@@ -2706,12 +2692,6 @@ _edje_entry_real_part_shutdown(Edje_Real_Part *rp)
    evas_object_del(en->cursor_bg);
    evas_object_del(en->cursor_fg);
 
-   if (en->pw_timer)
-     {
-        ecore_timer_del(en->pw_timer);
-        en->pw_timer = NULL;
-     }
-
 #ifdef HAVE_ECORE_IMF
    if (rp->part->entry_mode >= EDJE_ENTRY_EDIT_MODE_EDITABLE)
      {
@@ -3593,23 +3573,16 @@ _edje_entry_imf_event_commit_cb(void *data, int type __UNUSED__, void *event)
 
    if (rp->part->entry_mode == EDJE_ENTRY_EDIT_MODE_PASSWORD_SHOW_LAST_CHARACTER)
      {
-        _edje_entry_hide_visible_password(en->rp);
+        _edje_entry_hide_visible_password(en->rp);             
         /* if inputtin text is not allowed, dont allow text input */
         if (en->func)
           {
             if (en->func(en->data, (void *)ev->str)) return ECORE_CALLBACK_PASS_ON;
           }
 
-        evas_object_textblock_text_markup_prepend(en->cursor, "<password=off>");
-        evas_object_textblock_text_markup_prepend(en->cursor, ev->str);
-        evas_object_textblock_text_markup_prepend(en->cursor, "</password>");
-
-        if (en->pw_timer)
-          {
-             ecore_timer_del(en->pw_timer);
-             en->pw_timer = NULL;
-          }
-        en->pw_timer = ecore_timer_add(2.0, _password_timer_cb, en);
+        _text_filter_markup_prepend(en, tc, "<password=off>");
+        _text_filter_markup_prepend(en, tc, ev->str);
+        _text_filter_markup_prepend(en, tc, "</password>");    
      }
    else
      {
index 2472409..d85464e 100644 (file)
@@ -963,6 +963,13 @@ _edje_program_run(Edje *ed, Edje_Program *pr, Eina_Bool force, const char *ssig,
              if (_edje_block_break(ed)) goto break_prog;
           }
         break;
+      case EDJE_ACTION_TYPE_HIDE_VISIBLE_PASSWORD:
+          {
+             Edje_Real_Part *part;
+             part = ed->table_parts[pr->param.dst % ed->table_parts_size];
+             _edje_entry_hide_visible_password(part);
+          }
+        break;
      default:
         // _edje_emit(ed, "program,start", pr->name);
         // _edje_emit(ed, "program,stop", pr->name);