Modify codes for WIN32 build environment
[profile/tv/apps/native/settings.git] / src / view_pwd_popup.cpp
1 /*
2  * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.0 (the License);
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an AS IS BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #include "dbg.h"
18 #include "def.h"
19 #include "view_pwd_popup.h"
20 #include "utils.h"
21 #include "settings_provider.h"
22 #include "settingviewmgr.h"
23
24 #define PWD_DATA_ID "change_passcode_data"
25 #define CTXPOPUP_WIDTH 688
26 #define CTXPOPUP_HEIGHT 411
27 #define PWD_SIZE 5
28
29 #define BOX_HPADDING 10
30 #define BOX_VPADDING 0
31
32 #define MSGID_PWD_TITLE "Change passcode"
33 #define MSGID_UPTEXT "Enter your old passcode"
34 #define MSGID_DOWNTEXT "Default passcode is 0000"
35 #define MSGID_INVALID_PWD "Failed passcode attempt"
36 #define MSGID_NEW_PWD "Enter your new passcode"
37 #define MSGID_REENTER_PWD "Re-enter your new passcode"
38 #define MSGID_DIFFER_PWD "Not same passcode. Enter again"
39 #define MSGID_CANCEL "Cancel"
40 #define PWD_SYMBOL "*"
41 #define PWD_RANGE "0123456789"
42
43 #define SIG_CLICKED "clicked"
44 #define SIG_DISMISSED "dismissed"
45
46 enum {
47         ENTRY_0,
48         ENTRY_1,
49         ENTRY_2,
50         ENTRY_3,
51         ENTRY_MAX
52 };
53
54 struct SPasscodePopupView {
55         Evas_Object *win;
56         Evas_Object *bg;
57         Evas_Object *base;
58         Evas_Object *cancel_btn;
59         Evas_Object *ctxpopup;
60         Evas_Object *box;
61
62         Eina_Array *array;
63
64         char pwd[PWD_SIZE];
65         char entered_pwd[PWD_SIZE];
66         char reentered_pwd[PWD_SIZE];
67
68         int new_flag;
69         int renew_flag;
70         int wrong_flag;
71
72         CSettingMgr *mgr;
73         struct settingview_data *view;
74 };
75
76 //static void _hide(Evas_Object *base);
77
78 /**
79 * Free user data.
80 *
81 * @param[in]: data : the user data of change passcode view.
82 *
83 * @return: void.
84 */
85 static void _free_pwd_data(SPasscodePopupView *data)
86 {
87         if (!data)
88                 return;
89
90         if (data->bg)
91                 evas_object_del(data->bg);
92
93         if (data->base)
94                 evas_object_del(data->base);
95
96         if (data->ctxpopup)
97                 evas_object_del(data->ctxpopup);
98
99         if (data->array)
100                 eina_array_free(data->array);
101 }
102
103 /**
104 * Create background of change passcode view.
105 *
106 * @param[in]: win : the window this view created on.
107 *
108 * @return: the created background of type evas object.
109 */
110 static Evas_Object *_add_pwd_bg(Evas_Object *win)
111 {
112         Evas_Object *bg;
113
114         if (!win)
115                 return NULL;
116
117         bg = utils_add_base(win);
118         if (!bg) {
119                 _ERR("elm layout add failed.");
120                 return NULL;
121         }
122
123         elm_layout_file_set(bg, EDJ_FILE, GRP_PWD_BG);
124
125         return bg;
126 }
127
128 /**
129 * Create the base layout of change passcode view.
130 *
131 * @param[in]: ctxpopup : the ctxpopup which contains change passcode view.
132 *
133 * @return: the created base layout of change passcode view.
134 */
135 static Evas_Object *_add_pwd_base(Evas_Object *ctxpopup)
136 {
137         Evas_Object *base;
138
139         if (!ctxpopup)
140                 return NULL;
141
142         base = utils_add_base(ctxpopup);
143         if (!base) {
144                 _ERR("elm layout add failed.");
145                 return NULL;
146         }
147
148         elm_layout_file_set(base, EDJ_FILE, GRP_PWD_VIEW);
149
150         elm_object_part_text_set(base, PART_TITLE,
151                         utils_get_translation_str(MSGID_PWD_TITLE));
152         elm_object_part_text_set(base, PART_UPTEXT,
153                         utils_get_translation_str(MSGID_UPTEXT));
154         elm_object_part_text_set(base, PART_DOWNTEXT,
155                         utils_get_translation_str(MSGID_DOWNTEXT));
156
157         return base;
158 }
159
160 /**
161 * Evas_Smart_Cb type callback for handling click event.
162 *
163 * @param[in]: priv : the user data.
164 * @param[in]: obj : the corresponding object which the click event occurred.
165 * @param[in]: ev : event info.
166 *
167 * @return: void.
168 */
169 static void _cancelbtn_clicked_cb(void *priv, Evas_Object *obj, void *ev)
170 {
171         SPasscodePopupView *data;
172
173         if (!priv || !obj)
174                 return;
175
176         data = (SPasscodePopupView *) priv;
177
178         data->mgr->ViewPop();
179 }
180
181 /**
182 * Create cancel button of change passcode view.
183 *
184 * @param[in]: data : the user data of change passcode view.
185 *
186 * @return: the created cancel button or null if error occurred.
187 */
188 static Evas_Object *_add_pwd_cancel_btn(SPasscodePopupView *data)
189 {
190         Evas_Object *btn;
191
192         if (!data || !data->base)
193                 return NULL;
194
195         btn = utils_add_btn(data->base, PWD_BASIC_BTN,
196                         utils_get_translation_str((const char *) MSGID_CANCEL), EINA_TRUE);
197         if (!btn) {
198                 _ERR("utils add button failed.");
199                 return NULL;
200         }
201
202         evas_object_smart_callback_add(btn, SIG_CLICKED,
203                         _cancelbtn_clicked_cb, data);
204
205         elm_object_part_content_set(data->base, SWALLOW_CANCEL_BTN, btn);
206
207         elm_object_focus_allow_set(btn, EINA_TRUE);
208
209         return btn;
210 }
211
212 /**
213 * Set the move directions of focus between entries and cancel button.
214 *
215 * @param[in]: array : eina array containing entries.
216 * @param[in]: cancel_btn : the cancel button.
217 *
218 * @return: void.
219 */
220 static void _set_entry_directions(Eina_Array *array, Evas_Object *cancel_btn)
221 {
222         Evas_Object *en;
223         Evas_Object *lasten;
224         int i;
225
226         if (!array || !cancel_btn)
227                 return;
228
229         for (i = ENTRY_0; i < ENTRY_3; i++) {
230                 en = (Evas_Object *) eina_array_data_get(array, i);
231                 if (!en)
232                         return;
233
234                 elm_object_focus_next_object_set(en,
235                                 (Evas_Object *) eina_array_data_get(array, i + 1),
236                                 ELM_FOCUS_NEXT);
237                 elm_object_focus_next_object_set(en, en, ELM_FOCUS_LEFT);
238                 elm_object_focus_next_object_set(en, en, ELM_FOCUS_RIGHT);
239                 elm_object_focus_next_object_set(en, en, ELM_FOCUS_UP);
240                 elm_object_focus_next_object_set(en, cancel_btn,
241                                 ELM_FOCUS_DOWN);
242         }
243
244         lasten = (Evas_Object *) eina_array_data_get(array, ENTRY_3);
245         elm_object_focus_next_object_set(lasten, lasten, ELM_FOCUS_UP);
246         elm_object_focus_next_object_set(lasten, cancel_btn, ELM_FOCUS_DOWN);
247         elm_object_focus_next_object_set(lasten, lasten, ELM_FOCUS_LEFT);
248         elm_object_focus_next_object_set(lasten, lasten, ELM_FOCUS_RIGHT);
249
250         elm_object_focus_next_object_set(cancel_btn, cancel_btn,
251                         ELM_FOCUS_LEFT);
252         elm_object_focus_next_object_set(cancel_btn, cancel_btn,
253                         ELM_FOCUS_RIGHT);
254         elm_object_focus_next_object_set(cancel_btn,
255                         (Evas_Object *) eina_array_data_get(array, ENTRY_0), ELM_FOCUS_UP);
256         elm_object_focus_next_object_set(cancel_btn, cancel_btn,
257                         ELM_FOCUS_DOWN);
258 }
259
260 /**
261 * Get the passcode.
262 *
263 * @param[in]: vdata : view data.
264 *
265 * @return: the passcode.
266 */
267 static char *_get_pwd(struct settingview_data *vdata)
268 {
269         struct settingitem *item;
270
271         if (!vdata)
272                 return NULL;
273
274         item = viewdata_get_parentitem(vdata);
275         if (!item) {
276                 _ERR("get parent item failed.");
277                 return NULL;
278         }
279
280         return provider_get_list_value(item);
281 }
282
283 /**
284 * Check if the input passcode is right.
285 *
286 * @param[in]: data : the user data of change passcode view.
287 *
288 * @return: 0 - wrong passcode, 1 - right passcode.
289 */
290 static int _check_pwd(SPasscodePopupView *data)
291 {
292         char *pwd;
293
294         if (!data || !data->view)
295                 return 0;
296
297         pwd = _get_pwd(data->view);
298         if (!pwd) {
299                 _ERR("get passcode failed.");
300                 return 0;
301         }
302
303         if (strncmp(data->pwd, pwd, strlen(pwd))) {
304                 free(pwd);
305                 return 0;
306         }
307
308         free(pwd);
309
310         return 1;
311 }
312
313 /**
314 * Clear passcode.
315 *
316 * @param[in]: pwd : the passcode.
317 *
318 * @return: void.
319 */
320 static void _clear_pwd(char *pwd)
321 {
322         if (!pwd)
323                 return;
324
325         while (pwd) {
326                 if (*pwd == '\0')
327                         break;
328
329                 *pwd = 'F';
330                 pwd++;
331         }
332 }
333
334 /**
335 * Clear passcode.
336 *
337 * This function clears displayed passcode in entries when user
338 * inputs wrong passcode.
339 *
340 * @param[in]: data : the user data of change passcode view.
341 *
342 * @return: void.
343 */
344 static void _reset_pwd(SPasscodePopupView *data)
345 {
346         Evas_Object *btn, *first;
347         Eina_Array *array;
348         int i;
349
350         if (!data || !data->array || !data->base)
351                 return;
352
353         array = data->array;
354
355         first = (Evas_Object *) eina_array_data_get(array, ENTRY_0);
356         if (!first)
357                 return;
358
359         elm_object_focus_set(first, EINA_TRUE);
360         elm_object_focus_next_object_set(data->cancel_btn, first, ELM_FOCUS_UP);
361
362         for (i = ENTRY_0; i < ENTRY_MAX; i++) {
363                 btn = (Evas_Object *)eina_array_data_get(array, i);
364                 if (!btn)
365                         return;
366
367                 elm_object_text_set(btn, "");
368         }
369 }
370
371 /**
372 * Set passcode to system.
373 *
374 * @param[in]: data : the user data of change passcode view.
375 *
376 * @return: 0 - Success, -1 - Fail.
377 */
378 static int _set_pwd(SPasscodePopupView *data)
379 {
380         int ret;
381         struct settingitem *item;
382
383         if (!data || !data->view)
384                 return -1;
385
386         item = viewdata_get_parentitem(data->view);
387         if (!item) {
388                 _ERR("get parent item failed.");
389                 return -1;
390         }
391
392         ret = provider_set_list_value(item, data->pwd);
393         if (ret == -1) {
394                 _ERR("set passcode failed.");
395                 return -1;
396         }
397
398         return 0;
399 }
400
401 /**
402 * Check if the reentered passcode is right.
403 *
404 * @param[in]: data : the user data of change passcode view.
405 *
406 * @return: 0 - Success, -1 - Fail.
407 */
408 static int _check_reentered_pwd(SPasscodePopupView *data)
409 {
410         if (!data)
411                 return 0;
412
413         if (strncmp(data->entered_pwd, data->reentered_pwd,
414                         PWD_SIZE - 1))
415                 return 0;
416
417         return 1;
418 }
419
420 /**
421 * Update text of change passcode view.
422 *
423 * @param[in]: data : the user data of change passcode view.
424 * @param[in]: part : edje part of text.
425 * @param[in]: msgid : the message id of text.
426 *
427 * @return: void.
428 */
429 static void _update_pwd_ui(SPasscodePopupView *data,
430                 const char *part, const char *msgid)
431 {
432         char *text;
433
434         if (!data || !data->base || !msgid || !part)
435                 return;
436
437         _reset_pwd(data);
438
439         text = utils_get_translation_str(msgid);
440         elm_object_part_text_set(data->base, part, text);
441 }
442
443 /**
444 * Evas_Object_Event_Cb type callback for handling key press event.
445 *
446 * @param[in]: priv : the user data.
447 * @param[in]: e : the evas canvas.
448 * @param[in]: obj : the corresponding object which the key press event occurred.
449 * @param[in]: ei : event info.
450 *
451 * @return: void.
452 */
453 static void _entry_keypress_cb(void *priv, Evas *e,
454                 Evas_Object *obj, void *ei)
455 {
456         Evas_Event_Key_Down *event;
457         Eina_Array *array;
458         Evas_Object *next_entry;
459         SPasscodePopupView *data;
460         const char *keyname;
461         int entry_idx, i;
462
463         if (!priv || !ei || !obj)
464                 return;
465
466         data = (SPasscodePopupView *) priv;
467         array = data->array;
468         if (!array)
469                 return;
470
471         event = (Evas_Event_Key_Down *) ei;
472         keyname = event->keyname;
473         if (!keyname)
474                 return;
475
476         entry_idx = -1;
477         for (i = ENTRY_0; i < ENTRY_MAX; i++) {
478                 if (obj == eina_array_data_get(array, i)) {
479                         entry_idx = i;
480                         break;
481                 }
482         }
483
484         if (!strncmp(keyname, KEY_BACK, strlen(keyname)) || !strncmp(keyname, KEY_BACK_REMOTE, strlen(keyname))) {
485                 data->mgr->ViewPop();
486         } else if (!strncmp(keyname, KEY_DOWN, strlen(keyname))) {
487                 elm_object_focus_set(data->cancel_btn, EINA_TRUE);
488         } else if (!strncmp(keyname, KEY_0, strlen(keyname)) ||
489                         !strncmp(keyname, KEY_1, strlen(keyname)) ||
490                         !strncmp(keyname, KEY_2, strlen(keyname)) ||
491                         !strncmp(keyname, KEY_3, strlen(keyname)) ||
492                         !strncmp(keyname, KEY_4, strlen(keyname)) ||
493                         !strncmp(keyname, KEY_5, strlen(keyname)) ||
494                         !strncmp(keyname, KEY_6, strlen(keyname)) ||
495                         !strncmp(keyname, KEY_7, strlen(keyname)) ||
496                         !strncmp(keyname, KEY_8, strlen(keyname)) ||
497                         !strncmp(keyname, KEY_9, strlen(keyname))) {
498                 elm_entry_entry_set(obj, PWD_SYMBOL);
499
500                 data->pwd[entry_idx] = keyname[0];
501
502                 if (data->new_flag && !data->renew_flag)
503                         data->entered_pwd[entry_idx] = keyname[0];
504
505                 if (data->renew_flag)
506                         data->reentered_pwd[entry_idx] = keyname[0];
507
508                 if (entry_idx < ENTRY_3) {
509                         elm_object_focus_next(obj, ELM_FOCUS_NEXT);
510                         next_entry = elm_object_focus_next_object_get(obj,
511                                         ELM_FOCUS_NEXT);
512                         if (!next_entry) {
513                                 _ERR("next entry is null.");
514                                 return;
515                         }
516
517                         elm_object_focus_next_object_set(data->cancel_btn,
518                                         next_entry, ELM_FOCUS_UP);
519                 } else {
520                         if (!data->new_flag) {
521                                 if (_check_pwd(data)) {
522                                         _update_pwd_ui(data, PART_UPTEXT,
523                                                         MSGID_NEW_PWD);
524
525                                         data->new_flag = 1;
526                                 } else {
527                                         _update_pwd_ui(data, PART_UPTEXT,
528                                                         MSGID_INVALID_PWD);
529                                 }
530                         } else if (!data->renew_flag) {
531                                 _update_pwd_ui(data, PART_UPTEXT,
532                                                 MSGID_REENTER_PWD);
533
534                                 data->renew_flag = 1;
535                         } else {
536                                 if (_check_reentered_pwd(data)) {
537                                         if (_set_pwd(data) != 0) {
538                                                 _ERR("set passcode failed.");
539                                                 return;
540                                         }
541
542                                         data->new_flag = 0;
543                                         data->renew_flag = 0;
544
545                                         data->mgr->ViewPop();
546                                 } else {
547                                         _update_pwd_ui(data, PART_UPTEXT,
548                                                         MSGID_DIFFER_PWD);
549
550                                         data->renew_flag = 0;
551                                         data->new_flag = 1;
552                                 }
553                         }
554                 }
555         }
556 }
557
558 /**
559 * Create entry.
560 *
561 * @param[in]: parent : object the entry will be created on.
562 *
563 * @return: the created entry or null if error occurred.
564 */
565 static Evas_Object *_add_entry(Evas_Object *parent)
566 {
567         Evas_Object *entry;
568         Elm_Entry_Filter_Limit_Size length = {
569                 1
570         };
571         Elm_Entry_Filter_Accept_Set type = {
572                 PWD_RANGE
573         };
574
575         if (!parent)
576                 return NULL;
577
578         entry = utils_add_entry(parent);
579         if (!entry) {
580                 _ERR("utils add entry failed.");
581                 return NULL;
582         }
583
584         elm_entry_markup_filter_append(entry,
585                         elm_entry_filter_limit_size, &length);
586         elm_entry_markup_filter_append(entry,
587                         elm_entry_filter_accept_set, &type);
588
589         elm_object_style_set(entry, STYLE_PWD_ENTRY);
590
591         elm_entry_text_style_user_push(entry, STYLE_ENTRY_TEXT);
592         elm_object_part_content_set(parent, SWALLOW_ENTRY, entry);
593
594         return entry;
595 }
596
597 /**
598 * Create entries for inputting passcode.
599 *
600 * @param[in]: data : the user data of change passcode view.
601 *
602 * @return: 0 - Success, -1 - Fail.
603 */
604 static int _add_pwd_entry(SPasscodePopupView *data)
605 {
606         Eina_Array *array;
607         Evas_Object *box;
608         Evas_Object *entry;
609         Evas_Object *entry_base;
610         int i;
611
612         if (!data || !data->base) {
613                 _ERR("invalid arguments.");
614                 return -1;
615         }
616
617         box = utils_add_box(data->base);
618         if (!box) {
619                 _ERR("add box failed.");
620                 return -1;
621         }
622
623         elm_box_horizontal_set(box, EINA_TRUE);
624         elm_box_padding_set(box, BOX_HPADDING, BOX_VPADDING);
625
626         array = eina_array_new(1);
627         if (!array) {
628                 _ERR("new eina array failed.");
629                 evas_object_del(box);
630                 return -1;
631         }
632
633         for (i = ENTRY_0; i < ENTRY_MAX; i++) {
634                 entry_base = utils_add_base(data->base);
635                 if (!entry_base) {
636                         _ERR("entry base created failed.");
637                         evas_object_del(box);
638                         eina_array_free(array);
639                         return -1;
640                 }
641
642                 elm_layout_file_set(entry_base, EDJ_FILE, GRP_PWD_ENTRY);
643
644                 entry = _add_entry(entry_base);
645                 if (!entry) {
646                         _ERR("add entry failed.");
647                         evas_object_del(box);
648                         evas_object_del(entry_base);
649                         eina_array_free(array);
650                         return -1;
651                 }
652
653                 eina_array_push(array, entry);
654                 elm_box_pack_end(box, entry_base);
655
656                 evas_object_event_callback_add(entry, EVAS_CALLBACK_KEY_DOWN,
657                                 _entry_keypress_cb, data);
658         }
659
660         elm_object_part_content_set(data->base, SWALLOW_CONTENT_AREA, box);
661
662         elm_object_focus_allow_set(
663                         (Evas_Object *) eina_array_data_get(array, ENTRY_0), EINA_TRUE);
664         elm_object_focus_set(
665                         (Evas_Object *)eina_array_data_get(array, ENTRY_0), EINA_TRUE);
666
667         _set_entry_directions(array, data->cancel_btn);
668
669         data->box = box;
670         data->array = array;
671
672         return 0;
673 }
674
675 /**
676 * Evas_Smart_Cb type callback for handling ctxpopup dismissed event.
677 *
678 * @param[in]: priv : the user data.
679 * @param[in]: obj : the corresponding object which the dismissed event occurred.
680 * @param[in]: ev : event info.
681 *
682 * @return: void.
683 */
684 void CPasscodePopupView::sm_CbCtxpopupDismissed(void *priv, Evas_Object *obj, void *ev)
685 {
686         CPasscodePopupView *root = (CPasscodePopupView*)priv;
687         if (root)
688                 root->m_OnCtxpopupDismissed(obj, ev);
689 }
690
691
692 void CPasscodePopupView::m_OnCtxpopupDismissed(Evas_Object *obj, void *ev)
693 {
694         if (!obj)
695                 return;
696
697         if (!m->base || !m->mgr)
698                 return;
699
700         Hide();
701
702         m->mgr->ViewPop();
703 }
704
705
706
707 Evas_Object* CPasscodePopupView::Base(void)
708 {
709         ASSERT(m);
710
711         return m->base;
712 }
713
714
715 /**
716 * Create all the UI components of change passcode view.
717 *
718 * @param[in]: mgr : view manager of settings views.
719 * @param[in]: view : data of view.
720 * @prev[in]: prev : the user data.
721 *
722 * @return: the base layout of change passcode view or null
723 *                if error occurred.
724 */
725 bool CPasscodePopupView::Create(struct settingview_data *view, void *prev)
726 {
727         ASSERT(!m);
728         ASSERT(view);
729
730         CSettingMgr *mgr = CSettingMgr::GetInstance();
731         ASSERT(mgr);
732
733         Evas_Object *base, *bg;
734         Evas_Object *win;
735         Evas_Object *cancel_btn;
736         Evas_Object *ctxpopup;
737         int ret;
738         int width, height;
739         int xpos, ypos;
740
741         win = mgr->Window();
742         ASSERT(win);
743
744         m = new SPasscodePopupView;
745         if (!m) {
746                 _ERR("calloc _change_passcode_data failed.");
747                 return false;
748         }
749
750         m->win = win;
751
752         _clear_pwd(m->pwd);
753
754         bg = _add_pwd_bg(win);
755         if (!bg) {
756                 _ERR("add change passcode background failed.");
757                 goto error;
758         }
759
760         ctxpopup = utils_add_ctxpopup(win, (char *) CHANGE_PWD_CTXPOPUP_STYLE);
761         if (!ctxpopup) {
762                 _ERR("add ctxpopup failed.");
763                 goto error;
764         }
765
766         m->ctxpopup = ctxpopup;
767
768         base = _add_pwd_base(m->ctxpopup);
769         if (!base) {
770                 _ERR("add change passcode base layout failed.");
771                 goto error;
772         }
773
774         m->base = base;
775
776         elm_object_content_set(ctxpopup, base);
777
778         width = WIN_WIDTH;
779         height = WIN_HEIGHT;
780
781         xpos = (width - CTXPOPUP_WIDTH) / 2;
782         ypos = (height - CTXPOPUP_HEIGHT) / 2;
783         evas_object_move(m->ctxpopup, xpos * ELM_SCALE, ypos * ELM_SCALE);
784
785         cancel_btn = _add_pwd_cancel_btn(m);
786         if (!cancel_btn) {
787                 _ERR("add change passcode cancel button failed.");
788                 goto error;
789         }
790
791         m->cancel_btn = cancel_btn;
792
793         ret = _add_pwd_entry(m);
794         if (ret != 0) {
795                 _ERR("add change passcode input buttons failed.");
796                 goto error;
797         }
798
799         m->mgr = mgr;
800         m->bg = bg;
801         m->view = view;
802
803         evas_object_smart_callback_add(m->ctxpopup,
804                         SIG_DISMISSED, sm_CbCtxpopupDismissed, this);
805
806         evas_object_data_set(base, PWD_DATA_ID, m);
807
808         return true;
809
810 error:
811         _free_pwd_data(m);
812         delete m;
813         m = NULL;
814         return false;
815 }
816
817 /**
818 * Show the change passcode view.
819 *
820 * @param[in]: base : the base layout of change passcode view.
821 *
822 * @return: void.
823 */
824 void CPasscodePopupView::Show(void)
825 {
826         ASSERT(m);
827
828         evas_object_show(m->ctxpopup);
829 }
830
831 /**
832 * Destroy the change passcode view.
833 *
834 * @param[in]: base : the base layout of change passcode view.
835 *
836 * @return: void.
837 */
838 void CPasscodePopupView::Destroy(void)
839 {
840         ASSERT(m);
841
842         _free_pwd_data(m);
843         delete m;
844         m = NULL;
845 }
846
847 /**
848 * Hide the change passcode view.
849 *
850 * @param[in]: base : the base layout of change passcode view.
851 *
852 * @return: void.
853 */
854 void CPasscodePopupView::Hide(void)
855 {
856         ASSERT(m);
857
858         evas_object_hide(m->bg);
859         evas_object_hide(m->ctxpopup);
860 }
861
862
863 #if 0
864 /**
865 * view class of change passcode view.
866 */
867 static struct setting_class _vclass = {
868         VCLASS_TITLE_CHANGE_PASSCODE,
869         _create,
870         _show,
871         NULL,
872         NULL,
873         NULL,
874         NULL,
875         _hide,
876         _destroy,
877         NULL,
878         NULL,
879         NULL,
880         0
881 };
882
883 /**
884 * Return view class of change passcode view.
885 *
886 * @param: null.
887 *
888 * @return: the view class of change passcode view.
889 */
890 struct setting_class *view_passcode_popup_get_vclass(void)
891 {
892         return &_vclass;
893 }
894 #endif