From 87d414d59f5363139f0fd945015e23652ff08360 Mon Sep 17 00:00:00 2001 From: Sankar P Date: Thu, 9 Nov 2006 06:01:47 +0000 Subject: Disable mail delete for proxy when there are not enough rights 2006-11-09 Sankar P * em-folder-browser.c: (emfb_view_hide_selected): * em-folder-view.c: (emfv_popup_delete): * mail.error.xml: Disable mail delete for proxy when there are not enough rights svn path=/trunk/; revision=32958 --- mail/ChangeLog | 7 +++++++ mail/em-folder-browser.c | 5 +++++ mail/em-folder-view.c | 29 ++++++++++++++++++++++++++--- mail/mail.error.xml | 6 ++++++ 4 files changed, 44 insertions(+), 3 deletions(-) (limited to 'mail') diff --git a/mail/ChangeLog b/mail/ChangeLog index 3c7466a81f..e31770b7d3 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,10 @@ +2006-11-09 Sankar P + + * em-folder-browser.c: (emfb_view_hide_selected): + * em-folder-view.c: (emfv_popup_delete): + * mail.error.xml: + Disable mail delete for proxy when there are not enough rights + 2006-10-16 Tor Lillqvist Fix for #348212: diff --git a/mail/em-folder-browser.c b/mail/em-folder-browser.c index b995b31631..366bf2a4d8 100644 --- a/mail/em-folder-browser.c +++ b/mail/em-folder-browser.c @@ -1439,6 +1439,11 @@ emfb_view_hide_selected(BonoboUIComponent *uid, void *data, const char *path) /* TODO: perhaps this should sit directly on message_list? */ /* is it worth it, it's so trivial */ + + /* A new flag CAMEL_MESSAGE_HIDDEN is added by Sankar + while extending the CAMEL_MESSAGE_FLAGS for proxy permissions. + This can be used to hide messages. */ + uids = message_list_get_selected(emfv->list); message_list_hide_uids(emfv->list, uids); message_list_free_uids(emfv->list, uids); diff --git a/mail/em-folder-view.c b/mail/em-folder-view.c index b9d6dbe485..6f1dac6cb3 100644 --- a/mail/em-folder-view.c +++ b/mail/em-folder-view.c @@ -953,9 +953,32 @@ emfv_popup_delete(EPopup *ep, EPopupItem *pitem, void *data) { EMFolderView *emfv = data; int count; - - count = em_folder_view_mark_selected(emfv, CAMEL_MESSAGE_SEEN|CAMEL_MESSAGE_DELETED, CAMEL_MESSAGE_SEEN|CAMEL_MESSAGE_DELETED); - + GPtrArray *uids; + + 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 ((EMFormatHTML *)emfv->preview_active) { + GtkHTMLStream *hstream = gtk_html_begin(((EMFormatHTML *)emfv->preview)->html); + + gtk_html_stream_printf(hstream, "

%s

%s

", + _("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", "", ""); + + 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); diff --git a/mail/mail.error.xml b/mail/mail.error.xml index 21584eaf29..936bcf9748 100644 --- a/mail/mail.error.xml +++ b/mail/mail.error.xml @@ -391,5 +391,11 @@ You can choose to ignore this folder, overwrite or append its contents, or quit. <_secondary xml:space="preserve">Please enable the account or send using another account. + + <_primary>Mail Deletion Failed + <_secondary xml:space="preserve">You do not have sufficient permissions to delete this mail. + + + -- cgit v1.2.3