X-Git-Url: http://git.maemo.org/git/?a=blobdiff_plain;f=src%2Fmodest-mail-operation.c;h=08318087030961b15416a4b88726c95c6870b796;hb=ce57cdcc1da651d4c18119dcd9b73898c770b54b;hp=f2eb6c0fe468f1afcd4886dca8081784f79fcc44;hpb=c1516caebe8c4bebeb60d84d77f2cc678d84486e;p=modest diff --git a/src/modest-mail-operation.c b/src/modest-mail-operation.c index f2eb6c0..0831808 100644 --- a/src/modest-mail-operation.c +++ b/src/modest-mail-operation.c @@ -35,6 +35,8 @@ #include #include #include +#include +#include #include #include #include @@ -644,7 +646,7 @@ modest_mail_operation_save_to_drafts (ModestMailOperation *self, header = tny_msg_get_header (draft_msg); /* Remove the old draft expunging it */ tny_folder_remove_msg (folder, header, NULL); - tny_folder_sync (folder, TRUE, &(priv->error)); + tny_folder_sync (folder, FALSE, &(priv->error)); /* FALSE --> don't expunge */ g_object_unref (header); } @@ -1338,9 +1340,6 @@ transfer_folder_status_cb (GObject *obj, self = MODEST_MAIL_OPERATION (user_data); priv = MODEST_MAIL_OPERATION_GET_PRIVATE(self); - if ((status->position == 1) && (status->of_total == 100)) - return; - priv->done = status->position; priv->total = status->of_total; @@ -1630,9 +1629,6 @@ get_msg_status_cb (GObject *obj, if(priv->status == MODEST_MAIL_OPERATION_STATUS_CANCELED) return; - if ((status->position == 1) && (status->of_total == 100)) - return; - priv->done = 1; priv->total = 1; @@ -1872,9 +1868,8 @@ modest_mail_operation_get_msgs_full (ModestMailOperation *self, void -modest_mail_operation_remove_msg (ModestMailOperation *self, - TnyHeader *header, - gboolean remove_to_trash) +modest_mail_operation_remove_msg (ModestMailOperation *self, TnyHeader *header, + gboolean remove_to_trash /*ignored*/) { TnyFolder *folder; ModestMailOperationPrivate *priv; @@ -1882,6 +1877,9 @@ modest_mail_operation_remove_msg (ModestMailOperation *self, g_return_if_fail (MODEST_IS_MAIL_OPERATION (self)); g_return_if_fail (TNY_IS_HEADER (header)); + if (remove_to_trash) + g_warning ("remove to trash is not implemented"); + priv = MODEST_MAIL_OPERATION_GET_PRIVATE (self); folder = tny_header_get_folder (header); @@ -1890,46 +1888,21 @@ modest_mail_operation_remove_msg (ModestMailOperation *self, priv->status = MODEST_MAIL_OPERATION_STATUS_IN_PROGRESS; - /* Delete or move to trash */ - if (remove_to_trash) { - TnyFolder *trash_folder; - TnyStoreAccount *store_account; - - store_account = TNY_STORE_ACCOUNT (modest_tny_folder_get_account (folder)); - trash_folder = modest_tny_account_get_special_folder (TNY_ACCOUNT(store_account), - TNY_FOLDER_TYPE_TRASH); - if (trash_folder) { - TnyList *headers; - - /* Create list */ - headers = tny_simple_list_new (); - tny_list_append (headers, G_OBJECT (header)); - g_object_unref (header); - - /* Move to trash */ - modest_mail_operation_xfer_msgs (self, headers, trash_folder, TRUE, NULL, NULL); - g_object_unref (headers); -/* g_object_unref (trash_folder); */ - } else { - ModestMailOperationPrivate *priv; - - /* Set status failed and set an error */ - priv = MODEST_MAIL_OPERATION_GET_PRIVATE(self); - priv->status = MODEST_MAIL_OPERATION_STATUS_FAILED; - g_set_error (&(priv->error), MODEST_MAIL_OPERATION_ERROR, - MODEST_MAIL_OPERATION_ERROR_ITEM_NOT_FOUND, - _("Error trying to delete a message. Trash folder not found")); - } - g_object_unref (G_OBJECT (store_account)); - } else { - tny_folder_remove_msg (folder, header, &(priv->error)); - if (!priv->error) { - tny_header_set_flags (header, TNY_HEADER_FLAG_DELETED); - tny_folder_sync(folder, TRUE, &(priv->error)); - } + tny_folder_remove_msg (folder, header, &(priv->error)); + if (!priv->error) { + tny_header_set_flags (header, TNY_HEADER_FLAG_DELETED); + + if (TNY_IS_CAMEL_IMAP_FOLDER (folder)) + tny_folder_sync(folder, FALSE, &(priv->error)); /* FALSE --> don't expunge */ + else if (TNY_IS_CAMEL_POP_FOLDER (folder)) + tny_folder_sync(folder, TRUE, &(priv->error)); /* TRUE --> expunge */ + else + /* lcoal folders */ + tny_folder_sync(folder, TRUE, &(priv->error)); /* TRUE --> expunge */ } - + + /* Set status */ if (!priv->error) priv->status = MODEST_MAIL_OPERATION_STATUS_SUCCESS; @@ -1963,9 +1936,6 @@ transfer_msgs_status_cb (GObject *obj, self = helper->mail_op; priv = MODEST_MAIL_OPERATION_GET_PRIVATE(self); - if ((status->position == 1) && (status->of_total == 100)) - return; - priv->done = status->position; priv->total = status->of_total;