Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Option not to mark messages as read when viewed in preview pane (#148…

…5012)
  • Loading branch information...
commit bc4960108e78b8a571745f55f54c83ea34fd0336 1 parent 814905c
@thomascube thomascube authored
View
2  CHANGELOG
@@ -1,6 +1,8 @@
CHANGELOG RoundCube Webmail
===========================
+- Added option not to mark messages as read when viewed in preview pane (#1485012)
+- Allow plugins modify the Sent folder when composing (#1486548)
- Added optional (max_recipients) support to restrict total number of recipients per message (#1484542)
- Re-organize editor buttons, add blockquote and search buttons
- Make possible to write inside or after a quoted html message (#1485476)
View
4 config/main.inc.php.dist
@@ -434,6 +434,10 @@ $rcmail_config['draft_autosave'] = 300;
// default setting if preview pane is enabled
$rcmail_config['preview_pane'] = false;
+// Mark as read when viewed in preview pane (delay in seconds)
+// Set to -1 if messages in preview pane should not be marked as read
+$rcmail_config['preview_pane_mark_read'] = 0;
+
// focus new window if new message arrives
$rcmail_config['focus_on_new_message'] = true;
View
41 program/js/app.js
@@ -1273,6 +1273,9 @@ function rcube_webmail()
if (this.preview_timer)
clearTimeout(this.preview_timer);
+ if (this.preview_read_timer)
+ clearTimeout(this.preview_read_timer);
+
// save folderlist and folders location/sizes for droptarget calculation in drag_move()
if (this.gui_objects.folderlist && model)
{
@@ -1438,6 +1441,9 @@ function rcube_webmail()
if (this.preview_timer)
clearTimeout(this.preview_timer);
+ if (this.preview_read_timer)
+ clearTimeout(this.preview_read_timer);
+
var selected = list.get_single_selection() != null;
// Hide certain command buttons when Drafts folder is selected
@@ -1465,6 +1471,9 @@ function rcube_webmail()
if (this.preview_timer)
clearTimeout(this.preview_timer);
+ if (this.preview_read_timer)
+ clearTimeout(this.preview_read_timer);
+
var uid = list.get_single_selection();
if (uid && this.env.mailbox == this.env.drafts_mailbox)
this.goto_url('compose', '_draft_uid='+uid+'&_mbox='+urlencode(this.env.mailbox), true);
@@ -1754,24 +1763,25 @@ function rcube_webmail()
var url = '&_action='+action+'&_uid='+id+'&_mbox='+urlencode(this.env.mailbox)+add_url;
if (action == 'preview' && String(target.location.href).indexOf(url) >= 0)
this.show_contentframe(true);
- else
- {
+ else {
this.set_busy(true, 'loading');
target.location.href = this.env.comm_path+url;
// mark as read and change mbox unread counter
- if (action == 'preview' && this.message_list && this.message_list.rows[id] && this.message_list.rows[id].unread)
- {
- this.set_message(id, 'unread', false);
- this.update_thread_root(id, 'read');
- if (this.env.unread_counts[this.env.mailbox])
- {
- this.env.unread_counts[this.env.mailbox] -= 1;
- this.set_unread_count(this.env.mailbox, this.env.unread_counts[this.env.mailbox], this.env.mailbox == 'INBOX');
+ if (action == 'preview' && this.message_list && this.message_list.rows[id] && this.message_list.rows[id].unread && this.env.preview_pane_mark_read >= 0) {
+ this.preview_read_timer = window.setTimeout(function() {
+ ref.set_message(id, 'unread', false);
+ ref.update_thread_root(id, 'read');
+ if (ref.env.unread_counts[ref.env.mailbox]) {
+ ref.env.unread_counts[ref.env.mailbox] -= 1;
+ ref.set_unread_count(ref.env.mailbox, ref.env.unread_counts[ref.env.mailbox], ref.env.mailbox == 'INBOX');
}
- }
+ if (ref.env.preview_pane_mark_read > 0)
+ ref.http_post('mark', '_uid='+id+'&_flag=read');
+ }, this.env.preview_pane_mark_read * 1000);
}
- };
+ }
+ };
this.show_contentframe = function(show)
{
@@ -4661,6 +4671,13 @@ function rcube_webmail()
addrbook_show_images.disabled = !checkbox.checked;
}
+ this.toggle_preview_pane = function(checkbox)
+ {
+ var preview_pane_mark_read;
+ if (preview_pane_mark_read = document.getElementById('rcmfd_preview_pane_mark_read'))
+ preview_pane_mark_read.disabled = !checkbox.checked;
+ }
+
// display fetched raw headers
this.set_headers = function(content)
{
View
3  program/localization/de_CH/labels.inc
@@ -271,6 +271,7 @@ $labels['autosavedraft'] = 'Entwurf autom. speichern';
$labels['everynminutes'] = '$n Minute(n)';
$labels['keepalive'] = 'Auf neue Nachrichten prüfen nach';
$labels['never'] = 'nie';
+$labels['immediately'] = 'sofort';
$labels['messagesdisplaying'] = 'Nachrichtendarstellung';
$labels['messagescomposition'] = 'Nachrichtenerstellung';
$labels['mimeparamfolding'] = 'Namen der Dateianhänge';
@@ -299,6 +300,8 @@ $labels['replysignaturepos'] = 'Beim Antworten oder Weiterleiten die Signatur';
$labels['belowquote'] = 'unter der Originalnachricht einfügen';
$labels['abovequote'] = 'über der Originalnachricht einfügen';
$labels['insertsignature'] = 'Signatur einfügen';
+$labels['previewpanemarkread'] = 'Nachricht in Vorschau als gelesen markieren';
+$labels['afternseconds'] = 'nach $n Sekuden';
$labels['folder'] = 'Ordner';
$labels['folders'] = 'Ordner';
$labels['foldername'] = 'Ordnername';
View
3  program/localization/de_DE/labels.inc
@@ -271,6 +271,7 @@ $labels['autosavedraft'] = 'Entwurf automatisch speichern';
$labels['everynminutes'] = '$n Minute(n)';
$labels['keepalive'] = 'Auf neue Nachrichten prüfen nach';
$labels['never'] = 'nie';
+$labels['immediately'] = 'sofort';
$labels['messagesdisplaying'] = 'Nachrichtendarstellung';
$labels['messagescomposition'] = 'Nachrichtenerstellung';
$labels['mimeparamfolding'] = 'Namen der Dateianhänge';
@@ -299,6 +300,8 @@ $labels['replysignaturepos'] = 'Beim Antworten die Signatur';
$labels['belowquote'] = 'unter der Originalnachricht einfügen';
$labels['abovequote'] = 'über der Originalnachricht einfügen';
$labels['insertsignature'] = 'Signatur einfügen';
+$labels['previewpanemarkread'] = 'Nachricht in Vorschau als gelesen markieren';
+$labels['afternseconds'] = 'nach $n Sekuden';
$labels['folder'] = 'Ordner';
$labels['folders'] = 'Ordner';
$labels['foldername'] = 'Ordnername';
View
3  program/localization/en_US/labels.inc
@@ -327,6 +327,7 @@ $labels['autosavedraft'] = 'Automatically save draft';
$labels['everynminutes'] = 'every $n minute(s)';
$labels['keepalive'] = 'Check for new messages on';
$labels['never'] = 'never';
+$labels['immediately'] = 'immediately';
$labels['messagesdisplaying'] = 'Displaying Messages';
$labels['messagescomposition'] = 'Composing Messages';
$labels['mimeparamfolding'] = 'Attachment names';
@@ -355,6 +356,8 @@ $labels['replysignaturepos'] = 'When replying or forwarding place signature';
$labels['belowquote'] = 'below the quote';
$labels['abovequote'] = 'above the quote';
$labels['insertsignature'] = 'Insert signature';
+$labels['previewpanemarkread'] = 'Mark previewed messages as read';
+$labels['afternseconds'] = 'after $n seconds';
$labels['folder'] = 'Folder';
$labels['folders'] = 'Folders';
View
4 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);
View
4 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'])
View
4 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;
View
23 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));
View
3  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'],
Please sign in to comment.
Something went wrong with that request. Please try again.