diff options
author | thomascube <thomas@roundcube.net> | 2010-04-09 15:12:40 +0000 |
---|---|---|
committer | thomascube <thomas@roundcube.net> | 2010-04-09 15:12:40 +0000 |
commit | bc4960108e78b8a571745f55f54c83ea34fd0336 (patch) | |
tree | 5d970061197870d1ac258466587c939771ec6d79 /program/js | |
parent | 814905ca879d976792f33cf0fb45a4d3f8fedc32 (diff) |
Option not to mark messages as read when viewed in preview pane (#1485012)
Diffstat (limited to 'program/js')
-rw-r--r-- | program/js/app.js | 41 |
1 files changed, 29 insertions, 12 deletions
diff --git a/program/js/app.js b/program/js/app.js index b95cebd3d..946c43062 100644 --- a/program/js/app.js +++ b/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) { |