From: Jose Dapena Paz Date: Thu, 21 Feb 2008 09:31:22 +0000 (+0000) Subject: Changes to fix NB#80521. X-Git-Tag: git_migration_finished~1641 X-Git-Url: http://git.maemo.org/git/?p=modest;a=commitdiff_plain;h=3aaa3f4b34256495c99197096625357b66c00289 Changes to fix NB#80521. * src/modest-tny-mime-part.c: * Now we recognise a purged attachment as an attachment for modest. * src/maemo/modest-msg-view-window.c: * As we now detect purged attachments as attachments, we filter here to disallow saving purged attachments. * src/modest-ui-dimming-rules.c: * Remove invalid_account_for_purge as it was wrong, and it's now superseeded by _invalid_folder_for_purge. pmo-trunk-r4217 --- diff --git a/src/maemo/modest-msg-view-window.c b/src/maemo/modest-msg-view-window.c index 78bf0e5..ed507f4 100644 --- a/src/maemo/modest-msg-view-window.c +++ b/src/maemo/modest-msg-view-window.c @@ -2587,7 +2587,8 @@ modest_msg_view_window_save_attachments (ModestMsgViewWindow *window, TnyList *m TnyMimePart *mime_part = (TnyMimePart *) tny_iterator_get_current (iter); g_object_unref (iter); if (!modest_tny_mime_part_is_msg (mime_part) && - modest_tny_mime_part_is_attachment_for_modest (mime_part)) { + modest_tny_mime_part_is_attachment_for_modest (mime_part) && + !tny_mime_part_is_purged (mime_part)) { filename = tny_mime_part_get_filename (mime_part); } else { /* TODO: show any error? */ @@ -2634,7 +2635,8 @@ modest_msg_view_window_save_attachments (ModestMsgViewWindow *window, TnyList *m while (!tny_iterator_is_done (iter)) { TnyMimePart *mime_part = (TnyMimePart *) tny_iterator_get_current (iter); - if ((modest_tny_mime_part_is_attachment_for_modest (mime_part)) && + if ((modest_tny_mime_part_is_attachment_for_modest (mime_part)) && + !tny_mime_part_is_purged (mime_part) && (tny_mime_part_get_filename (mime_part) != NULL)) { SaveMimePartPair *pair; diff --git a/src/modest-tny-mime-part.c b/src/modest-tny-mime-part.c index 1500120..993664d 100644 --- a/src/modest-tny-mime-part.c +++ b/src/modest-tny-mime-part.c @@ -85,7 +85,7 @@ modest_tny_mime_part_is_attachment_for_modest (TnyMimePart *part) g_return_val_if_fail (part && TNY_IS_MIME_PART(part), FALSE); /* if tinymail thinks it's an attachment, it definitely is */ - if (tny_mime_part_is_attachment (part)) + if (tny_mime_part_is_attachment (part) || tny_mime_part_is_purged (part)) return TRUE; /* if the mime part is a message itself (ie. embedded), it's an attachment */ diff --git a/src/modest-ui-dimming-rules.c b/src/modest-ui-dimming-rules.c index f3846e4..c5ec36b 100644 --- a/src/modest-ui-dimming-rules.c +++ b/src/modest-ui-dimming-rules.c @@ -70,7 +70,6 @@ static gboolean _msg_download_in_progress (ModestWindow *win); static gboolean _msg_download_completed (ModestMainWindow *win); static gboolean _selected_msg_sent_in_progress (ModestWindow *win); static gboolean _sending_in_progress (ModestWindow *win); -static gboolean _invalid_account_for_purge (ModestWindow *win, ModestDimmingRule *rule); static gboolean _invalid_folder_for_purge (ModestWindow *win, ModestDimmingRule *rule); static gboolean _transfer_mode_enabled (ModestWindow *win); static gboolean _selected_folder_has_subfolder_with_same_name (ModestWindow *win); @@ -1240,11 +1239,6 @@ modest_ui_dimming_rules_on_remove_attachments (ModestWindow *win, gpointer user_ } } - /* cannot purge in pop accounts */ - if (!dimmed) { - dimmed = _invalid_account_for_purge (win, rule); - } - /* cannot purge in editable drafts nor pop folders */ if (!dimmed) { dimmed = _invalid_folder_for_purge (win, rule); @@ -2602,49 +2596,6 @@ _sending_in_progress (ModestWindow *win) } static gboolean -_invalid_account_for_purge (ModestWindow *win, - ModestDimmingRule *rule) -{ - const gchar *account_name; - ModestTnyAccountStore *account_store; - TnyAccount *store_account = NULL; - gboolean result = FALSE; - const gchar *protocol_name; - - account_name = modest_window_get_active_account (win); - if (account_name == NULL) - goto frees; - - account_store = modest_runtime_get_account_store (); - store_account = modest_tny_account_store_get_server_account (account_store, account_name, TNY_ACCOUNT_TYPE_STORE); - if (store_account == NULL) - goto frees; - - protocol_name = tny_account_get_proto (store_account); - if (modest_protocol_info_get_transport_store_protocol (protocol_name) == MODEST_PROTOCOL_STORE_POP) { - gint n_selected = 0; - result = TRUE; - - if (MODEST_IS_MSG_VIEW_WINDOW (win)) { - TnyList *attachments; - attachments = modest_msg_view_window_get_attachments (MODEST_MSG_VIEW_WINDOW(win)); - n_selected = tny_list_get_length (attachments); - g_object_unref (attachments); - } - - modest_dimming_rule_set_notification (rule, - ngettext ("mail_ib_unable_to_pure_attach_pop_mail_singular", - "mail_ib_unable_to_pure_attach_pop_mail_plural", - n_selected)); - - } -frees: - if (store_account) - g_object_unref (store_account); - return result; -} - -static gboolean _invalid_folder_for_purge (ModestWindow *win, ModestDimmingRule *rule) {