diff --git a/src/js/controller/account.js b/src/js/controller/account.js index 982706f..e6d6332 100644 --- a/src/js/controller/account.js +++ b/src/js/controller/account.js @@ -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) { @@ -26,7 +22,7 @@ define(function(require) { return; } - var id = keys.keyId.substring(8,keys.keyId.length); + var id = keys.keyId.substring(8, keys.keyId.length); download(keys.publicKeyArmored + keys.privateKeyArmored, id + '.asc', 'text/plain'); }); }; @@ -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); }); } diff --git a/src/js/controller/navigation.js b/src/js/controller/navigation.js index c38f91e..376f365 100644 --- a/src/js/controller/navigation.js +++ b/src/js/controller/navigation.js @@ -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(); diff --git a/src/js/controller/write.js b/src/js/controller/write.js index 8f7d961..2506256 100644 --- a/src/js/controller/write.js +++ b/src/js/controller/write.js @@ -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)); - }); } }; }); diff --git a/src/tpl/account.html b/src/tpl/account.html index 6ed4d88..4ca02f7 100644 --- a/src/tpl/account.html +++ b/src/tpl/account.html @@ -1,7 +1,7 @@