summaryrefslogtreecommitdiff
path: root/roundcubemail
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
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')
-rw-r--r--roundcubemail/program/js/app.js2
-rw-r--r--roundcubemail/program/js/list.js34
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;
+
},