edje : Password's last char show feature supported. This patch is made

by Shilpa.


SVN revision: 60858
This commit is contained in:
WooHyun Jung 2011-06-30 05:31:08 +00:00
parent 87c3fdfe67
commit 7a205c0ef6
5 changed files with 142 additions and 11 deletions

View File

@ -14,3 +14,4 @@ Davide Andreoli <dave@gurumeditation.it>
Sebastian Dransfeld <sd@tango.flipp.net>
Tom Hacohen <tom@stosb.com>
Aharon Hillel <a.hillel@partner.samsung.com>
Shilpa Singh <shilpa.singh@samsung.com> <shilpasingh.o@gmail.com>

View File

@ -1180,6 +1180,35 @@ EAPI void edje_scale_set (double scale);
*/
EAPI double edje_scale_get (void);
/**
* @brief Show last character in password mode.
*
* @param password_show_last If TRUE enable last character show in password mode.
*
* This function enables last input to be visible when in password mode for few seconds
* or until the next input is entered.
*
* The time out value is obtained by edje_password_show_last_timeout_set function.
*
* @see edje_password_show_last_timeout_set().
*/
EAPI void edje_password_show_last_set(Eina_Bool password_show_last);
/**
* @brief Set's the timeout value in last show password mode.
*
* @param password_show_last_timeout The timeout value.
*
* This functions sets the time out value for which the last input entered in password
* mode will be visible.
*
* This value can be used only when last show mode is set in password mode.
*
* @see edje_password_show_last_set().
*
*/
EAPI void edje_password_show_last_timeout_set(double password_show_last_timeout);
/**
* @brief Set the edje object's scaling factor.
*

View File

@ -20,6 +20,7 @@ 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;
@ -1008,6 +1009,37 @@ _delete(Evas_Textblock_Cursor *c, Evas_Object *o __UNUSED__, Entry *en __UNUSED_
evas_textblock_cursor_char_delete(c);
}
static void
_edje_entry_hide_visible_password(Edje_Real_Part *rp)
{
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))
{
const char *text = evas_textblock_node_format_text_get(node);
if (text)
{
if (!strcmp(text, "+ password=off"))
{
evas_textblock_node_format_remove_pair(rp->object,
(Evas_Object_Textblock_Node_Format *) node);
break;
}
}
}
_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);
en->pw_timer = NULL;
return ECORE_CALLBACK_CANCEL;
}
static void
_edje_key_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
{
@ -1332,9 +1364,24 @@ _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);
//zz
// evas_textblock_cursor_text_prepend(en->cursor, ev->string);
_text_filter_text_prepend(en, en->cursor, ev->string);
// if PASSWORD_SHOW_LAST mode, appending text with password=off tag
if ((rp->part->entry_mode == EDJE_ENTRY_EDIT_MODE_PASSWORD) &&
_edje_password_show_last)
{
_edje_entry_hide_visible_password(en->rp);
_text_filter_format_prepend(en, en->cursor, "+ password=off");
_text_filter_markup_prepend(en, en->cursor, ev->string);
_text_filter_format_prepend(en, en->cursor, "- password");
if (en->pw_timer)
{
ecore_timer_del(en->pw_timer);
en->pw_timer = NULL;
}
en->pw_timer = ecore_timer_add(_edje_password_show_last_timeout,
_password_timer_cb, en);
}
else
_text_filter_text_prepend(en, en->cursor, ev->string);
_anchors_get(en->cursor, rp->object, en);
_edje_emit(ed, "entry,changed", rp->part->name);
_edje_emit(ed, "cursor,changed", rp->part->name);
@ -1934,6 +1981,12 @@ _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)
{
@ -2773,10 +2826,25 @@ _edje_entry_imf_event_commit_cb(void *data, int type __UNUSED__, void *event)
if (evas_textblock_cursor_compare(en->cursor, tc))
cursor_move = EINA_TRUE;
//yy
// evas_textblock_cursor_text_prepend(en->cursor, ev->str);
_text_filter_text_prepend(en, tc, ev->str);
if ((rp->part->entry_mode == EDJE_ENTRY_EDIT_MODE_PASSWORD) &&
_edje_password_show_last)
_edje_entry_hide_visible_password(en->rp);
if ((rp->part->entry_mode == EDJE_ENTRY_EDIT_MODE_PASSWORD) &&
_edje_password_show_last && (!en->preedit_start))
{
_text_filter_format_prepend(en, tc, "+ password=off");
_text_filter_markup_prepend(en, tc, ev->str);
_text_filter_format_prepend(en, tc, "- password");
if (en->pw_timer)
{
ecore_timer_del(en->pw_timer);
en->pw_timer = NULL;
}
en->pw_timer = ecore_timer_add(_edje_password_show_last_timeout,
_password_timer_cb, en);
}
else
_text_filter_text_prepend(en, tc, ev->str);
if (!cursor_move)
{
@ -2835,10 +2903,24 @@ _edje_entry_imf_event_preedit_changed_cb(void *data, int type __UNUSED__, void *
preedit_start_pos = evas_textblock_cursor_pos_get(en->cursor);
/* insert preedit character(s) */
//xx
// evas_object_textblock_text_markup_prepend(en->cursor, preedit_string);
_text_filter_markup_prepend(en, en->cursor, preedit_string);
if ((rp->part->entry_mode == EDJE_ENTRY_EDIT_MODE_PASSWORD) &&
_edje_password_show_last)
{
_text_filter_format_prepend(en, en->cursor, "+ password=off");
_text_filter_markup_prepend(en, en->cursor, preedit_string);
_text_filter_format_prepend(en, en->cursor, "- password");
if (en->pw_timer)
{
ecore_timer_del(en->pw_timer);
en->pw_timer = NULL;
}
en->pw_timer = ecore_timer_add(_edje_password_show_last_timeout,
_password_timer_cb, en);
}
else
{
_text_filter_markup_prepend(en, en->cursor, preedit_string);
}
if (!preedit_end_state)
{
/* set preedit start cursor */

View File

@ -1450,6 +1450,9 @@ extern int _edje_freeze_val;
extern int _edje_freeze_calc_count;
extern Eina_List *_edje_freeze_calc_list;
extern Eina_Bool _edje_password_show_last;
extern FLOAT_T _edje_password_show_last_timeout;
extern Eina_Mempool *_edje_real_part_mp;
extern Eina_Mempool *_edje_real_part_state_mp;

View File

@ -22,6 +22,8 @@ static Eina_Rbtree *_edje_box_layout_registry = NULL;
char *_edje_fontset_append = NULL;
FLOAT_T _edje_scale = ZERO;
Eina_Bool _edje_password_show_last = EINA_FALSE;
FLOAT_T _edje_password_show_last_timeout = ZERO;
int _edje_freeze_val = 0;
int _edje_freeze_calc_count = 0;
Eina_List *_edje_freeze_calc_list = NULL;
@ -239,6 +241,20 @@ edje_scale_get(void)
return TO_DOUBLE(_edje_scale);
}
EAPI void
edje_password_show_last_set(Eina_Bool password_show_last)
{
if (_edje_password_show_last == password_show_last) return;
_edje_password_show_last = password_show_last;
}
EAPI void
edje_password_show_last_timeout_set(double password_show_last_timeout)
{
if (_edje_password_show_last_timeout == FROM_DOUBLE(password_show_last_timeout)) return;
_edje_password_show_last_timeout = FROM_DOUBLE(password_show_last_timeout);
}
EAPI Eina_Bool
edje_object_scale_set(Evas_Object *obj, double scale)
{