apply the latest changes
authordavid8.kim <david8.kim@samsung.com>
Wed, 17 Oct 2012 06:55:33 +0000 (15:55 +0900)
committerdavid8.kim <david8.kim@samsung.com>
Wed, 17 Oct 2012 06:55:33 +0000 (15:55 +0900)
account/src/email-account-folder.c
mailbox/include/email-mailbox.h
mailbox/src/email-mailbox-controlbar.c
mailbox/src/email-mailbox-item.c
mailbox/src/email-mailbox-list.c
mailbox/src/email-mailbox-sweep.c
mailbox/src/email-mailbox.c

index d0f2970..0f77bfe 100755 (executable)
@@ -784,8 +784,12 @@ static char *_gl_label_get_for_subitem(void *data, Evas_Object *obj, const char
 
        if (!strcmp(part, "elm.text")) {
                if (mlist->alias != NULL) {
-                       snprintf(tmp, sizeof(tmp), "%s [%d/%d]", mlist->alias,
-                                       mlist->unread_count, mlist->total_mail_count_on_local);
+                       if(mlist->no_select == 1) {
+                               snprintf(tmp, sizeof(tmp), "%s", mlist->alias);
+                       } else {
+                               snprintf(tmp, sizeof(tmp), "%s [%d/%d]", mlist->alias,
+                                               mlist->unread_count, mlist->total_mail_count_on_local);
+                       }
                        debug_log("%s : tree_item_data: %p, tree_item_data->it: %p", tmp, tree_item_data, tree_item_data->it);
                        return g_strdup(tmp);
                }
@@ -1318,6 +1322,12 @@ static void _gl_exp_sel(void *data, Evas_Object *obj, void *event_info)
 
                elm_genlist_item_update(it);
 
+               if(mlist->no_select == 1) {
+                       debug_log("Noselect folder is selected");
+                       return;
+               }
+
+
                service_h service;
                if (SERVICE_ERROR_NONE != service_create(&service))
                {
index 51adbd6..df9cc73 100755 (executable)
@@ -330,7 +330,6 @@ struct ug_data {
        MailboxAdvSearchViewInfo *adv_search_info;
        gboolean b_advanced_search_view;
        int emf_handle;
-       EmailAccountInfo *account_info;
        E_DBus_Connection *edbus_conn;
        gchar *prev_group_title;
        //email_sender_list *sender_list;
index 96cdd3b..8e7865a 100755 (executable)
@@ -838,6 +838,20 @@ static void _move_mail_cb(void *data, Evas_Object *obj, void *event_info)
 
        EmailMailboxUGD *mailbox_ugd = (EmailMailboxUGD *)data;
 
+       if (mailbox_ugd->mode == EMAIL_MAILBOX_MODE_ALL) {
+               Eina_List *list = edit_list;
+               list_data* ld = eina_list_data_get(list);
+               int first_account_id = ld->account_id;
+
+               Eina_List* cur = NULL;
+               EINA_LIST_FOREACH(list, cur, ld) {
+                       if (first_account_id != ld->account_id) {
+                               debug_log("first_account_id : %d, account_id : %d", first_account_id, ld->account_id);
+                               return;
+                       }
+               }
+       }
+
        _delete_selection_info(mailbox_ugd);
        mailbox_process_move_mail(mailbox_ugd);
 }
index 33cc591..de59baf 100755 (executable)
@@ -243,38 +243,9 @@ void mailbox_process_move_mail(EmailMailboxUGD *mailbox_ugd)
                list_data *ld = eina_list_data_get(nth_list);
 
                /* save the mail-id to be moved */
-               if (mailbox_ugd->previous_view == EMAIL_VIEW_UNREAD ||
-                       mailbox_ugd->previous_view == EMAIL_VIEW_IMPORTANT ||
-                       mailbox_ugd->previous_view == EMAIL_VIEW_ATTACHMENTS ||
-                       mailbox_ugd->previous_view == EMAIL_VIEW_PRIORITY ||
-                       mailbox_ugd->previous_view == EMAIL_VIEW_RECIPIENT ||
-                       mailbox_ugd->mode == EMAIL_MAILBOX_MODE_MAILBOX ||
-                       mailbox_ugd->b_thread_list == false)
-               {
-                       debug_log("not Thread... previous_view[%d]", mailbox_ugd->previous_view);
-                       int mail_id = ld->mail_id;
-                       mailbox_ugd->selected_list =
-                               g_list_prepend(mailbox_ugd->selected_list, GINT_TO_POINTER(mail_id));
-               }
-               /* get mails of thread id and add them to selected_list */
-               else {
-                       /* Get thread mail list */
-                       email_mail_list_item_t *mailbox_data = NULL;
-                       int mail_count = 0;
-                       int err = email_get_mail_list(ld->account_id, 0, ld->thread_id,
-                                                               -1, /* start_index */
-                                                               -1, /* limit_count */
-                                                               _mailbox_conv_sort_type(mailbox_ugd->sort_type), &mailbox_data, &mail_count);
-                       if( err != EMAIL_ERROR_NONE ) {
-                               debug_warning("email_get_mail_list_ex - err(%d)", err);
-                       }
-                       int k = 0;
-                       for( ; k<mail_count ; k++ )
-                               mailbox_ugd->selected_list = g_list_prepend(mailbox_ugd->selected_list,
-                                                                                                               GINT_TO_POINTER(mailbox_data[k].mail_id));
-                       FREE(mailbox_data);
-               }
-
+               debug_log("not Thread... previous_view[%d]", mailbox_ugd->previous_view);
+               int mail_id = ld->mail_id;
+               mailbox_ugd->selected_list = g_list_prepend(mailbox_ugd->selected_list, GINT_TO_POINTER(mail_id));
        }
 
 
@@ -301,120 +272,85 @@ void mailbox_process_delete_mail(void* data, Ecore_Thread *thd)
        int i = 0;
        int max_account_id = email_engine_get_max_account_id();
        int result = EMAIL_ERROR_UNKNOWN;
+       int is_trash = false;
 
        if (max_account_id < 0) {
-               debug_error("Invalid max_account_id was returned.");
+               debug_error("Invalid max_account_id(%d) was returned.", max_account_id);
                return;
        }
 
-       GList *move_mail_list[max_account_id];
-       memset(move_mail_list, 0, max_account_id*sizeof(GList *));
-
-       /* delete list and count */
-       GList *del_mail_list = NULL;
+       GList *mail_list[max_account_id];
+       memset(mail_list, 0, max_account_id*sizeof(GList *));
 
        Eina_List *list = edit_list;
        int checked_count = eina_list_count(list);
        debug_log("checked_count: %d", checked_count);
        if (checked_count <= 0) return;
 
-       /* if single mail view (not threaded view), */
-       if (previous_view == EMAIL_VIEW_UNREAD ||
-               previous_view == EMAIL_VIEW_IMPORTANT ||
-               previous_view == EMAIL_VIEW_PRIORITY ||
-               previous_view == EMAIL_VIEW_ATTACHMENTS ||
-               previous_view == EMAIL_VIEW_RECIPIENT ||
-               mailbox_ugd->mode == EMAIL_MAILBOX_MODE_MAILBOX ||
-               mailbox_ugd->b_thread_list == false)
-       {
-               /* get the first item and check if item is in trash box. if so, all other items are in trash */
-               list_data* ld = eina_list_data_get(list);
-               int is_trash = (GET_MAILBOX_TYPE(ld->mailbox_id) == EMAIL_MAILBOX_TYPE_TRASH)? 1:0;
-
-               Eina_List* cur = NULL;
-               EINA_LIST_FOREACH(list, cur, ld)
-               {
-                       if ( is_trash )
-                               del_mail_list =
-                                       g_list_prepend(del_mail_list, GINT_TO_POINTER(ld->mail_id));
-                       else
-                               move_mail_list[ld->account_id-1] =
-                                       g_list_prepend(move_mail_list[ld->account_id-1], GINT_TO_POINTER(ld->mail_id));
-               }
-       }
-       /* if threaded mail view */
-       else if (previous_view == EMAIL_VIEW_DATE)
-       {
-               /* Get thread mail list */
-               Eina_List* cur = NULL;
-               list_data* ld = NULL;
-               EINA_LIST_FOREACH(list, cur, ld)
-               {
-
-                       int count = 0;
-                       int acct = ld->account_id;
-                       if( acct <= 0 ) {
-                               debug_log("acct(%d) should be positive", acct);
-                       }
-                       email_mail_list_item_t *mail_list = NULL;
-                       int e = email_get_mail_list(acct, 0, ld->thread_id, -1, -1,
-                                                                                               _mailbox_conv_sort_type(mailbox_ugd->sort_type), &mail_list, &count);
-                       debug_log("id %d, count %d", acct, count);
-                       if( e != EMAIL_ERROR_NONE || !mail_list ) {
-                               debug_warning("email_get_mail_list -err(%d), acct(%d), th_id(%d), sort(%d) or mail_list NULL(%p)",
-                                                               e, acct, NULL, ld->thread_id, mailbox_ugd->sort_type, mail_list);
-                               continue;
-                       }
-                       int i=0;
-                       for( ; i < count ; i++ )
-                               move_mail_list[acct-1] =
-                                       g_list_prepend(move_mail_list[acct-1], GINT_TO_POINTER(mail_list[i].mail_id));
-
-                       FREE(mail_list);
-               }
-       }
-
+       /* get the first item and check if item is in trash box. if so, all other items are in trash */
+       list_data* ld = eina_list_data_get(list);
+       is_trash = (GET_MAILBOX_TYPE(ld->mailbox_id) == EMAIL_MAILBOX_TYPE_TRASH)? 1:0;
 
-       /* delete routine */
-       if ( del_mail_list )
+       Eina_List* cur = NULL;
+       EINA_LIST_FOREACH(list, cur, ld)
        {
-               int count = g_list_length(del_mail_list);
-               int mail_ids[count]; memset(mail_ids, 0, sizeof(mail_ids));
-               int i=0;
-               GList* cur = g_list_first(del_mail_list);
-               for ( ; i < count; ++i, cur = g_list_next(cur)) {
-                       mail_ids[i] = (int) g_list_nth_data(cur, 0);
-               }
-
-               result = email_delete_mail(mailbox_ugd->mailbox_id, mail_ids, count, EMAIL_DELETE_LOCAL_AND_SERVER);
-
-               if (result != EMAIL_ERROR_NONE) {
-                       debug_warning("email_delete_message account_id(%d) count(%d)- err (%d)",
-                                                                               mailbox_ugd->account_id, count, result);
-               }
+               mail_list[ld->account_id-1] = g_list_prepend(mail_list[ld->account_id-1], GINT_TO_POINTER(ld->mail_id));
        }
 
-       /* move-mails-to-trash routine */
+       /* move or delete mails rutine.*/
        int acct = 0;
        for ( acct = 0; acct < max_account_id; ++acct) {
-               if ( !move_mail_list[acct]) continue;
-               else
-               {
+               if ( !mail_list[acct]) continue;
+               else    {
                        /* convert GList to int array */
-                       int count = g_list_length(move_mail_list[acct]);
+                       int count = g_list_length(mail_list[acct]);
                        int mail_ids[count]; memset(mail_ids, 0, sizeof(mail_ids));
                        int i=0;
-                       GList* cur = g_list_first(move_mail_list[acct]);
+                       GList* cur = g_list_first(mail_list[acct]);
                        for( ; i < count ; i++, cur=g_list_next(cur))
                                mail_ids[i] = (int) g_list_nth_data(cur, 0);
 
-                       /* making dest folder - trash */
-                       int trashbox_id = GET_MAILBOX_ID(acct+1, EMAIL_MAILBOX_TYPE_TRASH);
+                       debug_log("account_id : %d, count : %d", acct+1, count);
+
+                       if (is_trash) {
+                               email_delete_option_t delete_option = EMAIL_DELETE_LOCAL_AND_SERVER;
+
+                               if (GET_ACCOUNT_SERVER_TYPE(acct+1) == EMAIL_SERVER_TYPE_POP3) {
+                                       debug_log("EMAIL_SERVER_TYPE_POP3..");
+                                       email_account_t *account_data = NULL;
+                                       if (email_engine_get_account_full_data(acct+1, &account_data)) {
+                                               if (account_data) {
+                                                       account_user_data_t *user_data = (account_user_data_t*)account_data->user_data;
+                                                       if (user_data != NULL) {
+                                                               debug_log("pop3_deleting_option:%d", user_data->pop3_deleting_option);
+                                                               if (user_data->pop3_deleting_option == 0) {
+                                                                       delete_option = EMAIL_DELETE_LOCALLY;
+                                                               } else if (user_data->pop3_deleting_option == 1) {
+                                                                       delete_option = EMAIL_DELETE_LOCAL_AND_SERVER;
+                                                               }
+                                                       }
+                                                       email_free_account(&account_data, 1);
+                                                       account_data = NULL;
+                                               }
+                                       }
+                               }
+
+                               int trashbox_id = GET_MAILBOX_ID(acct+1, EMAIL_MAILBOX_TYPE_TRASH);
+
+                               result = email_delete_mail(trashbox_id, mail_ids, count, delete_option);
+                               if (result != EMAIL_ERROR_NONE) {
+                                       debug_warning("email_delete_message mailbox_id(%d) count(%d)- err (%d)",
+                                                                                               mailbox_ugd->mailbox_id, count, result);
+                               }
+                       } else {
+                               /* making dest folder - trash */
+                               int trashbox_id = GET_MAILBOX_ID(acct+1, EMAIL_MAILBOX_TYPE_TRASH);
 
-                       result = email_move_mail_to_mailbox(mail_ids, count, trashbox_id);
-                       if (result != EMAIL_ERROR_NONE) {
-                               debug_warning("email_move_mail_to_mailbox acct(%d) folder_id(%d) num(%d) - err (%d)",
-                                                               acct+1, trashbox_id, count, result);
+                               result = email_move_mail_to_mailbox(mail_ids, count, trashbox_id);
+                               if (result != EMAIL_ERROR_NONE) {
+                                       debug_warning("email_move_mail_to_mailbox num(%d) folder_id(%d) - err (%d)",
+                                                                       count, trashbox_id, result);
+                               }
                        }
                }
        }
@@ -428,16 +364,10 @@ void mailbox_process_delete_mail(void* data, Ecore_Thread *thd)
                }
        }
 
-//CLEANUP:
-
-       if (del_mail_list) {
-               g_list_free(del_mail_list);
-       }
-
        for (i = 0; i < max_account_id; ++i) {
-               if (move_mail_list[i] != NULL) {
-                       g_list_free(move_mail_list[i]);
-                       move_mail_list[i] = NULL;
+               if (mail_list[i] != NULL) {
+                       g_list_free(mail_list[i]);
+                       mail_list[i] = NULL;
                }
        }
 
index ac4075b..2c4b984 100755 (executable)
@@ -1061,7 +1061,7 @@ void email_maillist_select_info(EmailMailboxUGD *mailbox_ugd)
        char text[128];
 
        /* Set the layout theme */
-       elm_layout_theme_set(mailbox_ugd->selectioninfo_layout, "standard", "selectioninfo", "default");
+       elm_layout_theme_set(mailbox_ugd->selectioninfo_layout, "standard", "selectioninfo", "center_text");
 
        if (!cnt) {
                elm_object_signal_emit(mailbox_ugd->sub_layout[mailbox_ugd->previous_view], "hide_selection_info", "elm");
index 045fbd6..a2d7489 100755 (executable)
@@ -204,28 +204,20 @@ static void _sweep_reply_cb(void *data, Evas_Object *obj, void *event_info)
                return;
        }
        list_data *ld = (list_data *)data;
-//     EmailMailboxUGD *mailbox_ugd = (EmailMailboxUGD *)(ld->mailbox_ugd);
 
        debug_log("mailbox_ugd->account_id: %d", ld->account_id);
        debug_log("ld->mail_id: %d", ld->mail_id);
 
-       email_mailbox_t *mbox = NULL;
-       int e = email_get_mailbox_by_mailbox_id(ld->mailbox_id, &mbox);
-       if (e != EMAIL_ERROR_NONE) {
-               debug_log("email_get_mailbox_by_mailbox_id mailbox_id(%d)- err[%d]", ld->mailbox_id, e);
-               goto CLEANUP;
-       }
-
        if (ld->mailbox_ugd->ug_composer) {
                debug_log("Composer UG is already launched");
-               goto CLEANUP;
+               return;
        }
 
        service_h service;
        if (SERVICE_ERROR_NONE != service_create(&service))
        {
                debug_log("creating service handle failed");
-               goto CLEANUP;
+               return;
        }
 
        char cmd[30] = { 0, };
@@ -245,9 +237,6 @@ static void _sweep_reply_cb(void *data, Evas_Object *obj, void *event_info)
        ld->mailbox_ugd->ug_composer = create_composer_ug(UG_NAME_EMAIL_COMPOSER, service, ld->mailbox_ugd);
        service_destroy(service);
 
-CLEANUP:
-       email_free_mailbox(&mbox, 1);
-
 }
 
 static void _sweep_forward_cb(void *data, Evas_Object *obj, void *event_info)
@@ -263,23 +252,16 @@ static void _sweep_forward_cb(void *data, Evas_Object *obj, void *event_info)
        debug_log("mailbox_ugd->account_id: %d", ld->account_id);
        debug_log("ld->mail_id: %d", ld->mail_id);
 
-       email_mailbox_t *mbox = NULL;
-       int e = email_get_mailbox_by_mailbox_id(ld->mailbox_id, &mbox);
-       if (e != EMAIL_ERROR_NONE) {
-               debug_log("email_get_mailbox_by_mailbox_id mailbox_id(%d)- err[%d]", ld->mailbox_id, e);
-               goto CLEANUP;
-       }
-
        if (ld->mailbox_ugd->ug_composer) {
                debug_log("Composer UG is already launched");
-               goto CLEANUP;
+               return;
        }
 
        service_h service;
        if (SERVICE_ERROR_NONE != service_create(&service))
        {
                debug_log("creating service handle failed");
-               goto CLEANUP;
+               return;
        }
 
        char cmd[30] = { 0, };
@@ -299,9 +281,6 @@ static void _sweep_forward_cb(void *data, Evas_Object *obj, void *event_info)
        ld->mailbox_ugd->ug_composer = create_composer_ug(UG_NAME_EMAIL_COMPOSER, service, ld->mailbox_ugd);
        service_destroy(service);
 
-CLEANUP:
-       email_free_mailbox(&mbox, 1);
-
 }
 
 static void _sweep_mark_as_read_unread_cb(void *data, Evas_Object *obj, void *event_info)
index 9bfb432..617d528 100755 (executable)
@@ -1291,7 +1291,7 @@ void _sync_all_folder(EmailMailboxUGD *mailbox_ugd)
 
        err = email_sync_header_for_all_account(&handle);
 
-       if (err == 0) {
+       if (err != EMAIL_ERROR_NONE) {
                debug_critical("fail to sync header for all account - err(%d)", err);
                return;
        }