2 * Copyright 2012 Samsung Electronics Co., Ltd
4 * Licensed under the Flora License, Version 1.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
8 * http://www.tizenopensource.org/license
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.
17 #include "email-setting.h"
18 #include "email-view-account-setup.h"
19 #include "email-setting-utils.h"
20 #include "email-setting-account-set.h"
22 static int _create(struct viewdata *vd);
23 static int _update(struct viewdata *vd);
24 static int _destroy(struct viewdata *vd);
25 static int _show(struct viewdata *vd);
26 static int _hide(struct viewdata *vd);
28 static void _push_naviframe(struct viewdata *vd);
29 static void _create_view(struct viewdata *vd);
30 static void _create_list(struct viewdata *vd);
31 static void _create_validation_popup(struct viewdata *vd, int account_id);
32 static void _create_account(void *data);
34 static int _check_null_field(struct viewdata *vd);
35 static int _check_preset_null_field(struct viewdata *vd);
36 static int _check_preset_isp_name(char *addr, int isp_type);
37 static void _read_all_entries(struct viewdata *vd);
38 /*static void _set_help_string(Evas_Object *eo, struct viewdata *vd);*/
39 static void _set_domain_string(struct viewdata *vd);
41 static void _next_cb(void *data, Evas_Object *obj, void *event_info);
42 static void _save_cb(void *data, Evas_Object *obj, void *event_info);
43 static void _manual_cb(void *data, Evas_Object *obj, void *event_info);
44 static void _back_cb(void *data, Evas_Object *obj, void *event_info);
45 static void _check1_clicked_cb(void *data, Evas_Object *obj, void *event_info);
46 static void _check2_clicked_cb(void *data, Evas_Object *obj, void *event_info);
47 static void _check1_clicked_cb2(void *data, Evas_Object *obj, const char *emission, const char *source);
48 static void _check2_clicked_cb2(void *data, Evas_Object *obj, const char *emission, const char *source);
49 static Eina_Bool _after_validation_cb(void *data);
51 static void _popup_ok_cb(void *data, Evas_Object *obj, void *event_info);
52 static void _popup_cancel_validation_cb(void *data, Evas_Object *obj, void *event_info);
53 static void _backup_input_cb(void *data, Evas_Object *obj, void *event_info);
54 static void _entry_focused_cb(void *data, Evas_Object *obj, void *event_info);
55 static void _entry_unfocused_cb(void *data, Evas_Object *obj, void *event_info);
56 static void _eraser_clicked_cb(void *data, Evas_Object *obj, const char *emission, const char *source);
57 static void _input_panel_state_changed_cb(void *data, Ecore_IMF_Context *ctx, int value);
58 static void _gl_ef_sel_cb(void *data, Evas_Object *obj, void *event_info);
59 static Evas_Object *_gl_ef_content_get_cb(void *data, Evas_Object *obj, const char *part);
61 static struct viewdata *g_vd = NULL;
67 char *str_account_name;
68 char *str_display_name;
69 char *str_email_address;
73 Evas_Object *entry_account_name;
74 Evas_Object *entry_display_name;
75 Evas_Object *entry_email_address;
76 Evas_Object *entry_user_id;
77 Evas_Object *entry_password;
79 Evas_Object *ef_account_name;
80 Evas_Object *ef_display_name;
81 Evas_Object *ef_email_address;
82 Evas_Object *ef_user_id;
83 Evas_Object *ef_password;
87 Evas_Object *scroller;
89 Evas_Object *l_button;
90 Evas_Object *r_button;
91 Evas_Object *r_button2;
92 Evas_Object *manual_btn;
94 Evas_Object *show_passwd_check;
95 Evas_Object *default_account_check;
97 Evas_Object *clicked_object;
100 Elm_Genlist_Item_Class itc1;
101 Elm_Genlist_Item_Class itc2;
104 Elm_Object_Item * c_item[4];
105 Elm_Object_Item *navi_it;
109 int set_default_account;
112 void setting_init_account_setup_view(struct viewdata *vd)
115 vd->type = VIEW_ACCOUNT_SETUP;
116 vd->create = _create;
117 vd->update = _update;
118 vd->destroy = _destroy;
121 vd->grp_nm = "setting_account_setup";
124 void setting_account_validation_success_cb(EmailSettingUGD *ugd)
129 top = ugd->view_st[ugd->view_top];
133 debug_log("vd is NULL");
139 if (ugd->popup_one) {
140 evas_object_del(ugd->popup_one);
141 ugd->popup_one = NULL;
143 if (ugd->popup_validate) {
144 evas_object_del(ugd->popup_validate);
145 ugd->popup_validate = NULL;
148 ugd->preset_vc_timer = ecore_timer_add(0.5, _after_validation_cb, vd);
151 void setting_account_validation_failed_cb(EmailSettingUGD *ugd, gboolean canceled)
157 top = ugd->view_st[ugd->view_top];
161 debug_log("vd is NULL");
165 account_id = ugd->account_id;
167 if (ugd->popup_one) {
168 evas_object_del(ugd->popup_one);
169 ugd->popup_one = NULL;
171 if (ugd->popup_validate) {
172 evas_object_del(ugd->popup_validate);
173 ugd->popup_validate = NULL;
176 if (canceled || ugd->err_code == EMAIL_ERROR_CANCELLED) {
177 ugd->popup_one = setting_get_notify(vd,
178 dgettext("sys_string", "IDS_COM_POP_WARNING"),
179 _("IDS_EMAIL_POP_ACCOUNT_CREATION_CANCELLED"),
180 1, dgettext("sys_string", "IDS_COM_SK_OK"),
181 _popup_ok_cb, NULL, NULL);
183 char *type = setting_get_service_fail_type(ugd->err_code);
184 ugd->popup_one = setting_get_notify(vd,
185 dgettext("sys_string", "IDS_COM_POP_WARNING"),
186 type, 1, dgettext("sys_string", "IDS_COM_SK_OK"),
187 _popup_ok_cb, NULL, NULL);
192 static int _create(struct viewdata *vd)
197 debug_log("vd is NULL");
202 EmailSettingUGD *ugd = vd->ugd;
206 p = vd->priv = calloc(1, sizeof(struct priv_data));
209 p->layout = setting_add_inner_layout(vd);
213 p->scroller = elm_scroller_add(ugd->navi_bar);
214 evas_object_propagate_events_set(p->scroller, EINA_FALSE);
215 elm_scroller_bounce_set(p->scroller, EINA_FALSE, EINA_FALSE);
216 elm_scroller_policy_set(p->scroller, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
217 evas_object_show(p->scroller);
219 elm_win_conformant_set(ugd->win, EINA_TRUE);
220 p->conform = elm_conformant_add(ugd->win);
221 elm_object_style_set(p->conform, "internal_layout");
222 elm_object_content_set(p->conform, p->scroller);
223 evas_object_show(p->conform);
225 elm_object_part_content_set(p->layout, "elm.swallow.content", p->conform);
229 ugd->wds_account_creation = 0;
231 if (vd->ugd->account_info != OTHERS) {
232 _set_domain_string(vd);
241 static int _update(struct viewdata *vd)
248 static int _destroy(struct viewdata *vd)
251 struct priv_data *p = vd->priv;
252 EmailSettingUGD *ugd = vd->ugd;
254 Ecore_IMF_Context *imf_context = NULL;
255 imf_context = elm_entry_imf_context_get(p->clicked_object);
257 ecore_imf_context_input_panel_hide(imf_context);
258 ecore_imf_context_input_panel_event_callback_del(imf_context,
259 ECORE_IMF_INPUT_PANEL_STATE_EVENT, _input_panel_state_changed_cb);
262 evas_object_del(p->l_button);
263 evas_object_del(p->r_button);
264 evas_object_del(p->genlist);
265 evas_object_del(p->cbar);
267 if (ugd->preset_vc_timer) {
268 ecore_timer_del(ugd->preset_vc_timer);
269 ugd->preset_vc_timer = NULL;
272 if (ugd->popup_one) {
273 evas_object_del(ugd->popup_one);
274 ugd->popup_one = NULL;
276 if (ugd->popup_validate) {
277 evas_object_del(ugd->popup_validate);
278 ugd->popup_validate = NULL;
281 ugd->account_info = 0;
283 setting_new_acct_final(vd);
287 static int _show(struct viewdata *vd)
292 debug_log("vd is NULL");
296 evas_object_show(vd->ly);
301 static int _hide(struct viewdata *vd)
306 debug_log("vd is NULL");
310 evas_object_hide(vd->ly);
315 static void _push_naviframe(struct viewdata *vd)
318 struct priv_data *p = vd->priv;
320 p->cbar = elm_toolbar_add(vd->ugd->navi_bar);
321 elm_toolbar_shrink_mode_set(p->cbar, ELM_TOOLBAR_SHRINK_EXPAND);
322 elm_object_style_set(p->cbar, "naviframe");
323 evas_object_show(p->cbar);
325 if (vd->ugd->account_info == OTHERS) {
326 p->c_item[0] = elm_toolbar_item_append(p->cbar, NULL,
327 dgettext("sys_string", "IDS_COM_BUTTON_LOGIN"), _next_cb, vd);
329 p->c_item[0] = elm_toolbar_item_append(p->cbar, NULL,
330 dgettext("sys_string", "IDS_COM_BUTTON_LOGIN"), _save_cb, vd);
332 elm_object_item_disabled_set(p->c_item[0], EINA_TRUE);
333 elm_object_item_disabled_set(elm_toolbar_item_append(p->cbar, NULL, "", NULL, NULL), EINA_TRUE);
334 elm_object_item_disabled_set(elm_toolbar_item_append(p->cbar, NULL, "", NULL, NULL), EINA_TRUE);
336 p->l_button = elm_button_add(vd->ugd->navi_bar);
337 elm_object_style_set(p->l_button, "naviframe/title/default");
338 elm_object_focus_allow_set(p->l_button, EINA_FALSE);
339 evas_object_show(p->l_button);
341 if (vd->ugd->account_info == OTHERS) {
342 elm_object_text_set(p->l_button, dgettext("sys_string", "IDS_COM_BUTTON_LOGIN"));
343 evas_object_smart_callback_add(p->l_button, "clicked", _next_cb, vd);
345 elm_object_text_set(p->l_button, dgettext("sys_string", "IDS_COM_BUTTON_LOGIN"));
346 evas_object_smart_callback_add(p->l_button, "clicked", _save_cb, vd);
349 elm_object_disabled_set(p->l_button, EINA_TRUE);
351 p->r_button = elm_button_add(vd->ugd->navi_bar);
352 elm_object_style_set(p->r_button, "naviframe/title/default");
353 elm_object_text_set(p->r_button, dgettext("sys_string", "IDS_COM_SK_CANCEL"));
354 evas_object_smart_callback_add(p->r_button, "clicked", _back_cb, vd);
355 evas_object_show(p->r_button);
357 p->r_button2 = elm_button_add(vd->ugd->navi_bar);
358 elm_object_style_set(p->r_button2, "naviframe/title/default");
359 elm_object_text_set(p->r_button2, dgettext("sys_string", "IDS_COM_SK_CANCEL"));
360 evas_object_smart_callback_add(p->r_button2, "clicked", _back_cb, vd);
361 /*elm_object_style_set(p->r_button2, "naviframe/back_btn/default");*/
362 evas_object_show(p->r_button2);
365 Evas_Object *title_ic = elm_icon_add(vd->ugd->navi_bar);
366 evas_object_size_hint_aspect_set(title_ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
367 elm_icon_resizable_set(title_ic, EINA_TRUE, EINA_TRUE);
369 Elm_Object_Item *navi_it = NULL;
370 char title_str[50] = { 0, };
371 if (vd->ugd->account_info == GMAIL) {
372 snprintf(title_str, sizeof(title_str), "%s", dgettext("sys_string", "IDS_COM_BODY_GOOGLE"));
373 elm_icon_file_set(title_ic, ACCOUNT_ICON_GMAIL, NULL);
374 } else if (vd->ugd->account_info == HOTMAIL) {
375 snprintf(title_str, sizeof(title_str), "%s", _("IDS_EMAIL_BODY_WINDOWS_LIVE_HOTMAIL"));
376 elm_icon_file_set(title_ic, ACCOUNT_ICON_HOTMAIL, NULL);
377 } else if (vd->ugd->account_info == YAHOOMAIL) {
378 snprintf(title_str, sizeof(title_str), "%s", _("IDS_EMAIL_BODY_YAHOO_E_MAIL"));
379 elm_icon_file_set(title_ic, ACCOUNT_ICON_YAHOO, NULL);
380 } else if (vd->ugd->account_info == AOL) {
381 snprintf(title_str, sizeof(title_str), "%s", _("IDS_EMAIL_BODY_AOL"));
382 elm_icon_file_set(title_ic, ACCOUNT_ICON_AOL, NULL);
384 snprintf(title_str, sizeof(title_str), "%s", dgettext("sys_string", "IDS_COM_BODY_OTHERS"));
386 navi_it = elm_naviframe_item_push(vd->ugd->navi_bar, title_str, p->r_button2, NULL, p->layout, NULL);
387 elm_object_item_part_content_set(navi_it, "icon", title_ic);
388 elm_object_item_part_content_set(navi_it, "title_left_btn", p->l_button);
389 elm_object_item_part_content_set(navi_it, "title_right_btn", p->r_button);
390 elm_object_item_part_content_set(navi_it, "controlbar", p->cbar);
391 p->navi_it = navi_it;
392 evas_object_show(vd->ugd->navi_bar);
395 static void _create_view(struct viewdata *vd)
399 EmailSettingUGD *ugd;
402 debug_log("vd is null!");
409 Evas_Object *sub_ly = elm_layout_add(ugd->navi_bar);
410 if (vd->ugd->account_info == OTHERS)
411 elm_layout_file_set(sub_ly, EV_THEME_PATH, "other_account_add");
413 elm_layout_file_set(sub_ly, EV_THEME_PATH, "account_add");
414 evas_object_size_hint_weight_set(sub_ly, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
415 evas_object_show(sub_ly);
418 elm_object_part_content_set(sub_ly, "list", p->genlist);
420 Evas_Object *checkbox_set = elm_layout_add(sub_ly);
421 elm_layout_file_set(checkbox_set, EV_THEME_PATH, "account_add_checkbox_set");
422 evas_object_size_hint_weight_set(checkbox_set, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
423 evas_object_show(checkbox_set);
425 Evas_Object *check1 = elm_check_add(checkbox_set);
426 elm_check_state_set(check1, EINA_FALSE);
427 evas_object_smart_callback_add(check1, "changed", _check1_clicked_cb, (void *)vd);
428 elm_object_part_content_set(checkbox_set, "checkbox.1", check1);
429 elm_object_focus_allow_set(check1, EINA_FALSE);
430 p->default_account_check = check1;
432 Evas_Object *check2 = elm_check_add(checkbox_set);
433 elm_check_state_set(check2, EINA_FALSE);
434 evas_object_smart_callback_add(check2, "changed", _check2_clicked_cb, (void *)vd);
435 elm_object_part_content_set(checkbox_set, "checkbox.2", check2);
436 elm_object_focus_allow_set(check2, EINA_FALSE);
437 p->show_passwd_check = check2;
439 char *desc = g_strdup(_("IDS_EMAIL_BODY_SEND_EMAIL_FROM_THIS_ACCOUNT_BY_DEFAULT"));
440 Evas_Object *label1 = elm_label_add(checkbox_set);
441 char *text = g_strconcat("<color=#838B8BFF><font_size=32><align=left>",
442 desc, "</align></font_size></color>", NULL);
443 edje_object_signal_callback_add(elm_layout_edje_get(checkbox_set),
444 "elm,action,text1_clicked", "elm", _check1_clicked_cb2, (void *)vd);
445 elm_object_text_set(label1, text);
446 evas_object_show(label1);
449 elm_object_part_content_set(checkbox_set, "text.1", label1);
451 desc = g_strdup(_("IDS_EMAIL_BODY_SHOW_PASSWORD"));
452 Evas_Object *label2 = elm_label_add(checkbox_set);
453 text = g_strconcat("<color=#838B8BFF><font_size=32><align=left>",
454 desc, "</align></font_size></color>", NULL);
455 edje_object_signal_callback_add(elm_layout_edje_get(checkbox_set),
456 "elm,action,text2_clicked", "elm", _check2_clicked_cb2, (void *)vd);
457 elm_object_text_set(label2, text);
458 evas_object_show(label2);
461 elm_object_part_content_set(checkbox_set, "text.2", label2);
463 elm_object_part_content_set(sub_ly, "checkbox_set", checkbox_set);
465 Evas_Object *button_set = elm_layout_add(sub_ly);
466 elm_layout_file_set(button_set, EV_THEME_PATH, "account_add_manual_button");
467 evas_object_size_hint_weight_set(button_set, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
468 evas_object_show(button_set);
470 Evas_Object *btn = elm_button_add(button_set);
471 elm_object_text_set(btn, _("IDS_EMAIL_BODY_MANUAL_SETUP"));
472 evas_object_smart_callback_add(btn, "clicked", _manual_cb, (void *)vd);
473 elm_object_style_set(btn, "text_only/style2");
474 evas_object_show(btn);
476 elm_object_part_content_set(button_set, "btn", btn);
477 elm_object_disabled_set(p->manual_btn, EINA_TRUE);
479 elm_object_part_content_set(sub_ly, "button_set", button_set);
481 elm_object_content_set(p->scroller, sub_ly);
484 static void _create_list(struct viewdata *vd)
489 debug_critical("vd is null!");
494 EmailSettingUGD *ugd;
500 Elm_Object_Item *item = NULL;
501 Elm_Object_Item *git = NULL;
503 p->genlist = elm_genlist_add(ugd->navi_bar);
504 elm_object_style_set(p->genlist, "dialogue");
505 evas_object_show(p->genlist);
507 p->itc1.item_style = "dialogue/separator";
508 p->itc1.func.text_get = NULL;
509 p->itc1.func.content_get = NULL;
510 p->itc1.func.state_get = NULL;
511 p->itc1.func.del = NULL;
513 p->itc2.item_style = "dialogue/1icon";
514 p->itc2.func.text_get = NULL;
515 p->itc2.func.content_get = _gl_ef_content_get_cb;
516 p->itc2.func.state_get = NULL;
517 p->itc2.func.del = NULL;
519 git = elm_genlist_item_append(p->genlist, &(p->itc1), NULL, NULL,
520 ELM_GENLIST_ITEM_GROUP, NULL, NULL);
521 elm_genlist_item_select_mode_set(git, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
523 if (ugd->account_info == OTHERS) {
524 /* Account name for OTHER */
526 item = elm_genlist_item_append(p->genlist, &(p->itc2), (void *)i, git,
527 ELM_GENLIST_ITEM_NONE, _gl_ef_sel_cb, (void *)i);
531 item = elm_genlist_item_append(p->genlist, &(p->itc2), (void *)i, git,
532 ELM_GENLIST_ITEM_NONE, _gl_ef_sel_cb, (void *)i);*/
537 item = elm_genlist_item_append(p->genlist, &(p->itc2), (void *)i, git,
538 ELM_GENLIST_ITEM_NONE, _gl_ef_sel_cb, (void *)i);*/
542 item = elm_genlist_item_append(p->genlist, &(p->itc2), (void *)i, git,
543 ELM_GENLIST_ITEM_NONE, _gl_ef_sel_cb, (void *)i);
547 item = elm_genlist_item_append(p->genlist, &(p->itc2), (void *)i, git,
548 ELM_GENLIST_ITEM_NONE, _gl_ef_sel_cb, (void *)i);
551 static void _create_validation_popup(struct viewdata *vd, int account_id)
556 debug_critical("vd is null!");
560 email_account_t *account = vd->ugd->new_account;
562 debug_log("account id:%d", account_id);
563 debug_log("account name:%s", account->account_name);
564 debug_log("email address:%s", account->user_email_address);
566 vd->ugd->account_id = account_id;
568 EmailSettingUGD *ugd = vd->ugd;
569 struct priv_data *p = vd->priv;
571 if (ugd->popup_one) {
572 evas_object_del(ugd->popup_one);
573 ugd->popup_one = NULL;
575 if (ugd->popup_validate) {
576 evas_object_del(ugd->popup_validate);
577 ugd->popup_validate = NULL;
580 vd->ugd->cancel_event = 0;
581 elm_object_disabled_set(p->l_button, EINA_TRUE);
582 elm_object_disabled_set(p->r_button, EINA_TRUE);
583 elm_object_disabled_set(p->r_button2, EINA_TRUE);
584 elm_object_disabled_set(p->manual_btn, EINA_TRUE);
585 elm_object_item_disabled_set(p->c_item[0], EINA_TRUE);
587 debug_log("Start Account Validation");
588 ugd->popup_validate = setting_get_pb_notify(vd,
589 _("IDS_EMAIL_POP_VALIDATING_ACCOUNT_ING"), 1,
590 dgettext("sys_string", "IDS_COM_SK_CANCEL"),
591 _popup_cancel_validation_cb, NULL, NULL);
594 static void _create_account(void *data)
598 struct viewdata *vd = (struct viewdata *)data;
601 debug_critical("vd is null!");
605 EmailSettingUGD *ugd = vd->ugd;
607 struct priv_data *p = vd->priv;
610 if (email_engine_add_account_with_validation(vd->ugd->new_account,
611 &account_id, &(p->handle), &error_code)) {
612 debug_log("Account added to Email Service DB");
613 vd->ugd->start_account_validation = 1;
614 ugd->handle = p->handle;
615 _create_validation_popup(vd, account_id);
617 debug_log("Fail to make account");
619 if (ugd->popup_one) {
620 evas_object_del(ugd->popup_one);
621 ugd->popup_one = NULL;
623 if (ugd->popup_validate) {
624 evas_object_del(ugd->popup_validate);
625 ugd->popup_validate = NULL;
628 if (error_code == EMAIL_ERROR_ALREADY_EXISTS)
629 ugd->popup_one = setting_get_notify(vd,
630 dgettext("sys_string", "IDS_COM_POP_WARNING"),
631 dgettext("sys_string", "IDS_COM_POP_ALREDY_EXISTS"), 1,
632 dgettext("sys_string", "IDS_COM_SK_OK"),
633 _popup_ok_cb, NULL, NULL);
635 ugd->popup_one = setting_get_notify(vd,
636 dgettext("sys_string", "IDS_COM_POP_WARNING"),
637 _("IDS_EMAIL_POP_UNABLE_TO_ADD_ACCOUNT"), 1,
638 dgettext("sys_string", "IDS_COM_SK_OK"),
639 _popup_ok_cb, NULL, NULL);
644 static int _check_null_field(struct viewdata *vd)
648 if (vd->ugd->new_account == NULL) {
649 debug_log("new_account is NULL");
653 email_account_t *account = vd->ugd->new_account;
655 if (account->account_name == NULL || strlen(account->account_name) == 0 ||
656 /*account->user_display_name == NULL || strlen(account->user_display_name) == 0 ||*/
657 account->user_email_address == NULL || strlen(account->user_email_address) == 0 ||
658 /*account->incoming_server_user_name == NULL || strlen(account->incoming_server_user_name) == 0 ||*/
659 account->incoming_server_password == NULL || strlen(account->incoming_server_password) == 0)
665 static int _check_preset_null_field(struct viewdata *vd)
669 if (vd->ugd->new_account == NULL) {
670 debug_log("new_account is NULL");
674 email_account_t *account = vd->ugd->new_account;
676 if (/*account->user_display_name == NULL || strlen(account->user_display_name) == 0 ||*/
677 account->user_email_address == NULL || strlen(account->user_email_address) == 0 ||
678 account->incoming_server_password == NULL || strlen(account->incoming_server_password) == 0)
684 static int _check_preset_isp_name(char *addr, int isp_type)
689 if (isp_type == HOTMAIL) {
692 ptr1 = g_strrstr(addr, "@hotmail.");
693 ptr2 = g_strrstr(addr, "@live.");
695 if (ptr1 != NULL || ptr2 != NULL)
697 } else if (isp_type == GMAIL) {
698 ret = g_str_has_suffix(addr, "@gmail.com") ||
699 g_str_has_suffix(addr, "@googlemail.com");
700 } else if (isp_type == AOL) {
703 ptr1 = g_strrstr(addr, "@aol.");
704 ptr2 = g_strrstr(addr, "@aim.");
706 if (ptr1 != NULL || ptr2 != NULL)
715 static void _read_all_entries(struct viewdata *vd)
724 debug_log("priv is NULL");
728 if (vd->ugd->new_account)
729 setting_new_acct_final(vd);
731 setting_new_acct_init(vd);
732 email_account_t *account = vd->ugd->new_account;
734 if (vd->ugd->account_info == OTHERS) {
735 /*buf = elm_entry_markup_to_utf8(elm_entry_entry_get(p->entry_account_name));*/
736 if (p->entry_account_name) {
737 buf = (char *)elm_entry_entry_get(p->entry_account_name);
738 debug_log("account name : %s", buf);
740 account->account_name = g_strdup(buf);
744 /*buf = elm_entry_markup_to_utf8(elm_entry_entry_get(p->entry_email_address));*/
745 if (p->entry_email_address) {
746 buf = (char *)elm_entry_entry_get(p->entry_email_address);
747 debug_log("email addr : %s", buf);
749 account->user_email_address = g_strdup(buf);
752 if (p->entry_password) {
753 buf = (char *)elm_entry_markup_to_utf8(elm_entry_entry_get(p->entry_password));
754 debug_log("password : %s", buf);
756 account->incoming_server_password = g_strdup(buf);
762 static void _set_domain_string(struct viewdata *vd)
765 EmailSettingUGD *ugd = vd->ugd;
769 if (ugd->account_info == HOTMAIL) {
770 p->str_email_address = g_strdup("@hotmail.com");
771 } else if (ugd->account_info == YAHOOMAIL) {
772 p->str_email_address = g_strdup("@yahoo.com");
773 } else if (ugd->account_info == GMAIL) {
774 p->str_email_address = g_strdup("@gmail.com");
775 } else if (ugd->account_info == AOL) {
776 p->str_email_address = g_strdup("@aol.com");
778 debug_log("Unknown account type");
782 static void _next_cb(void *data, Evas_Object *obj, void *event_info)
786 struct viewdata *vd = (struct viewdata *)data;
789 debug_log("vd is NULL");
793 struct priv_data *p = NULL;
794 EmailSettingUGD *ugd = NULL;
801 Ecore_IMF_Context *imf_context = NULL;
802 imf_context = elm_entry_imf_context_get(p->clicked_object);
804 ecore_imf_context_input_panel_hide(imf_context);
807 /* Save the Account Data */
808 _read_all_entries(vd);
809 email_account_t *account = vd->ugd->new_account;
811 debug_log("accountStructure Info");
812 debug_log("Account Name:%s", account->account_name);
813 debug_log("Display Name:%s", account->user_display_name);
814 debug_log("Email Addr:%s", account->user_email_address);
815 debug_log("User Name:%s", account->incoming_server_user_name);
816 debug_log("User Password:%s", account->incoming_server_password);
818 if (ugd->popup_one) {
819 evas_object_del(ugd->popup_one);
820 ugd->popup_one = NULL;
822 if (ugd->popup_validate) {
823 evas_object_del(ugd->popup_validate);
824 ugd->popup_validate = NULL;
827 /* check Null field */
828 ret = _check_null_field(vd);
830 ugd->popup_one = setting_get_notify(vd,
831 dgettext("sys_string", "IDS_COM_POP_WARNING"),
832 _("IDS_EMAIL_POP_PLEASE_FILL_ALL_THE_MANDATORY_FIELDS"), 1,
833 dgettext("sys_string", "IDS_COM_SK_OK"),
834 _popup_ok_cb, NULL, NULL);
838 /* check character validation */
839 buf = g_strdup(account->user_email_address);
841 ret = email_get_address_validation(buf);
843 ugd->popup_one = setting_get_notify(vd,
844 dgettext("sys_string", "IDS_COM_POP_WARNING"),
845 _("IDS_EMAIL_POP_INVALID_EMAIL_ADDRESS"), 1,
846 dgettext("sys_string", "IDS_COM_SK_OK"),
847 _popup_ok_cb, NULL, NULL);
854 setting_change_view(VIEW_MANUAL_SETUP, ugd);
859 static void _save_cb(void *data, Evas_Object *obj, void *event_info)
862 struct viewdata *vd = (struct viewdata *)data;
865 debug_log("vd is NULL");
869 struct priv_data *p = NULL;
870 EmailSettingUGD *ugd = NULL;
877 Ecore_IMF_Context *imf_context = NULL;
878 imf_context = elm_entry_imf_context_get(p->clicked_object);
880 ecore_imf_context_input_panel_hide(imf_context);
884 _read_all_entries(vd);
885 email_account_t *account = vd->ugd->new_account;
887 debug_log("accountStructure Info");
888 debug_log("Display Name:%s", account->user_display_name);
889 debug_log("Email Addr:%s", account->user_email_address);
890 debug_log("User Password:%s", account->incoming_server_password);
892 if (ugd->popup_one) {
893 evas_object_del(ugd->popup_one);
894 ugd->popup_one = NULL;
896 if (ugd->popup_validate) {
897 evas_object_del(ugd->popup_validate);
898 ugd->popup_validate = NULL;
901 /* check Null field */
902 ret = _check_preset_null_field(vd);
904 debug_log("empty space in account info");
905 ugd->popup_one = setting_get_notify(vd,
906 dgettext("sys_string", "IDS_COM_POP_WARNING"),
907 _("IDS_EMAIL_POP_PLEASE_FILL_ALL_THE_MANDATORY_FIELDS"),
908 1, dgettext("sys_string", "IDS_COM_SK_OK"),
909 _popup_ok_cb, NULL, NULL);
914 buf = g_strdup(account->user_email_address);
915 ret = _check_preset_isp_name(buf, ugd->account_info);
917 debug_log("wrong ISP server name for preset accounts");
918 ugd->popup_one = setting_get_notify(vd,
919 dgettext("sys_string", "IDS_COM_POP_WARNING"),
920 _("IDS_EMAIL_POP_INVALID_EMAIL_ADDRESS"),
921 1, dgettext("sys_string", "IDS_COM_SK_OK"),
922 _popup_ok_cb, NULL, NULL);
928 /* check character validation */
929 buf = g_strdup(account->user_email_address);
931 ret = email_get_address_validation(buf);
933 debug_log("Wrong character in email address");
934 ugd->popup_one = setting_get_notify(vd,
935 dgettext("sys_string", "IDS_COM_POP_WARNING"),
936 _("IDS_EMAIL_POP_INVALID_EMAIL_ADDRESS"),
937 1, dgettext("sys_string", "IDS_COM_SK_OK"),
938 _popup_ok_cb, NULL, NULL);
944 /* account info setting */
945 setting_set_account(vd);
950 static void _manual_cb(void *data, Evas_Object *obj, void *event_info)
954 struct viewdata *vd = (struct viewdata *)data;
957 debug_log("vd is NULL");
961 EmailSettingUGD *ugd = NULL;
967 /* Save the Account Data */
968 _read_all_entries(vd);
969 email_account_t *account = vd->ugd->new_account;
971 debug_log("accountStructure Info");
972 debug_log("Account Name:%s", account->account_name);
973 debug_log("Display Name:%s", account->user_display_name);
974 debug_log("Email Addr:%s", account->user_email_address);
975 debug_log("User Name:%s", account->incoming_server_user_name);
976 debug_log("User Password:%s", account->incoming_server_password);
978 if (ugd->popup_one) {
979 evas_object_del(ugd->popup_one);
980 ugd->popup_one = NULL;
982 if (ugd->popup_validate) {
983 evas_object_del(ugd->popup_validate);
984 ugd->popup_validate = NULL;
987 /* check Null field */
988 if (vd->ugd->account_info == OTHERS) {
989 ret = _check_null_field(vd);
991 ret = _check_preset_null_field(vd);
995 ugd->popup_one = setting_get_notify(vd,
996 dgettext("sys_string", "IDS_COM_POP_WARNING"),
997 _("IDS_EMAIL_POP_PLEASE_FILL_ALL_THE_MANDATORY_FIELDS"), 1,
998 dgettext("sys_string", "IDS_COM_SK_OK"),
999 _popup_ok_cb, NULL, NULL);
1004 if (ugd->account_info != OTHERS) {
1005 buf = g_strdup(account->user_email_address);
1006 ret = _check_preset_isp_name(buf, ugd->account_info);
1008 debug_log("wrong ISP server name for preset accounts");
1009 ugd->popup_one = setting_get_notify(vd,
1010 dgettext("sys_string", "IDS_COM_POP_WARNING"),
1011 _("IDS_EMAIL_POP_INVALID_EMAIL_ADDRESS"),
1012 1, dgettext("sys_string", "IDS_COM_SK_OK"),
1013 _popup_ok_cb, NULL, NULL);
1020 /* check character validation */
1021 buf = g_strdup(account->user_email_address);
1023 ret = email_get_address_validation(buf);
1025 ugd->popup_one = setting_get_notify(vd,
1026 dgettext("sys_string", "IDS_COM_POP_WARNING"),
1027 _("IDS_EMAIL_POP_INVALID_EMAIL_ADDRESS"), 1,
1028 dgettext("sys_string", "IDS_COM_SK_OK"),
1029 _popup_ok_cb, NULL, NULL);
1037 /* account info setting */
1038 if (ugd->account_info != OTHERS)
1039 setting_set_account(vd);
1041 setting_change_view(VIEW_MANUAL_SETUP, ugd);
1046 static void _back_cb(void *data, Evas_Object *obj, void *event_info)
1050 struct viewdata *vd = (struct viewdata *)data;
1051 struct priv_data *p = vd->priv;
1053 if (vd->ugd->atomic_pop) {
1054 debug_log("During atomic poping");
1058 if (p->entry_account_name) {
1059 elm_object_focus_allow_set(p->entry_account_name, EINA_FALSE);
1062 if (p->entry_email_address) {
1063 elm_object_focus_allow_set(p->entry_email_address, EINA_FALSE);
1066 if (p->entry_password) {
1067 elm_object_focus_allow_set(p->entry_password, EINA_FALSE);
1070 Ecore_IMF_Context *imf_context = NULL;
1071 imf_context = elm_entry_imf_context_get(p->clicked_object);
1073 ecore_imf_context_input_panel_hide(imf_context);
1074 ecore_imf_context_input_panel_event_callback_del(imf_context,
1075 ECORE_IMF_INPUT_PANEL_STATE_EVENT, _input_panel_state_changed_cb);
1078 elm_object_disabled_set(p->l_button, EINA_TRUE);
1079 elm_object_disabled_set(p->r_button, EINA_TRUE);
1080 elm_object_disabled_set(p->r_button2, EINA_TRUE);
1081 elm_object_disabled_set(p->manual_btn, EINA_TRUE);
1082 elm_object_item_disabled_set(p->c_item[0], EINA_TRUE);
1084 if (!strcmp(vd->ugd->start_view_type, "account-add")) {
1085 ug_destroy_me(vd->ugd->ug);
1087 setting_back_to_prev_view(vd);
1091 static void _check1_clicked_cb(void *data, Evas_Object *obj, void *event_info)
1094 struct viewdata *vd = (struct viewdata *)data;
1097 debug_log("vd is NULL");
1101 struct priv_data *p = vd->priv;
1102 Eina_Bool state = elm_check_state_get(obj);
1105 p->set_default_account = 1;
1107 p->set_default_account = 0;
1110 static void _check1_clicked_cb2(void *data, Evas_Object *obj, const char *emission, const char *source)
1113 struct viewdata *vd = (struct viewdata *)data;
1116 debug_log("vd is NULL");
1120 struct priv_data *p = vd->priv;
1121 Eina_Bool state = elm_check_state_get(p->default_account_check);
1124 elm_check_state_set(p->default_account_check, EINA_FALSE);
1125 p->set_default_account = 0;
1127 elm_check_state_set(p->default_account_check, EINA_TRUE);
1128 p->set_default_account = 1;
1132 static void _check2_clicked_cb(void *data, Evas_Object *obj, void *event_info)
1135 struct viewdata *vd = (struct viewdata *)data;
1138 debug_log("vd is NULL");
1142 struct priv_data *p = vd->priv;
1143 Eina_Bool state = elm_check_state_get(obj);
1146 elm_entry_password_set(p->entry_password, EINA_FALSE);
1148 elm_entry_password_set(p->entry_password, EINA_TRUE);
1151 static void _check2_clicked_cb2(void *data, Evas_Object *obj, const char *emission, const char *source)
1154 struct viewdata *vd = (struct viewdata *)data;
1157 debug_log("vd is NULL");
1161 struct priv_data *p = vd->priv;
1162 Eina_Bool state = elm_check_state_get(p->show_passwd_check);
1165 elm_check_state_set(p->show_passwd_check, EINA_FALSE);
1166 elm_entry_password_set(p->entry_password, EINA_TRUE);
1168 elm_check_state_set(p->show_passwd_check, EINA_TRUE);
1169 elm_entry_password_set(p->entry_password, EINA_FALSE);
1173 static Eina_Bool _after_validation_cb(void *data)
1177 struct viewdata *vd = (struct viewdata *)data;
1180 debug_log("vd is NULL");
1184 EmailSettingUGD *ugd = NULL;
1185 struct priv_data *p = NULL;
1190 if (ugd->preset_vc_timer) {
1191 ecore_timer_del(ugd->preset_vc_timer);
1192 ugd->preset_vc_timer = NULL;
1195 if (ugd->popup_one) {
1196 evas_object_del(ugd->popup_one);
1197 ugd->popup_one = NULL;
1199 if (ugd->popup_validate) {
1200 evas_object_del(ugd->popup_validate);
1201 ugd->popup_validate = NULL;
1204 if (p->set_default_account) {
1205 if (email_engine_set_default_account(vd->ugd->account_id)) {
1206 debug_log("new default account is %d", vd->ugd->account_id);
1210 status_message_post(_("IDS_EMAIL_POP_SUCCEEDED"));
1212 setting_change_view(VIEW_SYNC_SETUP, ugd);
1214 setting_get_small_notify(vd, _("IDS_EMAIL_POP_SUCCEEDED"));
1216 /*debug_log("_after_validation_cb %s", vd->ugd->start_view_type);
1218 if (vd->ugd->start_view_type != NULL &&
1219 strcmp(vd->ugd->start_view_type, "first-setup") == 0) {
1220 ug_destroy_me(vd->ugd->ug);
1221 } else if (vd->ugd->start_view_type != NULL &&
1222 strcmp(vd->ugd->start_view_type, "account-add") == 0) {
1223 ug_destroy_me(vd->ugd->ug);
1224 } else if (vd->ugd->start_view_type != NULL &&
1225 strcmp(vd->ugd->start_view_type, "select-account") == 0) {
1226 service_h service = NULL;
1227 service_create(&service);
1229 service_add_extra_data(service, EMAIL_BUNDLE_KEY_REFRESH_ACCOUNT, EMAIL_BUNDLE_KEY_REFRESH_ACCOUNT);
1230 ug_send_result(vd->ugd->ug, service);
1231 service_destroy(service);
1234 setting_update_acct_list(vd);
1235 setting_back_to_prev_nth_view(vd, 2, vd->ugd->navi_main_it);
1236 vd->ugd->atomic_pop = 0;
1242 static void _popup_ok_cb(void *data, Evas_Object *obj, void *event_info)
1246 debug_log("data is NULL");
1250 struct viewdata *vd = (struct viewdata *)data;
1251 EmailSettingUGD *ugd = vd->ugd;
1252 struct priv_data *p = vd->priv;
1254 if (ugd->popup_one) {
1255 evas_object_del(ugd->popup_one);
1256 ugd->popup_one = NULL;
1258 if (ugd->popup_validate) {
1259 evas_object_del(ugd->popup_validate);
1260 ugd->popup_validate = NULL;
1263 elm_object_disabled_set(p->l_button, EINA_FALSE);
1264 elm_object_disabled_set(p->r_button, EINA_FALSE);
1265 elm_object_disabled_set(p->r_button2, EINA_FALSE);
1266 elm_object_disabled_set(p->manual_btn, EINA_FALSE);
1267 elm_object_item_disabled_set(p->c_item[0], EINA_FALSE);
1270 static void _popup_cancel_validation_cb(void *data, Evas_Object *obj, void *event_info)
1274 debug_log("data is NULL");
1278 struct viewdata *vd = (struct viewdata *)data;
1279 EmailSettingUGD *ugd = vd->ugd;
1280 struct priv_data *p = vd->priv;
1282 if (ugd->popup_one) {
1283 evas_object_del(ugd->popup_one);
1284 ugd->popup_one = NULL;
1286 if (ugd->popup_validate) {
1287 evas_object_del(ugd->popup_validate);
1288 ugd->popup_validate = NULL;
1291 int account_id = vd->ugd->account_id;
1292 vd->ugd->cancel_event = 1;
1293 email_engine_stop_working(account_id, p->handle);
1294 email_engine_delete_account(account_id);
1296 elm_object_disabled_set(p->l_button, EINA_FALSE);
1297 elm_object_disabled_set(p->r_button, EINA_FALSE);
1298 elm_object_disabled_set(p->r_button2, EINA_FALSE);
1299 elm_object_disabled_set(p->manual_btn, EINA_FALSE);
1300 elm_object_item_disabled_set(p->c_item[0], EINA_FALSE);
1303 static void _backup_input_cb(void *data, Evas_Object *obj, void *event_info)
1306 Evas_Object *eo = (Evas_Object *)obj;
1307 struct viewdata *vd = g_vd;
1311 struct priv_data *p = vd->priv;
1315 EmailSettingUGD *ugd = vd->ugd;
1319 if (elm_object_focus_get(data)) {
1320 if (elm_entry_is_empty(obj))
1321 elm_object_signal_emit(data, "elm,state,eraser,hide", "elm");
1323 elm_object_signal_emit(data, "elm,state,eraser,show", "elm");
1326 if (eo == p->entry_account_name) {
1327 debug_log("entry_account_name");
1328 if (p->str_account_name) {
1329 g_free(p->str_account_name);
1330 p->str_account_name = NULL;
1333 p->str_account_name = g_strdup(elm_entry_entry_get(eo));
1334 } else if (eo == p->entry_user_id) {
1335 debug_log("entry_user_id");
1336 if (p->str_user_id) {
1337 g_free(p->str_user_id);
1338 p->str_user_id = NULL;
1341 p->str_user_id = g_strdup(elm_entry_entry_get(eo));
1342 } else if (eo == p->entry_display_name) {
1343 debug_log("entry_display_name");
1344 if (p->str_display_name) {
1345 g_free(p->str_display_name);
1346 p->str_display_name = NULL;
1349 p->str_display_name = g_strdup(elm_entry_entry_get(eo));
1350 } else if (eo == p->entry_email_address) {
1351 debug_log("entry_email_address");
1352 if (p->str_email_address) {
1353 g_free(p->str_email_address);
1354 p->str_email_address = NULL;
1357 p->str_email_address = g_strdup(elm_entry_entry_get(eo));
1358 } else if (eo == p->entry_password) {
1359 debug_log("entry_password");
1360 if (p->str_password) {
1361 g_free(p->str_password);
1362 p->str_password = NULL;
1365 p->str_password = g_strdup(elm_entry_entry_get(eo));
1368 if (ugd->account_info == OTHERS) {
1369 if (p->str_account_name == NULL) {
1370 elm_object_disabled_set(p->l_button, EINA_TRUE);
1371 elm_object_disabled_set(p->manual_btn, EINA_TRUE);
1372 elm_object_item_disabled_set(p->c_item[0], EINA_TRUE);
1376 if (g_strcmp0(p->str_account_name, "") == 0) {
1377 elm_object_disabled_set(p->l_button, EINA_TRUE);
1378 elm_object_disabled_set(p->manual_btn, EINA_TRUE);
1379 elm_object_item_disabled_set(p->c_item[0], EINA_TRUE);
1384 if (p->str_email_address == NULL || p->str_password == NULL) {
1385 elm_object_disabled_set(p->l_button, EINA_TRUE);
1386 elm_object_disabled_set(p->manual_btn, EINA_TRUE);
1387 elm_object_item_disabled_set(p->c_item[0], EINA_TRUE);
1391 if (g_strcmp0(p->str_email_address, "") == 0 || g_strcmp0(p->str_password, "") == 0) {
1392 elm_object_disabled_set(p->l_button, EINA_TRUE);
1393 elm_object_disabled_set(p->manual_btn, EINA_TRUE);
1394 elm_object_item_disabled_set(p->c_item[0], EINA_TRUE);
1396 elm_object_disabled_set(p->l_button, EINA_FALSE);
1397 elm_object_disabled_set(p->manual_btn, EINA_FALSE);
1398 elm_object_item_disabled_set(p->c_item[0], EINA_FALSE);
1402 static void _entry_focused_cb(void *data, Evas_Object *obj, void *event_info)
1407 debug_log("obj is NULL");
1411 if (!elm_entry_is_empty(obj))
1412 elm_object_signal_emit(data, "elm,state,eraser,show", "elm");
1413 elm_object_signal_emit(data, "elm,state,guidetext,hide", "elm");
1416 static void _entry_unfocused_cb(void *data, Evas_Object *obj, void *event_info)
1421 debug_log("obj is NULL");
1425 if (elm_entry_is_empty(obj))
1426 elm_object_signal_emit(data, "elm,state,guidetext,show", "elm");
1427 elm_object_signal_emit(data, "elm,state,eraser,hide", "elm");
1430 static void _eraser_clicked_cb(void *data, Evas_Object *obj, const char *emission, const char *source)
1435 debug_log("obj is NULL");
1439 elm_entry_entry_set(data, "");
1442 static void _input_panel_state_changed_cb(void *data, Ecore_IMF_Context *ctx, int value)
1447 debug_log("data is NULL");
1451 struct viewdata *vd = (struct viewdata *)data;
1452 struct priv_data *p = vd->priv;
1454 if (value == ECORE_IMF_INPUT_PANEL_STATE_SHOW) {
1455 debug_log("input panel show");
1456 evas_object_show(p->l_button);
1457 evas_object_show(p->r_button);
1458 elm_object_item_part_content_set(p->navi_it, "title_left_btn", p->l_button);
1459 elm_object_item_part_content_set(p->navi_it, "title_right_btn", p->r_button);
1460 } else if (value == ECORE_IMF_INPUT_PANEL_STATE_HIDE) {
1461 debug_log("input panel hide");
1462 elm_object_item_part_content_unset(p->navi_it, "title_left_btn");
1463 elm_object_item_part_content_unset(p->navi_it, "title_right_btn");
1464 evas_object_hide(p->l_button);
1465 evas_object_hide(p->r_button);
1469 static void _gl_ef_sel_cb(void *data, Evas_Object *obj, void *event_info)
1472 int index = (int)data;
1473 struct viewdata *vd = g_vd;
1474 struct priv_data *p = vd->priv;
1476 Elm_Object_Item *item = (Elm_Object_Item *)event_info;
1477 elm_genlist_item_selected_set(item, EINA_FALSE);
1480 p->clicked_object = p->entry_account_name;
1481 } else if (index == 2) {
1482 p->clicked_object = p->entry_user_id;
1483 } else if (index == 3) {
1484 p->clicked_object = p->entry_display_name;
1485 } else if (index == 4) {
1486 p->clicked_object = p->entry_email_address;
1487 } else if (index == 5) {
1488 p->clicked_object = p->entry_password;
1492 static Evas_Object *_gl_ef_content_get_cb(void *data, Evas_Object *obj, const char *part)
1495 int index = (int)data;
1496 struct viewdata *vd = g_vd;
1497 struct priv_data *p = vd->priv;
1498 EmailSettingUGD *ugd = vd->ugd;
1499 Ecore_IMF_Context *imf_context = NULL;
1501 if (!strcmp(part, "elm.icon")) {
1506 p->ef_account_name = elm_layout_add(p->genlist);
1507 elm_layout_theme_set(p->ef_account_name, "layout", "editfield", "title");
1508 p->entry_account_name = elm_entry_add(p->genlist);
1509 elm_entry_scrollable_set(p->entry_account_name, EINA_TRUE);
1510 elm_entry_single_line_set(p->entry_account_name, EINA_TRUE);
1511 elm_entry_input_panel_return_key_disabled_set(p->entry_account_name, EINA_TRUE);
1512 elm_entry_cnp_mode_set(p->entry_account_name, ELM_CNP_MODE_PLAINTEXT);
1513 elm_entry_input_panel_layout_set(p->entry_account_name, ELM_INPUT_PANEL_LAYOUT_EMAIL);
1514 elm_entry_editable_set(p->entry_account_name, TRUE);
1515 evas_object_smart_callback_add(p->entry_account_name, "changed", _backup_input_cb, p->ef_account_name);
1516 evas_object_smart_callback_add(p->entry_account_name, "focused", _entry_focused_cb, p->ef_account_name);
1517 evas_object_smart_callback_add(p->entry_account_name, "unfocused", _entry_unfocused_cb, p->ef_account_name);
1518 evas_object_show(p->entry_account_name);
1520 imf_context = elm_entry_imf_context_get(p->entry_account_name);
1522 ecore_imf_context_input_panel_event_callback_add(imf_context,
1523 ECORE_IMF_INPUT_PANEL_STATE_EVENT,
1524 _input_panel_state_changed_cb, (void *)vd);
1526 elm_object_part_content_set(p->ef_account_name, "elm.swallow.content", p->entry_account_name);
1527 /*elm_object_part_text_set(p->ef_account_name, "elm.guidetext", str);*/
1528 elm_object_part_text_set(p->ef_account_name, "elm.text", _("IDS_EMAIL_BODY_ACCOUNT_NAME"));
1529 elm_object_signal_callback_add(p->ef_account_name, "elm,eraser,clicked", "elm", _eraser_clicked_cb, p->entry_account_name);
1531 evas_object_size_hint_weight_set(p->ef_account_name, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1532 evas_object_show(p->ef_account_name);
1534 if (p->str_account_name)
1535 elm_entry_entry_set(p->entry_account_name, p->str_account_name);
1537 if (ugd->account_info == OTHERS && p->icon_get_cnt1 == 2 &&
1538 strcmp(ugd->start_view_type, EMAIL_BUNDLE_VAL_VIEW_ACCOUNT_ADD) != 0) {
1539 p->clicked_object = p->entry_account_name;
1540 evas_object_show(p->entry_account_name);
1541 elm_object_focus_set(p->entry_account_name, EINA_TRUE);
1544 if (ugd->account_info == OTHERS && p->icon_get_cnt1 == 3 &&
1545 strcmp(ugd->start_view_type, EMAIL_BUNDLE_VAL_VIEW_ACCOUNT_ADD) == 0) {
1546 p->clicked_object = p->entry_account_name;
1547 evas_object_show(p->entry_account_name);
1548 elm_object_focus_set(p->entry_account_name, EINA_TRUE);
1551 return p->ef_account_name;
1552 } else if (index == 2) {
1554 p->ef_user_id = elm_layout_add(p->genlist);
1555 elm_layout_theme_set(p->ef_user_id, "layout", "editfield", "title");
1556 p->entry_user_id = elm_entry_add(p->genlist);
1557 elm_entry_scrollable_set(p->entry_user_id, EINA_TRUE);
1558 elm_entry_single_line_set(p->entry_user_id, EINA_TRUE);
1559 elm_entry_input_panel_return_key_disabled_set(p->entry_user_id, EINA_TRUE);
1560 elm_entry_cnp_mode_set(p->entry_user_id, ELM_CNP_MODE_PLAINTEXT);
1561 elm_entry_input_panel_layout_set(p->entry_user_id, ELM_INPUT_PANEL_LAYOUT_EMAIL);
1562 elm_entry_editable_set(p->entry_user_id, TRUE);
1563 evas_object_smart_callback_add(p->entry_user_id, "changed", _backup_input_cb, p->ef_user_id);
1564 evas_object_smart_callback_add(p->entry_user_id, "focused", _entry_focused_cb, p->ef_user_id);
1565 evas_object_smart_callback_add(p->entry_user_id, "unfocused", _entry_unfocused_cb, p->ef_user_id);
1566 evas_object_show(p->entry_user_id);
1568 imf_context = elm_entry_imf_context_get(p->entry_user_id);
1570 ecore_imf_context_input_panel_event_callback_add(imf_context,
1571 ECORE_IMF_INPUT_PANEL_STATE_EVENT,
1572 _input_panel_state_changed_cb, (void *)vd);
1574 elm_object_part_content_set(p->ef_user_id, "elm.swallow.content", p->entry_user_id);
1575 /*elm_object_part_text_set(p->ef_user_id, "elm.guidetext", dgettext("sys_string", "IDS_COM_BODY_USER_NAME"));*/
1576 elm_object_part_text_set(p->ef_user_id, "elm.text", dgettext("sys_string", "IDS_COM_BODY_USER_NAME"));
1577 elm_object_signal_callback_add(p->ef_user_id, "elm,eraser,clicked", "elm", _eraser_clicked_cb, p->entry_user_id);
1579 evas_object_size_hint_weight_set(p->ef_user_id, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1580 evas_object_show(p->ef_user_id);
1583 elm_entry_entry_set(p->entry_user_id, p->str_user_id);
1585 return p->ef_user_id;
1586 } else if (index == 3) {
1588 p->ef_display_name = elm_layout_add(p->genlist);
1589 elm_layout_theme_set(p->ef_display_name, "layout", "editfield", "title");
1590 p->entry_display_name = elm_entry_add(p->genlist);
1591 elm_entry_scrollable_set(p->entry_display_name, EINA_TRUE);
1592 elm_entry_single_line_set(p->entry_display_name, EINA_TRUE);
1593 elm_entry_input_panel_return_key_disabled_set(p->entry_display_name, EINA_TRUE);
1594 elm_entry_cnp_mode_set(p->entry_display_name, ELM_CNP_MODE_PLAINTEXT);
1595 elm_entry_input_panel_layout_set(p->entry_display_name, ELM_INPUT_PANEL_LAYOUT_EMAIL);
1596 elm_entry_editable_set(p->entry_display_name, TRUE);
1597 evas_object_smart_callback_add(p->entry_display_name, "changed", _backup_input_cb, p->ef_display_name);
1598 evas_object_smart_callback_add(p->entry_display_name, "focused", _entry_focused_cb, p->ef_display_name);
1599 evas_object_smart_callback_add(p->entry_display_name, "unfocused", _entry_unfocused_cb, p->ef_display_name);
1600 evas_object_show(p->entry_display_name);
1602 imf_context = elm_entry_imf_context_get(p->entry_display_name);
1604 ecore_imf_context_input_panel_event_callback_add(imf_context,
1605 ECORE_IMF_INPUT_PANEL_STATE_EVENT,
1606 _input_panel_state_changed_cb, (void *)vd);
1608 elm_object_part_content_set(p->ef_display_name, "elm.swallow.content", p->entry_display_name);
1609 /*elm_object_part_text_set(p->ef_display_name, "elm.guidetext", _("IDS_EMAIL_BODY_YOUR_NAME"));*/
1610 elm_object_part_text_set(p->ef_display_name, "elm.text", dgettext("sys_string", "IDS_COM_BODY_DETAILS_NAME"));
1611 elm_object_signal_callback_add(p->ef_display_name, "elm,eraser,clicked", "elm", _eraser_clicked_cb, p->entry_display_name);
1613 evas_object_size_hint_weight_set(p->ef_display_name, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1614 evas_object_show(p->ef_display_name);
1616 if (p->str_display_name)
1617 elm_entry_entry_set(p->entry_display_name, p->str_display_name);
1619 return p->ef_display_name;
1620 } else if (index == 4) {
1624 p->ef_email_address = elm_layout_add(p->genlist);
1625 elm_layout_theme_set(p->ef_email_address, "layout", "editfield", "title");
1626 p->entry_email_address = elm_entry_add(p->genlist);
1627 elm_entry_scrollable_set(p->entry_email_address, EINA_TRUE);
1628 elm_entry_single_line_set(p->entry_email_address, EINA_TRUE);
1629 elm_entry_input_panel_return_key_disabled_set(p->entry_email_address, EINA_TRUE);
1630 elm_entry_cnp_mode_set(p->entry_email_address, ELM_CNP_MODE_PLAINTEXT);
1631 elm_entry_input_panel_layout_set(p->entry_email_address, ELM_INPUT_PANEL_LAYOUT_EMAIL);
1632 elm_entry_editable_set(p->entry_email_address, TRUE);
1633 evas_object_smart_callback_add(p->entry_email_address, "changed", _backup_input_cb, p->ef_email_address);
1634 evas_object_smart_callback_add(p->entry_email_address, "focused", _entry_focused_cb, p->ef_email_address);
1635 evas_object_smart_callback_add(p->entry_email_address, "unfocused", _entry_unfocused_cb, p->ef_email_address);
1636 evas_object_show(p->entry_email_address);
1638 imf_context = elm_entry_imf_context_get(p->entry_email_address);
1640 ecore_imf_context_input_panel_event_callback_add(imf_context,
1641 ECORE_IMF_INPUT_PANEL_STATE_EVENT,
1642 _input_panel_state_changed_cb, (void *)vd);
1644 elm_object_part_content_set(p->ef_email_address, "elm.swallow.content", p->entry_email_address);
1645 /*_set_help_string(p->ef_email_address, vd);*/
1646 elm_object_part_text_set(p->ef_email_address, "elm.text", dgettext("sys_string", "IDS_COM_BODY_EMAIL_ADDRESS"));
1647 elm_object_signal_callback_add(p->ef_email_address, "elm,eraser,clicked", "elm", _eraser_clicked_cb, p->entry_email_address);
1649 evas_object_size_hint_weight_set(p->ef_email_address, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1650 evas_object_show(p->ef_email_address);
1652 if (p->str_email_address)
1653 elm_entry_entry_set(p->entry_email_address, p->str_email_address);
1655 if (ugd->account_info != OTHERS && p->icon_get_cnt2 == 2 &&
1656 strcmp(ugd->start_view_type, EMAIL_BUNDLE_VAL_VIEW_ACCOUNT_ADD) != 0) {
1657 p->clicked_object = p->entry_email_address;
1658 evas_object_show(p->entry_email_address);
1659 elm_object_focus_set(p->entry_email_address, EINA_TRUE);
1660 elm_entry_cursor_begin_set(p->entry_email_address);
1663 if (ugd->account_info != OTHERS && p->icon_get_cnt2 == 3 &&
1664 strcmp(ugd->start_view_type, EMAIL_BUNDLE_VAL_VIEW_ACCOUNT_ADD) == 0) {
1665 p->clicked_object = p->entry_email_address;
1666 evas_object_show(p->entry_email_address);
1667 elm_object_focus_set(p->entry_email_address, EINA_TRUE);
1668 elm_entry_cursor_begin_set(p->entry_email_address);
1671 return p->ef_email_address;
1672 } else if (index == 5) {
1674 p->ef_password = elm_layout_add(p->genlist);
1675 elm_layout_theme_set(p->ef_password, "layout", "editfield", "title");
1676 p->entry_password = elm_entry_add(p->genlist);
1677 elm_entry_scrollable_set(p->entry_password, EINA_TRUE);
1678 elm_entry_single_line_set(p->entry_password, EINA_TRUE);
1679 elm_entry_input_panel_return_key_disabled_set(p->entry_password, EINA_TRUE);
1680 elm_entry_cnp_mode_set(p->entry_password, ELM_CNP_MODE_PLAINTEXT);
1681 elm_entry_input_panel_layout_set(p->entry_password, ELM_INPUT_PANEL_LAYOUT_EMAIL);
1682 elm_entry_editable_set(p->entry_password, EINA_TRUE);
1683 elm_entry_password_set(p->entry_password, EINA_TRUE);
1685 evas_object_smart_callback_add(p->entry_password, "changed", _backup_input_cb, p->ef_password);
1686 evas_object_smart_callback_add(p->entry_password, "focused", _entry_focused_cb, p->ef_password);
1687 evas_object_smart_callback_add(p->entry_password, "unfocused", _entry_unfocused_cb, p->ef_password);
1688 evas_object_show(p->entry_password);
1690 imf_context = elm_entry_imf_context_get(p->entry_password);
1692 ecore_imf_context_input_panel_event_callback_add(imf_context,
1693 ECORE_IMF_INPUT_PANEL_STATE_EVENT,
1694 _input_panel_state_changed_cb, (void *)vd);
1696 elm_object_part_content_set(p->ef_password, "elm.swallow.content", p->entry_password);
1697 /*elm_object_part_text_set(p->ef_password, "elm.guidetext", _("IDS_EMAIL_BODY_USER_PASSWORD"));*/
1698 elm_object_part_text_set(p->ef_password, "elm.text", dgettext("sys_string", "IDS_COM_BODY_PASSWORD"));
1699 elm_object_signal_callback_add(p->ef_password, "elm,eraser,clicked", "elm", _eraser_clicked_cb, p->entry_password);
1701 evas_object_size_hint_weight_set(p->ef_password, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1702 evas_object_show(p->ef_password);
1704 if (p->str_password)
1705 elm_entry_entry_set(p->entry_password, p->str_password);
1707 Eina_Bool state = elm_check_state_get(p->show_passwd_check);
1710 elm_entry_password_set(p->entry_password, EINA_FALSE);
1712 elm_entry_password_set(p->entry_password, EINA_TRUE);
1714 return p->ef_password;