* Mail: Implement new preference for toggle actions. For instance, switching Cc, BCc or S/MIME Sign always on when trying to compose an email.

This commit is contained in:
Hadi Nategh 2018-06-25 11:34:16 +02:00
parent 4313b57675
commit ec59013349
2 changed files with 47 additions and 12 deletions

View File

@ -182,25 +182,25 @@ class mail_hooks
$folderList['none'] = lang('no folders');
// Build toogled on actions sel options
$allActions = array_merge(mail_compose::getToolbarActions(array(
$allActions = mail_compose::getToolbarActions(array(
'priority' => true,
'mailaccount' => $GLOBALS['egw_info']['user']['preferences']['mail']['ActiveProfileID']
)));
));
$toggledOnActions = array (
'mail_compose.cc_expander' => array (
'id' => 'mail_compose.cc_expander',
'cc_expander' => array (
'id' => 'cc_expander',
'label' => lang('Cc'),
),
'mail_compose.bcc_expander' => array (
'id' => 'mail_compose.bcc_expander',
'bcc_expander' => array (
'id' => 'bcc_expander',
'label' => lang('Bcc')
),
'mail_compose.folder_expander' => array(
'id' => 'mail_compose.folder_expander',
'folder_expander' => array(
'id' => 'folder_expander',
'label' => lang('Folder')
),
'mail_compose.replyto_expander' => array(
'id' => 'mail_compose.replyto_expander',
'replyto_expander' => array(
'id' => 'replyto_expander',
'label' => lang('Reply to')
)
);
@ -209,8 +209,8 @@ class mail_hooks
{
if ($action['checkbox'])
{
$toggledOnActions['mail_compose.'.$name] = array(
'id' => 'mail_compose.'.$name,
$toggledOnActions[$name] = array(
'id' => $name,
'label' => lang($action['caption']),
'title' => lang($action['hint']),
'icon' => $action['icon'],

View File

@ -350,6 +350,7 @@ app.classes.mail = AppJS.extend(
this.mail_currentlyFocussed = this.et2.mail_currentlyFocussed;
}
this.preSetToggledOnActions ();
},
/**
@ -6100,5 +6101,39 @@ app.classes.mail = AppJS.extend(
template: egw.webserverUrl+'/mail/templates/default/modifyMessageSubjectDialog.xet?1',
resizable: false
}, et2_dialog._create_parent('mail'));
},
/**
* Pre set toggled actions
*/
preSetToggledOnActions: function ()
{
var actions = egw.preference('toggledOnActions', 'mail');
var toolbar = this.et2.getWidgetById('composeToolbar');
if (actions)
{
actions = actions.split(',');
for (var i=0; i < actions.length; i++)
{
if (toolbar.options.actions[actions[i]])
{
var $d = jQuery('#composeToolbar-'+actions[i]);
if ($d.length > 0
&& toolbar._actionManager.getActionById(actions[i]).checkbox
&& !toolbar._actionManager.getActionById(actions[i]).checked)
{
$d.trigger('click');
}
}
else
{
var widget = this.et2.getWidgetById(actions[i]);
if (widget)
{
jQuery(widget.getDOMNode()).trigger('click');
}
}
}
}
}
});