[security,password] remove unused code
[apps/core/preloaded/settings.git] / setting-password / include / setting-password.h
1 /*
2  * setting
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd.
5  *
6  * Contact: MyoungJune Park <mj2004.park@samsung.com>
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  *
20  */
21 #ifndef _SETTING_PASSWORD_H_
22 #define _SETTING_PASSWORD_H_
23
24 #include <glib.h>
25 #include <Elementary.h>
26 #include <Ecore_IMF.h>
27
28 #include <ITapiSim.h>
29 #include <TelSim.h>
30 #include <TelErr.h>
31 #include <TapiUtility.h>
32
33 #include <glib-object.h>
34
35 #include <setting-common-draw-widget.h>
36 #include <setting-common-view.h>
37 #include <setting-debug.h>
38
39 #include <security-server.h>
40
41 #define SETTING_PW_UG_NORMAL_PASSWORD_MIN_LENGTH 4
42 #define SETTING_PW_UG_NORMAL_PASSWORD_MAX_LENGTH 16
43 #define SETTING_PW_UG_PRIVACY_PASSWORD_MIN_LENGTH 4
44 #define SETTING_PW_UG_PRIVACY_PASSWORD_MAX_LENGTH 16
45 #define SETTING_PW_UG_SIM_MIN_LENGTH 4
46 #define SETTING_PW_UG_SIM_MAX_LENGTH 8
47 #define SETTING_PW_UG_PIN_MIN_LENGTH 4
48 #define SETTING_PW_UG_PIN_MAX_LENGTH 8
49 #define SETTING_PW_UG_PUK_MIN_LENGTH 4
50 #define SETTING_PW_UG_PUK_MAX_LENGTH 8
51 #define SETTING_PW_MAX_TITLE_LENGTH MAX_DISPLAY_NAME_LEN_ON_UI
52
53 #define PASSWORD_EMPTY  _("IDS_ST_BODY_PASSWORD_EMPTY")
54 #define ATTEMPT_DESC    _("IDS_ST_POP_PD_ATTEMPT_LEFT")                 /* "%d attempt left" */
55 #define ATTEMPTS_DESC   _("IDS_ST_POP_PD_ATTEMPTS_LEFT")                /* "%d attempts left" */
56 #define PIN_ERR_DESC    _("IDS_ST_POP_INCORRECT_PIN_PD_ATTEMPTS_LEFT") /* "Incorrect PIN. %d attempts left" */
57 #define PUK1_ERR_DESC   _("IDS_ST_POP_INCORRECT_PUK1_PD_ATTEMPTS_LEFT") /* "Incorrect PUK1. %d attempts left" */
58 #define PUK2_ERR_DESC   _("IDS_ST_POP_INCORRECT_PUK2_PD_ATTEMPTS_LEFT") /* "Incorrect PUK2. %d attempts left" */
59 #define PW_ERR_DESC     _("IDS_ST_POP_INCORRECT_PASSWORD")      /* "Incorrect password" */
60 #define PW_ERR_DELAY_DESC _("IDS_ST_BODY_ENTER_PASSWORD_AGAIN_AFTER_PD_SECONDS") /* "Please enter password again after %d seconds" */
61 #define PW_ERR_DELAY_TIME       30
62 #define ATTEMPT_INFINITE        999999
63
64 #define PW_SHORT_GUIDE_CURRENT          "IDS_ST_BODY_CURRENT"
65 #define PW_SHORT_GUIDE_NEW                      "IDS_ST_BODY_NEW"
66 #define PW_SHORT_GUIDE_CONFIRM          "IDS_ST_BODY_CONFIRM"
67
68 typedef enum {
69         SETTING_PW_TYPE_SIM_LOCK_ON, 
70         SETTING_PW_TYPE_SIM_LOCK_OFF,
71         SETTING_PW_TYPE_PIN_LOCK_ON,
72         SETTING_PW_TYPE_PIN_LOCK_OFF,
73         SETTING_PW_TYPE_CHANGE_PIN1,
74         SETTING_PW_TYPE_CHANGE_PIN2,
75         SETTING_PW_TYPE_PIN1_BLOCKED,
76         SETTING_PW_TYPE_PIN2_BLOCKED,
77         SETTING_PW_TYPE_RESET, 
78         SETTING_PW_TYPE_MAX,
79 } setting_pw_type;
80
81 struct _pw_item {
82         int pw_type_num;
83         char *pw_type_string;
84 };
85
86 /* For Tapi */
87 typedef enum {
88         SIM_OPERATION_OK,
89         SIM_ERROR,
90         SIM_REQ_PIN,
91         SIM_OPERATION_OFF,
92         SIM_LOCK_ON_SUCCESS,
93         SIM_LOCK_OFF_SUCCESS,
94         SIM_PIN_LOCK_ON_SUCCESS,
95         SIM_PIN_LOCK_OFF_SUCCESS,
96         SIM_LOCK_ON_FAIL,
97         SIM_LOCK_INCORRECT_PASSWORD,
98         SIM_INCORRECT_PIN1_CODE,
99         SIM_INCORRECT_PIN2_CODE,
100         SIM_INCORRECT_PUK1_CODE,
101         SIM_INCORRECT_PUK2_CODE,
102         SIM_PIN1_CHANGE_SUCCESS,
103         SIM_PIN2_CHANGE_SUCCESS,
104         SIM_PIN1_CHANGE_FAIL,
105         SIM_PIN2_CHANGE_FAIL,
106         SIM_PIN1_BLOCKED,
107         SIM_PIN2_BLOCKED,
108         SIM_PIN1_UNBLOCKED,
109         SIM_PIN2_UNBLOCKED,
110         SIM_PUK1_BLOCKED,
111         SIM_PUK2_BLOCKED,
112         SIM_REQUIRED_PUK_CODE,
113         SIM_OPERATION_UNAVAILABLE,
114         SIM_UNKNOWN_ERROR,
115 } sim_stat_value;
116
117 typedef enum {
118         SETTING_PW_NAVIBAR_WITH_NO_BTN,
119         SETTING_PW_NAVIBAR_WITH_LEFT_BTN,
120         SETTING_PW_NAVIBAR_WITH_RIGHT_BTN,
121         SETTING_PW_NAVIBAR_WITH_BOTH_BTN,
122 } setting_pw_navibar_style_t;
123
124 typedef struct _tapi_request_event {
125         unsigned int sid;
126         int event;
127 } tapi_request_event;
128
129 typedef struct _tapi_receive_info {
130         sim_stat_value stat;
131         int retry_cnt;
132 } tapi_receive_info;
133
134 typedef struct _tapi_request_tapi_info {
135         tapi_request_event *evt;
136         int evt_sz;
137
138         void *cb_data;
139         void (*cb) (tapi_receive_info *, void *);
140 } tapi_request_tapi_info;
141
142 /**
143  * Setting Password UG context
144  * all UG function has void* as an agument. this is casted back to SettingPasswordUG
145  * and the functions access app context.
146  */
147 typedef struct _SettingPasswordUG {
148         ui_gadget_h ug;
149         TapiHandle *handle;
150         TelSimSecResult_t *verify_puks_result;
151
152         /* add more variables here (move your appdata to here) */
153         Evas *evas;
154         Evas_Object *win_main_layout;
155         Evas_Object *win_get;
156         Evas_Object *ly_main;
157
158         setting_pw_type view_type;
159         char *view_type_string;
160
161         Setting_GenGroupItem_Data *ed_pw1;
162         Setting_GenGroupItem_Data *ed_pw2;
163         Setting_GenGroupItem_Data *ed_pw3;
164         Setting_GenGroupItem_Data *focus_data;
165         Evas_Object *setpw_notify;
166         Evas_Object *notify;
167
168         Elm_Object_Item *err_desc;
169         Elm_Genlist_Item_Class itc_err_desc;
170
171         Elm_Object_Item *navi_it;
172         Evas_Object *controllbar;
173         tapi_request_tapi_info *t_info;
174         Evas_Object *navi_bar;
175         Elm_Genlist_Item_Class itc_variable_height;
176         Elm_Genlist_Item_Class itc_seperator;
177         Elm_Genlist_Item_Class itc_layout;
178         Elm_Genlist_Item_Class itc_group_item;
179         Evas_Object *scroller;
180         int disable_item_type;
181
182         int is_description;
183         int is_empty;
184
185         bool destroy;
186         Ecore_Timer *remove_timer;
187         Ecore_Timer *set_history_timer;
188         /* end */
189
190 } SettingPasswordUG;
191
192 extern setting_view setting_view_password_main;
193
194 void setting_sim_change_pins_cb(TapiHandle *handle, int result, void *data, void *user_data);
195 void setting_sim_verify_puks_cb(TapiHandle *handle, int result, void *data, void *user_data);
196 void setting_sim_facility_enable_cb(TapiHandle *handle, int result, void *data, void *user_data);
197 void setting_sim_facility_disable_cb(TapiHandle *handle, int result, void *data, void *user_data);
198
199 void setting_password_ug_popup_resp_cb(void *data, Evas_Object *obj, void *event_info);
200 void setting_password_ug_create_popup_notitle_nobtn(void *data, char *str, int destroy);
201
202 void setting_password_ug_display_desc(void *data, char *desc, int destroy);
203
204
205 #endif