diff options
author | Milan Crha <mcrha@redhat.com> | 2008-04-30 17:52:56 +0800 |
---|---|---|
committer | Milan Crha <mcrha@src.gnome.org> | 2008-04-30 17:52:56 +0800 |
commit | 05e8333292dc51f0b6c949d3aeb3496c08d4e613 (patch) | |
tree | 976156e2fab9640b3c86d914d79581843bcb0047 | |
parent | 6d29300fdf6fe18576c54d3e1ed2d8c9982945a6 (diff) | |
download | gsoc2013-evolution-05e8333292dc51f0b6c949d3aeb3496c08d4e613.tar.gz gsoc2013-evolution-05e8333292dc51f0b6c949d3aeb3496c08d4e613.tar.zst gsoc2013-evolution-05e8333292dc51f0b6c949d3aeb3496c08d4e613.zip |
** Fix for bug #467892
2008-04-30 Milan Crha <mcrha@redhat.com>
** Fix for bug #467892
* em-folder-view.c: (em_folder_view_open_selected):
Do not inherit search filters when opening messages in new window.
* message-list.c: (regen_list_exec):
If we are called from folder_changed even, then keep the actually
selected message so it will not disappear when user reads it and
it doesn't belong to actual filter anymore.
svn path=/trunk/; revision=35454
-rw-r--r-- | mail/ChangeLog | 11 | ||||
-rw-r--r-- | mail/em-folder-view.c | 3 | ||||
-rw-r--r-- | mail/message-list.c | 32 |
3 files changed, 34 insertions, 12 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index 92e1583fe7..9c26cece04 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,14 @@ +2008-04-30 Milan Crha <mcrha@redhat.com> + + ** Fix for bug #467892 + + * em-folder-view.c: (em_folder_view_open_selected): + Do not inherit search filters when opening messages in new window. + * message-list.c: (regen_list_exec): + If we are called from folder_changed even, then keep the actually + selected message so it will not disappear when user reads it and + it doesn't belong to actual filter anymore. + 2008-04-30 Shuai Liu <shuai.liu@sun.com> ** Fix for bug #530672 diff --git a/mail/em-folder-view.c b/mail/em-folder-view.c index 7d59b549c6..3ea1b96e77 100644 --- a/mail/em-folder-view.c +++ b/mail/em-folder-view.c @@ -561,7 +561,8 @@ em_folder_view_open_selected(EMFolderView *emfv) emmb = (EMMessageBrowser *)em_message_browser_window_new(); message_list_set_threaded(((EMFolderView *)emmb)->list, emfv->list->threaded); - message_list_set_search(((EMFolderView *)emmb)->list, emfv->list->search); + /* do not inherit search filter, because it can hide actual message for some filters */ + /*message_list_set_search(((EMFolderView *)emmb)->list, emfv->list->search);*/ 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); diff --git a/mail/message-list.c b/mail/message-list.c index 01a1e6b4b8..b811941978 100644 --- a/mail/message-list.c +++ b/mail/message-list.c @@ -3845,6 +3845,7 @@ regen_list_exec (struct _regen_list_msg *m) CamelMessageInfo *info; ETreePath cursor; int i; + char *expr = NULL; if (m->folder != m->ml->folder) return; @@ -3858,10 +3859,8 @@ regen_list_exec (struct _regen_list_msg *m) /* if we have hidedeleted on, use a search to find it out, merge with existing search if set */ if (!camel_folder_has_search_capability(m->folder)) { /* if we have no search capability, dont let search or hide deleted work */ - uids = camel_folder_get_uids(m->folder); + expr = NULL; } else if (m->hidedel) { - char *expr; - if (m->hidejunk) { if (m->search) { expr = alloca(strlen(m->search) + 92); @@ -3875,25 +3874,36 @@ regen_list_exec (struct _regen_list_msg *m) } else expr = "(match-all (not (system-flag \"deleted\")))"; } - searchuids = uids = camel_folder_search_by_expression (m->folder, expr, &m->base.ex); } else { - char *expr; - if (m->hidejunk) { if (m->search) { expr = alloca(strlen(m->search) + 64); sprintf(expr, "(and (match-all (not (system-flag \"junk\")))\n %s)", m->search); } else expr = "(match-all (not (system-flag \"junk\")))"; - searchuids = uids = camel_folder_search_by_expression (m->folder, expr, &m->base.ex); } else { - if (m->search) - searchuids = uids = camel_folder_search_by_expression (m->folder, m->search, &m->base.ex); - else - uids = camel_folder_get_uids (m->folder); + expr = m->search; } } + if (expr == NULL) { + uids = camel_folder_get_uids (m->folder); + } else { + char *tmp_expr = NULL; + + /* If m->changes is not NULL, then it means we are called from folder_changed event, + thus we will keep the selected message to be sure it doesn't disappear because + it no longer belong to our search filter. */ + if (m->changes && m->ml->search && m->ml->cursor_uid) { + tmp_expr = g_strdup_printf ("(or %s (match-all (uid \"%s\")))", expr, m->ml->cursor_uid); + expr = tmp_expr; + } + + searchuids = uids = camel_folder_search_by_expression (m->folder, expr, &m->base.ex); + + g_free (tmp_expr); + } + if (camel_exception_is_set (&m->base.ex)) return; |