You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@guacamole.apache.org by jm...@apache.org on 2016/06/30 05:37:24 UTC
[30/32] incubator-guacamole-client git commit: GUACAMOLE-55:
Automatically fire guacClipboard events from index controller when local
clipboard has changed.
GUACAMOLE-55: Automatically fire guacClipboard events from index controller when local clipboard has changed.
Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/commit/a4019b7f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/a4019b7f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/a4019b7f
Branch: refs/heads/master
Commit: a4019b7f82db6b4a1febeb225289e661df745250
Parents: b55c4c0
Author: Michael Jumper <mj...@apache.org>
Authored: Wed Jun 29 19:57:01 2016 -0700
Committer: Michael Jumper <mj...@apache.org>
Committed: Wed Jun 29 19:57:01 2016 -0700
----------------------------------------------------------------------
.../app/index/controllers/indexController.js | 23 ++++++++++++++++++++
.../src/main/webapp/app/index/indexModule.js | 1 +
2 files changed, 24 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/a4019b7f/guacamole/src/main/webapp/app/index/controllers/indexController.js
----------------------------------------------------------------------
diff --git a/guacamole/src/main/webapp/app/index/controllers/indexController.js b/guacamole/src/main/webapp/app/index/controllers/indexController.js
index 4d951fc..25e6b61 100644
--- a/guacamole/src/main/webapp/app/index/controllers/indexController.js
+++ b/guacamole/src/main/webapp/app/index/controllers/indexController.js
@@ -26,6 +26,7 @@ angular.module('index').controller('indexController', ['$scope', '$injector',
// Required services
var $document = $injector.get('$document');
var $window = $injector.get('$window');
+ var clipboardService = $injector.get('clipboardService');
var guacNotification = $injector.get('guacNotification');
/**
@@ -124,6 +125,28 @@ angular.module('index').controller('indexController', ['$scope', '$injector',
keyboard.reset();
};
+ /**
+ * Checks whether the clipboard data has changed, firing a new
+ * "guacClipboard" event if it has.
+ */
+ var checkClipboard = function checkClipboard() {
+ clipboardService.getLocalClipboard().then(function clipboardRead(data) {
+ $scope.$broadcast('guacClipboard', data);
+ });
+ };
+
+ // Attempt to read the clipboard if it may have changed
+ $window.addEventListener('load', checkClipboard, true);
+ $window.addEventListener('copy', checkClipboard, true);
+ $window.addEventListener('cut', checkClipboard, true);
+ $window.addEventListener('focus', function focusGained(e) {
+
+ // Only recheck clipboard if it's the window itself that gained focus
+ if (e.target === $window)
+ checkClipboard();
+
+ }, true);
+
// Display login screen if a whole new set of credentials is needed
$scope.$on('guacInvalidCredentials', function loginInvalid(event, parameters, error) {
$scope.page.title = 'APP.NAME';
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/a4019b7f/guacamole/src/main/webapp/app/index/indexModule.js
----------------------------------------------------------------------
diff --git a/guacamole/src/main/webapp/app/index/indexModule.js b/guacamole/src/main/webapp/app/index/indexModule.js
index e1bbd51..22ab84f 100644
--- a/guacamole/src/main/webapp/app/index/indexModule.js
+++ b/guacamole/src/main/webapp/app/index/indexModule.js
@@ -23,6 +23,7 @@
angular.module('index', [
'auth',
'client',
+ 'clipboard',
'home',
'login',
'manage',