diff options
| -rw-r--r-- | roundcubemail/program/js/app.js | 2 | ||||
| -rw-r--r-- | roundcubemail/program/js/list.js | 34 |
2 files changed, 33 insertions, 3 deletions
diff --git a/roundcubemail/program/js/app.js b/roundcubemail/program/js/app.js index 1552bb568..d232c8510 100644 --- a/roundcubemail/program/js/app.js +++ b/roundcubemail/program/js/app.js @@ -1890,7 +1890,7 @@ function rcube_webmail() { var a_uids = new Array(); var r_uids = new Array(); - var selection = this.message_list ? this.message_list.get_selection() : new Array(); + var selection = this.message_list ? this.message_list.get_selection('mark') : new Array(); if (uid) a_uids[0] = uid; diff --git a/roundcubemail/program/js/list.js b/roundcubemail/program/js/list.js index 24e43a223..12cecc50a 100644 --- a/roundcubemail/program/js/list.js +++ b/roundcubemail/program/js/list.js @@ -698,9 +698,39 @@ clear_selection: function(id) /** * Getter for the selection array */ -get_selection: function() +get_selection: function(action) { - return this.selection; + action = typeof(action) != 'undefined' ? action : 'default'; + + // if one of the selections is a thread, then return the + // selection and all of it's chilren, but not when we're + // marking messages, only when moving/copying. + if (action != 'mark') + { + var uids = Array(); + for (i = 0; i < this.selection.length; i++) + { + var current_row = this.rows[this.selection[i]]; + uids.push(current_row.uid); + if (current_row.has_children) + { + // move to the next row and record the depth + current_row = this.rows[current_row.obj.nextSibling.uid]; + starting_depth = current_row.depth; + do + { + uids.push(current_row.uid); + if (!current_row.obj.nextSibling) + break; + current_row = this.rows[current_row.obj.nextSibling.uid]; + } while (current_row.depth >= starting_depth); + } + } + return uids; + } + else + return this.selection; + }, |
