[Libreoffice-commits] online.git: loleaflet/src

Ashod Nakashian ashod.nakashian at collabora.co.uk
Fri Jun 2 03:08:12 UTC 2017


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

New commits:
commit d4b2badd4e40e2d2e9bd526e6bfef050a7a5f81e
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>

diff --git a/loleaflet/src/core/Socket.js b/loleaflet/src/core/Socket.js
index c0b53dca..d3fe0c16 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);
@@ -243,6 +245,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)');
@@ -332,6 +335,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);
 
@@ -340,7 +352,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 f969cd4a..29a7cf8e 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