From bff88dcb94a95d53ac37d8ac3c2b86f512b5869a Mon Sep 17 00:00:00 2001 From: alecpl Date: Fri, 13 May 2011 17:31:09 +0000 Subject: - Apply fixes from trunk (up to r4756) --- program/js/app.js | 47 +++++++++++++++++++++++------------------------ program/js/list.js | 8 +++++--- 2 files changed, 28 insertions(+), 27 deletions(-) (limited to 'program/js') diff --git a/program/js/app.js b/program/js/app.js index 07947db76..dcfed47bb 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -647,13 +647,13 @@ function rcube_webmail() case 'delete': // mail task - if (this.task=='mail') + if (this.task == 'mail') this.delete_messages(); // addressbook task - else if (this.task=='addressbook') + else if (this.task == 'addressbook') this.delete_contacts(); // user settings task - else if (this.task=='settings') + else if (this.task == 'settings') this.delete_identity(); break; @@ -1353,22 +1353,20 @@ function rcube_webmail() this.doc_mouse_up = function(e) { - var model, list, li; + var model, list, li, id; - if (this.message_list) { - if (!rcube_mouse_is_over(e, this.message_list.list.parentNode)) - this.message_list.blur(); + if (list = this.message_list) { + if (!rcube_mouse_is_over(e, list.list.parentNode)) + list.blur(); else - this.message_list.focus(); - list = this.message_list; + list.focus(); model = this.env.mailboxes; } - else if (this.contact_list) { - if (!rcube_mouse_is_over(e, this.contact_list.list.parentNode)) - this.contact_list.blur(); + else if (list = this.contact_list) { + if (!rcube_mouse_is_over(e, list.list.parentNode)) + list.blur(); else - this.contact_list.focus(); - list = this.contact_list; + list.focus(); model = this.env.contactfolders; } else if (this.ksearch_value) { @@ -1389,7 +1387,7 @@ function rcube_webmail() // reset 'pressed' buttons if (this.buttons_sel) { - for (var id in this.buttons_sel) + for (id in this.buttons_sel) if (typeof id != 'function') this.button_out(this.buttons_sel[id], id); this.buttons_sel = {}; @@ -1488,8 +1486,6 @@ function rcube_webmail() this.command('previouspage'); else if (list.key_pressed == 34) this.command('nextpage'); - else - list.shiftkey = false; }; this.msglist_get_preview = function() @@ -2415,17 +2411,19 @@ function rcube_webmail() // delete selected messages from the current mailbox this.delete_messages = function() { - var selection = this.message_list ? $.merge([], this.message_list.get_selection()) : []; + var uid, i, len, trash = this.env.trash_mailbox, + list = this.message_list, + selection = list ? $.merge([], list.get_selection()) : []; // exit if no mailbox specified or if selection is empty if (!this.env.uid && !selection.length) return; // also select childs of collapsed rows - for (var uid, i=0, len=selection.length; i=0; i--) - if (rows[i].id && String(rows[i].id).match(/rcmrow([a-z0-9\-_=\+\/]+)/i) && this.rows[RegExp.$1] != null) + if (rows[i].id && String(rows[i].id).match(/^rcmrow([a-z0-9\-_=\+\/]+)/i) && this.rows[RegExp.$1] != null) return RegExp.$1; } @@ -988,6 +988,8 @@ key_press: function(e) this.shiftkey = e.shiftKey; this.key_pressed = keyCode; this.triggerEvent('keypress'); + // reset shiftkey flag, we need it only for registered events + this.shiftkey = false; if (this.key_pressed == this.BACKSPACE_KEY) return rcube_event.cancel(e); -- cgit v1.2.3