From 06343d189ea9a58713fff0482b7cb8e48190f8a0 Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Wed, 22 Oct 2008 13:41:22 -0400
Subject: [PATCH] - Added option focus_on_new_message (#1485374)
---
CHANGELOG | 4 ++++
program/steps/mail/check_recent.inc | 3 +++
program/steps/settings/func.inc | 9 ++++++++-
program/localization/en_US/labels.inc | 1 +
program/localization/pl_PL/labels.inc | 1 +
program/localization/ru_RU/labels.inc | 1 +
config/main.inc.php.dist | 3 +++
program/js/app.js | 10 ++++++++++
program/steps/settings/save_prefs.inc | 1 +
program/localization/en_GB/labels.inc | 1 +
10 files changed, 33 insertions(+), 1 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG
index b54a297..e0caecf 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,10 @@
CHANGELOG RoundCube Webmail
---------------------------
+2008/10/22 (alec)
+----------
+- Added option focus_on_new_message (#1485374)
+
2008/10/18 (alec)
----------
- Fix html2text class autoloading on Windows (#1485505)
diff --git a/config/main.inc.php.dist b/config/main.inc.php.dist
index 253c29e..6c5b98a 100644
--- a/config/main.inc.php.dist
+++ b/config/main.inc.php.dist
@@ -355,6 +355,9 @@
// default setting if preview pane is enabled
$rcmail_config['preview_pane'] = FALSE;
+// focus new window if new message arrives
+$rcmail_config['focus_on_new_message'] = true;
+
// Clear Trash on logout
$rcmail_config['logout_purge'] = FALSE;
diff --git a/program/js/app.js b/program/js/app.js
index fc99871..6994d18 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -3582,6 +3582,16 @@
}
};
+ // notifies that a new message(s) has hit the mailbox
+ this.new_message_focus = function()
+ {
+ // focus main window
+ if (this.env.framed && window.parent)
+ window.parent.focus();
+ else
+ window.focus();
+ }
+
// add row to contacts list
this.add_contact_row = function(cid, cols, select)
{
diff --git a/program/localization/en_GB/labels.inc b/program/localization/en_GB/labels.inc
index f8f19d3..48656c2 100644
--- a/program/localization/en_GB/labels.inc
+++ b/program/localization/en_GB/labels.inc
@@ -232,6 +232,7 @@
$labels['miscfolding'] = 'RFC 2047/2231 (MS Outlook)';
$labels['2047folding'] = 'Full RFC 2047 (other)';
$labels['advancedoptions'] = 'Advanced options';
+$labels['focusonnewmessage'] = 'Focus browser window on new message';
$labels['messagesdisplaying'] = 'Displaying Messages';
$labels['messagescomposition'] = 'Composing Messages';
$labels['folder'] = 'Folder';
diff --git a/program/localization/en_US/labels.inc b/program/localization/en_US/labels.inc
index 1fdf753..904450b 100644
--- a/program/localization/en_US/labels.inc
+++ b/program/localization/en_US/labels.inc
@@ -290,6 +290,7 @@
$labels['miscfolding'] = 'RFC 2047/2231 (MS Outlook)';
$labels['2047folding'] = 'Full RFC 2047 (other)';
$labels['advancedoptions'] = 'Advanced options';
+$labels['focusonnewmessage'] = 'Focus browser window on new message';
$labels['folder'] = 'Folder';
$labels['folders'] = 'Folders';
diff --git a/program/localization/pl_PL/labels.inc b/program/localization/pl_PL/labels.inc
index d8c94f4..ecf430f 100644
--- a/program/localization/pl_PL/labels.inc
+++ b/program/localization/pl_PL/labels.inc
@@ -231,6 +231,7 @@
$labels['autosavedraft'] = 'Automatyczny zapis tworzonej wiadomości';
$labels['everynminutes'] = 'co $n minut';
$labels['never'] = 'nigdy';
+$labels['focusonnewmessage'] = 'Informuj przeglądarkę o nowej wiadomości';
$labels['folder'] = 'Folder';
$labels['folders'] = 'Foldery';
$labels['foldername'] = 'Nazwa folderu';
diff --git a/program/localization/ru_RU/labels.inc b/program/localization/ru_RU/labels.inc
index 17a2a8a..9578844 100644
--- a/program/localization/ru_RU/labels.inc
+++ b/program/localization/ru_RU/labels.inc
@@ -237,6 +237,7 @@
$labels['miscfolding'] = 'RFC 2047/2231 (наибольшая совместимость)';
$labels['2047folding'] = 'RFC 2047 (для старых программ)';
$labels['advancedoptions'] = 'Дополнительные настройки';
+$labels['focusonnewmessage'] = 'Фокусировать окно браузера при новом сообщении';
$labels['folder'] = 'Папка';
$labels['folders'] = 'Папки';
$labels['foldername'] = 'Имя папки';
diff --git a/program/steps/mail/check_recent.inc b/program/steps/mail/check_recent.inc
index e84d7ba..07313c1 100644
--- a/program/steps/mail/check_recent.inc
+++ b/program/steps/mail/check_recent.inc
@@ -41,6 +41,9 @@
$OUTPUT->command('set_rowcount', rcmail_get_messagecount_text());
$OUTPUT->command('set_quota', rcmail_quota_content($IMAP->get_quota()));
+ if (rcmail::get_instance()->config->get('focus_on_new_message',true))
+ $OUTPUT->command('new_message_focus');
+
// add new message headers to list
$a_headers = array();
for ($i=$recent_count, $id=$count_all-$recent_count+1; $i>0; $i--, $id++)
diff --git a/program/steps/settings/func.inc b/program/steps/settings/func.inc
index 6e8c6b5..1b28d3b 100644
--- a/program/steps/settings/func.inc
+++ b/program/steps/settings/func.inc
@@ -148,6 +148,13 @@
$table = new html_table(array('cols' => 2));
+ if (!isset($no_override['focus_on_new_message'])) {
+ $field_id = 'rcmfd_focus_on_new_message';
+ $input_focus_on_new_message = new html_checkbox(array('name' => '_focus_on_new_message', 'id' => $field_id, 'value' => 1));
+ $table->add('title', html::label($field_id, Q(rcube_label('focusonnewmessage'))));
+ $table->add(null, $input_focus_on_new_message->show($config['focus_on_new_message']?1:0));
+ }
+
// show config parameter for preview pane
if (!isset($no_override['preview_pane'])) {
$field_id = 'rcmfd_preview';
@@ -294,7 +301,7 @@
$table->add('title', html::label($field_id, Q(rcube_label('skipdeleted'))));
$table->add(null, $input_purge->show($config['skip_deleted']?1:0));
}
-
+
// Trash purging on logout
if (!isset($no_override['logout_purge'])) {
$field_id = 'rcmfd_logout_purge';
diff --git a/program/steps/settings/save_prefs.inc b/program/steps/settings/save_prefs.inc
index beeb1df..3f6328d 100644
--- a/program/steps/settings/save_prefs.inc
+++ b/program/steps/settings/save_prefs.inc
@@ -30,6 +30,7 @@
'htmleditor' => isset($_POST['_htmleditor']) ? TRUE : FALSE,
'inline_images' => isset($_POST['_inline_images']) ? TRUE : FALSE,
'preview_pane' => isset($_POST['_preview_pane']) ? TRUE : FALSE,
+ 'focus_on_new_message' => isset($_POST['_focus_on_new_message']) ? TRUE : FALSE,
'read_when_deleted' => isset($_POST['_read_when_deleted']) ? TRUE : FALSE,
'skip_deleted' => isset($_POST['_skip_deleted']) ? TRUE : FALSE,
'flag_for_deletion' => isset($_POST['_flag_for_deletion']) ? TRUE : FALSE,
--
Gitblit v1.9.1