@ -48,6 +48,7 @@ function rcube_webmail()
this . http _request _jobs = { } ;
this . http _request _jobs = { } ;
this . menu _stack = [ ] ;
this . menu _stack = [ ] ;
this . entity _selectors = [ ] ;
this . entity _selectors = [ ] ;
this . image _style = { } ;
// webmail client settings
// webmail client settings
this . dblclick _time = 500 ;
this . dblclick _time = 500 ;
@ -347,6 +348,7 @@ function rcube_webmail()
}
}
else if ( this . env . action == 'get' ) {
else if ( this . env . action == 'get' ) {
this . enable _command ( 'download' , true ) ;
this . enable _command ( 'download' , true ) ;
this . enable _command ( 'image-scale' , 'image-rotate' , ! ! /^image\// . test ( this . env . mimetype ) ) ;
// Mozilla's PDF.js viewer does not allow printing from host page (#5125)
// Mozilla's PDF.js viewer does not allow printing from host page (#5125)
// to minimize user confusion we disable the Print button
// to minimize user confusion we disable the Print button
@ -1018,6 +1020,10 @@ function rcube_webmail()
break ;
break ;
case 'add-contact' :
this . add _contact ( props ) ;
break ;
case 'load-remote' :
case 'load-remote' :
if ( this . env . uid ) {
if ( this . env . uid ) {
if ( props && this . env . sender ) {
if ( props && this . env . sender ) {
@ -3585,7 +3591,11 @@ function rcube_webmail()
ref . mailvelope _init ( action , kr ) ;
ref . mailvelope _init ( action , kr ) ;
} ;
} ;
mailvelope . getKeyring ( keyring ) . then ( fn , function ( err ) {
mailvelope . getVersion ( ) . then ( function ( v ) {
mailvelope . VERSION = v ;
mailvelope . VERSION _MAJOR = Math . floor ( parseFloat ( v ) ) ;
return mailvelope . getKeyring ( keyring ) ;
} ) . then ( fn , function ( err ) {
// attempt to create a new keyring for this app/user
// attempt to create a new keyring for this app/user
mailvelope . createKeyring ( keyring ) . then ( fn , function ( err ) {
mailvelope . createKeyring ( keyring ) . then ( fn , function ( err ) {
console . error ( err ) ;
console . error ( err ) ;
@ -3625,8 +3635,12 @@ function rcube_webmail()
else if ( action == 'compose' ) {
else if ( action == 'compose' ) {
this . env . compose _commands . push ( 'compose-encrypted' ) ;
this . env . compose _commands . push ( 'compose-encrypted' ) ;
var sign _supported = mailvelope . VERSION _MAJOR >= 2 ;
var is _html = $ ( '[name="_is_html"]' ) . val ( ) > 0 ;
var is _html = $ ( '[name="_is_html"]' ) . val ( ) > 0 ;
if ( sign _supported )
this . env . compose _commands . push ( 'compose-encrypted-signed' ) ;
if ( this . env . pgp _mime _message ) {
if ( this . env . pgp _mime _message ) {
// fetch PGP/Mime part and open load into Mailvelope editor
// fetch PGP/Mime part and open load into Mailvelope editor
var lock = this . set _busy ( true , this . get _label ( 'loadingdata' ) ) ;
var lock = this . set _busy ( true , this . get _label ( 'loadingdata' ) ) ;
@ -3637,6 +3651,8 @@ function rcube_webmail()
error : function ( o , status , err ) {
error : function ( o , status , err ) {
ref . http _error ( o , status , err , lock ) ;
ref . http _error ( o , status , err , lock ) ;
ref . enable _command ( 'compose-encrypted' , ! is _html ) ;
ref . enable _command ( 'compose-encrypted' , ! is _html ) ;
if ( sign _supported )
ref . enable _command ( 'compose-encrypted-signed' , ! is _html ) ;
} ,
} ,
success : function ( data ) {
success : function ( data ) {
ref . set _busy ( false , null , lock ) ;
ref . set _busy ( false , null , lock ) ;
@ -3648,24 +3664,38 @@ function rcube_webmail()
ref . compose _encrypted ( { quotedMail : data } ) ;
ref . compose _encrypted ( { quotedMail : data } ) ;
ref . enable _command ( 'compose-encrypted' , true ) ;
ref . enable _command ( 'compose-encrypted' , true ) ;
ref . enable _command ( 'compose-encrypted-signed' , false ) ;
}
}
} ) ;
} ) ;
}
}
else {
else {
// enable encrypted compose toggle
// enable encrypted compose toggle
this . enable _command ( 'compose-encrypted' , ! is _html ) ;
this . enable _command ( 'compose-encrypted' , ! is _html ) ;
if ( sign _supported )
this . enable _command ( 'compose-encrypted-signed' , ! is _html ) ;
}
}
// make sure to disable encryption button after toggling editor into HTML mode
// make sure to disable encryption button after toggling editor into HTML mode
this . addEventListener ( 'actionafter' , function ( args ) {
this . addEventListener ( 'actionafter' , function ( args ) {
if ( args . ret && args . action == 'toggle-editor' )
if ( args . ret && args . action == 'toggle-editor' ) {
ref . enable _command ( 'compose-encrypted' , ! args . props . html ) ;
ref . enable _command ( 'compose-encrypted' , ! args . props . html ) ;
if ( sign _supported )
ref . enable _command ( 'compose-encrypted-signed' , ! args . props . html ) ;
}
} ) ;
} ) ;
} else if ( action == 'edit-identity' ) {
} else if ( action == 'edit-identity' ) {
ref . mailvelope _identity _keygen ( ) ;
ref . mailvelope _identity _keygen ( ) ;
}
}
} ;
} ;
// handler for the 'compose-encrypted-signed' command
this . compose _encrypted _signed = function ( props )
{
props = props || { } ;
props . signMsg = true ;
this . compose _encrypted ( props ) ;
} ;
// handler for the 'compose-encrypted' command
// handler for the 'compose-encrypted' command
this . compose _encrypted = function ( props )
this . compose _encrypted = function ( props )
{
{
@ -3698,6 +3728,10 @@ function rcube_webmail()
options = { predefinedText : $ ( '#' + this . env . composebody ) . val ( ) } ;
options = { predefinedText : $ ( '#' + this . env . composebody ) . val ( ) } ;
}
}
if ( props . signMsg ) {
options . signMsg = props . signMsg ;
}
if ( this . env . compose _mode == 'reply' ) {
if ( this . env . compose _mode == 'reply' ) {
options . quotedMailIndent = true ;
options . quotedMailIndent = true ;
options . quotedMailHeader = this . env . compose _reply _header ;
options . quotedMailHeader = this . env . compose _reply _header ;
@ -5443,8 +5477,6 @@ function rcube_webmail()
{
{
if ( value )
if ( value )
this . http _post ( 'addcontact' , { _address : value , _reload : reload } ) ;
this . http _post ( 'addcontact' , { _address : value , _reload : reload } ) ;
return true ;
} ;
} ;
// send remote request to search mail or contacts
// send remote request to search mail or contacts
@ -5649,6 +5681,38 @@ function rcube_webmail()
this . env . is _sent = true ;
this . env . is _sent = true ;
} ;
} ;
this . image _rotate = function ( )
{
var curr = this . image _style ? ( this . image _style . rotate || 0 ) : 0 ;
this . image _style . rotate = curr > 180 ? 0 : curr + 90 ;
this . apply _image _style ( ) ;
} ;
this . image _scale = function ( prop )
{
var curr = this . image _style ? ( this . image _style . scale || 1 ) : 1 ;
this . image _style . scale = Math . max ( 0.1 , curr + 0.1 * ( prop == '-' ? - 1 : 1 ) ) ;
this . apply _image _style ( ) ;
} ;
this . apply _image _style = function ( )
{
var style = [ ] ,
head = $ ( this . gui _objects . messagepartframe ) . contents ( ) . find ( 'head' ) ;
$ ( '#image-style' , head ) . remove ( ) ;
$ . each ( { scale : '' , rotate : 'deg' } , function ( i , v ) {
var val = ref . image _style [ i ] ;
if ( val )
style . push ( i + '(' + val + v + ')' ) ;
} ) ;
if ( style )
head . append ( $ ( '<style id="image-style">' ) . text ( 'img { transform: ' + style . join ( ' ' ) + '}' ) ) ;
} ;
/*********************************************************/
/*********************************************************/
/********* keyboard live-search methods *********/
/********* keyboard live-search methods *********/
@ -6374,8 +6438,11 @@ function rcube_webmail()
{
{
var undelete = this . env . source && this . env . address _sources [ this . env . source ] . undelete ;
var undelete = this . env . source && this . env . address _sources [ this . env . source ] . undelete ;
if ( ! undelete ) {
if ( undelete ) {
cid = this . contact _list . get _selection ( ) ;
this . _with _selected _contacts ( 'delete' ) ;
}
else {
var cid = this . contact _list . get _selection ( ) ;
this . confirm _dialog ( this . get _label ( 'deletecontactconfirm' ) , 'delete' , function ( ) {
this . confirm _dialog ( this . get _label ( 'deletecontactconfirm' ) , 'delete' , function ( ) {
ref . _with _selected _contacts ( 'delete' , { _cid : cid } ) ;
ref . _with _selected _contacts ( 'delete' , { _cid : cid } ) ;
} ) ;
} ) ;