modify password error handling to set two cases 71/35871/1 accepted/tizen/tv/20150226.011303 submit/tizen/20150226.001323
authorSoohye Shin <soohye.shin@samsung.com>
Wed, 25 Feb 2015 11:55:03 +0000 (20:55 +0900)
committerSoohye Shin <soohye.shin@samsung.com>
Wed, 25 Feb 2015 11:55:03 +0000 (20:55 +0900)
- Enter Password
- System Failure

Change-Id: I24b4ae3fcec86aa2841bfbb24bfbfc6a7fe94bbc
Signed-off-by: Soohye Shin <soohye.shin@samsung.com>
edje/bar/ubar.edc
include/defs.h
src/ubar.c

index b05b05f..1cf656a 100644 (file)
@@ -1171,7 +1171,14 @@ group {
                        description {
                                state, "wrong.pw" 0.0;
                                inherit, "default" 0.0;
-                               text.text, "Wrong Password";
+                               text.text, "Enter Password";
+                               color, 255 0 0 255;
+                               visible, 1;
+                       }
+                       description {
+                               state, "system.fail" 0.0;
+                               inherit, "default" 0.0;
+                               text.text, "System Failure";
                                color, 255 0 0 255;
                                visible, 1;
                        }
@@ -1199,6 +1206,13 @@ group {
                        action, STATE_SET "default" 0.0;
                        target, "message.pw";
                }
+               program {
+                       name, "show,system,fail";
+                       signal, SIG_SHOW_SYSTEM_FAIL;
+                       source, SRC_PROG;
+                       action, STATE_SET "system.fail" 0.0;
+                       target, "message.pw";
+               }
        }
 }
 
@@ -1310,10 +1324,17 @@ group {
                                inherit, "default" 0.0;
                                visible, 1;
                        }
-                       description{
+                       description {
                                state, "wrong.pw" 0.0;
                                inherit, "default" 0.0;
-                               text.text, "Wrong Password";
+                               text.text, "Enter Password";
+                               color, 255 0 0 255;
+                               visible, 1;
+                       }
+                       description {
+                               state, "system.fail" 0.0;
+                               inherit, "default" 0.0;
+                               text.text, "System Failure";
                                color, 255 0 0 255;
                                visible, 1;
                        }
@@ -1341,6 +1362,13 @@ group {
                        action, STATE_SET "default" 0.0;
                        target, "message.pw";
                }
+               program {
+                       name, "show,system,fail";
+                       signal, SIG_SHOW_SYSTEM_FAIL;
+                       source, SRC_PROG;
+                       action, STATE_SET "system.fail" 0.0;
+                       target, "message.pw";
+               }
        }
 }
 
@@ -1621,7 +1649,14 @@ group {
                        description {
                                state, "wrong.pw" 0.0;
                                inherit, "default" 0.0;
-                               text.text, "Wrong Password";
+                               text.text, "Enter Password";
+                               color, 255 0 0 255;
+                               visible, 1;
+                       }
+                       description {
+                               state, "system.fail" 0.0;
+                               inherit, "default" 0.0;
+                               text.text, "System Failure";
                                color, 255 0 0 255;
                                visible, 1;
                        }
@@ -1663,5 +1698,12 @@ group {
                        action, STATE_SET "wrong.pw" 0.0;
                        target, "message.pw";
                }
+               program {
+                       name, "show,system,fail";
+                       signal, SIG_SHOW_SYSTEM_FAIL;
+                       source, SRC_PROG;
+                       action, STATE_SET "system.fail" 0.0;
+                       target, "message.pw";
+               }
        }
 }
index ddf7a6a..b689012 100644 (file)
 #define SIG_HIDE_ID "hide.id"
 #define SIG_SHOW_ID "show.id"
 #define SIG_SHOW_WRONG_PW "show.wrong.pw"
+#define SIG_SHOW_SYSTEM_FAIL "show.system.fail"
 #define SIG_SHOW_ARROW "show.arrow"
 #define SIG_HIDE_ARROW "hide.arrow"
 
index b271551..890eca1 100644 (file)
@@ -964,11 +964,11 @@ static Evas_Object *_add_popup(Evas_Object *base, const char *title,
        return popup;
 }
 
