summaryrefslogtreecommitdiff
path: root/roundcubemail/program/js/list.js
diff options
context:
space:
mode:
authorNathan Kinkade <nkinkade@nkinka.de>2009-04-04 19:40:03 +0000
committerNathan Kinkade <nkinkade@nkinka.de>2009-04-04 19:40:03 +0000
commitf3bb47d0e30a2e581b5017f5b7da7bb4290b60cc (patch)
tree3af1196f3fb313100c80924fc5b29fed2378b3cb /roundcubemail/program/js/list.js
parent104e16492cfac7c170446f888995ee989d492db2 (diff)
Fixes moving and copying of threads so that all children of selected messages get moved along with the selected message itself.
Diffstat (limited to 'roundcubemail/program/js/list.js')
-rw-r--r--roundcubemail/program/js/list.js34
1 files changed, 32 insertions, 2 deletions
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;
+
},