Re-submit search query when switching folders

pull/193/head
Thomas Bruederli 11 years ago
parent 6f17090258
commit 6884f3f1f7

@ -697,9 +697,17 @@ function rcube_webmail()
break; break;
case 'list': case 'list':
// TODO: don't reset search but re-send for the new folder // re-send for the selected folder
if (props && props != '') if (props && props != '' && this.env.search_request) {
this.reset_qsearch(); var oldmbox = this.env.search_scope == 'all' ? '*' : this.env.mailbox;
this.env.search_mods[props] = this.env.search_mods[oldmbox]; // copy search mods from active search
this.env.mailbox = props;
this.env.search_scope = 'base';
this.qsearch(this.gui_objects.qsearchbox.value);
this.select_folder(this.env.mailbox, '', true);
break;
}
if (this.env.action == 'compose' && this.env.extwin) if (this.env.action == 'compose' && this.env.extwin)
window.close(); window.close();
else if (this.task == 'mail') { else if (this.task == 'mail') {
@ -4100,11 +4108,11 @@ function rcube_webmail()
}; };
// send remote request to search mail or contacts // send remote request to search mail or contacts
this.qsearch = function(value) this.qsearch = function(value, mods)
{ {
if (value != '') { if (value != '') {
var r, lock = this.set_busy(true, 'searching'), var r, lock = this.set_busy(true, 'searching'),
url = this.search_params(value); url = this.search_params(value, null, mods);
if (this.message_list) if (this.message_list)
this.clear_message_list(); this.clear_message_list();
@ -4128,7 +4136,7 @@ function rcube_webmail()
}; };
// build URL params for search // build URL params for search
this.search_params = function(search, filter) this.search_params = function(search, filter, smods)
{ {
var n, url = {}, mods_arr = [], var n, url = {}, mods_arr = [],
mods = this.env.search_mods, mods = this.env.search_mods,
@ -4147,11 +4155,11 @@ function rcube_webmail()
if (search) { if (search) {
url._q = search; url._q = search;
if (mods && this.message_list) if (!smods && mods && this.message_list)
mods = mods[mbox] ? mods[mbox] : mods['*']; smods = mods[mbox] || mods['*'];
if (mods) { if (smods) {
for (n in mods) for (n in smods)
mods_arr.push(n); mods_arr.push(n);
url._headers = mods_arr.join(','); url._headers = mods_arr.join(',');
} }

@ -21,6 +21,8 @@
$REMOTE_REQUEST = TRUE; $REMOTE_REQUEST = TRUE;
@set_time_limit(170); // extend default max_execution_time to ~3 minutes
// reset list_page and old search results // reset list_page and old search results
$RCMAIL->storage->set_page(1); $RCMAIL->storage->set_page(1);
$RCMAIL->storage->set_search_set(NULL); $RCMAIL->storage->set_search_set(NULL);

@ -769,7 +769,7 @@ function rcube_mail_ui()
mbox = '*'; mbox = '*';
mods = mods[mbox] ? mods[mbox] : mods['*']; mods = mods[mbox] ? mods[mbox] : mods['*'];
all = 'text'; all = 'text';
$('#s_scope_'+scope).prop('checked', true); $('#s_scope_'+scope).attr('checked',true);
} }
else { else {
all = '*'; all = '*';

Loading…
Cancel
Save