1
0
mirror of https://github.com/moparisthebest/mail synced 2024-11-29 20:32:15 -05:00

review and fix key export

This commit is contained in:
Tankred Hase 2013-10-22 16:45:50 +02:00
parent 33440ae16f
commit ed3f4318b4
5 changed files with 25 additions and 23 deletions

View File

@ -15,10 +15,6 @@ define(function(require) {
// scope functions
//
$scope.hideAccountView = function() {
$scope.$parent.$parent.accountOpen = false;
};
$scope.exportKeyFile = function() {
emailDao._crypto.exportKeys(function(err, keys) {
if (err) {
@ -47,7 +43,9 @@ define(function(require) {
file.createWriter(function(writer) {
writer.onerror = console.error;
writer.onwriteend = function() {};
writer.write(new Blob([content], { type: contentType }));
writer.write(new Blob([content], {
type: contentType
}));
}, console.error);
});
}

View File

@ -24,7 +24,6 @@ define(function(require) {
$scope.openNav = function() {
$scope.navOpen = true;
};
$scope.closeNav = function() {
$scope.navOpen = false;
};
@ -33,7 +32,6 @@ define(function(require) {
$scope.writerReply = !! (replyTo);
$scope.writerOpen = true;
};
$scope.closeWriter = function() {
$scope.writerOpen = false;
};
@ -43,9 +41,12 @@ define(function(require) {
$scope.closeNav();
};
$scope.showAccountView = function() {
$scope.openAccount = function() {
$scope.accountOpen = true;
};
$scope.closeAccount = function() {
$scope.accountOpen = false;
};
$scope.remove = function(email) {
var trashFolder = _.findWhere($scope.folders, {
@ -150,25 +151,32 @@ define(function(require) {
ngModule.directive('keyShortcuts', function() {
return function(scope, elm) {
elm.bind('keydown', function(e) {
if (e.keyCode === 78 && !scope.$$childTail.writerOpen) {
var cs = scope.$$childTail;
if (e.keyCode === 78 && !cs.writerOpen) {
// n -> new mail
e.preventDefault();
scope.$$childTail.openWriter();
cs.openWriter();
} else if (e.keyCode === 82 && !scope.$$childTail.writerOpen && scope.$$childTail.selected) {
} else if (e.keyCode === 82 && !cs.writerOpen && cs.selected) {
// r -> reply
e.preventDefault();
scope.$$childTail.openWriter(scope.$$childTail.selected);
cs.openWriter(cs.selected);
} else if (e.keyCode === 27 && scope.$$childTail.writerOpen) {
} else if (e.keyCode === 27 && cs.writerOpen) {
// escape -> close writer
e.preventDefault();
scope.$$childTail.closeWriter();
cs.closeWriter();
} else if (e.keyCode === 83 && !scope.$$childTail.writerOpen && scope.$$childTail.synchronize) {
} else if (e.keyCode === 27 && cs.accountOpen) {
// escape -> close account view
e.preventDefault();
cs.closeAccount();
} else if (e.keyCode === 83 && !cs.writerOpen && cs.synchronize) {
// s -> sync folder
e.preventDefault();
scope.$$childTail.synchronize();
cs.synchronize();
}
scope.$apply();

View File

@ -173,10 +173,6 @@ define(function(require) {
});
}
});
// set attribute value to 'false' on blur event:
element.bind('blur', function() {
scope.$apply(model.assign(scope, false));
});
}
};
});

View File

@ -1,7 +1,7 @@
<div class="lightbox-body" ng-controller="AccountCtrl">
<header>
<h2>Account</h2>
<button class="close" ng-click="hideAccountView()" data-action="lightbox-close">&#xe007;</button>
<button class="close" ng-click="closeAccount()" data-action="lightbox-close">&#xe007;</button>
</header>
<div class="content">

View File

@ -13,7 +13,7 @@
</ul>
<ul class="nav-secondary">
<li><a href="#" ng-click="showAccountView(); $event.preventDefault()">Account</a></li>
<li><a href="#" ng-click="openAccount(); $event.preventDefault()">Account</a></li>
<li><a href="#">About whiteout.io</a></li>
<li><a href="#">Help</a></li>
</ul>