From 06343d189ea9a58713fff0482b7cb8e48190f8a0 Mon Sep 17 00:00:00 2001 From: alecpl Date: Wed, 22 Oct 2008 17:41:22 +0000 Subject: - Added option focus_on_new_message (#1485374) --- CHANGELOG | 4 ++++ config/main.inc.php.dist | 3 +++ program/js/app.js | 10 ++++++++++ program/localization/en_GB/labels.inc | 1 + program/localization/en_US/labels.inc | 1 + program/localization/pl_PL/labels.inc | 1 + program/localization/ru_RU/labels.inc | 1 + program/steps/mail/check_recent.inc | 3 +++ program/steps/settings/func.inc | 9 ++++++++- program/steps/settings/save_prefs.inc | 1 + 10 files changed, 33 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index b54a29701..e0caecfe9 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 253c29e60..6c5b98a1b 100644 --- a/config/main.inc.php.dist +++ b/config/main.inc.php.dist @@ -355,6 +355,9 @@ $rcmail_config['draft_autosave'] = 300; // 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 fc99871b1..6994d1893 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -3582,6 +3582,16 @@ function rcube_webmail() } }; + // 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 f8f19d386..48656c214 100644 --- a/program/localization/en_GB/labels.inc +++ b/program/localization/en_GB/labels.inc @@ -232,6 +232,7 @@ $labels['2231folding'] = 'Full RFC 2231 (Thunderbird)'; $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 1fdf75389..904450b44 100644 --- a/program/localization/en_US/labels.inc +++ b/program/localization/en_US/labels.inc @@ -290,6 +290,7 @@ $labels['2231folding'] = 'Full RFC 2231 (Thunderbird)'; $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 d8c94f414..ecf430f4d 100644 --- a/program/localization/pl_PL/labels.inc +++ b/program/localization/pl_PL/labels.inc @@ -231,6 +231,7 @@ $labels['skipdeleted'] = 'Ukryj wiadomości oznaczone do usunięcia'; $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 17a2a8a86..9578844c4 100644 --- a/program/localization/ru_RU/labels.inc +++ b/program/localization/ru_RU/labels.inc @@ -237,6 +237,7 @@ $labels['2231folding'] = 'RFC 2231 (только для новейших про $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 e84d7ba9e..07313c156 100644 --- a/program/steps/mail/check_recent.inc +++ b/program/steps/mail/check_recent.inc @@ -41,6 +41,9 @@ foreach ($a_mailboxes as $mbox_name) $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 6e8c6b509..1b28d3b17 100644 --- a/program/steps/settings/func.inc +++ b/program/steps/settings/func.inc @@ -148,6 +148,13 @@ function rcmail_user_prefs_form($attrib) $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 @@ function rcmail_user_prefs_form($attrib) $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 beeb1df0f..3f6328d0d 100644 --- a/program/steps/settings/save_prefs.inc +++ b/program/steps/settings/save_prefs.inc @@ -30,6 +30,7 @@ $a_user_prefs = array( '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, -- cgit v1.2.3