Thomas Bruederli
2014-04-23 ab366809d5df50f9e5c88e1ab3671318d296ccb3
Only refresh the affected parts of a cross-folder search set after moving/deleting/flagging
1 files modified
24 ■■■■■ changed files
program/lib/Roundcube/rcube_imap.php 24 ●●●●● patch | view | raw | blame | history
program/lib/Roundcube/rcube_imap.php
@@ -1714,6 +1714,19 @@
        return $this->get_search_set();
    }
    /**
     * Flag certain result subsets as 'incomplete'.
     * For subsequent refresh_search() calls to only refresh the updated parts.
     */
    protected function set_search_dirty($folder)
    {
        if ($this->search_set && is_a($this->search_set, 'rcube_result_multifolder')) {
            if ($subset = $this->search_set->get_set($folder)) {
                $subset->incomplete = $this->search_set->incomplete = true;
            }
        }
    }
    /**
     * Return message headers object of a specific message
@@ -2420,6 +2433,8 @@
                    $this->clear_message_cache($folder, $all_mode ? null : explode(',', $uids));
                }
            }
            $this->set_search_dirty($folder);
        }
        return $result;
@@ -2529,6 +2544,9 @@
        if ($moved) {
            $this->clear_messagecount($from_mbox);
            $this->clear_messagecount($to_mbox);
            $this->set_search_dirty($from_mbox);
            $this->set_search_dirty($to_mbox);
        }
        // moving failed
        else if ($to_trash && $config->get('delete_always', false)) {
@@ -2545,7 +2563,7 @@
                if ($this->search_threads || $all_mode) {
                    $this->refresh_search();
                }
                else {
                else if (!$this->search_set->incomplete) {
                    $this->search_set->filter(explode(',', $uids), $this->folder);
                }
            }
@@ -2633,13 +2651,15 @@
            // unset threads internal cache
            unset($this->icache['threads']);
            $this->set_search_dirty($folder);
            // remove message ids from search set
            if ($this->search_set && $folder == $this->folder) {
                // threads are too complicated to just remove messages from set
                if ($this->search_threads || $all_mode) {
                    $this->refresh_search();
                }
                else {
                else if (!$this->search_set->incomplete) {
                    $this->search_set->filter(explode(',', $uids));
                }
            }