@ -732,25 +732,13 @@ expand_row: function(e, id)
{
var row = this . rows [ id ] ,
evtarget = rcube _event . get _target ( e ) ,
mod _key = rcube _event . get _modifier ( e ) ;
mod _key = rcube _event . get _modifier ( e ) ,
action = ( row . expanded ? 'collapse' : 'expand' ) + ( mod _key == CONTROL _KEY || this . multiexpand ? '_all' : '' ) ;
// Don't treat double click on the expando as double click on the message.
row . clicked = 0 ;
if ( row . expanded ) {
evtarget . className = 'collapsed' ;
if ( mod _key == CONTROL _KEY || this . multiexpand )
this . collapse _all ( row ) ;
else
this . collapse ( row ) ;
}
else {
evtarget . className = 'expanded' ;
if ( mod _key == CONTROL _KEY || this . multiexpand )
this . expand _all ( row ) ;
else
this . expand ( row ) ;
}
this [ action ] ( row ) ;
} ,
collapse : function ( row )
@ -759,6 +747,7 @@ collapse: function(row)
new _row = row ? row . obj . nextSibling : null ;
row . expanded = false ;
this . update _expando ( row . id ) ;
this . triggerEvent ( 'expandcollapse' , { uid : row . uid , expanded : row . expanded , obj : row . obj } ) ;
while ( new _row ) {
@ -814,6 +803,7 @@ expand: function(row)
last _expanded _parent _depth = p . depth ;
$ ( new _row ) . css ( 'display' , '' ) ;
r . expanded = true ;
this . update _expando ( r . id , true ) ;
this . triggerEvent ( 'expandcollapse' , { uid : r . uid , expanded : r . expanded , obj : new _row } ) ;
}
}
@ -828,6 +818,7 @@ expand: function(row)
this . resize ( ) ;
this . triggerEvent ( 'listupdate' ) ;
return false ;
} ,
@ -843,7 +834,7 @@ collapse_all: function(row)
this . update _expando ( row . id ) ;
this . triggerEvent ( 'expandcollapse' , { uid : row . uid , expanded : row . expanded , obj : row . obj } ) ;
// don't collapse sub-root tree in multiexpand mode
// don't collapse sub-root tree in multiexpand mode
if ( depth && this . multiexpand )
return false ;
}
@ -860,10 +851,12 @@ collapse_all: function(row)
if ( row || r . depth )
$ ( new _row ) . css ( 'display' , 'none' ) ;
if ( r . has_children && r . expanded) {
if ( r . expanded) {
r . expanded = false ;
this . update _expando ( r . id , false ) ;
this . triggerEvent ( 'expandcollapse' , { uid : r . uid , expanded : r . expanded , obj : new _row } ) ;
if ( r . has _children ) {
this . update _expando ( r . id ) ;
this . triggerEvent ( 'expandcollapse' , { uid : r . uid , expanded : r . expanded , obj : new _row } ) ;
}
}
}
}
@ -872,6 +865,7 @@ collapse_all: function(row)
this . resize ( ) ;
this . triggerEvent ( 'listupdate' ) ;
return false ;
} ,
@ -899,10 +893,12 @@ expand_all: function(row)
break ;
$ ( new _row ) . css ( 'display' , '' ) ;
if ( r . has _children && ! r . expanded ) {
if ( ! r . expanded ) {
r . expanded = true ;
this . update _expando ( r . id , true ) ;
this . triggerEvent ( 'expandcollapse' , { uid : r . uid , expanded : r . expanded , obj : new _row } ) ;
if ( r . has _children ) {
this . update _expando ( r . id , true ) ;
this . triggerEvent ( 'expandcollapse' , { uid : r . uid , expanded : r . expanded , obj : new _row } ) ;
}
}
}
}
@ -911,6 +907,7 @@ expand_all: function(row)
this . resize ( ) ;
this . triggerEvent ( 'listupdate' ) ;
return false ;
} ,
@ -1429,29 +1426,20 @@ key_press: function(e)
mod _key = rcube _event . get _modifier ( e ) ;
switch ( keyCode ) {
case 40 :
case 38 :
case 63233 : // "down", in safari keypress
case 63232 : // "up", in safari keypress
case 37 : // Left arrow
case 39 : // Right arrow
case 40 : // Up arrow
case 38 : // Down arrow
case 63233 : // "down" in Safari keypress
case 63232 : // "up" in Safari keypress
// Stop propagation so that the browser doesn't scroll
rcube _event . cancel ( e ) ;
return this . use _arrow _key ( keyCode , mod _key ) ;
case 32 :
case 32 : // Space
rcube _event . cancel ( e ) ;
return this . select _row ( this . last _selected , mod _key , true ) ;
case 37 : // Left arrow
case 39 : // Right arrow
// Stop propagation
rcube _event . cancel ( e ) ;
var ret = this . use _arrow _key ( keyCode , mod _key ) ;
this . key _pressed = keyCode ;
this . modkey = mod _key ;
this . triggerEvent ( 'keypress' ) ;
this . modkey = 0 ;
return ret ;
case 36 : // Home
this . select _first ( mod _key ) ;
return rcube _event . cancel ( e ) ;
@ -1506,43 +1494,39 @@ key_press: function(e)
* /
use _arrow _key : function ( keyCode , mod _key )
{
var new _row ,
selected _row = this . rows [ this . last _selected ] ;
var new _row , selected _row = this . rows [ this . last _selected ] ;
// Safari uses the nonstandard keycodes 63232/63233 for up/down, if we're
if ( ! selected _row ) {
// select the first row if none selected yet
this . select _first ( CONTROL _KEY ) ;
}
// Safari uses the non-standard keycodes 63232/63233 for up/down, if we're
// using the keypress event (but not the keydown or keyup event).
if ( keyCode == 40 || keyCode == 63233 ) // down arrow key pressed
else if ( keyCode == 40 || keyCode == 63233 ) // Down arrow
new _row = this . get _next _row ( ) ;
else if ( keyCode == 38 || keyCode == 63232 ) // up arrow key pressed
else if ( keyCode == 38 || keyCode == 63232 ) // Up arrow
new _row = this . get _prev _row ( ) ;
else {
if ( ! selected _row || ! selected _row . has _children )
return ;
// expand
if ( keyCode == 39 ) {
if ( selected _row . expanded )
return ;
if ( mod _key == CONTROL _KEY || this . multiexpand )
this . expand _all ( selected _row ) ;
else
this . expand ( selected _row ) ;
}
// collapse
else if ( keyCode == 39 && selected _row . has _children ) { // Right arrow
if ( ! selected _row . expanded )
this . expand _all ( selected _row ) ;
else {
if ( ! selected _row . expanded )
return ;
if ( mod _key == CONTROL _KEY || this . multiexpand )
this . collapse _all ( selected _row ) ;
else
this . collapse ( selected _row ) ;
// jump to the first child
new _row = this . get _next _row ( ) ;
mod _key = null ;
}
}
else if ( keyCode == 37 ) { // Left arrow
if ( selected _row . expanded && selected _row . has _children && ( ! selected _row . parent _uid || ! this . multiexpand ) )
this . collapse _all ( selected _row ) ;
else if ( selected _row . parent _uid ) {
// jump to the top-most or closest parent
if ( mod _key == CONTROL _KEY )
new _row = this . rows [ this . find _root ( selected _row . uid ) ] ;
else
new _row = this . rows [ selected _row . parent _uid ] ;
this . update _expando ( selected _row . id , selected _row . expanded ) ;
return false ;
mod _key = null ;
}
}
if ( new _row ) {
@ -1553,10 +1537,6 @@ use_arrow_key: function(keyCode, mod_key)
this . select _row ( new _row . uid , mod _key , false ) ;
this . scrollto ( new _row . uid ) ;
}
else if ( ! new _row && ! selected _row ) {
// select the first row if none selected yet
this . select _first ( CONTROL _KEY ) ;
}
return false ;
} ,