diff --git a/CHANGELOG b/CHANGELOG index 94f4829a8..19c5ed469 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -30,6 +30,7 @@ CHANGELOG Roundcube Webmail - Fix missing vcard_attachment icon on messages list (#1490303) - Fix storing signatures with big images in MySQL database (#1490306) - Fix Opera browser detection in javascript (#1490307) +- Fix so search filter, scope and fields are reset on folder change RELEASE 1.1.0 ------------- diff --git a/program/js/app.js b/program/js/app.js index 7d3f0c55d..223606e45 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -2378,6 +2378,9 @@ function rcube_webmail() // list messages of a specific mailbox using filter this.filter_mailbox = function(filter) { + if (this.filter_disabled) + return; + var lock = this.set_busy(true, 'searching'); this.clear_message_list(); @@ -2411,16 +2414,22 @@ function rcube_webmail() if (sort) url._sort = sort; - // also send search request to get the right messages - if (this.env.search_request) - url._search = this.env.search_request; - - // set page=1 if changeing to another mailbox + // folder change, reset page, search scope, etc. if (this.env.mailbox != mbox) { page = 1; this.env.current_page = page; + this.env.search_scope = 'base'; this.select_all_mode = false; + + // reset search filter + this.filter_disabled = true; + if (this.gui_objects.search_filter) + $(this.gui_objects.search_filter).val('ALL').change(); + this.filter_disabled = false; } + // also send search request to get the right messages + else if (this.env.search_request) + url._search = this.env.search_request; if (!update_only) { // unselect selected messages and clear the list and message data diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc index 341c14bc8..684cdf933 100644 --- a/program/steps/mail/func.inc +++ b/program/steps/mail/func.inc @@ -64,17 +64,6 @@ if (empty($RCMAIL->action) || $RCMAIL->action == 'list') { $mbox_name = $RCMAIL->storage->get_folder(); if (empty($RCMAIL->action)) { - // initialize searching result if search_filter is used - if ($_SESSION['search_filter'] && $_SESSION['search_filter'] != 'ALL') { - $RCMAIL->storage->search($mbox_name, $_SESSION['search_filter'], RCUBE_CHARSET, rcmail_sort_column()); - - $search_request = md5($mbox_name.$_SESSION['search_filter']); - $_SESSION['search'] = $RCMAIL->storage->get_search_set(); - $_SESSION['search_request'] = $search_request; - - $OUTPUT->set_env('search_request', $search_request); - } - $OUTPUT->set_env('search_mods', rcmail_search_mods()); if (!empty($_SESSION['search_scope'])) @@ -2056,7 +2045,7 @@ function rcmail_search_filter($attrib) $select_filter->add($RCMAIL->gettext('priority').': '.$RCMAIL->gettext('low'), 'HEADER X-PRIORITY 4'); $select_filter->add($RCMAIL->gettext('priority').': '.$RCMAIL->gettext('lowest'), 'HEADER X-PRIORITY 5'); - $out = $select_filter->show($_SESSION['search_filter']); + $out = $select_filter->show($_REQUEST['_search'] ? $_SESSION['search_filter'] : 'ALL'); $RCMAIL->output->add_gui_object('search_filter', $attrib['id']); diff --git a/program/steps/mail/list.inc b/program/steps/mail/list.inc index 32197bde3..4f2b73c53 100644 --- a/program/steps/mail/list.inc +++ b/program/steps/mail/list.inc @@ -58,20 +58,6 @@ $threading = (bool) $RCMAIL->storage->get_threading(); // Synchronize mailbox cache, handle flag changes $RCMAIL->storage->folder_sync($mbox_name); -// initialize searching result if search_filter is used -if ($_SESSION['search_filter'] && $_SESSION['search_filter'] != 'ALL') { - $search_request = md5($mbox_name.$_SESSION['search_scope'].$_SESSION['search_filter']); - $RCMAIL->storage->search($mbox_name, $_SESSION['search_filter'], RCUBE_CHARSET, rcmail_sort_column()); - - $_SESSION['search'] = $RCMAIL->storage->get_search_set(); - $_SESSION['search_request'] = $search_request; - - $OUTPUT->set_env('search_request', $search_request); - $OUTPUT->set_env('search_filter', $_SESSION['search_filter']); - - $multifolder = is_a($_SESSION['search'][1], 'rcube_result_multifolder'); -} - // fetch message headers if ($count = $RCMAIL->storage->count($mbox_name, $threading ? 'THREADS' : 'ALL', !empty($_REQUEST['_refresh']))) { $a_headers = $RCMAIL->storage->list_messages($mbox_name, NULL, rcmail_sort_column(), rcmail_sort_order());