(feat) reorganized menu + added view raw source feature

pull/95/merge
Ludovic Marcotte 2015-08-04 16:51:33 -04:00
parent dff7b59036
commit 6e114b84be
4 changed files with 64 additions and 18 deletions

View File

@ -1,8 +1,6 @@
/* UIxMailSourceView.h - this file is part of SOGo
*
* Copyright (C) 2007 Inverse inc.
*
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
* Copyright (C) 2007-2015 Inverse inc.
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,8 +1,6 @@
/* UIxMailSourceView.m - this file is part of SOGo
*
* Copyright (C) 2007 Inverse inc.
*
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
* Copyright (C) 2007-2015 Inverse inc.
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -68,12 +68,6 @@
<md-tooltip md-direction="left"><var:string label:value="Reply to Sender Only"/></md-tooltip>
<md-icon>reply</md-icon>
</md-button>
<md-button class="sg-icon-button" aria-label="Reply All"
ng-hide="viewer.message.isDraft"
ng-click="viewer.replyAll($event)">
<md-tooltip md-direction="left"><var:string label:value="Reply to sender and all recipients"/></md-tooltip>
<md-icon>reply_all</md-icon>
</md-button>
<md-button class="sg-icon-button" aria-label="Forward"
ng-hide="viewer.message.isDraft"
ng-click="viewer.forward($event)">
@ -90,12 +84,33 @@
<md-tooltip md-direction="left"><var:string label:value="Delete selected message or folder"/></md-tooltip>
<md-icon>delete</md-icon>
</md-button>
<md-button class="sg-icon-button" aria-label="Load Images"
ng-show="viewer.message.$hasUnsafeContent"
ng-click="viewer.message.loadUnsafeContent()">
<md-tooltip md-direction="left"><var:string label:value="Load Images"/></md-tooltip>
<md-icon>image</md-icon>
</md-button>
<md-menu>
<md-button label:aria-label="More mail options" class="sg-icon-button" ng-click="$mdOpenMenu($event)">
<md-icon>more_vert</md-icon>
</md-button>
<md-menu-content width="4">
<md-menu-item ng-hide="viewer.message.isDraft">
<md-button aria-label="Reply All"
ng-click="viewer.replyAll($event)">
<var:string label:value="Reply All"/>
</md-button>
</md-menu-item>
<md-menu-item ng-show="viewer.message.$hasUnsafeContent">
<md-button aria-label="Load Images"
ng-click="viewer.message.loadUnsafeContent()">
<var:string label:value="Load Images"/>
</md-button>
</md-menu-item>
<md-menu-item>
<md-button aria-label="View Message Source"
ng-click="viewer.viewRawSource($event)">
<var:string label:value="View Message Source"/>
</md-button>
</md-menu-item>
</md-menu-content>
</md-menu>
</div>
</header>
<md-divider><!-- divider --></md-divider>

View File

@ -21,6 +21,7 @@
vm.replyAll = replyAll;
vm.forward = forward;
vm.edit = edit;
vm.viewRawSource = viewRawSource;
// Watch the message model "flags" attribute to remove on-the-fly a tag from the IMAP message
// when removed from the message viewer.
@ -81,6 +82,40 @@
showMailEditor($event, vm.message);
});
}
function viewRawSource($event) {
Message.$$resource.post(vm.message.id, "viewsource").then(function(data) {
$mdDialog.show({
parent: angular.element(document.body),
targetEvent: $event,
clickOutsideToClose: true,
escapeToClose: true,
template: [
'<md-dialog flex="80" flex-sm="100" aria-label="' + l('View Message Source') + '">',
' <md-dialog-content>',
' <pre>',
data,
' </pre>',
' </md-dialog-content>',
' <div class="md-actions">',
' <md-button ng-click="close()">' + l('Close') + '</md-button>',
' </div>',
'</md-dialog>'
].join(''),
controller: MessageRawSourceDialogController
});
/**
* @ngInject
*/
MessageRawSourceDialogController.$inject = ['scope', '$mdDialog'];
function MessageRawSourceDialogController(scope, $mdDialog) {
scope.close = function() {
$mdDialog.hide();
};
}
});
}
}
angular