From 6dc1a6645168e5e777a3db97b92d360a9e6b0c86 Mon Sep 17 00:00:00 2001
From: Thomas Bruederli <thomas@roundcube.net>
Date: Mon, 07 Apr 2014 11:01:30 -0400
Subject: [PATCH] Fix page title and folder selection in search mode

---
 program/steps/mail/search.inc         |    1 +
 program/steps/mail/func.inc           |    2 +-
 program/localization/en_US/labels.inc |    1 +
 program/js/app.js                     |    2 +-
 4 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/program/js/app.js b/program/js/app.js
index 7c27d21..adf1356 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -712,7 +712,7 @@
           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.env.search_scope = 'sub';
           this.qsearch(this.gui_objects.qsearchbox.value);
           this.select_folder(this.env.mailbox, '', true);
           break;
diff --git a/program/localization/en_US/labels.inc b/program/localization/en_US/labels.inc
index 05eab67..5bb645d 100644
--- a/program/localization/en_US/labels.inc
+++ b/program/localization/en_US/labels.inc
@@ -319,6 +319,7 @@
 $labels['spouse'] = 'Spouse';
 $labels['allfields'] = 'All fields';
 $labels['search'] = 'Search';
+$labels['searchfor'] = 'Search for "$q"';
 $labels['advsearch'] = 'Advanced Search';
 $labels['advanced'] = 'Advanced';
 $labels['other'] = 'Other';
diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc
index 0d6f9cd..4ff8fcb 100644
--- a/program/steps/mail/func.inc
+++ b/program/steps/mail/func.inc
@@ -420,7 +420,7 @@
 
     $OUTPUT->command('set_message_coltypes', $a_show_cols, $thead, $smart_col);
 
-    if ($multifolder) {
+    if ($multifolder && $_SESSION['search_scope'] == 'all') {
         $OUTPUT->command('select_folder', '');
     }
 
diff --git a/program/steps/mail/search.inc b/program/steps/mail/search.inc
index 941e68b..797c8fc 100644
--- a/program/steps/mail/search.inc
+++ b/program/steps/mail/search.inc
@@ -170,4 +170,5 @@
 $OUTPUT->set_env('pagecount', ceil($count/$RCMAIL->storage->get_pagesize()));
 $OUTPUT->set_env('exists', $RCMAIL->storage->count($mbox_name, 'EXISTS'));
 $OUTPUT->command('set_rowcount', rcmail_get_messagecount_text($count, 1), $mbox);
+$OUTPUT->set_pagetitle($RCMAIL->gettext(array('name' => 'searchfor', 'vars' => array('q' => $str))));
 $OUTPUT->send();

--
Gitblit v1.9.1