From 2c33c7e38bc767330b4eebdc9e4d234caca72966 Mon Sep 17 00:00:00 2001 From: Thomas Bruederli Date: Thu, 16 Jan 2014 15:41:19 +0100 Subject: Make message pagenav (prev/next) work with sorted multi-folder search results --- program/lib/Roundcube/rcube_imap.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'program/lib/Roundcube/rcube_imap.php') diff --git a/program/lib/Roundcube/rcube_imap.php b/program/lib/Roundcube/rcube_imap.php index e265946f2..847bcfa70 100644 --- a/program/lib/Roundcube/rcube_imap.php +++ b/program/lib/Roundcube/rcube_imap.php @@ -973,6 +973,9 @@ class rcube_imap extends rcube_storage $a_msg_headers = $this->conn->sortHeaders($a_msg_headers, $sort_field, $this->sort_order); } + // store (sorted) message index + $search_set->set_message_index($a_msg_headers, $sort_field, $this->sort_order); + // only return the requested part of the set $slice_length = min($page_size, $cnt - ($to > $cnt ? $from : $to)); $a_msg_headers = array_slice(array_values($a_msg_headers), $from, $slice_length); @@ -1279,8 +1282,13 @@ class rcube_imap extends rcube_storage return new rcube_result_index($folder, '* SORT'); } + if ($this->search_set instanceof rcube_result_multifolder) { + $index = $this->search_set; + $index->folder = $folder; + // TODO: handle changed sorting + } // search result is an index with the same sorting? - if (($this->search_set instanceof rcube_result_index) + else if (($this->search_set instanceof rcube_result_index) && ((!$this->sort_field && !$this->search_sorted) || ($this->search_sorted && $this->search_sort_field == $this->sort_field)) ) { -- cgit v1.2.3