aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2005-02-01 08:33:53 +0800
committerMichael Zucci <zucchi@src.gnome.org>2005-02-01 08:33:53 +0800
commitd98b22611bf1e9d4b0b6f00f1711c071cfad431c (patch)
treefd9b5aeb556fde97403096729bbfa7376972254a
parent747e6c8717847ccc7cbb20b8739467a4fe4a0d83 (diff)
downloadgsoc2013-evolution-d98b22611bf1e9d4b0b6f00f1711c071cfad431c.tar
gsoc2013-evolution-d98b22611bf1e9d4b0b6f00f1711c071cfad431c.tar.gz
gsoc2013-evolution-d98b22611bf1e9d4b0b6f00f1711c071cfad431c.tar.bz2
gsoc2013-evolution-d98b22611bf1e9d4b0b6f00f1711c071cfad431c.tar.lz
gsoc2013-evolution-d98b22611bf1e9d4b0b6f00f1711c071cfad431c.tar.xz
gsoc2013-evolution-d98b22611bf1e9d4b0b6f00f1711c071cfad431c.tar.zst
gsoc2013-evolution-d98b22611bf1e9d4b0b6f00f1711c071cfad431c.zip
** See bug #71312.
2005-02-01 Not Zed <NotZed@Ximian.com> ** See bug #71312. * em-folder-view.c (em_folder_view_open_selected): if we're looking at a vfolder, then look open the original folder if we need to perform any edits. svn path=/trunk/; revision=28649
-rw-r--r--mail/ChangeLog8
-rw-r--r--mail/em-folder-view.c65
-rw-r--r--mail/mail-tools.c1
3 files changed, 58 insertions, 16 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 7b36d25cd6..232ac1dfa1 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,11 @@
+2005-02-01 Not Zed <NotZed@Ximian.com>
+
+ ** See bug #71312.
+
+ * em-folder-view.c (em_folder_view_open_selected): if we're
+ looking at a vfolder, then look open the original folder if we need
+ to perform any edits.
+
2005-01-31 Hans Petter Jansson <hpj@novell.com>
* importers/mail-importer.h (mc): Remove unused global symbol.
diff --git a/mail/em-folder-view.c b/mail/em-folder-view.c
index aeada91494..d3438c6bf6 100644
--- a/mail/em-folder-view.c
+++ b/mail/em-folder-view.c
@@ -54,6 +54,7 @@
#include <camel/camel-multipart.h>
#include <camel/camel-stream-mem.h>
#include <camel/camel-url.h>
+#include <camel/camel-vee-folder.h>
#include <bonobo/bonobo-main.h>
#include <bonobo/bonobo-object.h>
@@ -93,6 +94,7 @@
#include "mail-autofilter.h"
#include "mail-vfolder.h"
#include "mail-component.h"
+#include "mail-tools.h"
#include "evolution-shell-component-utils.h" /* Pixmap stuff, sigh */
@@ -365,7 +367,7 @@ em_folder_view_mark_selected(EMFolderView *emfv, guint32 mask, guint32 set)
int
em_folder_view_open_selected(EMFolderView *emfv)
{
- GPtrArray *uids;
+ GPtrArray *uids, *views;
int i = 0;
uids = message_list_get_selected(emfv->list);
@@ -384,26 +386,57 @@ em_folder_view_open_selected(EMFolderView *emfv)
}
}
- if (em_utils_folder_is_drafts(emfv->folder, emfv->folder_uri)
+ if (em_utils_folder_is_drafts(emfv->folder, emfv->folder_uri)
|| em_utils_folder_is_outbox(emfv->folder, emfv->folder_uri)) {
em_utils_edit_messages(emfv->folder, uids, TRUE);
- } else {
- /* TODO: have an em_utils_open_messages call? */
- for (i=0; i<uids->len; i++) {
- EMMessageBrowser *emmb;
-
- emmb = (EMMessageBrowser *)em_message_browser_window_new();
- message_list_set_threaded(((EMFolderView *)emmb)->list, emfv->list->threaded);
- em_folder_view_set_hide_deleted((EMFolderView *)emmb, emfv->hide_deleted);
- /* FIXME: session needs to be passed easier than this */
- em_format_set_session((EMFormat *)((EMFolderView *)emmb)->preview, ((EMFormat *)emfv->preview)->session);
- em_folder_view_set_folder((EMFolderView *)emmb, emfv->folder, emfv->folder_uri);
- em_folder_view_set_message((EMFolderView *)emmb, uids->pdata[i], FALSE);
- gtk_widget_show(emmb->window);
+ return uids->len;
+ }
+
+ /* for vfolders we need to edit the *original*, not the vfolder copy */
+ views = g_ptr_array_new();
+ for (i=0;i<uids->len;i++) {
+ if (camel_object_is((CamelObject *)emfv->folder, camel_vee_folder_get_type())) {
+ CamelVeeMessageInfo *vinfo = (CamelVeeMessageInfo *)camel_folder_get_message_info(emfv->folder, uids->pdata[i]);
+
+ if (vinfo) {
+ char *uid;
+ /* TODO: get_location shouldn't strdup the uid */
+ CamelFolder *f = camel_vee_folder_get_location((CamelVeeFolder *)emfv->folder, vinfo, &uid);
+ char *uri = mail_tools_folder_to_url(f);
+
+ if (em_utils_folder_is_drafts(f, uri) || em_utils_folder_is_outbox(f, uri)) {
+ GPtrArray *edits = g_ptr_array_new();
+
+ g_ptr_array_add(edits, uid);
+ em_utils_edit_messages(f, edits, TRUE);
+ } else {
+ g_free(uid);
+ g_ptr_array_add(views, g_strdup(uids->pdata[i]));
+ }
+ g_free(uri);
+ }
+ } else {
+ g_ptr_array_add(views, g_strdup(uids->pdata[i]));
}
+ }
- message_list_free_uids(emfv->list, uids);
+ /* TODO: have an em_utils_open_messages call? */
+ for (i=0; i<views->len; i++) {
+ EMMessageBrowser *emmb;
+
+ emmb = (EMMessageBrowser *)em_message_browser_window_new();
+ message_list_set_threaded(((EMFolderView *)emmb)->list, emfv->list->threaded);
+ em_folder_view_set_hide_deleted((EMFolderView *)emmb, emfv->hide_deleted);
+ /* FIXME: session needs to be passed easier than this */
+ em_format_set_session((EMFormat *)((EMFolderView *)emmb)->preview, ((EMFormat *)emfv->preview)->session);
+ em_folder_view_set_folder((EMFolderView *)emmb, emfv->folder, emfv->folder_uri);
+ em_folder_view_set_message((EMFolderView *)emmb, views->pdata[i], FALSE);
+ gtk_widget_show(emmb->window);
+ g_free(views->pdata[i]);
}
+ g_ptr_array_free(views, TRUE);
+
+ message_list_free_uids(emfv->list, uids);
return i;
}
diff --git a/mail/mail-tools.c b/mail/mail-tools.c
index 59dd3613ec..b49fb38a43 100644
--- a/mail/mail-tools.c
+++ b/mail/mail-tools.c
@@ -406,6 +406,7 @@ mail_tools_x_evolution_message_parse (char *in, unsigned int inlen, GPtrArray **
return folder;
}
+/* FIXME: This should be a property on CamelFolder */
char *
mail_tools_folder_to_url (CamelFolder *folder)
{