diff options
-rw-r--r-- | mail/ChangeLog | 11 | ||||
-rw-r--r-- | mail/em-folder-view.c | 105 | ||||
-rw-r--r-- | mail/evolution-mail.schemas.in | 15 | ||||
-rw-r--r-- | mail/mail.error.xml | 9 |
4 files changed, 116 insertions, 24 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index cd101439cc..38a591d531 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,14 @@ +2007-11-12 Milan Crha <mcrha@redhat.com> + + ** Fix for bug #263236 + + * mail.error.xml: New message "ask-delete-vfolder-msg". + * em-folder-view.c: (emfv_delete_msg_response), + (emfv_popup_delete): When deleting from vFolder, ask if really want + to and warn about deleting in a real folder too. + * evolution-mail.schemas.in: New option + "/apps/evolution/mail/prompts/delete_in_vfolder" to not ask again. + 2007-11-08 Matthew Barnes <mbarnes@redhat.com> * em-folder-selector.h: diff --git a/mail/em-folder-view.c b/mail/em-folder-view.c index aaa3b00024..5ec86facb3 100644 --- a/mail/em-folder-view.c +++ b/mail/em-folder-view.c @@ -58,6 +58,7 @@ #include <camel/camel-vee-folder.h> #include <camel/camel-disco-store.h> #include <camel/camel-offline-store.h> +#include <camel/camel-vee-store.h> #include <bonobo/bonobo-main.h> #include <bonobo/bonobo-object.h> @@ -1031,42 +1032,98 @@ emfv_popup_mark_nojunk (EPopup *ep, EPopupItem *pitem, void *data) message_list_select(emfv->list, MESSAGE_LIST_SELECT_NEXT, 0, 0); } +#define DelInVFolderCheckName "DelInVFolderCheck" +#define DelInVFolderKey "/apps/evolution/mail/prompts/delete_in_vfolder" + static void -emfv_popup_delete(EPopup *ep, EPopupItem *pitem, void *data) +emfv_delete_msg_response (GtkWidget *dialog, int response, gpointer data) { - EMFolderView *emfv = data; - int count; - GPtrArray *uids; + if (response == GTK_RESPONSE_OK) { + EMFolderView *emfv = data; + int count; + GPtrArray *uids; - uids = message_list_get_selected(emfv->list); - camel_folder_freeze(emfv->folder); + if (dialog) { + GList *children, *l; + + children = gtk_container_get_children (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox)); + for (l = children; l; l = l->next) { + if (GTK_IS_CHECK_BUTTON (l->data) && + !strcmp (gtk_widget_get_name (GTK_WIDGET (l->data)), DelInVFolderCheckName)) + break; + } + + if (l) { + GConfClient *gconf = gconf_client_get_default (); + gconf_client_set_bool (gconf, DelInVFolderKey, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (l->data)), NULL); + g_object_unref (gconf); + } + + g_list_free (children); + } + + uids = message_list_get_selected(emfv->list); + camel_folder_freeze(emfv->folder); + + for (count=0; count < uids->len; count++) { + if (camel_folder_get_message_flags (emfv->folder, uids->pdata[count]) & CAMEL_MESSAGE_USER_NOT_DELETABLE) { + if (emfv->preview_active) { + GtkHTMLStream *hstream = gtk_html_begin(((EMFormatHTML *)emfv->preview)->html); - for (count=0; count < uids->len; count++) { - if (camel_folder_get_message_flags (emfv->folder, uids->pdata[count]) & CAMEL_MESSAGE_USER_NOT_DELETABLE) { - if (emfv->preview_active) { - GtkHTMLStream *hstream = gtk_html_begin(((EMFormatHTML *)emfv->preview)->html); + gtk_html_stream_printf(hstream, "<h2>%s</h2><p>%s</p>", + _("Mail Deletion Failed"), + _("You do not have sufficient permissions to delete this mail.")); + gtk_html_stream_close(hstream, GTK_HTML_STREAM_OK); + } else + e_error_run (NULL, "mail:no-delete-permission", "", ""); - gtk_html_stream_printf(hstream, "<h2>%s</h2><p>%s</p>", - _("Mail Deletion Failed"), - _("You do not have sufficient permissions to delete this mail.")); - gtk_html_stream_close(hstream, GTK_HTML_STREAM_OK); + count = -1; + break; } else - e_error_run (NULL, "mail:no-delete-permission", "", ""); + camel_folder_set_message_flags(emfv->folder, uids->pdata[count], CAMEL_MESSAGE_SEEN|CAMEL_MESSAGE_DELETED, CAMEL_MESSAGE_SEEN|CAMEL_MESSAGE_DELETED ); + } - count = -1; - break; - } else - camel_folder_set_message_flags(emfv->folder, uids->pdata[count], CAMEL_MESSAGE_SEEN|CAMEL_MESSAGE_DELETED, CAMEL_MESSAGE_SEEN|CAMEL_MESSAGE_DELETED ); + message_list_free_uids(emfv->list, uids); + camel_folder_thaw(emfv->folder); + + if (count == 1) { + if (!message_list_select (emfv->list, MESSAGE_LIST_SELECT_NEXT, 0, 0) && emfv->hide_deleted) + message_list_select (emfv->list, MESSAGE_LIST_SELECT_PREVIOUS, 0, 0); + } } - message_list_free_uids(emfv->list, uids); - camel_folder_thaw(emfv->folder); + if (dialog) + gtk_widget_destroy (dialog); +} - if (count == 1) { - if (!message_list_select (emfv->list, MESSAGE_LIST_SELECT_NEXT, 0, 0) && emfv->hide_deleted) - message_list_select (emfv->list, MESSAGE_LIST_SELECT_PREVIOUS, 0, 0); +static void +emfv_popup_delete (EPopup *ep, EPopupItem *pitem, void *data) +{ + EMFolderView *emfv = data; + GConfClient *gconf = gconf_client_get_default (); + + if (emfv->folder && emfv->folder->parent_store && CAMEL_IS_VEE_STORE (emfv->folder->parent_store) + && !gconf_client_get_bool (gconf, DelInVFolderKey, NULL)) { + GtkWidget *dialog, *checkbox, *align; + + dialog = e_error_new (NULL, "mail:ask-delete-vfolder-msg", emfv->folder->full_name, NULL); + g_signal_connect (dialog, "response", G_CALLBACK (emfv_delete_msg_response), emfv); + checkbox = gtk_check_button_new_with_label (_("Do not ask me again.")); + gtk_widget_set_name (checkbox, DelInVFolderCheckName); + align = gtk_alignment_new (0.5, 0.5, 0.0, 0.0); + gtk_container_add (GTK_CONTAINER (align), checkbox); + gtk_widget_show (checkbox); + gtk_box_pack_end (GTK_BOX (GTK_DIALOG (dialog)->vbox), align, TRUE, TRUE, 6); + gtk_widget_show (align); + gtk_widget_show (dialog); + } else { + emfv_delete_msg_response (NULL, GTK_RESPONSE_OK, emfv); } + + g_object_unref (gconf); } +#undef DelInVFolderCheckName +#undef DelInVFolderKey static void emfv_popup_undelete(EPopup *ep, EPopupItem *pitem, void *data) diff --git a/mail/evolution-mail.schemas.in b/mail/evolution-mail.schemas.in index f85512fac3..7048d77933 100644 --- a/mail/evolution-mail.schemas.in +++ b/mail/evolution-mail.schemas.in @@ -876,6 +876,21 @@ </long> </locale> </schema> + + <schema> + <key>/schemas/apps/evolution/mail/prompts/delete_in_vfolder</key> + <applyto>/apps/evolution/mail/prompts/delete_in_vfolder</applyto> + <owner>evolution-mail</owner> + <type>bool</type> + <default>false</default> + <locale name="C"> + <short>Prompt when deleting messages in search folder</short> + <long> + It disables the feature where repeated prompts to ask if delete messages from search folder. + </long> + </locale> + </schema> + <!-- Trash settings --> <schema> diff --git a/mail/mail.error.xml b/mail/mail.error.xml index d62e8f694f..8c19265736 100644 --- a/mail/mail.error.xml +++ b/mail/mail.error.xml @@ -190,6 +190,15 @@ Many email systems add an Apparently-To header to messages that only have BCC re <button stock="gtk-delete" response="GTK_RESPONSE_OK"/> </error> + <error id="ask-delete-vfolder-msg" type="question" default="GTK_RESPONSE_CANCEL"> + <_title>Delete messages in virtual folder?</_title> + <_primary>Delete messages in virtual folder "{0}"?</_primary> + <_secondary xml:space="preserve">Warning deleting email from a virtual folder will delete the actual email from one of your Inbox folders. +Do you really want to do this?</_secondary> + <button stock="gtk-cancel" response="GTK_RESPONSE_CANCEL"/> + <button stock="gtk-delete" response="GTK_RESPONSE_OK"/> + </error> + <error id="no-rename-folder-exists" type="error"> <_primary>Cannot rename "{0}" to "{1}".</_primary> <_secondary xml:space="preserve">A folder named "{1}" already exists. Please use a different name.</_secondary> |