summaryrefslogtreecommitdiff
path: root/program
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2013-12-12 08:59:41 +0100
committerAleksander Machniak <alec@alec.pl>2013-12-12 08:59:41 +0100
commit4187b3e26ff00b607d05cb9b588e83db18c3cab7 (patch)
tree65e2f2263cf96a7765e54d7fb303e5c0173a05ee /program
parentd19c0f9f309cbe63411a8ddcbbda3daf7461a30d (diff)
parent48660a881c698e3cd45dcff5075c8541e178331d (diff)
Merge branch 'master' of github.com:roundcube/roundcubemail
Diffstat (limited to 'program')
-rw-r--r--program/js/app.js12
-rw-r--r--program/js/list.js86
-rw-r--r--program/steps/settings/save_folder.inc2
3 files changed, 58 insertions, 42 deletions
diff --git a/program/js/app.js b/program/js/app.js
index bad8a2f9c..cbe61ab4a 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -5744,19 +5744,23 @@ function rcube_webmail()
.prop({checked: subscribed ? true : false, disabled: is_protected ? true : false});
// add to folder/row-ID map
- this.env.subscriptionrows[id] = [name, display_name, 0];
+ this.env.subscriptionrows[id] = [name, display_name, false];
// sort folders (to find a place where to insert the row)
// replace delimiter with \0 character to fix sorting
// issue where 'Abc Abc' would be placed before 'Abc/def'
var replace_from = RegExp(RegExp.escape(this.env.delimiter), 'g'),
replace_to = String.fromCharCode(0);
+
$.each(this.env.subscriptionrows, function(k,v) {
- var n = v[0];
- n = n.replace(replace_from, replace_to);
- v.push(n);
+ if (v.length < 4) {
+ var n = v[0];
+ n = n.replace(replace_from, replace_to);
+ v.push(n);
+ }
folders.push(v);
});
+
folders.sort(function(a, b) {
var len = a.length - 1; n1 = a[len], n2 = b[len];
return n1 < n2 ? -1 : 1;
diff --git a/program/js/list.js b/program/js/list.js
index 8677f029d..895a9e645 100644
--- a/program/js/list.js
+++ b/program/js/list.js
@@ -1322,59 +1322,71 @@ drag_mouse_move: function(e)
if (this.drag_start) {
// check mouse movement, of less than 3 pixels, don't start dragging
- var m = rcube_event.get_mouse_pos(e);
+ var m = rcube_event.get_mouse_pos(e),
+ limit = 10, selection = [], self = this;
if (!this.drag_mouse_start || (Math.abs(m.x - this.drag_mouse_start.x) < 3 && Math.abs(m.y - this.drag_mouse_start.y) < 3))
return false;
+ // remember dragging start position
+ this.drag_start_pos = {left: m.x, top: m.y};
+
+ // initialize drag layer
if (!this.draglayer)
this.draglayer = $('<div>').attr('id', 'rcmdraglayer')
- .css({ position:'absolute', display:'none', 'z-index':2000 })
+ .css({position: 'absolute', display: 'none', 'z-index': 2000})
.appendTo(document.body);
+ else
+ this.draglayer.html('');
- // also select childs of (collapsed) threads for dragging
- var n, uid, selection = $.merge([], this.selection);
- for (n in selection) {
- uid = selection[n];
- if (!this.rows[uid].expanded)
- this.select_children(uid);
- }
+ // get selected rows (in display order), don't use this.selection here
+ $(this.row_tagname() + '.selected', this.tbody).each(function() {
+ if (!String(this.id).match(self.id_regexp))
+ return;
- // reset content
- this.draglayer.html('');
+ var uid = RegExp.$1, row = self.rows[uid];
- // get subjects of selected messages
- var n, obj, me = this;
- for (n=0; n<this.selection.length; n++) {
- // only show 12 lines
- if (n>12) {
- this.draglayer.append('...');
- break;
- }
+ if ($.inArray(uid, selection) > -1)
+ return;
- if (obj = this.rows[this.selection[n]].obj) {
- $('> '+this.col_tagname(), obj).each(function(i, elem) {
- if (n == 0)
- me.drag_start_pos = $(elem).offset();
+ selection.push(uid);
- if (me.subject_col < 0 || (me.subject_col >= 0 && me.subject_col == i)) {
- var subject = $(elem).text();
+ // also handle children of (collapsed) trees for dragging (they might be not selected)
+ if (row.has_children && !row.expanded)
+ $.each(self.row_children(uid), function() {
+ if ($.inArray(this, selection) > -1)
+ return;
+ selection.push(this);
+ });
- if (subject) {
- // remove leading spaces
- subject = $.trim(subject);
- // truncate line to 50 characters
- subject = (subject.length > 50 ? subject.substring(0, 50) + '...' : subject);
+ // break the loop asap
+ if (selection.length > limit + 1)
+ return false;
+ });
- var entry = $('<div>').text(subject);
- me.draglayer.append(entry);
- }
+ // append subject (of every row up to the limit) to the drag layer
+ $.each(selection, function(i, uid) {
+ if (i > limit) {
+ self.draglayer.append('...');
+ return false;
+ }
+
+ $('> ' + self.col_tagname(), self.rows[uid].obj).each(function(n, cell) {
+ if (self.subject_col < 0 || (self.subject_col >= 0 && self.subject_col == n)) {
+ var subject = $(cell).text();
- return false; // break
+ if (subject) {
+ // remove leading spaces
+ subject = $.trim(subject);
+ // truncate line to 50 characters
+ subject = (subject.length > 50 ? subject.substring(0, 50) + '...' : subject);
+
+ self.draglayer.append($('<div>').text(subject));
+ return false;
}
- });
- }
- }
+ }
+ });
+ });
this.draglayer.show();
this.drag_active = true;
diff --git a/program/steps/settings/save_folder.inc b/program/steps/settings/save_folder.inc
index efb096d57..72a631cfc 100644
--- a/program/steps/settings/save_folder.inc
+++ b/program/steps/settings/save_folder.inc
@@ -40,7 +40,7 @@ $options = strlen($old_imap) ? rcmail_folder_options($old_imap) : array();
if ($options['protected'] || $options['norename']) {
}
else if (!strlen($name)) {
- $error = rcube_label('cannotbeempty');
+ $error = rcube_label('namecannotbeempty');
}
else if (mb_strlen($name) > 128) {
$error = rcube_label('nametoolong');