update license verison number 1.0 -> 1.1
[apps/home/settings.git] / setting-security / include / setting-security.h
1 /*
2  * setting
3  * Copyright (c) 2012 Samsung Electronics Co., Ltd.
4  *
5  * Licensed under the Flora License, Version 1.1 (the License);
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *     http://floralicense.org/license/
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an AS IS BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 #ifndef __SETTING_SECURITY_H__
18 #define __SETTING_SECURITY_H__
19
20 #include <glib.h>
21 #include <stdio.h>
22 #include <Elementary.h>
23 #include <Ecore_IMF.h>
24
25 #include <ITapiSim.h>
26 #include <TelSim.h>
27 #include <TelErr.h>
28 #include <TapiUtility.h>
29 #include <ITapiModem.h>
30
31 #include <glib-object.h>
32
33 #include <setting-common-draw-widget.h>
34 #include <setting-common-view.h>
35 #include <setting-debug.h>
36
37 #define USELESS_SIM_CARD "Not useful SIM card"
38 #define Keystr_ScreenLockType                   "IDS_ST_BODY_SCREEN_LOCK_TYPE"
39 #define Keystr_Swipe                                            "IDS_ST_MBODY_SWIPE"
40
41 #if SUPPORT_PARENTAL_MODE
42 #define Keystr_ParentalMode             "Parental mode"
43 #endif
44
45 typedef struct _SettingSecurityUG SettingSecurityUG;
46
47 typedef enum {
48         SETTING_SEC_PW_SIM_LOCK_ON,
49         SETTING_SEC_PW_SIM_LOCK_OFF,
50         SETTING_SEC_PW_SIM_LOCK_DISABLED,
51         SETTING_SEC_PW_PIN_LOCK_ON,
52         SETTING_SEC_PW_PIN_LOCK_OFF,
53         SETTING_SEC_PW_CHANGE_PIN1,
54         SETTING_SEC_PW_CHANGE_PIN2,
55         SETTING_SEC_PW_PIN1_BLOCKED,
56         SETTING_SEC_PW_PIN2_BLOCKED,
57         SETTING_SEC_PW_PIN1_UNBLOCKED,
58         SETTING_SEC_PW_PIN2_UNBLOCKED,
59         SETTING_SEC_PW_MAX
60 } setting_sec_pw_type;
61
62 struct _security_item {
63         int pw_type_num;
64         char *pw_type_string;
65         int (*passwd_handler)(SettingSecurityUG *ad, void* data);
66 };
67
68 /**
69  * Setting Security UG context
70  * all UG function has void* as an agument. this is casted back to SettingSecurityUG
71  * and the functions access app context.
72  */
73 struct _SettingSecurityUG {
74         ui_gadget_h ug;
75         TapiHandle *handle;
76         TelSimFacilityStatus_t sim_status;
77         TelSimFacilityStatus_t pin1_status;
78         TelSimFacilityStatus_t pin2_status;//it indicates fdn status too
79
80         /* add more variables here (move your appdata to here) */
81         Evas *evas;
82         Evas_Object *win_main_layout;
83         Evas_Object *win_get;
84         Evas_Object *notify;
85
86         Evas_Object *ly_main;
87         Evas_Object *navi_bar;
88         Evas_Object *sim_popup;
89         ui_gadget_h ug_passwd;
90
91         Setting_GenGroupItem_Data *data_sim_lk;
92         Setting_GenGroupItem_Data *data_pin_lk;
93         Setting_GenGroupItem_Data *data_change_pin1;
94         Setting_GenGroupItem_Data *data_change_pin2;
95         Setting_GenGroupItem_Data *data_screen_lock_type;
96 #if 0
97         Setting_GenGroupItem_Data *data_locktype_swipe;
98 #endif
99         Setting_GenGroupItem_Data *data_locktype_3rd[128];
100         Evas_Object *sl_scroller;
101         Evas_Object *lock_type_rd;
102
103         Elm_Object_Item *screen_lock_main_item;
104         char *selected_lock_type;
105         /* for simple password */
106
107         Elm_Genlist_Item_Class itc_1text;
108         Elm_Genlist_Item_Class itc_1text_1icon;
109         Elm_Genlist_Item_Class itc_seperator;
110         Elm_Genlist_Item_Class itc_2text_2;
111
112         setting_sec_pw_type pw_type;
113
114         char *input_pwd;
115
116         int sel_item; /**< It's used to check PIN1, PIN2 _BLOCKED. 0:click pin lock, 1:change pin1 code, 2:fdn, 3: change pin2 code */
117         Ecore_Timer *update_view_timer;
118 };
119
120 extern setting_view setting_view_security_main;
121 extern setting_view setting_view_security_sim_settings;
122 extern setting_view setting_view_security_locktype;
123
124 SettingSecurityUG *g_ad;        /* for tapi callback */
125
126 void setting_security_result_password_ug_cb(ui_gadget_h ug,
127                                             service_h service, void *priv);
128 void setting_security_sim_get_facility_cb(TapiHandle *handle, int result, void *data, void *user_data);
129 void setting_security_pin_get_facility_cb(TapiHandle *handle, int result, void *data, void *user_data);
130
131 gboolean setting_security_create_password_sg(void *data);
132
133 #endif