tizen 2.4 release
[apps/home/settings.git] / setting-locktype / include / setting-locktype.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_LOCKTYPE_H__
22 #define __SETTING_LOCKTYPE_H__
23
24 #include <glib.h>
25 #include <stdio.h>
26 #include <dirent.h>
27 #include <Elementary.h>
28 #include <Ecore_IMF.h>
29 #include <glib-object.h>
30
31 #include <setting-common-draw-widget.h>
32 #include <setting-common-view.h>
33 #include <setting-debug.h>
34 #include <dlog.h>
35 #include <recorder.h>
36 #include <app_manager.h>
37
38 /*#include <ckmc/ckmc-control.h> */
39 /*#include <ckmc/ckmc-type.h> */
40
41
42 /*///////////////////face and voice unlock */
43 #define SET_AS_LOCK_STR "IDS_ST_SK_SET_LITE"/*"Set as lock" */
44 #define CONTINUE_STR "Continue"
45 #define SET_UP_STR "Set it up"
46 #define ADAPT_VOICE_STR "Adapt Voice"
47
48 #define About_Motion_Unlock_Str "IDS_ST_HEADER_MOTION_UNLOCK"
49 #define About_Face_Unlock_Str "About Face Unlock"
50 #define Setup_Face_Unlock_Str   "Set up Face Unlock"
51 #define Voice_Record_BtnStr "Voice record icon"
52 #define Put_Face_Str "<align=middle>Put your face here</align>"
53 #define Show_Face_Str "Show your face"
54
55 #define Motion_Unlock_Guildtext "Unlock device using motion<br><br>"\
56         "Tap and hold the screen then tilt the device "\
57         "towards you to unlock it. If the screen does not unlock, "\
58         "try tiling the device more. When learn about tilt or motion "\
59         "lock are set,motion activation will be automatically enabled "\
60         "in Settings"
61
62 #define Motion_Unlock_Guildtext1 "IDS_ST_HEADER_UNLOCK_DEVICE_USING_MOTION_ABB"
63 #define Motion_Unlock_Guildtext2 "IDS_ST_BODY_TAP_AND_HOLD_THE_SCREEN_THEN_TILT_THE_DEVICE_TOWARDS_YOU_TO_UNLOCK_IT_IF_THE_SCREEN_DOES_NOT_UNLOCK_TRY_TILTING_THE_DEVICE_MORE"
64 #define Motion_Unlock_Guildtext3 "IDS_ST_BODY_WHEN_LEARN_ABOUT_TILT_OR_MOTION_UNLOCK_ARE_SET_MOTION_ACTIVATION_WILL_BE_AUTOMATICALLY_ENABLED_IN_SETTINGS"
65
66 #define Face_Unlock_Warring     "Warning<br><br>"\
67         "Do not use face unlock while driving, it may distract you from "\
68         "the road and cause an accident"
69
70 #define Face_Unlock_Warring2    "Look at your phone to Unlock it<br><br>"\
71         "Keep these things in mind<br>"\
72         ".Face Unlock is less secure than PIN or password.<br><br>"\
73         ".Someone who looks similar to you could unlock your phone.<br><br>"\
74         ".The data used to identify your face is kept private on the phone."
75
76 #define Face_Unlock_Warring3    "For best results:<br><br>"\
77         ".Find an indoor spot that is not too bright or too dim.<br><br>"\
78         ".Hold the phone at eye level."
79
80 #define Voice_Unlock_Guildtext "Tap button below then say voice command you want to use for Unlock 4 times all at once"
81 #define Voice_Unlock_Guildtext2 "Use 3-5 syllable words and maintain constant intonation.<br><br>"\
82         "All background music and recording will stop when you unlock the device using Face and voice<br>"
83 #define Voice_Recognized_text "Recognised. Now you can use your own voice command for Unlock.<br><br>"\
84         "For assuring higher security. You can adapt voice command by tapping 'Adapt voice' button."
85
86 #define Adapt_voice_Str "Adapt Voice"
87
88 #define Finish_Setup_Face "You've finished!<br><br>"\
89         "To unlock your phone, just look at it.<br><br>"\
90         "Tip : improve face matching by having your face capture in different "\
91         "conditions."
92
93 #define Speak_Now_Str                                   "Speak now"
94
95 #define Keystr_ScreenLockType                   "IDS_ST_BODY_SCREEN_LOCK_TYPE"
96 #define Keystr_LockScreenOptions                        "IDS_ST_BODY_LOCK_SCREEN_OPTIONS"
97 #define Keystr_Swipe                                            "IDS_ST_MBODY_SWIPE"
98 #define Keystr_FaceAndVoice                             "IDS_ST_BODY_FACE_AND_VOICE"
99 #define Keystr_FingerPrint                                              "Fingerprint"
100
101
102 typedef struct _SettingLocktypeUG SettingLocktypeUG;
103
104 struct _locktype_item {
105         int pw_type_num;
106         char *pw_type_string;
107         int (*passwd_handler)(SettingLocktypeUG *ad, void *data);
108 };
109
110 #define MAX_VOICE_TIME 4
111 #define MAX_SEC_PROFILE_NUM 100
112
113 enum {
114     SETTING_LOCKTYPE_PW_PASSWORD,
115     SETTING_LOCKTYPE_PW_SIMPLE_PASSWD,
116     SETTING_LOCKTYPE_PW_CHANGE_PASSWD,
117     SETTING_LOCKTYPE_PW_CHANGE_SIMPLE_PASSWD,
118     SETTING_LOCKTYPE_PW_MAX
119 };
120
121 enum {
122     SETTING_LOCKTYPE_VIEWTYPE_MAIN,
123     SETTING_LOCKTYPE_VIEWTYPE_ENCRYPTION,
124     SETTING_LOCKTYPE_VIEWTYPE_RECOVERY, /* In case that recovery password using tizen account, lockscreen can call locktype */
125 };
126
127 /**
128  * Setting Security UG context
129  * all UG function has void* as an agument. this is casted back to SettingSecurityUG
130  * and the functions access app context.
131  */
132 struct _SettingLocktypeUG {
133         ui_gadget_h ug;
134
135         /* add more variables here (move your appdata to here) */
136         Evas *evas;
137         Evas_Object *win_main_layout;
138         Evas_Object *win_get;
139         Evas_Object *notify;
140         Evas_Object *video_ly;
141         Evas_Object *video_ly_show_face_btn;
142         Evas_Object *video_ly_content_face;
143         Ecore_Timer *update_timer;
144         Evas_Object *image[MAX_VOICE_TIME];
145         int processed_img_num;
146         Evas_Object *record_genlist;
147         Elm_Object_Item *screen_lock_main_item;
148         char *selected_lock_type;
149         recorder_h recorder_handle;
150
151         Evas_Object *ly_guild;
152         Evas_Object *ly_main;
153         Evas_Object *navi_bar;
154         ui_gadget_h ug_passwd;
155         ui_gadget_h ug_loading;
156         Evas_Object *genlist;
157         Evas_Object *save_popup;
158
159         Elm_Genlist_Item_Class itc_1text;
160         Elm_Genlist_Item_Class itc_bg_1icon;
161         Elm_Genlist_Item_Class itc_1text_1icon;
162         Elm_Genlist_Item_Class itc_seperator;
163         Elm_Genlist_Item_Class itc_2text_2;
164         Elm_Genlist_Item_Class itc_1icon;
165         Elm_Genlist_Item_Class itc_group_item;
166         Elm_Genlist_Item_Class itc_2text_3_parent;
167
168         int pw_type;
169
170         Evas_Object *lock_type_rd;
171         Setting_GenGroupItem_Data *data_sl_simple_pw;
172         Setting_GenGroupItem_Data *data_sl_pw;
173
174         int old_type;
175         Setting_GenGroupItem_Data *data_locktype_none;
176         Setting_GenGroupItem_Data *data_locktype_swipe;
177         Setting_GenGroupItem_Data *data_locktype_fingerprint;
178         Setting_GenGroupItem_Data *data_locktype_motion;
179         Setting_GenGroupItem_Data *data_locktype_face;
180         Setting_GenGroupItem_Data *data_locktype_simple;
181         Setting_GenGroupItem_Data *data_locktype_password;
182         Setting_GenGroupItem_Data *data_locktype_3rd[128];
183
184         Ecore_Timer *update_locktype_timer;
185         bool cur_enc_mode;
186         bool ug_is_destroying;
187         int viewtype;
188         char *caller;
189         char *input_pwd;
190 };
191
192 extern setting_view setting_view_locktype_main;
193
194
195 void setting_locktype_result_password_ug_cb(ui_gadget_h ug,
196                                             app_control_h service, void *priv);
197 gboolean setting_locktype_create_password_sg(void *data);
198 void setting_locktype_destroy_password_ug_cb(ui_gadget_h ug,
199                                              void *priv);
200 void setting_locktype_layout_passwd_ug_cb(ui_gadget_h ug,
201                                           enum ug_mode mode, void *priv);
202
203 #endif