[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-2-1' - loleaflet/src

Ashod Nakashian ashod.nakashian at collabora.co.uk
Mon Jun 5 15:00:50 UTC 2017


 loleaflet/src/core/Socket.js |   14 +++++++++++++-
 loleaflet/src/map/Map.js     |    7 ++++---
 2 files changed, 17 insertions(+), 4 deletions(-)

New commits:
commit 2b7ef1ac10926c91565156c7d769448ca647bf61
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Thu Jun 1 22:30:53 2017 -0400

    loleaflet: click to reload idle document
    
    Change-Id: I29275e71d8ca7ef9aa25ef4697ba5c6f414aa0bb
    Reviewed-on: https://gerrit.libreoffice.org/38336
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>
    (cherry picked from commit d4b2badd4e40e2d2e9bd526e6bfef050a7a5f81e)
    Reviewed-on: https://gerrit.libreoffice.org/38337
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    Tested-by: Jan Holesovsky <kendy at collabora.com>

diff --git a/loleaflet/src/core/Socket.js b/loleaflet/src/core/Socket.js
index fdce2a54..4085e107 100644
--- a/loleaflet/src/core/Socket.js
+++ b/loleaflet/src/core/Socket.js
@@ -112,6 +112,8 @@ L.Socket = L.Class.extend({
 	_onSocketOpen: function () {
 		console.debug('_onSocketOpen:');
 		this._map._serverRecycling = false;
+		this._map._documentIdle = false;
+
 		// Always send the protocol version number.
 		// TODO: Move the version number somewhere sensible.
 		this._doSend('loolclient ' + this.ProtocolVersionNumber);
@@ -231,6 +233,7 @@ L.Socket = L.Class.extend({
 			}
 			else if (textMsg === 'idle') {
 				msg = _('Session terminated due to idleness');
+				this._map._documentIdle = true;
 			}
 			else if (textMsg === 'shuttingdown') {
 				msg = _('Server is shutting down for maintenance (auto-saving)');
@@ -298,6 +301,15 @@ L.Socket = L.Class.extend({
 			});
 			options.$vex.append(options.$vexContent);
 
+			if (textMsg === 'idle') {
+				var map = this._map;
+				options.$vex.bind('click.vex', function(e) {
+					console.debug('idleness: reactivating');
+					map._documentIdle = false;
+					return map._activate();
+				});
+			}
+
 			$(options.appendLocation).append(options.$vex);
 			vex.setupBodyClassName(options.$vex);
 
@@ -306,7 +318,7 @@ L.Socket = L.Class.extend({
 				this._map.fire('postMessage', {msgId: 'Session_Closed'});
 			}
 
-			if (textMsg === 'idle' || textMsg === 'ownertermination') {
+			if (textMsg === 'ownertermination') {
 				this._map.remove();
 			}
 
diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js
index 0dc0f056..5ac07a4d 100644
--- a/loleaflet/src/map/Map.js
+++ b/loleaflet/src/map/Map.js
@@ -72,6 +72,7 @@ L.Map = L.Evented.extend({
 		this._enabled = true;
 		this._debugAlwaysActive = false; // disables the dimming / document inactivity when true
 		this._serverRecycling = false;
+		this._documentIdle = false;
 
 		vex.dialogID = -1;
 
@@ -796,7 +797,7 @@ L.Map = L.Evented.extend({
 	},
 
 	_activate: function () {
-		if (this._serverRecycling) {
+		if (this._serverRecycling || this._documentIdle) {
 			return;
 		}
 
@@ -890,7 +891,7 @@ L.Map = L.Evented.extend({
 	},
 
 	_startInactiveTimer: function () {
-		if (this._serverRecycling) {
+		if (this._serverRecycling || this._documentIdle) {
 			return;
 		}
 
@@ -903,7 +904,7 @@ L.Map = L.Evented.extend({
 	},
 
 	_deactivate: function () {
-		if (this._serverRecycling) {
+		if (this._serverRecycling || this._documentIdle) {
 			return;
 		}
 


More information about the Libreoffice-commits mailing list