-static void _show_wrong_password(struct _ubar_item *item)
+static void _show_message(struct _ubar_item *item, const char *signal)
 {
        Evas_Object *ly;
 
-       if (!item) {
+       if (!item || !signal) {
                _ERR("Invalid argument");
                return;
        }
@@ -980,7 +980,7 @@ static void _show_wrong_password(struct _ubar_item *item)
                return;
        }
 
-       elm_object_signal_emit(ly, SIG_SHOW_WRONG_PW, SRC_PROG);
+       elm_object_signal_emit(ly, signal, SRC_PROG);
 }
 
 static Eina_Bool _check_delete_user(struct _ubar_item *item)
@@ -998,12 +998,14 @@ static Eina_Bool _check_delete_user(struct _ubar_item *item)
        password = elm_entry_entry_get(item->pw_entry);
        if (!password || strlen(password) == 0) {
                _ERR("wrong password");
-               goto err;
+               _show_message(item, SIG_SHOW_WRONG_PW);
+               return EINA_FALSE;
        }
 
        if (!engine_ubar_item_delete(bar->eng, item->it, password)) {
                _ERR("failed to delete user");
-               goto err;
+               _show_message(item, SIG_SHOW_SYSTEM_FAIL);
+               return EINA_FALSE;
        }
 
        _destroy_popup(item);
@@ -1015,9 +1017,6 @@ static Eina_Bool _check_delete_user(struct _ubar_item *item)
        _update_items(bar, bar->eng);
 
        return EINA_TRUE;
-err:
-       _show_wrong_password(item);
-       return EINA_FALSE;
 }
 
 static void _popup_delete_clicked(void *data, Evas *e, Evas_Object *obj,
@@ -1366,13 +1365,15 @@ static Eina_Bool _check_edit_user(struct _ubar_item *item)
        password = elm_entry_entry_get(item->pw_entry);
        if (!password || strlen(password) == 0) {
                _ERR("wrong password");
-               goto err;
+               _show_message(item, SIG_SHOW_WRONG_PW);
+               return EINA_FALSE;
        }
 
        elm_image_file_get(cur->ic, &icon, NULL);
        if (!engine_ubar_item_update(bar->eng, item->it, icon, password)) {
                _ERR("failed to update user");
-               goto err;
+               _show_message(item, SIG_SHOW_SYSTEM_FAIL);
+               return EINA_FALSE;
        }
 
        _destroy_popup(item);
@@ -1384,9 +1385,6 @@ static Eina_Bool _check_edit_user(struct _ubar_item *item)
        _update_items(bar, bar->eng);
 
        return EINA_TRUE;
-err:
-       _show_wrong_password(item);
-       return EINA_FALSE;
 }
 
 static void _popup_edit_clicked(void *data, Evas *e, Evas_Object *obj,
@@ -1631,21 +1629,20 @@ static Eina_Bool _check_login_user(struct _ubar_item *item)
        password = elm_entry_entry_get(item->pw_entry);
        if (!password || strlen(password) == 0) {
                _ERR("wrong password");
-               goto err;
+               _show_message(item, SIG_SHOW_WRONG_PW);
+               return EINA_FALSE;
        }
 
        if (!engine_ubar_item_change_user(item->bar->eng, item->it, password)) {
-               _ERR("failed to change user");
-               goto err;
+               _ERR("failed to delete user");
+               _show_message(item, SIG_SHOW_SYSTEM_FAIL);
+               return EINA_FALSE;
        }
 
        item->pw_entry = NULL;
        _destroy_popup(item);
 
        return EINA_TRUE;
-err:
-       _show_wrong_password(item);
-       return EINA_FALSE;
 }
 
 static void _login_clicked(void *data, Evas *e, Evas_Object *obj, void *ei)
@@ -1936,13 +1933,15 @@ static Eina_Bool _check_add_user(struct _ubar_item *item)
        password = elm_entry_entry_get(item->pw_entry);
        if (!password || strlen(password) == 0) {
                _ERR("wrong password");
-               goto err;
+               _show_message(item, SIG_SHOW_WRONG_PW);
+               return EINA_FALSE;
        }
 
        elm_image_file_get(cur->ic, &icon, NULL);
        if (!engine_ubar_item_add(bar->eng, id, password, icon)) {
                _ERR("failed to add user");
-               goto err;
+               _show_message(item, SIG_SHOW_SYSTEM_FAIL);
+               return EINA_FALSE;
        }
 
        _destroy_popup(item);
@@ -1954,9 +1953,6 @@ static Eina_Bool _check_add_user(struct _ubar_item *item)
        _update_items(bar, bar->eng);
 
        return EINA_TRUE;
-err:
-       _show_wrong_password(item);
-       return EINA_FALSE;
 }
 
 static Eina_Bool _check_popup_state(struct _ubar_item *item)