Sorry about that. I just retried it and got the same problems. Try
this one. I created the one I sent earlier with cvs diff. This one was
created with Tortoise with whatever default options it throws into the
bag. This one works fine with the latest CVS (1.27 of app.js, I
believe.) Good luck.
-Charles
Daniel Paquet wrote:
> Is the patch work with a freshly cvs'ed source?
>
> The patch is failing for me. With error
>
> patching file app.js
> Hunk #3 FAILED at 1006.
> Hunk #5 FAILED at 1043.
> Hunk #6 FAILED at 1052.
> Hunk #7 succeeded at 1048 (offset -25 lines).
> Hunk #8 FAILED at 1053.
> Hunk #9 succeeded at 1064 (offset -111 lines).
> Hunk #10 succeeded at 1081 (offset -111 lines).
> Hunk #11 succeeded at 2762 (offset -111 lines).
> 4 out of 11 hunks FAILED -- saving rejects to file app.js.rej
>
>
>
Index: program/js/app.js
===================================================================
RCS file: /cvsroot/roundcubemail/roundcubemail/program/js/app.js,v
retrieving revision 1.27
diff -u -r1.27 app.js
--- program/js/app.js 13 Jan 2006 17:14:38 -0000 1.27
+++ program/js/app.js 19 Jan 2006 05:23:23 -0000
@@ -13,6 +13,10 @@
$Id: app.js,v 1.27 2006/01/13 17:14:38 roundcube Exp $
*/
+// Constants
+var CONTROL_KEY = 1;
+var SHIFT_KEY = 2;
+var CONTROL_SHIFT_KEY = 3;
var rcube_webmail_client;
@@ -997,11 +1001,30 @@
if (this.dont_select)
return false;
+ // selects currently unselected row
if (!this.in_selection_before)
- {
- var ctrl = this.check_ctrlkey(e);
- this.select(id, ctrl);
+ {
+ var mod_key = this.get_modifier(e);
+ if (!mod_key) {
+ this.select(id, false);
+ this.last_selected = id;
+ } else {
+ switch (mod_key) {
+ case SHIFT_KEY: { this.shift_select(id,false); break; }
+ case CONTROL_KEY: {
+ this.select(id, true);
+ this.last_selected = id;
+ break;
+ }
+ case CONTROL_SHIFT_KEY: { this.shift_select(id,true); break;}
+ default: {
+ this.select(id, false);
+ this.last_selected = id;
+ break;
+ }
+ }
}
+ }
if (this.selection.length)
{
@@ -1017,7 +1040,7 @@
// onmouseup-handler of message list row
this.click_row = function(e, id)
{
- var shift = this.check_shiftkey(e);
+ var mod_key = this.get_modifier(e);
// don't do anything (another action processed before)
if (this.dont_select)
@@ -1026,16 +1049,33 @@
return false;
}
- if (!this.drag_active && this.in_selection_before==id)
- {
- this.select(id, (shift && this.task!='settings'));
+ // unselects currently selected row
+ if (!this.drag_active && this.in_selection_before==id) {
+ if (!mod_key) {
+ this.last_selected = id;
+ this.select(id, false);
+ } else {
+ switch (mod_key) {
+ case SHIFT_KEY: { this.shift_select(id,false); break; }
+ case CONTROL_KEY: {
+ this.last_selected = id;
+ this.select(id, (this.task!='settings'));
+ break;
+ }
+ case CONTROL_SHIFT_KEY: {this.shift_select(id,true);break;}
+ default: {
+ this.select(id, false);
+ this.last_selected = id;
+ break;
+ }
+ }
}
-
+ }
this.drag_start = false;
this.in_selection_before = false;
// row was double clicked
- if (this.task=='mail' && this.list_rows && this.list_rows[id].clicked && !shift)
+ if (this.task=='mail' && this.list_rows && this.list_rows[id].clicked)
{
this.show_message(id);
return false;
@@ -1132,7 +1172,6 @@
this.selection = a_pre.concat(a_post);
this.set_classname(this.list_rows[id].obj, 'selected', false);
}
-
selected = (this.selection.length==1);
}
@@ -1150,6 +1189,28 @@
};
+// select all rows from the last selected row to the current one, while deselecting all other rows
+ this.shift_select = function(id,control)
+ {
+ var from_rowIndex = this.list_rows[this.last_selected].obj.rowIndex;
+ var to_rowIndex = this.list_rows[id].obj.rowIndex;
+
+ var i = ((from_rowIndex < to_rowIndex)? from_rowIndex : to_rowIndex);
+ var j = ((from_rowIndex > to_rowIndex)? from_rowIndex : to_rowIndex);
+
+ // iterate through the entire message list
+ for (var n in this.list_rows) {
+ if ((this.list_rows[n].obj.rowIndex >= i) && (this.list_rows[n].obj.rowIndex <= j)) {
+ if (!this.in_selection(n))
+ this.select(n, true);
+ } else {
+ if (this.in_selection(n) && !control)
+ this.select(n, true);
+ }
+ }
+ };
+
+
this.clear_selection = function()
{
for(var n=0; n<this.selection.length; n++)
@@ -2809,6 +2870,26 @@
return false;
}
+
+// returns modifier key (constants defined at top of file)
+ this.get_modifier = function(e)
+ {
+ var opcode = 0;
+ if (e = e || window.event)
+ {
+ opcode += (e.ctrlKey && CONTROL_KEY) + (e.shiftKey && SHIFT_KEY);
+ return opcode;
+ }
+ if (e.cancelBubble)
+ {
+ e.cancelBubble = true;
+ e.returnValue = false;
+ }
+ else if (e.preventDefault)
+ e.preventDefault();
+ }
+
+
this.get_mouse_pos = function(e)
{
if(!e) e = window.event;