summaryrefslogtreecommitdiff
path: root/program/steps
diff options
context:
space:
mode:
authorthomascube <thomas@roundcube.net>2010-04-09 15:12:40 +0000
committerthomascube <thomas@roundcube.net>2010-04-09 15:12:40 +0000
commitbc4960108e78b8a571745f55f54c83ea34fd0336 (patch)
tree5d970061197870d1ac258466587c939771ec6d79 /program/steps
parent814905ca879d976792f33cf0fb45a4d3f8fedc32 (diff)
Option not to mark messages as read when viewed in preview pane (#1485012)
Diffstat (limited to 'program/steps')
-rw-r--r--program/steps/mail/compose.inc4
-rw-r--r--program/steps/mail/func.inc4
-rw-r--r--program/steps/mail/show.inc4
-rw-r--r--program/steps/settings/func.inc23
-rw-r--r--program/steps/settings/save_prefs.inc3
5 files changed, 33 insertions, 5 deletions
diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc
index 658f59037..2fac294af 100644
--- a/program/steps/mail/compose.inc
+++ b/program/steps/mail/compose.inc
@@ -143,6 +143,10 @@ if (!empty($msg_uid))
$CONFIG['prefer_html'] = $CONFIG['prefer_html'] || $CONFIG['htmleditor'] || $compose_mode == RCUBE_COMPOSE_DRAFT || $compose_mode == RCUBE_COMPOSE_EDIT;
$MESSAGE = new rcube_message($msg_uid);
+ // make sure message is marked as read
+ if ($MESSAGE && $MESSAGE->headers && !$MESSAGE->headers->seen)
+ $IMAP->set_flag($msg_uid, 'SEEN');
+
if (!empty($MESSAGE->headers->charset))
$IMAP->set_charset($MESSAGE->headers->charset);
diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc
index 93a595602..7f67b2974 100644
--- a/program/steps/mail/func.inc
+++ b/program/steps/mail/func.inc
@@ -121,7 +121,9 @@ if (empty($RCMAIL->action) || $RCMAIL->action == 'list')
$OUTPUT->set_env('skip_deleted', true);
if ($CONFIG['display_next'])
$OUTPUT->set_env('display_next', true);
-
+
+ $OUTPUT->set_env('preview_pane_mark_read', $RCMAIL->config->get('preview_pane_mark_read', 0));
+
if ($CONFIG['trash_mbox'])
$OUTPUT->set_env('trash_mailbox', $CONFIG['trash_mbox']);
if ($CONFIG['drafts_mbox'])
diff --git a/program/steps/mail/show.inc b/program/steps/mail/show.inc
index 02e1f4824..10de46a36 100644
--- a/program/steps/mail/show.inc
+++ b/program/steps/mail/show.inc
@@ -140,7 +140,7 @@ if ($_GET['_uid']) {
$OUTPUT->set_env('last_uid', $last);
}
- if (!$MESSAGE->headers->seen)
+ if (!$MESSAGE->headers->seen && ($RCMAIL->action == 'show' || ($RCMAIL->action == 'preview' && intval($CONFIG['preview_pane_mark_read']) == 0)))
$RCMAIL->plugins->exec_hook('message_read', array('uid' => $MESSAGE->uid,
'mailbox' => $mbox_name, 'message' => $MESSAGE));
}
@@ -226,7 +226,7 @@ else
// mark message as read
-if ($MESSAGE && $MESSAGE->headers && !$MESSAGE->headers->seen)
+if ($MESSAGE && $MESSAGE->headers && !$MESSAGE->headers->seen && ($RCMAIL->action == 'show' || ($RCMAIL->action == 'preview' && intval($CONFIG['preview_pane_mark_read']) == 0)))
$IMAP->set_flag($MESSAGE->uid, 'SEEN');
exit;
diff --git a/program/steps/settings/func.inc b/program/steps/settings/func.inc
index 7ad2449b5..1516b9810 100644
--- a/program/steps/settings/func.inc
+++ b/program/steps/settings/func.inc
@@ -279,7 +279,8 @@ function rcmail_user_prefs($current=null)
// show config parameter for preview pane
if (!isset($no_override['preview_pane'])) {
$field_id = 'rcmfd_preview';
- $input_preview = new html_checkbox(array('name' => '_preview_pane', 'id' => $field_id, 'value' => 1));
+ $input_preview = new html_checkbox(array('name' => '_preview_pane', 'id' => $field_id, 'value' => 1,
+ 'onchange' => JS_OBJECT_NAME.'.toggle_preview_pane(this)'));
$blocks['main']['options']['preview_pane'] = array(
'title' => html::label($field_id, Q(rcube_label('previewpane'))),
@@ -287,6 +288,26 @@ function rcmail_user_prefs($current=null)
);
}
+ // show config parameter for preview pane auto mark as read delay
+ if (!isset($no_override['preview_pane_mark_read'])) {
+ // apply default if config option is not set at all
+ $config['preview_pane_mark_read'] = $RCMAIL->config->get('preview_pane_mark_read', 0);
+
+ $field_id = 'rcmfd_preview_pane_mark_read';
+ $select_delay = new html_select(array('name' => '_preview_pane_mark_read', 'id' => $field_id,
+ 'disabled' => $config['preview_pane']?0:1));
+
+ $select_delay->add(rcube_label('never'), '-1');
+ $select_delay->add(rcube_label('immediately'), 0);
+ foreach(array(5, 10, 20, 30) as $sec)
+ $select_delay->add(rcube_label(array('name' => 'afternseconds', 'vars' => array('n' => $sec))), $sec);
+
+ $blocks['main']['options']['preview_pane_mark_read'] = array(
+ 'title' => html::label($field_id, Q(rcube_label('previewpanemarkread'))),
+ 'content' => $select_delay->show(intval($config['preview_pane_mark_read'])),
+ );
+ }
+
if (!isset($no_override['mdn_requests'])) {
$field_id = 'rcmfd_mdn_requests';
$select_mdn_requests = new html_select(array('name' => '_mdn_requests', 'id' => $field_id));
diff --git a/program/steps/settings/save_prefs.inc b/program/steps/settings/save_prefs.inc
index 4eebef291..215ec44e8 100644
--- a/program/steps/settings/save_prefs.inc
+++ b/program/steps/settings/save_prefs.inc
@@ -40,7 +40,8 @@ switch ($CURR_SECTION)
case 'mailbox':
$a_user_prefs = array(
'focus_on_new_message' => isset($_POST['_focus_on_new_message']) ? TRUE : FALSE,
- 'preview_pane' => isset($_POST['_preview_pane']) ? TRUE : FALSE,
+ 'preview_pane' => isset($_POST['_preview_pane']) ? TRUE : FALSE,
+ 'preview_pane_mark_read' => isset($_POST['_preview_pane_mark_read']) ? intval($_POST['_preview_pane_mark_read']) : $CONFIG['preview_pane_mark_read'],
'autoexpand_threads' => isset($_POST['_autoexpand_threads']) ? intval($_POST['_autoexpand_threads']) : 0,
'mdn_requests' => isset($_POST['_mdn_requests']) ? intval($_POST['_mdn_requests']) : 0,
'keep_alive' => isset($_POST['_keep_alive']) ? intval($_POST['_keep_alive'])*60 : $CONFIG['keep_alive'],