#include "email-setting.h"
#include "email-setting-utils.h"
-/* TODO: Need to remove */
-void setting_set_csc_account(email_view_t *vd);
-
/**
* @brief Set up an account setting
* @remark Operation occurs with default provider.
} \
} while (0)
-typedef enum {
- FOLDER_TYPE_NONE = 0,
- FOLDER_TYPE_INBOX,
- FOLDER_TYPE_SENTBOX,
- FOLDER_TYPE_TRASH,
- FOLDER_TYPE_DRAFTBOX,
- FOLDER_TYPE_SPAMBOX,
- FOLDER_TYPE_OUTBOX,
- FOLDER_TYPE_ALL_EMAILS,
- FOLDER_TYPE_SEARCH_RESULT,
- FOLDER_TYPE_USER_DEFINED = 0xFF,
- FOLDER_TYPE_MAX
-} SETTING_FOLDER_TYPE_ID; /* TODO: This enum can be replaced with email_mailbox_type_e. */
typedef enum {
POPUP_ENTRY_EDITFIELD,
*/
void setting_deregister_keypad_rot_cb(EmailSettingUGD *ugd);
+/**
+ * @brief The function creates account validation popup
+ * @param[in] vd View data
+ * @param[in] handle The data pointer to be passed to cb func.
+ */
+void setting_create_account_validation_popup(email_view_t *vd, int *handle);
+
#endif /* __EMAIL_SETTING_UTILS_H__ */
/* EOF */
#include "email-setting-string.h"
#include "email-module-dev.h"
-#define VIEW_ST_MAX 20 /* Maximum View Stack */
-
#define _EDJ(o) elm_layout_edje_get(o)
#define DEFAULT_EMAIL_RINGTONE_PATH "/opt/usr/share/settings/Alerts/Postman(Default_Email).ogg"
-typedef enum _ViewType ViewType;
enum _ViewType {
VIEW_SETTING = 1000,
VIEW_ACCOUNT_SETUP,
VIEW_NOTIFICATION_SETTING,
VIEW_SIGNATURE_SETTING,
VIEW_SIGNATURE_EDIT,
-
- /* error case */
- VIEW_INVALID,
-};
-
-typedef struct sp_desc EmailSpDesc;
-struct sp_desc {
- int index;
- char *id;
- char *csc_code;
- char *name;
- char *name_str_id;
- char *icon_path;
- char *sending_address;
- int sending_port;
- int sending_security;
- char *receiving_server_type;
- char *receiving_address;
- int receiving_port;
- int receiving_security;
- int rgb;
-};
-
-enum {
- PRIORITY_SENDER_MODE_ADD = 1,
- PRIORITY_SENDER_MODE_EDIT,
- PRIORITY_SENDER_MODE_MAX
+ VIEW_INVALID
};
-
-typedef enum _email_add_account_e {
- EMAIL_ADD_ACCOUNT_TYPE_EMAIL = 1, /**< CSC_FEATURE_DEF_BOOL_EMAIL_PROVIDERS_DISPLAY_ENABLE 0 */
- EMAIL_ADD_ACCOUNT_TYPE_OTHERS, /**< when "Others" is selected */
- EMAIL_ADD_ACCOUNT_TYPE_CSC, /**< CSC_FEATURE_DEF_BOOL_EMAIL_PROVIDERS_DISPLAY_ENABLE 1 */
-} email_add_account_e;
-
-typedef struct ug_data EmailSettingUGD;
+typedef enum _ViewType ViewType;
struct ug_data
{
/* for adding account */
GSList *default_provider_list;
- char *email_sp;
- char *email_sp_icon_path;
- email_add_account_e add_account_type;
email_account_t *new_account;
email_account_t *account_list;
- email_protocol_config_t *imap_conf;
- email_protocol_config_t *pop_conf;
- email_protocol_config_t *smtp_conf;
/* view specified variables */
int account_count;
int account_id;
- int add_account;
- int setup_mailbox;
- int is_account_deleted_on_this;
+ Eina_Bool is_account_deleted_on_this;
Eina_Bool is_set_default_account;
/* for noti mgr */
/* for cancel op */
GSList *cancel_op_list;
- Ecore_Thread *query_thread;
/* for conformant */
- int is_keypad;
- int is_clipboard;
+ Eina_Bool is_keypad;
};
+typedef struct ug_data EmailSettingUGD;
#endif /* __EMAIL_SETTING_H__ */
* @brief Creates account setup view
* @param[in] ugd Email settings data
*/
-void create_account_setup_view(EmailSettingUGD *ugd, email_add_account_e account_type, char *sp_name, char *sp_icon_path);
+void create_account_setup_view(EmailSettingUGD *ugd);
#endif /* __EMAIL_VIEW_ACCOUNT_SETUP_H__ */
static email_setting_string_t EMAIL_SETTING_STRING_SENT_FROM_SAMSUNG_MOBILE = {PACKAGE, "IDS_EMAIL_SBODY_SENT_FROM_MY_SAMSUNG_DEVICE"};
-#define ACOOUNT_ICON_PATH tzplatform_mkpath(TZ_SYS_RO_ICONS, "org.tizen.email.png")
+#define ACCOUNT_ICON_PATH tzplatform_mkpath(TZ_SYS_RO_ICONS, "org.tizen.email.png")
#define DEFAULT_SIGNATURE EMAIL_SETTING_STRING_SENT_FROM_SAMSUNG_MOBILE.id
#define DEFAULT_EMAIL_SIZE 1024*50
static void _set_default_setting_to_account(email_view_t *vd, email_account_t *account);
static void _set_setting_account_provider_info_to_email_account_t(email_account_t *account, setting_account_provider_info_t *info);
static void _set_setting_account_server_info_to_email_account_t(email_account_t *account, setting_account_server_info_t *info);
-char *_get_logo_path(email_view_t *vd);
int setting_is_in_default_provider_list(email_view_t *vd, const char *email_addr)
{
}
}
-void setting_set_csc_account(email_view_t *vd)
-{
- debug_enter();
-
- retm_if(!vd, "vd is NULL");
-
- EmailSettingUGD *ugd = (EmailSettingUGD *)vd->module;
- email_account_t *account = NULL;
- account = ugd->new_account;
-
- retm_if(!account, "account is NULL");
-
- /* set default common setting */
- _set_default_setting_to_account(vd, account);
-
- _account_info_print(account);
-}
-
static void _set_display_name_with_email_addr(char *email_addr, char **display_name)
{
debug_enter();
account->options.add_myname_card = 0;
account->options.add_signature = 1;
account->options.signature = g_strdup(DEFAULT_SIGNATURE);
- account->logo_icon_path = _get_logo_path(vd);
+ account->logo_icon_path = g_strdup(ACCOUNT_ICON_PATH);
account->outgoing_server_type = EMAIL_SERVER_TYPE_SMTP;
account->outgoing_server_need_authentication = EMAIL_AUTHENTICATION_METHOD_DEFAULT;
account->incoming_server_authentication_method = EMAIL_AUTHENTICATION_METHOD_NO_AUTH;
}
}
-char *_get_logo_path(email_view_t *vd)
-{
- debug_enter();
- EmailSettingUGD *ugd = (EmailSettingUGD *)vd->module;
- if (ugd->email_sp_icon_path)
- return g_strdup(ugd->email_sp_icon_path);
- return g_strdup(ACOOUNT_ICON_PATH);
-}
/* EOF */
static email_setting_string_t EMAIL_SETTING_STRING_ACCOUNT_ALREADY_EXISTS = {PACKAGE, "IDS_ST_POP_THIS_ACCOUNT_HAS_ALREADY_BEEN_ADDED"};
static email_setting_string_t EMAIL_SETTING_STRING_AUTHENTICATION_FAILED = {PACKAGE, "IDS_ST_POP_CHECK_THE_EMAIL_ADDRESS_AND_PASSWORD_YOU_HAVE_ENTERED"};
static email_setting_string_t EMAIL_SETTING_STRING_INCORRECT_USER_NAME_OR_PASSWORD = {PACKAGE, "IDS_ST_POP_CHECK_THE_EMAIL_ADDRESS_AND_PASSWORD_YOU_HAVE_ENTERED"};
-static email_setting_string_t EMAIL_SETTING_STRING_OTHERS = {PACKAGE, "IDS_ST_MBODY_OTHER"};
static email_setting_string_t EMAIL_SETTING_STRING_UNKNOWN_ERROR = {PACKAGE, "IDS_EMAIL_POP_AN_UNKNOWN_ERROR_HAS_OCCURRED"};
static email_setting_string_t EMAIL_SETTING_STRING_EMAIL = {PACKAGE, "IDS_ST_HEADER_EMAIL"};
static email_setting_string_t EMAIL_SETTING_STRING_CANCEL = {PACKAGE, "IDS_EMAIL_BUTTON_CANCEL"};
static email_setting_string_t EMAIL_SETTING_STRING_TLS_SSL_FAIL = {PACKAGE, "IDS_EMAIL_BODY_UNABLE_TO_OPEN_CONNECTION_TO_SERVER_SECURITY_ERROR_OCCURRED"};
static email_setting_string_t EMAIL_SETTING_STRING_WARNING = {PACKAGE, "IDS_ST_HEADER_WARNING"};
static email_setting_string_t EMAIL_SETTING_STRING_UNABLE_TO_VALIDATE = {PACKAGE, "IDS_ST_HEADER_UNABLE_TO_VALIDATE_ACCOUNT_ABB"};
+static email_setting_string_t EMAIL_SETTING_STRING_VALIDATING_ACCOUNT_ING = {PACKAGE, "IDS_ST_TPOP_VALIDATING_ACCOUNT_ING_ABB"};
/* not defined in UX */
static email_setting_string_t EMAIL_SETTING_STRING_MANY_LOGIN_FAIL = {PACKAGE, N_("Too many login failure")};
retm_if(!header, "header is NULL!");
elm_object_domain_translatable_part_text_set(ugd->popup, "title,text", header->domain, header->id);
}
- ugd->is_keypad = 0;
+ ugd->is_keypad = EINA_FALSE;
}
static void _entry_popup_keypad_up_cb(void *data, Evas_Object *obj, void *event_info)
rot = elm_win_rotation_get(ugd->base.win);
if (rot == 90 || rot == 270)
elm_object_part_text_set(ugd->popup, "title,text", NULL);
- ugd->is_keypad = 1;
+ ugd->is_keypad = EINA_TRUE;
}
static void _entry_popup_rot_cb(void *data, Evas_Object *obj, void *event_info)
retm_if(!ugd, "ugd is NULL");
DELETE_EVAS_OBJECT(ugd->popup);
-
- if (ugd->query_thread && !ecore_thread_check(ugd->query_thread)) {
- ecore_thread_cancel(ugd->query_thread);
- debug_log("query thread is cancelled: %p", ugd->query_thread);
- ugd->query_thread = NULL;
- }
}
static void _popup_noop_cb(void *data, Evas_Object *obj, void *event_info)
{
debug_enter();
- if (ugd->add_account_type == EMAIL_ADD_ACCOUNT_TYPE_CSC) {
- return g_strdup(ugd->email_sp);
- } else if (ugd->add_account_type == EMAIL_ADD_ACCOUNT_TYPE_EMAIL) {
- return g_strdup(EMAIL_SETTING_STRING_EMAIL.id);
- } else {
- return g_strdup(EMAIL_SETTING_STRING_OTHERS.id);
- }
+ return g_strdup(EMAIL_SETTING_STRING_EMAIL.id);
}
static void _popup_content_remove(Evas_Object *popup)
Elm_Object_Item *navi_it = elm_naviframe_top_item_get(ugd->base.navi);
elm_naviframe_item_title_enabled_set(navi_it, EINA_TRUE, EINA_TRUE);
}
- ugd->is_keypad = 0;
+ ugd->is_keypad = EINA_FALSE;
}
static void _keypad_up_cb(void *data, Evas_Object *obj, void *event_info)
Elm_Object_Item *navi_it = elm_naviframe_top_item_get(ugd->base.navi);
elm_naviframe_item_title_enabled_set(navi_it, EINA_FALSE, EINA_TRUE);
}
- ugd->is_keypad = 1;
+ ugd->is_keypad = EINA_TRUE;
}
static void _keypad_rot_cb(void *data, Evas_Object *obj, void *event_info)
}
}
}
+
+void setting_create_account_validation_popup(email_view_t *vd, int *handle)
+{
+ debug_enter();
+
+ retm_if(!vd, "vd is null");
+
+ EmailSettingUGD *ugd = (EmailSettingUGD *)vd->module;
+ email_account_t *account = ugd->new_account;
+
+ debug_secure("account name:%s", account->account_name);
+ debug_secure("email address:%s", account->user_email_address);
+
+ debug_log("Start Account Validation");
+ ugd->popup = setting_get_pb_process_notify(vd,
+ &(EMAIL_SETTING_STRING_VALIDATING_ACCOUNT_ING), 0, NULL, NULL, NULL, NULL,
+ POPUP_BACK_TYPE_DESTROY_WITH_CANCEL_OP, handle);
+}
+
/* EOF */
bindtextdomain(PACKAGE, email_get_locale_dir());
- ugd->add_account_type = EMAIL_ADD_ACCOUNT_TYPE_EMAIL;
-
ugd->filter_listener.cb_data = ugd;
ugd->filter_listener.destroy_request_cb = _filter_destroy_request_cb;
create_setting_view(ugd);
break;
case VIEW_ACCOUNT_SETUP:
- create_account_setup_view(ugd, ugd->add_account_type, NULL, NULL);
+ create_account_setup_view(ugd);
break;
case VIEW_ACCOUNT_DETAILS:
create_account_details_view(ugd);
}
debug_log("is_keypad: %d", ugd->is_keypad);
- debug_log("is_clipboard: %d", ugd->is_clipboard);
debug_log("event: %d", event);
return;
ugd->app_control_google_eas = NULL;
}
- FREE(ugd->email_sp);
- FREE(ugd->email_sp_icon_path);
-
/* ICU */
setting_close_icu_pattern_generator();
retm_if(!response, "response data is NULL");
retm_if(ugd->account_id != response->account_id, "account_id is different");
- retm_if(ugd->is_account_deleted_on_this == 1, "account is deleted on this ug");
+ retm_if(ugd->is_account_deleted_on_this, "account is deleted on this ug");
debug_log("account is deleted. Let's destroyed");
email_module_make_destroy_request(&ugd->base);
elm_genlist_item_selected_set(item, EINA_FALSE);
if (li->index == SIGNATURE_LIST_ITEM) {
- ugd->add_account = 0;
create_signature_setting_view(ugd);
return;
} else if (li->index == NOTIFICATION_LIST_ITEM) {
int ret = setting_delete_account_from_account_svc(account_svc_id);
if (ret == ACCOUNT_ERROR_NONE) {
/* delete account from email_svc */
- ugd->is_account_deleted_on_this = 1;
+ ugd->is_account_deleted_on_this = EINA_TRUE;
ret = email_engine_delete_account(account_id);
if (ret) {
ugd->popup = setting_get_pb_process_notify(&vd->base,
vd->del_timer = ecore_timer_add(3.0, _after_delete_cb, vd);
debug_log("delete success");
} else {
- ugd->is_account_deleted_on_this = 0;
+ ugd->is_account_deleted_on_this = EINA_FALSE;
ugd->popup = setting_get_notify(&vd->base, &(EMAIL_SETTING_STRING_HEADER_DELETE),
&(EMAIL_SETTING_STRING_UNABLE_DELETE), 1,
&(EMAIL_SETTING_STRING_OK),
typedef struct view_data EmailSettingVD;
-static EmailSettingVD *g_vd = NULL;
-
static int _create(email_view_t *self);
static void _destroy(email_view_t *self);
static void _activate(email_view_t *self, email_view_state prev_state);
static void _create_view(EmailSettingVD *vd);
static void _initialize_handle(EmailSettingVD *vd);
static void _create_list(EmailSettingVD *vd);
-static void _create_validation_popup(EmailSettingVD *vd);
-static void _validate_account(void *data);
+static void _validate_account(EmailSettingVD *vd);
static void _account_validate_cb(int account_id, email_setting_response_data *response, void *user_data);
static int _check_null_field(EmailSettingVD *vd);
static void _read_all_entries(EmailSettingVD *vd);
-static void _set_domain_string(EmailSettingVD *vd);
static void _set_username_before_at(EmailSettingVD *vd);
static void _popup_list_select_cb(void *data, Evas_Object *obj, void *event_info);
static char *_popup_list_text_get_cb(void *data, Evas_Object *obj, const char *part);
static char *_gl_text_get_cb(void *data, Evas_Object *obj, const char *part);
static Evas_Object *_gl_content_get_cb(void *data, Evas_Object *obj, const char *part);
-static void _set_cb(void *data, Evas_Object *obj, void *event_info);
-static void _next_cb(void *data, Evas_Object *obj, void *event_info);
-static void _save_cb(void *data, Evas_Object *obj, void *event_info);
-static void _login_cb(void *data, Evas_Object *obj, void *event_info);
-static void _manual_cb(void *data, Evas_Object *obj, void *event_info);
+
+static void _perform_account_validation(EmailSettingVD *vd);
+static void _switch_to_manual_setup(EmailSettingVD *vd);
+static void _next_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info);
+static void _manual_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info);
static void _check_clicked_cb(void *data, Evas_Object *obj, void *event_info);
static Eina_Bool _after_validation_cb(void *data);
static Eina_Bool _startup_focus_cb(void *data);
static void _return_key_cb(void *data, Evas_Object *obj, void *event_info);
static void _gl_sel_cb(void *data, Evas_Object *obj, void *event_info);
-static email_setting_string_t EMAIL_SETTING_STRING_ALREADY_EXIST = {PACKAGE, "IDS_ST_POP_THIS_ACCOUNT_HAS_ALREADY_BEEN_ADDED"};
+static void _create_account_type_chooser_popup(EmailSettingVD *vd);
+
static email_setting_string_t EMAIL_SETTING_STRING_EMAIL_ADDRESS = {PACKAGE, "IDS_EMAIL_BODY_EMAIL_ADDRESS"};
static email_setting_string_t EMAIL_SETTING_STRING_NEXT = {PACKAGE, "IDS_ST_BUTTON_NEXT"};
static email_setting_string_t EMAIL_SETTING_STRING_OK = {PACKAGE, "IDS_EMAIL_BUTTON_OK"};
-static email_setting_string_t EMAIL_SETTING_STRING_OTHERS = {PACKAGE, "IDS_ST_MBODY_OTHER"};
-static email_setting_string_t EMAIL_SETTING_STRING_SK_ADD_ACCOUNT = {PACKAGE, "IDS_EMAIL_OPT_ADD_ACCOUNT"};
-static email_setting_string_t EMAIL_SETTING_STRING_ACCOUNT_ALREADY_EXISTS = {PACKAGE, "IDS_ST_POP_THIS_ACCOUNT_HAS_ALREADY_BEEN_ADDED"};
static email_setting_string_t EMAIL_SETTING_STRING_EMAIL = {PACKAGE, "IDS_ST_HEADER_EMAIL"};
static email_setting_string_t EMAIL_SETTING_STRING_IMAP = {PACKAGE, "IDS_ST_SBODY_IMAP"};
-static email_setting_string_t EMAIL_SETTING_STRING_INVALID_EMAIL_ADDRESS = {PACKAGE, "IDS_EMAIL_TPOP_INVALID_EMAIL_ADDRESS_ENTERED"};
static email_setting_string_t EMAIL_SETTING_STRING_MANUAL_SETUP = {PACKAGE, "IDS_ST_BUTTON_MANUAL_SETUP_ABB"};
static email_setting_string_t EMAIL_SETTING_STRING_POP3 = {PACKAGE, "IDS_ST_SBODY_POP3"};
static email_setting_string_t EMAIL_SETTING_STRING_SELECT_TYPE_OF_ACCOUNT = {PACKAGE, "IDS_ST_HEADER_SELECT_ACCOUNT_TYPE_ABB"};
static email_setting_string_t EMAIL_SETTING_STRING_SEND_EMAIL_FROM_THIS_ACCOUNT_BY_DEFAULT = {PACKAGE, "IDS_ST_SBODY_SET_AS_DEFAULT_ACCOUNT_ABB"};
static email_setting_string_t EMAIL_SETTING_STRING_SHOW_PASSWORD = {PACKAGE, "IDS_ST_SBODY_SHOW_PASSWORD_ABB"};
-static email_setting_string_t EMAIL_SETTING_STRING_UNABLE_TO_ADD_ACCOUNT = {PACKAGE, "IDS_ST_HEADER_UNABLE_TO_ADD_ACCOUNT_ABB"};
-static email_setting_string_t EMAIL_SETTING_STRING_VALIDATING_ACCOUNT_ING = {PACKAGE, "IDS_ST_TPOP_VALIDATING_ACCOUNT_ING_ABB"};
static email_setting_string_t EMAIL_SETTING_STRING_ENTER_PASS = {PACKAGE, "IDS_ST_TMBODY_PASSWORD"};
+static email_setting_string_t EMAIL_SETTING_STRING_WARNING = {PACKAGE, "IDS_ST_HEADER_WARNING"};
+static email_setting_string_t EMAIL_SETTING_STRING_SK_ADD_ACCOUNT = {PACKAGE, "IDS_EMAIL_OPT_ADD_ACCOUNT"};
+static email_setting_string_t EMAIL_SETTING_STRING_INVALID_EMAIL_ADDRESS = {PACKAGE, "IDS_EMAIL_TPOP_INVALID_EMAIL_ADDRESS_ENTERED"};
+static email_setting_string_t EMAIL_SETTING_STRING_UNABLE_TO_ADD_ACCOUNT = {PACKAGE, "IDS_ST_HEADER_UNABLE_TO_ADD_ACCOUNT_ABB"};
static email_setting_string_t EMAIL_SETTING_STRING_FILL_MANDATORY_FIELDS = {PACKAGE, "IDS_EMAIL_POP_PLEASE_FILL_ALL_THE_MANDATORY_FIELDS"};
static email_setting_string_t EMAIL_SETTING_STRING_SERVER_QUERY_FAIL = {PACKAGE, "IDS_EMAIL_POP_SERVER_INFORMATION_QUERY_FAILED_ENTER_SERVER_INFORMATION_MANUALLY"};
-static email_setting_string_t EMAIL_SETTING_STRING_WARNING = {PACKAGE, "IDS_ST_HEADER_WARNING"};
+static email_setting_string_t EMAIL_SETTING_STRING_ACCOUNT_ALREADY_EXISTS = {PACKAGE, "IDS_ST_POP_THIS_ACCOUNT_HAS_ALREADY_BEEN_ADDED"};
enum {
EMAIL_ADDRESS_LIST_ITEM = 1,
Evas_Object *show_passwd_check;
Eina_Bool is_show_passwd_check;
- Evas_Object *login_c_btn;
- Evas_Object *manual_c_btn;
+ Evas_Object *next_btn;
+ Evas_Object *manual_btn;
Ecore_Timer *preset_vc_timer;
Ecore_Timer *focus_timer;
EmailSettingVD *vd;
} ListItemData;
-void create_account_setup_view(EmailSettingUGD *ugd, email_add_account_e account_type, char *sp_name, char *sp_icon_path)
+void create_account_setup_view(EmailSettingUGD *ugd)
{
debug_enter();
vd->base.update = _update;
vd->base.on_back_key = _on_back_key;
- FREE(ugd->email_sp);
- FREE(ugd->email_sp_icon_path);
- ugd->email_sp = g_strdup(sp_name);
- ugd->email_sp_icon_path = g_strdup(sp_icon_path);
- ugd->add_account_type = account_type;
ugd->is_set_default_account = EINA_FALSE;
debug_log("view create result: %d", email_module_create_view(&ugd->base, &vd->base));
vd->base.content = setting_add_inner_layout(&vd->base);
_push_naviframe(vd);
- g_vd = vd;
- if (ugd->new_account)
+ if (ugd->new_account) {
setting_new_acct_final(&vd->base);
- setting_new_acct_init(&vd->base);
-
- if (ugd->add_account_type == EMAIL_ADD_ACCOUNT_TYPE_CSC) {
- setting_set_csc_account(&vd->base);
- _set_domain_string(vd);
}
+ setting_new_acct_init(&vd->base);
ugd->account_id = 0;
FREE(vd->str_password);
FREE(vd->str_password_before);
-
GSList *l = vd->list_items;
while (l) {
ListItemData *li = l->data;
{
debug_enter();
EmailSettingUGD *ugd = (EmailSettingUGD *)vd->base.module;
- Elm_Object_Item *navi_it = NULL;
int push_flags = ((ugd->base.views_count == 1) ? EVPF_NO_TRANSITION : 0);
- if (ugd->add_account_type == EMAIL_ADD_ACCOUNT_TYPE_CSC) {
- navi_it = email_module_view_push(&vd->base, ugd->email_sp, push_flags);
- } else if (ugd->add_account_type == EMAIL_ADD_ACCOUNT_TYPE_EMAIL) {
- navi_it = email_module_view_push(&vd->base, EMAIL_SETTING_STRING_EMAIL.id, push_flags);
- elm_object_item_domain_text_translatable_set(navi_it, EMAIL_SETTING_STRING_EMAIL.domain, EINA_TRUE);
- } else {
- navi_it = email_module_view_push(&vd->base, EMAIL_SETTING_STRING_OTHERS.id, push_flags);
- elm_object_item_domain_text_translatable_set(navi_it, EMAIL_SETTING_STRING_OTHERS.domain, EINA_TRUE);
- }
+ Elm_Object_Item *navi_it = email_module_view_push(&vd->base, EMAIL_SETTING_STRING_EMAIL.id, push_flags);
+ elm_object_item_domain_text_translatable_set(navi_it, EMAIL_SETTING_STRING_EMAIL.domain, EINA_TRUE);
Evas_Object *btn = NULL;
Evas_Object *btn_ly = NULL;
btn = elm_button_add(btn_ly);
elm_object_style_set(btn, "bottom");
elm_object_domain_translatable_text_set(btn, EMAIL_SETTING_STRING_MANUAL_SETUP.domain, EMAIL_SETTING_STRING_MANUAL_SETUP.id);
- evas_object_smart_callback_add(btn, "clicked", _manual_cb, vd);
- vd->manual_c_btn = btn;
+ evas_object_smart_callback_add(btn, "clicked", _manual_btn_clicked_cb, vd);
+ vd->manual_btn = btn;
elm_object_disabled_set(btn, EINA_TRUE);
elm_layout_content_set(btn_ly, "btn1.swallow", btn);
btn = elm_button_add(btn_ly);
elm_object_style_set(btn, "bottom");
elm_object_domain_translatable_text_set(btn, EMAIL_SETTING_STRING_NEXT.domain, EMAIL_SETTING_STRING_NEXT.id);
- evas_object_smart_callback_add(btn, "clicked", _set_cb, vd);
- vd->login_c_btn = btn;
+ evas_object_smart_callback_add(btn, "clicked", _next_btn_clicked_cb, vd);
+ vd->next_btn = btn;
elm_object_disabled_set(btn, EINA_TRUE);
elm_layout_content_set(btn_ly, "btn2.swallow", btn);
li->index = DEFAULT_ACCOUNT_LIST_ITEM;
li->vd = vd;
- item = elm_genlist_item_append(vd->genlist, vd->itc2, li, NULL,
- ELM_GENLIST_ITEM_NONE, _gl_sel_cb, li);
+ item = elm_genlist_item_append(vd->genlist, vd->itc2, li, NULL, ELM_GENLIST_ITEM_NONE, _gl_sel_cb, li);
elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_ALWAYS);
vd->list_items = g_slist_append(vd->list_items, li);
}
{
ListItemData *li = data;
if (li) {
- if (li->index == DEFAULT_ACCOUNT_LIST_ITEM && !strcmp("elm.text", part))
+ if (li->index == DEFAULT_ACCOUNT_LIST_ITEM && !strcmp("elm.text", part)) {
return g_strdup(email_setting_gettext(EMAIL_SETTING_STRING_SEND_EMAIL_FROM_THIS_ACCOUNT_BY_DEFAULT));
- else if (li->index == SHOW_PASSWORD_LIST_ITEM && !strcmp("elm.text", part))
+ } else if (li->index == SHOW_PASSWORD_LIST_ITEM && !strcmp("elm.text", part)) {
return g_strdup(email_setting_gettext(EMAIL_SETTING_STRING_SHOW_PASSWORD));
+ }
}
return NULL;
}
return NULL;
}
-static void _create_validation_popup(EmailSettingVD *vd)
+static void _validate_account(EmailSettingVD *vd)
{
debug_enter();
retm_if(!vd, "view data is null");
EmailSettingUGD *ugd = (EmailSettingUGD *)vd->base.module;
- email_account_t *account = ugd->new_account;
-
- debug_secure("account name:%s", account->account_name);
- debug_secure("email address:%s", account->user_email_address);
-
- debug_log("Start Account Validation");
- ugd->popup = setting_get_pb_process_notify(&vd->base,
- &(EMAIL_SETTING_STRING_VALIDATING_ACCOUNT_ING), 0,
- NULL, NULL,
- NULL, NULL,
- POPUP_BACK_TYPE_DESTROY_WITH_CANCEL_OP, &(vd->handle));
-}
-
-static void _validate_account(void *data)
-{
- debug_enter();
-
- EmailSettingVD *vd = data;
-
- retm_if(!vd, "view data is null");
-
- EmailSettingUGD *ugd = (EmailSettingUGD *)vd->base.module;
int error_code = 0;
vd->handle = EMAIL_OP_HANDLE_INITIALIZER;
+
if (email_engine_validate_account(ugd->new_account, &(vd->handle), &error_code)) {
debug_log("Validate account");
- _create_validation_popup(vd);
+ setting_create_account_validation_popup(&vd->base, &(vd->handle));
} else {
- debug_error("Fail to make account");
-
- if (error_code == EMAIL_ERROR_ALREADY_EXISTS)
+ if (error_code == EMAIL_ERROR_ALREADY_EXISTS) {
ugd->popup = setting_get_notify(&vd->base,
&(EMAIL_SETTING_STRING_WARNING),
- &(EMAIL_SETTING_STRING_ALREADY_EXIST), 1,
- &(EMAIL_SETTING_STRING_OK),
- _popup_ok_cb, NULL, NULL);
- else
+ &(EMAIL_SETTING_STRING_ACCOUNT_ALREADY_EXISTS), 1,
+ &(EMAIL_SETTING_STRING_OK), _popup_ok_cb, NULL, NULL);
+ } else {
ugd->popup = setting_get_notify(&vd->base,
&(EMAIL_SETTING_STRING_WARNING),
&(EMAIL_SETTING_STRING_UNABLE_TO_ADD_ACCOUNT), 1,
- &(EMAIL_SETTING_STRING_OK),
- _popup_ok_cb, NULL, NULL);
+ &(EMAIL_SETTING_STRING_OK), _popup_ok_cb, NULL, NULL);
+ }
}
}
+static void _create_account_type_chooser_popup(EmailSettingVD *vd)
+{
+ debug_enter();
+
+ EmailSettingUGD *ugd = (EmailSettingUGD *)vd->base.module;
+
+ retm_if(!ugd, "ugd is NULL");
+
+ if (ugd->popup) {
+ DELETE_EVAS_OBJECT(ugd->popup);
+ }
+
+ ugd->popup = setting_get_empty_content_notify(&vd->base,
+ &(EMAIL_SETTING_STRING_SELECT_TYPE_OF_ACCOUNT),
+ 0, NULL, NULL, NULL, NULL);
+
+ Elm_Genlist_Item_Class *itc = setting_get_genlist_class_item("type1", _popup_list_text_get_cb, NULL, NULL, NULL);
+
+ Evas_Object *genlist = elm_genlist_add(ugd->popup);
+ elm_object_style_set(genlist, "popup");
+ elm_genlist_homogeneous_set(genlist, EINA_TRUE);
+ elm_scroller_policy_set(genlist, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
+ elm_scroller_content_min_limit(genlist, EINA_FALSE, EINA_TRUE);
+
+ int index = 0;
+ for (; index < 2; index++) {
+ elm_genlist_item_append(genlist, itc,
+ (void *)(ptrdiff_t)index,
+ NULL,
+ ELM_GENLIST_ITEM_NONE,
+ _popup_list_select_cb,
+ vd);
+ }
+
+ elm_genlist_item_class_free(itc);
+ evas_object_show(genlist);
+
+ elm_object_content_set(ugd->popup, genlist);
+
+ evas_object_show(ugd->popup);
+}
+
static int _check_null_field(EmailSettingVD *vd)
{
debug_enter();
retvm_if(!account, FALSE, "account is null");
if (!STR_VALID(account->user_email_address) ||
- !STR_VALID(account->incoming_server_password))
+ !STR_VALID(account->incoming_server_password)) {
return FALSE;
- else
+ } else {
return TRUE;
+ }
}
static void _read_all_entries(EmailSettingVD *vd)
{
debug_enter();
- retm_if(!vd, "vd is null");
-
EmailSettingUGD *ugd = (EmailSettingUGD *)vd->base.module;
email_account_t *account = ugd->new_account;
account->user_email_address = g_strdup(vd->str_email_address);
account->incoming_server_password = g_strdup(vd->str_password);
-
- if (ugd->add_account_type != EMAIL_ADD_ACCOUNT_TYPE_CSC) {
- FREE(account->account_name);
- account->account_name = g_strdup(vd->str_email_address);
- }
-}
-
-static void _set_domain_string(EmailSettingVD *vd)
-{
- debug_enter();
- EmailSettingUGD *ugd = (EmailSettingUGD *)vd->base.module;
-
- if (ugd->add_account_type == EMAIL_ADD_ACCOUNT_TYPE_CSC) {
- vd->str_email_address = g_strdup(ugd->new_account->user_email_address);
- }
}
-static void _next_cb(void *data, Evas_Object *obj, void *event_info)
+static bool _check_possibility_to_perform_action(EmailSettingVD *vd)
{
debug_enter();
-
- EmailSettingVD *vd = data;
-
- retm_if(!vd, "vd is null");
+ retvm_if(setting_get_network_failure_notify(&vd->base), false, "display network failure notify");
EmailSettingUGD *ugd = (EmailSettingUGD *)vd->base.module;
- email_account_t *account = ugd->new_account;
- char *buf = NULL;
- int ret = 0;
+
+ retvm_if(ugd->popup, false, "invalid case..");
/* Save the Account Data */
_read_all_entries(vd);
+ email_account_t *account = ugd->new_account;
+
debug_secure("accountStructure Info");
debug_secure("Account Name: %s", account->account_name);
debug_secure("Display Name: %s", account->user_display_name);
debug_secure("User Name: %s", account->incoming_server_user_name);
/* check Null field */
- ret = _check_null_field(vd);
- if (!ret) {
+ if (!_check_null_field(vd)) {
ugd->popup = setting_get_notify(&vd->base,
&(EMAIL_SETTING_STRING_WARNING),
&(EMAIL_SETTING_STRING_FILL_MANDATORY_FIELDS), 1,
- &(EMAIL_SETTING_STRING_OK),
- _popup_ok_cb, NULL, NULL);
- return;
+ &(EMAIL_SETTING_STRING_OK), _popup_ok_cb, NULL, NULL);
+ return false;
}
/* check character validation */
- buf = g_strdup(account->user_email_address);
- ret = email_get_address_validation(buf);
- if (!ret) {
+ if (!email_get_address_validation(account->user_email_address)) {
ugd->popup = setting_get_notify(&vd->base,
&(EMAIL_SETTING_STRING_WARNING),
&(EMAIL_SETTING_STRING_INVALID_EMAIL_ADDRESS), 1,
- &(EMAIL_SETTING_STRING_OK),
- _popup_ok_cb, NULL, NULL);
- g_free(buf);
- return;
- }
-
- /* check duplication account */
- ret = setting_is_duplicate_account(buf);
- if (ret < 0) {
- ugd->popup = setting_get_notify(&vd->base,
- &(EMAIL_SETTING_STRING_WARNING),
- &(EMAIL_SETTING_STRING_ACCOUNT_ALREADY_EXISTS), 1,
- &(EMAIL_SETTING_STRING_OK),
- _popup_ok_cb, NULL, NULL);
- g_free(buf);
- return;
- }
-
- /* account info setting */
- ret = setting_is_in_default_provider_list(&vd->base, buf);
- if (ret) {
- setting_set_default_provider_info_to_account(&vd->base, account);
- _validate_account(vd);
- } else {
- /* fail for _get_login_account_info_cb */
- DELETE_EVAS_OBJECT(ugd->popup);
- ugd->popup = setting_get_notify(&vd->base,
- &(EMAIL_SETTING_STRING_SK_ADD_ACCOUNT),
- &(EMAIL_SETTING_STRING_SERVER_QUERY_FAIL),
- 1, &(EMAIL_SETTING_STRING_OK),
- _popup_ok_cb, NULL, NULL);
+ &(EMAIL_SETTING_STRING_OK), _popup_ok_cb, NULL, NULL);
+ return false;
}
-
- g_free(buf);
+ return true;
}
-static void _save_cb(void *data, Evas_Object *obj, void *event_info)
+static void _perform_account_validation(EmailSettingVD *vd)
{
debug_enter();
- EmailSettingVD *vd = data;
+ retm_if(!_check_possibility_to_perform_action(vd), "_check_possibility_to_perform_action failed");
- retm_if(!vd, "vd is null");
-
- EmailSettingUGD *ugd = NULL;
- char *buf = NULL;
- int ret = 0;
-
- ugd = (EmailSettingUGD *)vd->base.module;
-
- /* Save the data */
- _read_all_entries(vd);
+ EmailSettingUGD *ugd = (EmailSettingUGD *)vd->base.module;
email_account_t *account = ugd->new_account;
- debug_secure("accountStructure Info");
- debug_secure("Display Name:%s", account->user_display_name);
- debug_secure("Email Addr:%s", account->user_email_address);
-
- /* check Null field */
- ret = _check_null_field(vd);
- if (!ret) {
- debug_error("empty space in account info");
- ugd->popup = setting_get_notify(&vd->base,
- &(EMAIL_SETTING_STRING_WARNING),
- &(EMAIL_SETTING_STRING_FILL_MANDATORY_FIELDS),
- 1, &(EMAIL_SETTING_STRING_OK),
- _popup_ok_cb, NULL, NULL);
- return;
- }
-
- /* check character validation */
- buf = g_strdup(account->user_email_address);
-
- ret = email_get_address_validation(buf);
- if (!ret) {
- debug_error("Wrong character in email address");
+ /* check duplication account */
+ if (setting_is_duplicate_account(account->user_email_address) < 0) {
ugd->popup = setting_get_notify(&vd->base,
&(EMAIL_SETTING_STRING_WARNING),
- &(EMAIL_SETTING_STRING_INVALID_EMAIL_ADDRESS),
- 1, &(EMAIL_SETTING_STRING_OK),
- _popup_ok_cb, NULL, NULL);
- g_free(buf);
+ &(EMAIL_SETTING_STRING_ACCOUNT_ALREADY_EXISTS), 1,
+ &(EMAIL_SETTING_STRING_OK), _popup_ok_cb, NULL, NULL);
return;
}
- /* check duplication account */
- ret = setting_is_duplicate_account(buf);
- if (ret < 0) {
+ if (setting_is_in_default_provider_list(&vd->base, account->user_email_address)) {
+ setting_set_default_provider_info_to_account(&vd->base, account);
+ _validate_account(vd);
+ } else {
ugd->popup = setting_get_notify(&vd->base,
- &(EMAIL_SETTING_STRING_WARNING),
- &(EMAIL_SETTING_STRING_ACCOUNT_ALREADY_EXISTS), 1,
- &(EMAIL_SETTING_STRING_OK),
- _popup_ok_cb, NULL, NULL);
-
- g_free(buf);
+ &(EMAIL_SETTING_STRING_SK_ADD_ACCOUNT),
+ &(EMAIL_SETTING_STRING_SERVER_QUERY_FAIL), 1,
+ &(EMAIL_SETTING_STRING_OK), _popup_ok_cb, NULL, NULL);
return;
}
- g_free(buf);
-
- /* account info setting */
- setting_set_csc_account(&vd->base);
-
- _validate_account(vd);
}
-static void _login_cb(void *data, Evas_Object *obj, void *event_info)
+static void _switch_to_manual_setup(EmailSettingVD *vd)
{
debug_enter();
-
- EmailSettingVD *vd = data;
-
- retm_if(!vd, "vd is NULL");
+ retm_if(!_check_possibility_to_perform_action(vd), "_check_possibility_to_perform_action failed");
EmailSettingUGD *ugd = (EmailSettingUGD *)vd->base.module;
+ email_account_t *account = ugd->new_account;
- _read_all_entries(vd);
-
- ugd->email_sp = NULL;
- _next_cb(vd, NULL, NULL);
+ if (setting_is_in_default_provider_list(&vd->base, account->user_email_address)) {
+ setting_set_default_provider_info_to_account(&vd->base, account);
+ create_manual_setup_view(ugd);
+ } else {
+ debug_log("show popup to select IMAP/POP3");
+ _create_account_type_chooser_popup(vd);
+ }
}
-static void _set_cb(void *data, Evas_Object *obj, void *event_info)
+static void _next_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info)
{
debug_enter();
- EmailSettingVD *vd = data;
- retm_if(!vd, "vd is NULL");
+ retm_if(!data, "data is NULL");
- if (setting_get_network_failure_notify(&vd->base)) {
- debug_log("display network failure notify");
- return;
- }
-
- EmailSettingUGD *ugd = (EmailSettingUGD *)vd->base.module;
-
- debug_log("add account mode: %d", ugd->add_account_type);
-
- FREE(ugd->imap_conf);
- FREE(ugd->pop_conf);
- FREE(ugd->smtp_conf);
-
- if (ugd->popup) {
- debug_log("invalid case..");
- return;
- }
-
- if (ugd->add_account_type == EMAIL_ADD_ACCOUNT_TYPE_OTHERS) {
- _next_cb(vd, NULL, NULL);
- } else if (ugd->add_account_type == EMAIL_ADD_ACCOUNT_TYPE_CSC) {
- _save_cb(vd, NULL, NULL);
- } else {
- _login_cb(vd, NULL, NULL);
- }
+ _perform_account_validation((EmailSettingVD *)data);
}
-static void _manual_cb(void *data, Evas_Object *obj, void *event_info)
+static void _manual_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info)
{
debug_enter();
+ retm_if(!data, "data is NULL");
- EmailSettingVD *vd = data;
- retm_if(!vd, "vd is null");
-
- if (setting_get_network_failure_notify(&vd->base)) {
- debug_log("display network failure notify");
- return;
- }
-
- EmailSettingUGD *ugd = NULL;
- char *buf = NULL;
- int ret = 0;
-
- ugd = (EmailSettingUGD *)vd->base.module;
-
- if (ugd->popup) {
- debug_log("invalid case..");
- return;
- }
-
- /* Save the Account Data */
- _read_all_entries(vd);
- email_account_t *account = ugd->new_account;
-
- debug_secure("accountStructure Info");
- debug_secure("Account Name:%s", account->account_name);
- debug_secure("Display Name:%s", account->user_display_name);
- debug_secure("Email Addr:%s", account->user_email_address);
- debug_secure("User Name:%s", account->incoming_server_user_name);
-
- /* check Null field */
- ret = _check_null_field(vd);
- if (!ret) {
- ugd->popup = setting_get_notify(&vd->base,
- &(EMAIL_SETTING_STRING_WARNING),
- &(EMAIL_SETTING_STRING_FILL_MANDATORY_FIELDS), 1,
- &(EMAIL_SETTING_STRING_OK),
- _popup_ok_cb, NULL, NULL);
- return;
- }
-
- /* check character validation */
- buf = g_strdup(account->user_email_address);
-
- ret = email_get_address_validation(buf);
- if (!ret) {
- ugd->popup = setting_get_notify(&vd->base,
- &(EMAIL_SETTING_STRING_WARNING),
- &(EMAIL_SETTING_STRING_INVALID_EMAIL_ADDRESS), 1,
- &(EMAIL_SETTING_STRING_OK),
- _popup_ok_cb, NULL, NULL);
-
- g_free(buf);
- return;
- }
-
- g_free(buf);
-
- /* account info setting */
- int is_need_query = 0;
- FREE(ugd->imap_conf);
- FREE(ugd->pop_conf);
- FREE(ugd->smtp_conf);
- if (ugd->add_account_type == EMAIL_ADD_ACCOUNT_TYPE_CSC) {
- setting_set_csc_account(&vd->base);
- } else if (ugd->add_account_type == EMAIL_ADD_ACCOUNT_TYPE_EMAIL) {
-
- ugd->email_sp = NULL;
- int is_default_provider = setting_is_in_default_provider_list(&vd->base, account->user_email_address);
- if (is_default_provider)
- setting_set_default_provider_info_to_account(&vd->base, account);
- is_need_query = !is_default_provider;
-
- } else if (ugd->add_account_type == EMAIL_ADD_ACCOUNT_TYPE_OTHERS) {
- ugd->email_sp = NULL;
- int is_default_provider = setting_is_in_default_provider_list(&vd->base, account->user_email_address);
- if (is_default_provider)
- setting_set_default_provider_info_to_account(&vd->base, account);
- else
- setting_set_others_account(&vd->base);
- is_need_query = !is_default_provider;
- }
-
- if (is_need_query) {
- DELETE_EVAS_OBJECT(ugd->popup);
-
- debug_log("show popup to select IMAP/POP3");
- ugd->popup = setting_get_empty_content_notify(&vd->base, &(EMAIL_SETTING_STRING_SELECT_TYPE_OF_ACCOUNT),
- 0, NULL, NULL, NULL, NULL);
-
- Evas_Object *genlist = NULL;
- Elm_Genlist_Item_Class *itc = setting_get_genlist_class_item("type1", _popup_list_text_get_cb, NULL, NULL, NULL);
-
- genlist = elm_genlist_add(ugd->popup);
- elm_object_style_set(genlist, "popup");
-
- elm_genlist_homogeneous_set(genlist, EINA_TRUE);
- elm_scroller_policy_set(genlist, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
- elm_scroller_content_min_limit(genlist, EINA_FALSE, EINA_TRUE);
-
- int index = 0;
- for (index = 0; index < 2; index++) {
- elm_genlist_item_append(genlist, itc, (void *)(ptrdiff_t)index, NULL, ELM_GENLIST_ITEM_NONE, _popup_list_select_cb, (void *)(ptrdiff_t)index);
- }
-
- evas_object_show(genlist);
- elm_object_content_set(ugd->popup, genlist);
-
- evas_object_show(ugd->popup);
-
- } else {
- DELETE_EVAS_OBJECT(ugd->popup);
-
- debug_log("add account mode: %d", ugd->add_account_type);
- create_manual_setup_view(ugd);
- }
+ _switch_to_manual_setup((EmailSettingVD *)data);
}
static void _on_back_key(email_view_t *self)
static Eina_Bool _after_validation_cb(void *data)
{
debug_enter();
+ retvm_if(!data, ECORE_CALLBACK_CANCEL, "data is null");
EmailSettingVD *vd = data;
-
- retvm_if(!vd, ECORE_CALLBACK_CANCEL, "vd is null");
-
- EmailSettingUGD *ugd = NULL;
-
- ugd = (EmailSettingUGD *)vd->base.module;
+ EmailSettingUGD *ugd = (EmailSettingUGD *)vd->base.module;
DELETE_TIMER_OBJECT(vd->preset_vc_timer);
DELETE_EVAS_OBJECT(ugd->popup);
static Eina_Bool _startup_focus_cb(void *data)
{
debug_enter();
+ retvm_if(!data, ECORE_CALLBACK_CANCEL, "data is null");
EmailSettingVD *vd = data;
- retvm_if(!vd, ECORE_CALLBACK_CANCEL, "vd is null");
-
DELETE_TIMER_OBJECT(vd->focus_timer);
elm_object_focus_set(vd->entry_email_address.entry, EINA_TRUE);
static void _popup_ok_cb(void *data, Evas_Object *obj, void *event_info)
{
debug_enter();
-
retm_if(!data, "data is null");
EmailSettingVD *vd = data;
}
if (vd->str_email_address == NULL || vd->str_password == NULL || !email_get_address_validation(vd->str_email_address)) {
- elm_object_disabled_set(vd->manual_c_btn, EINA_TRUE);
- elm_object_disabled_set(vd->login_c_btn, EINA_TRUE);
+ elm_object_disabled_set(vd->manual_btn, EINA_TRUE);
+ elm_object_disabled_set(vd->next_btn, EINA_TRUE);
elm_entry_input_panel_return_key_disabled_set(vd->entry_password.entry, EINA_TRUE);
return;
}
if (g_strcmp0(vd->str_email_address, "") == 0 || g_strcmp0(vd->str_password, "") == 0) {
- elm_object_disabled_set(vd->manual_c_btn, EINA_TRUE);
- elm_object_disabled_set(vd->login_c_btn, EINA_TRUE);
+ elm_object_disabled_set(vd->manual_btn, EINA_TRUE);
+ elm_object_disabled_set(vd->next_btn, EINA_TRUE);
elm_entry_input_panel_return_key_disabled_set(vd->entry_password.entry, EINA_TRUE);
} else {
- elm_object_disabled_set(vd->manual_c_btn, EINA_FALSE);
- elm_object_disabled_set(vd->login_c_btn, EINA_FALSE);
+ elm_object_disabled_set(vd->manual_btn, EINA_FALSE);
+ elm_object_disabled_set(vd->next_btn, EINA_FALSE);
elm_entry_input_panel_return_key_disabled_set(vd->entry_password.entry, EINA_FALSE);
}
}
if (li->index == EMAIL_ADDRESS_LIST_ITEM) {
elm_object_focus_set(vd->entry_password.entry, EINA_TRUE);
} else if (li->index == PASSWORD_LIST_ITEM) {
- _set_cb(vd, NULL, NULL);
+ _perform_account_validation(vd);
}
}
/* initialize handle */
vd->handle = EMAIL_OP_HANDLE_INITIALIZER;
- if (response->err == EMAIL_ERROR_NONE ||
- response->err == EMAIL_ERROR_VALIDATE_ACCOUNT_OF_SMTP) {
+ if (response->err == EMAIL_ERROR_NONE || response->err == EMAIL_ERROR_VALIDATE_ACCOUNT_OF_SMTP) {
vd->is_retry_validate_with_username = 0;
DELETE_TIMER_OBJECT(vd->preset_vc_timer);
- if (response->err == EMAIL_ERROR_VALIDATE_ACCOUNT_OF_SMTP)
+
+ if (response->err == EMAIL_ERROR_VALIDATE_ACCOUNT_OF_SMTP) {
debug_warning("smtp validation failed but it can be ignored");
+ }
_update_account_capability(vd, (const char *)(response->data));
_update_account_smtp_mail_limit_size(vd, (const char *)(response->data));
vd->preset_vc_timer = ecore_timer_add(0.5, _after_validation_cb, vd);
- } else if (!(vd->is_retry_validate_with_username) &&
- (response->err != EMAIL_ERROR_CANCELLED)) {
+ } else if (!(vd->is_retry_validate_with_username) && (response->err != EMAIL_ERROR_CANCELLED)) {
vd->is_retry_validate_with_username = 1;
_set_username_before_at(vd);
_validate_account(vd);
EmailSettingUGD *ugd = (EmailSettingUGD *)vd->base.module;
email_account_t *account = ugd->new_account;
- char *buf = NULL;
- if (account->incoming_server_user_name)
+ if (account->incoming_server_user_name) {
free(account->incoming_server_user_name);
- if (account->outgoing_server_user_name)
+ }
+ if (account->outgoing_server_user_name) {
free(account->outgoing_server_user_name);
+ }
- buf = g_strdup(account->user_email_address);
+ char *buf = g_strdup(account->user_email_address);
account->incoming_server_user_name = g_strdup(strtok(buf, "@"));
- account->outgoing_server_user_name = strdup(account->incoming_server_user_name);
+ account->outgoing_server_user_name = g_strdup(account->incoming_server_user_name);
+ g_free(buf);
debug_secure("retry to validate with user name: %s", account->incoming_server_user_name);
-
- g_free(buf);
}
static char *_popup_list_text_get_cb(void *data, Evas_Object *obj, const char *part)
static void _popup_list_select_cb(void *data, Evas_Object *obj, void *event_info)
{
debug_enter();
+ retm_if(!data, "data is NULL");
- int index = (int)(ptrdiff_t)data;
- EmailSettingVD *vd = NULL;
- EmailSettingUGD *ugd = NULL;
+ Elm_Object_Item *item = event_info;
+ int index = (int)(ptrdiff_t)elm_object_item_data_get(item);
- vd = g_vd;
- ugd = (EmailSettingUGD *)vd->base.module;
+ EmailSettingVD *vd = data;
+ EmailSettingUGD *ugd = (EmailSettingUGD *)vd->base.module;
DELETE_EVAS_OBJECT(ugd->popup);
static void _push_naviframe(EmailSettingVD *vd);
static void _create_list(EmailSettingVD *vd);
-static void _create_validation_popup(EmailSettingVD *vd);
-static int _validate_account(void *data);
-static int _check_null_field(EmailSettingVD *vd);
-static int _check_validation_field(EmailSettingVD *vd);
+static void _validate_account(EmailSettingVD *vd);
+static Eina_Bool _check_null_field(EmailSettingVD *vd);
+static Eina_Bool _check_validation_field(EmailSettingVD *vd);
static void _set_username_before_at(EmailSettingVD *vd);
static void _set_username_with_email_address(EmailSettingVD *vd);
static void _read_all_entries(EmailSettingVD *vd);
static void _update_account_capability(EmailSettingVD *vd, const char *capability);
static void _update_account_smtp_mail_limit_size(EmailSettingVD *vd, const char *mail_limit_size);
+static void _perform_account_validation(EmailSettingVD *vd);
static void _show_finished_cb(void *data, Evas_Object *obj, void *event_info);
-static void _save_cb(void *data, Evas_Object *obj, void *event_info);
-static void _cancel_cb(void *data, Evas_Object *obj, void *event_info);
+static void _next_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info);
+static void _cancel_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info);
static Eina_Bool _after_validation_cb(void *data);
static void _popup_ok_cb(void *data, Evas_Object *obj, void *event_info);
static void _backup_input_cb(void *data, Evas_Object *obj, void *event_info);
static void _gl_ex_incoming_type_radio_cb(void *data, Evas_Object *obj, void *event_info);
static void _gl_ex_incoming_secure_radio_cb(void *data, Evas_Object *obj, void *event_info);
-static email_setting_string_t EMAIL_SETTING_STRING_ACCOUNT_ALREADY_EXISTS = {PACKAGE, "IDS_ST_POP_THIS_ACCOUNT_HAS_ALREADY_BEEN_ADDED"};
-static email_setting_string_t EMAIL_SETTING_STRING_ALREADY_EXIST = {PACKAGE, "IDS_ST_POP_THIS_ACCOUNT_HAS_ALREADY_BEEN_ADDED"};
static email_setting_string_t EMAIL_SETTING_STRING_EMAIL = {PACKAGE, "IDS_ST_HEADER_EMAIL"};
static email_setting_string_t EMAIL_SETTING_STRING_IMAP4 = {PACKAGE, "IDS_EMAIL_BODY_IMAP4"};
static email_setting_string_t EMAIL_SETTING_STRING_INCOMING_MAIL_SERVER_TYPE = {PACKAGE, "IDS_ST_HEADER_SERVER_TYPE_ABB"};
static email_setting_string_t EMAIL_SETTING_STRING_INCOMING_SERVER = {PACKAGE, "IDS_ST_TMBODY_SERVER_ADDRESS"};
static email_setting_string_t EMAIL_SETTING_STRING_INCOMING_SETTINGS = {PACKAGE, "IDS_ST_HEADER_INCOMING_SERVER_SETTINGS_ABB"};
static email_setting_string_t EMAIL_SETTING_STRING_OK = {PACKAGE, "IDS_EMAIL_BUTTON_OK"};
-static email_setting_string_t EMAIL_SETTING_STRING_OTHERS = {PACKAGE, "IDS_ST_MBODY_OTHER"};
static email_setting_string_t EMAIL_SETTING_STRING_OUTGOING_PORT = {PACKAGE, "IDS_ST_BODY_PORT"};
static email_setting_string_t EMAIL_SETTING_STRING_OUTGOING_SERVER = {PACKAGE, "IDS_ST_TMBODY_SERVER_ADDRESS"};
static email_setting_string_t EMAIL_SETTING_STRING_OUTGOING_SETTINGS = {PACKAGE, "IDS_ST_HEADER_OUTGOING_SERVER_SETTINGS_ABB"};
static email_setting_string_t EMAIL_SETTING_STRING_SECURE_CONNECTION = {PACKAGE, "IDS_ST_HEADER_SECURITY_TYPE_ABB"};
static email_setting_string_t EMAIL_SETTING_STRING_SSL = {PACKAGE, "IDS_ST_SBODY_SSL"};
static email_setting_string_t EMAIL_SETTING_STRING_TLS = {PACKAGE, "IDS_ST_SBODY_TLS"};
-static email_setting_string_t EMAIL_SETTING_STRING_UNABLE_TO_ADD_ACCOUNT = {PACKAGE, "IDS_ST_HEADER_UNABLE_TO_ADD_ACCOUNT_ABB"};
static email_setting_string_t EMAIL_SETTING_STRING_USER_NAME = {PACKAGE, "IDS_ST_TMBODY_USERNAME"};
-static email_setting_string_t EMAIL_SETTING_STRING_VALIDATING_ACCOUNT_ING = {PACKAGE, "IDS_ST_TPOP_VALIDATING_ACCOUNT_ING_ABB"};
-static email_setting_string_t EMAIL_SETTING_STRING_WARNING = {PACKAGE, "IDS_ST_HEADER_WARNING"};
-static email_setting_string_t EMAIL_SETTING_STRING_FILL_MANDATORY_FIELDS = {PACKAGE, "IDS_EMAIL_POP_PLEASE_FILL_ALL_THE_MANDATORY_FIELDS"};
static email_setting_string_t EMAIL_SETTING_STRING_OFF = {PACKAGE, "IDS_ST_OPT_NONE"};
static email_setting_string_t EMAIL_SETTING_STRING_NEXT = {PACKAGE, "IDS_ST_BUTTON_NEXT"};
static email_setting_string_t EMAIL_SETTING_STRING_CANCEL = {PACKAGE, "IDS_EMAIL_BUTTON_CANCEL"};
+static email_setting_string_t EMAIL_SETTING_STRING_WARNING = {PACKAGE, "IDS_ST_HEADER_WARNING"};
+static email_setting_string_t EMAIL_SETTING_STRING_FILL_MANDATORY_FIELDS = {PACKAGE, "IDS_EMAIL_POP_PLEASE_FILL_ALL_THE_MANDATORY_FIELDS"};
+static email_setting_string_t EMAIL_SETTING_STRING_ACCOUNT_ALREADY_EXISTS = {PACKAGE, "IDS_ST_POP_THIS_ACCOUNT_HAS_ALREADY_BEEN_ADDED"};
+static email_setting_string_t EMAIL_SETTING_STRING_UNABLE_TO_ADD_ACCOUNT = {PACKAGE, "IDS_ST_HEADER_UNABLE_TO_ADD_ACCOUNT_ABB"};
enum {
USERNAME_LIST_ITEM = 1,
EmailSettingUGD *ugd = (EmailSettingUGD *)vd->base.module;
vd->account = ugd->new_account;
-
- if (ugd->add_account_type == EMAIL_ADD_ACCOUNT_TYPE_OTHERS) {
- if (!vd->account->incoming_server_address) {
- /* if this is not default provider */
- vd->account->incoming_server_type = EMAIL_SERVER_TYPE_POP3;
- vd->account->incoming_server_secure_connection = 0;
- vd->account->outgoing_server_secure_connection = 0;
- }
- }
-
vd->base.content = setting_add_inner_layout(&vd->base);
_push_naviframe(vd);
static void _push_naviframe(EmailSettingVD *vd)
{
debug_enter();
- EmailSettingUGD *ugd = (EmailSettingUGD *)vd->base.module;
- Elm_Object_Item *navi_it = NULL;
- Evas_Object *next_btn = NULL;
- Evas_Object *cancel_btn = NULL;
-
- if (ugd->add_account_type == EMAIL_ADD_ACCOUNT_TYPE_OTHERS) {
- navi_it = email_module_view_push(&vd->base, EMAIL_SETTING_STRING_OTHERS.id, 0);
- elm_object_item_domain_text_translatable_set(navi_it, EMAIL_SETTING_STRING_OTHERS.domain, EINA_TRUE);
- } else if (ugd->add_account_type == EMAIL_ADD_ACCOUNT_TYPE_CSC) {
- navi_it = email_module_view_push(&vd->base, ugd->email_sp, 0);
- } else {
- navi_it = email_module_view_push(&vd->base, EMAIL_SETTING_STRING_EMAIL.id, 0);
- elm_object_item_domain_text_translatable_set(navi_it, EMAIL_SETTING_STRING_EMAIL.domain, EINA_TRUE);
- }
- Evas_Object *btn_ly = NULL;
- btn_ly = elm_layout_add(vd->base.content);
+ Elm_Object_Item *navi_it = email_module_view_push(&vd->base, EMAIL_SETTING_STRING_EMAIL.id, 0);
+ elm_object_item_domain_text_translatable_set(navi_it, EMAIL_SETTING_STRING_EMAIL.domain, EINA_TRUE);
+
+ Evas_Object *btn_ly = elm_layout_add(vd->base.content);
elm_layout_file_set(btn_ly, email_get_setting_theme_path(), "two_bottom_btn");
- cancel_btn = elm_button_add(vd->base.module->navi);
+ Evas_Object *cancel_btn = elm_button_add(vd->base.module->navi);
elm_object_style_set(cancel_btn, "bottom");
elm_object_domain_translatable_text_set(cancel_btn, EMAIL_SETTING_STRING_CANCEL.domain, EMAIL_SETTING_STRING_CANCEL.id);
- evas_object_smart_callback_add(cancel_btn, "clicked", _cancel_cb, vd);
+ evas_object_smart_callback_add(cancel_btn, "clicked", _cancel_btn_clicked_cb, vd);
elm_layout_content_set(btn_ly, "btn1.swallow", cancel_btn);
- vd->next_btn = next_btn = elm_button_add(vd->base.module->navi);
- elm_object_style_set(next_btn, "bottom");
- elm_object_domain_translatable_text_set(next_btn, EMAIL_SETTING_STRING_NEXT.domain, EMAIL_SETTING_STRING_NEXT.id);
- evas_object_smart_callback_add(next_btn, "clicked", _save_cb, vd);
- elm_layout_content_set(btn_ly, "btn2.swallow", next_btn);
+ vd->next_btn = elm_button_add(vd->base.module->navi);
+ elm_object_style_set(vd->next_btn, "bottom");
+ elm_object_domain_translatable_text_set(vd->next_btn, EMAIL_SETTING_STRING_NEXT.domain, EMAIL_SETTING_STRING_NEXT.id);
+ evas_object_smart_callback_add(vd->next_btn, "clicked", _next_btn_clicked_cb, vd);
+ elm_layout_content_set(btn_ly, "btn2.swallow", vd->next_btn);
elm_object_item_part_content_set(navi_it, "toolbar", btn_ly);
elm_object_part_content_set(vd->base.content, "elm.swallow.content", vd->genlist);
}
-static int _validate_account(void *data)
+static void _validate_account(EmailSettingVD *vd)
{
debug_enter();
- EmailSettingVD *vd = data;
- retvm_if(!vd, FALSE, "view data is null");
+ retm_if(!vd, "view data is null");
EmailSettingUGD *ugd = (EmailSettingUGD *)vd->base.module;
int error_code = 0;
vd->handle = EMAIL_OP_HANDLE_INITIALIZER;
+
if (email_engine_validate_account(ugd->new_account, &(vd->handle), &error_code)) {
debug_log("Validate account");
- _create_validation_popup(vd);
+ setting_create_account_validation_popup(&vd->base, &(vd->handle));
} else {
- debug_error("Fail to make account");
- if (error_code == EMAIL_ERROR_ALREADY_EXISTS)
+ if (error_code == EMAIL_ERROR_ALREADY_EXISTS) {
ugd->popup = setting_get_notify(&vd->base,
&(EMAIL_SETTING_STRING_WARNING),
- &(EMAIL_SETTING_STRING_ALREADY_EXIST), 1,
- &(EMAIL_SETTING_STRING_OK),
- _popup_ok_cb, NULL, NULL);
- else
+ &(EMAIL_SETTING_STRING_ACCOUNT_ALREADY_EXISTS), 1,
+ &(EMAIL_SETTING_STRING_OK), _popup_ok_cb, NULL, NULL);
+ } else {
ugd->popup = setting_get_notify(&vd->base,
&(EMAIL_SETTING_STRING_WARNING),
&(EMAIL_SETTING_STRING_UNABLE_TO_ADD_ACCOUNT), 1,
- &(EMAIL_SETTING_STRING_OK),
- _popup_ok_cb, NULL, NULL);
+ &(EMAIL_SETTING_STRING_OK), _popup_ok_cb, NULL, NULL);
+ }
}
- return TRUE;
}
-static void _create_validation_popup(EmailSettingVD *vd)
+static Eina_Bool _check_validation_field(EmailSettingVD *vd)
{
debug_enter();
-
- retm_if(!vd, "view data is null");
-
- EmailSettingUGD *ugd = (EmailSettingUGD *)vd->base.module;
- email_account_t *account = vd->account;
-
- debug_secure("account name: %s", account->account_name);
- debug_secure("email address: %s", account->user_email_address);
-
- debug_log("Start Account Validation");
- ugd->popup = setting_get_pb_process_notify(&vd->base, &(EMAIL_SETTING_STRING_VALIDATING_ACCOUNT_ING), 0,
- NULL, NULL,
- NULL, NULL,
- POPUP_BACK_TYPE_DESTROY_WITH_CANCEL_OP, &(vd->handle));
-}
-
-static int _check_validation_field(EmailSettingVD *vd)
-{
- debug_enter();
- int ret = 1;
-
GSList *l = vd->list_items;
- if (!l)
- ret = 0;
+ Eina_Bool ret = EINA_TRUE;
+ if (!l) {
+ ret = EINA_FALSE;
+ }
while (l) {
ListItemData *li = l->data;
li->index != INCOMING_SETTING_TITLE_LIST_ITEM &&
li->index != INCOMING_SECURE_CONN_LIST_ITEM) {
if (li->entry_str == NULL || !g_strcmp0(li->entry_str, "")) {
- ret = 0;
+ ret = EINA_FALSE;
break;
}
}
return ret;
}
-static int _check_null_field(EmailSettingVD *vd)
+static Eina_Bool _check_null_field(EmailSettingVD *vd)
{
debug_enter();
email_account_t *account = vd->account;
!STR_VALID(account->outgoing_server_address) ||
account->incoming_server_port_number == 0 ||
account->outgoing_server_port_number == 0) {
- return FALSE;
+ return EINA_FALSE;
} else {
- return TRUE;
+ return EINA_TRUE;
}
}
debug_enter();
GSList *l = NULL;
email_account_t *account = NULL;
- EmailSettingUGD *ugd = (EmailSettingUGD *)vd->base.module;
account = vd->account;
l = vd->list_items;
while (l) {
ListItemData *li = l->data;
if (li->index == USERNAME_LIST_ITEM) {
- char *buf = NULL;
-
- if (ugd->add_account_type == EMAIL_ADD_ACCOUNT_TYPE_OTHERS) {
- FREE(account->account_name);
- account->account_name = g_strdup(li->entry_str);
- }
- buf = g_strdup(li->entry_str);
- account->incoming_server_user_name = g_strdup(buf);
- account->outgoing_server_user_name = g_strdup(buf);
- account->user_display_name = g_strdup(buf);
- FREE(buf);
+ account->incoming_server_user_name = g_strdup(li->entry_str);
+ account->outgoing_server_user_name = g_strdup(li->entry_str);
+ account->user_display_name = g_strdup(li->entry_str);
} else if (li->index == PASSWORD_LIST_ITEM) {
account->incoming_server_password = g_strdup(li->entry_str);
} else if (li->index == OUTGOING_SERVER_LIST_ITEM) {
}
}
-static void _save_cb(void *data, Evas_Object *obj, void *event_info)
+static void _perform_account_validation(EmailSettingVD *vd)
{
- debug_enter();
- EmailSettingVD *vd = data;
- EmailSettingUGD *ugd = NULL;
- email_account_t *account = NULL;
- char *buf = NULL;
- int ret = 0;
-
- retm_if(!vd, "vd is NULL");
-
- ugd = (EmailSettingUGD *)vd->base.module;
- account = vd->account;
+ email_account_t *account = vd->account;
+ EmailSettingUGD *ugd = (EmailSettingUGD *)vd->base.module;
/* Save the data */
_read_all_entries(vd);
/* check Null field */
- ret = _check_null_field(vd);
- if (!ret) {
- debug_error("empty space in account info");
- ugd->popup = setting_get_notify(&vd->base,
+ if (!_check_null_field(vd)) {
+ ugd->popup = setting_get_notify(&(vd->base),
&(EMAIL_SETTING_STRING_WARNING),
&(EMAIL_SETTING_STRING_FILL_MANDATORY_FIELDS), 1,
- &(EMAIL_SETTING_STRING_OK),
- _popup_ok_cb, NULL, NULL);
+ &(EMAIL_SETTING_STRING_OK), _popup_ok_cb, NULL, NULL);
return;
}
/* check duplication account */
- buf = g_strdup(account->user_email_address);
- ret = setting_is_duplicate_account(buf);
- if (ret < 0) {
- ugd->popup = setting_get_notify(&vd->base,
+ if (setting_is_duplicate_account(account->user_email_address) < 0) {
+ ugd->popup = setting_get_notify(&(vd->base),
&(EMAIL_SETTING_STRING_WARNING),
&(EMAIL_SETTING_STRING_ACCOUNT_ALREADY_EXISTS), 1,
- &(EMAIL_SETTING_STRING_OK),
- _popup_ok_cb, NULL, NULL);
-
- g_free(buf);
+ &(EMAIL_SETTING_STRING_OK), _popup_ok_cb, NULL, NULL);
return;
}
- g_free(buf);
_validate_account(vd);
}
-static void _cancel_cb(void *data, Evas_Object *obj, void *event_info)
+static void _next_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ debug_enter();
+ retm_if(!data, "data is NULL");
+
+ _perform_account_validation(data);
+}
+
+static void _cancel_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info)
{
debug_enter();
retm_if(!data, "data is NULL");
EmailSettingUGD *ugd = (EmailSettingUGD *)vd->base.module;
DELETE_EVAS_OBJECT(ugd->popup);
-
- elm_object_disabled_set(vd->next_btn, EINA_FALSE);
}
static void _backup_input_cb(void *data, Evas_Object *obj, void *event_info)
ListItemData *li = data;
if (li) {
- EmailSettingVD *vd = li->vd;
- int valid = 0;
-
char *val = setting_get_entry_str(obj);
if (val && strlen(val) > 0) {
free(li->entry_str);
}
}
- valid = _check_validation_field(vd);
-
if (li->index == OUTGOING_PORT_LIST_ITEM) {
- elm_entry_input_panel_return_key_disabled_set(li->editfield.entry, !valid);
+ elm_entry_input_panel_return_key_disabled_set(li->editfield.entry, !_check_validation_field(li->vd));
}
free(val);
}
next_entry = entry_smtp_port;
elm_object_focus_set(next_entry, EINA_TRUE);
} else {
- _save_cb(vd, NULL, NULL);
+ _perform_account_validation(vd);
}
}
elm_entry_context_menu_disabled_set(li->editfield.entry, EINA_TRUE);
}
- if (li->index == OUTGOING_SERVER_LIST_ITEM)
+ if (li->index == OUTGOING_SERVER_LIST_ITEM) {
li->entry_limit = setting_set_input_entry_limit(li->editfield.entry,
0, EMAIL_LIMIT_OUTGOING_SERVER_LENGTH);
- else if (li->index == OUTGOING_PORT_LIST_ITEM)
+ } else if (li->index == OUTGOING_PORT_LIST_ITEM) {
li->entry_limit = setting_set_input_entry_limit(li->editfield.entry,
0, EMAIL_LIMIT_OUTGOING_PORT_LENGTH);
- else if (li->index == INCOMING_SERVER_LIST_ITEM)
+ } else if (li->index == INCOMING_SERVER_LIST_ITEM) {
li->entry_limit = setting_set_input_entry_limit(li->editfield.entry,
0, EMAIL_LIMIT_INCOMING_SERVER_LENGTH);
- else if (li->index == INCOMING_PORT_LIST_ITEM)
+ } else if (li->index == INCOMING_PORT_LIST_ITEM) {
li->entry_limit = setting_set_input_entry_limit(li->editfield.entry,
0, EMAIL_LIMIT_INCOMING_PORT_LENGTH);
+ }
elm_entry_cnp_mode_set(li->editfield.entry, ELM_CNP_MODE_PLAINTEXT);
elm_entry_editable_set(li->editfield.entry, TRUE);
if (li->index == OUTGOING_PORT_LIST_ITEM) {
elm_entry_input_panel_return_key_type_set(li->editfield.entry, ELM_INPUT_PANEL_RETURN_KEY_TYPE_DONE);
elm_entry_input_panel_return_key_disabled_set(li->editfield.entry, EINA_TRUE);
- }
- else
+ } else {
elm_entry_input_panel_return_key_type_set(li->editfield.entry, ELM_INPUT_PANEL_RETURN_KEY_TYPE_NEXT);
+ }
setting_set_entry_str(li->editfield.entry, li->entry_str);
evas_object_propagate_events_set(li->editfield.entry, EINA_TRUE);
evas_object_smart_callback_add(li->editfield.entry, "preedit,changed", _backup_input_cb, li);
evas_object_smart_callback_add(li->editfield.entry, "activated", _return_key_cb, li);
- if (li->index == OUTGOING_SERVER_LIST_ITEM)
+ if (li->index == OUTGOING_SERVER_LIST_ITEM) {
elm_object_domain_translatable_part_text_set(li->editfield.entry, "elm.guide",
EMAIL_SETTING_STRING_OUTGOING_SERVER.domain, EMAIL_SETTING_STRING_OUTGOING_SERVER.id);
- else if (li->index == OUTGOING_PORT_LIST_ITEM)
+ } else if (li->index == OUTGOING_PORT_LIST_ITEM) {
elm_object_domain_translatable_part_text_set(li->editfield.entry, "elm.guide",
EMAIL_SETTING_STRING_OUTGOING_PORT.domain, EMAIL_SETTING_STRING_OUTGOING_PORT.id);
- else if (li->index == INCOMING_SERVER_LIST_ITEM)
+ } else if (li->index == INCOMING_SERVER_LIST_ITEM) {
elm_object_domain_translatable_part_text_set(li->editfield.entry, "elm.guide",
EMAIL_SETTING_STRING_INCOMING_SERVER.domain, EMAIL_SETTING_STRING_INCOMING_SERVER.id);
- else if (li->index == INCOMING_PORT_LIST_ITEM)
+ } else if (li->index == INCOMING_PORT_LIST_ITEM) {
elm_object_domain_translatable_part_text_set(li->editfield.entry, "elm.guide",
EMAIL_SETTING_STRING_INCOMING_PORT.domain, EMAIL_SETTING_STRING_INCOMING_PORT.id);
-
+ }
return li->editfield.layout;
}
retm_if(!vd, "vd is NULL");
retm_if(!account, "account is NULL");
- EmailSettingUGD *ugd = (EmailSettingUGD *)vd->base.module;
- email_protocol_config_t *conf = NULL;
-
- if (server == EMAIL_SERVER_TYPE_IMAP4 && ugd->imap_conf)
- conf = ugd->imap_conf;
- else if (server == EMAIL_SERVER_TYPE_POP3 && ugd->pop_conf)
- conf = ugd->pop_conf;
- else
- conf = NULL;
-
- account->incoming_server_type = server;
- if (conf) {
- account->incoming_server_address = g_strdup(conf->server_addr);
- account->incoming_server_port_number = conf->port_number;
- account->incoming_server_secure_connection = conf->security_type;
+ if (server == EMAIL_SERVER_TYPE_IMAP4) {
+ setting_set_others_account_server_default_type(account, 0, 1, -1);
} else {
- if (server == EMAIL_SERVER_TYPE_IMAP4)
- setting_set_others_account_server_default_type(account, 0, 1, -1);
- else
- setting_set_others_account_server_default_type(account, 1, 1, -1);
+ setting_set_others_account_server_default_type(account, 1, 1, -1);
}
GSList *l = vd->list_items;
EmailSettingUGD *ugd = (EmailSettingUGD *)vd->base.module;
email_account_t *account = ugd->new_account;
- char *buf = NULL;
- if (account->incoming_server_user_name)
+ if (account->incoming_server_user_name){
free(account->incoming_server_user_name);
- if (account->outgoing_server_user_name)
+ }
+ if (account->outgoing_server_user_name) {
free(account->outgoing_server_user_name);
+ }
- buf = g_strdup(account->user_email_address);
+ char *buf = g_strdup(account->user_email_address);
account->incoming_server_user_name = g_strdup(strtok(buf, "@"));
account->outgoing_server_user_name = g_strdup(account->incoming_server_user_name);
+ g_free(buf);
debug_secure("retry to validate with user name: %s", account->incoming_server_user_name);
-
- if (buf)
- free(buf);
}
static void _set_username_with_email_address(EmailSettingVD *vd)
EmailSettingUGD *ugd = (EmailSettingUGD *)vd->base.module;
email_account_t *account = ugd->new_account;
- char *buf = NULL;
- if (account->incoming_server_user_name)
+ if (account->incoming_server_user_name) {
free(account->incoming_server_user_name);
- if (account->outgoing_server_user_name)
+ }
+ if (account->outgoing_server_user_name) {
free(account->outgoing_server_user_name);
+ }
- buf = g_strdup(account->user_email_address);
- account->incoming_server_user_name = g_strdup(buf);
- account->outgoing_server_user_name = g_strdup(buf);
+ if (account->user_email_address) {
+ account->incoming_server_user_name = strdup(account->user_email_address);
+ account->outgoing_server_user_name = strdup(account->user_email_address);
+ }
debug_secure("retry to validate with user name: %s", account->incoming_server_user_name);
-
- if (buf)
- free(buf);
}
static void _show_finished_cb(void *data, Evas_Object *obj, void *event_info)
DELETE_EVAS_OBJECT(vd->ctx_popup);
- create_account_setup_view(ugd, ugd->add_account_type, NULL, NULL);
+ create_account_setup_view(ugd);
}
static int _update_list(EmailSettingVD *vd)
EmailSettingVD *vd = (EmailSettingVD *)self;
EmailSettingUGD *ugd = (EmailSettingUGD *)vd->base.module;
- if (ugd->add_account) {
- vd->account_data = ugd->new_account;
- } else {
- if (!setting_get_acct_full_data(ugd->account_id, &(vd->account_data))) {
- debug_error("setting_get_acct_full_data failed");
- return -1;
- }
+ if (!setting_get_acct_full_data(ugd->account_id, &(vd->account_data))) {
+ debug_error("setting_get_acct_full_data failed");
+ return -1;
}
EMAIL_SETTING_PRINT_ACCOUNT_INFO(vd->account_data);
EmailSettingVD *vd = (EmailSettingVD *)self;
EmailSettingUGD *ugd = (EmailSettingUGD *)vd->base.module;
- if (ugd->add_account) {
- vd->account_data = ugd->new_account;
- } else {
- if (!setting_get_acct_full_data(ugd->account_id, &(vd->account_data))) {
- debug_error("setting_get_acct_full_data failed");
- return -1;
- }
+ if (!setting_get_acct_full_data(ugd->account_id, &(vd->account_data))) {
+ debug_error("setting_get_acct_full_data failed");
+ return -1;
}
+
EMAIL_SETTING_PRINT_ACCOUNT_INFO(vd->account_data);
vd->base.content = setting_add_inner_layout(&vd->base);
_push_naviframe(vd);
}
/* read account info again. */
- if (ugd->add_account) {
- vd->account_data = ugd->new_account;
- } else {
- if (vd->account_data) {
- email_engine_free_account_list(&vd->account_data, 1);
- vd->account_data = NULL;
- }
- if (!setting_get_acct_full_data(ugd->account_id, &vd->account_data)) {
- debug_error("setting_get_acct_full_data failed");
- return;
- }
+ if (vd->account_data) {
+ email_engine_free_account_list(&vd->account_data, 1);
+ vd->account_data = NULL;
+ }
+
+ if (!setting_get_acct_full_data(ugd->account_id, &vd->account_data)) {
+ debug_error("setting_get_acct_full_data failed");
+ return;
}
+
EMAIL_SETTING_PRINT_ACCOUNT_INFO(vd->account_data);
_create_list(vd);