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

Pranav Kant pranavk at collabora.co.uk
Thu Sep 22 20:15:43 UTC 2016


 loleaflet/src/control/Permission.js           |    1 -
 loleaflet/src/core/Socket.js                  |   13 +++++--------
 loleaflet/src/layer/marker/ProgressOverlay.js |    3 +--
 loleaflet/src/layer/tile/TileLayer.js         |   10 +---------
 loleaflet/src/map/Map.js                      |   16 +++++++++-------
 5 files changed, 16 insertions(+), 27 deletions(-)

New commits:
commit 56d92527c2c3457c0578814216a678d1c7e7592c
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Fri Sep 23 01:21:43 2016 +0530

    loleaflet: Kill this troublesome editlock related code
    
    This code throws sometimes. Rather than investigating what makes
    it actually throw, lets kill it because we don't want any
    editlock functionality anyways now.
    
    Change-Id: I8a484ba9e3a658ca739122bb6d2d0c92c4180ff5

diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js
index f4158d1..122028c 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -198,17 +198,9 @@ L.TileLayer = L.GridLayer.extend({
 		this);
 
 		map.on('updatepermission', function(e) {
-			// {En,Dis}able selection handles
-			for (var key in this._selectionHandles) {
-				this._selectionHandles[key].setDraggable(e.perm === 'edit');
-			}
-
-			// we want graphic selection handles to appear
-			// when in editmode, and dissappear when in view mode
 			if (e.perm !== 'edit') {
-				this._graphicSelection = null;
+				this._clearSelections();
 			}
-			this._onUpdateGraphicSelection();
 		}, this);
 
 		for (var key in this._selectionHandles) {
commit afe14df0476835b49d4d12a56e263a52c86dbd9b
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Fri Sep 23 00:25:32 2016 +0530

    loleaflet: Start spinner when added to map
    
    ... otherwise we see a non-rotating spinner after first
    initialization.
    
    Change-Id: Idf6e259634607249e3411bf772a55fee768f925a

diff --git a/loleaflet/src/layer/marker/ProgressOverlay.js b/loleaflet/src/layer/marker/ProgressOverlay.js
index 91785e9..a6f7e35 100644
--- a/loleaflet/src/layer/marker/ProgressOverlay.js
+++ b/loleaflet/src/layer/marker/ProgressOverlay.js
@@ -20,6 +20,7 @@ L.ProgressOverlay = L.Layer.extend({
 			this.update();
 		}
 
+		this._spinnerInterval = L.LOUtil.startSpinner(this._spinnerCanvas, this.options.spinnerSpeed);
 		this._map.on('moveend', this.update, this);
 	},
 
@@ -56,8 +57,6 @@ L.ProgressOverlay = L.Layer.extend({
 
 		this._container.style.width  = this._size.x + 'px';
 
-		this._spinnerInterval = L.LOUtil.startSpinner(this._spinnerCanvas, this.options.spinnerSpeed);
-
 		L.DomEvent
 			.disableClickPropagation(this._progress)
 			.disableScrollPropagation(this._container);
commit 460ca57dab5aae99f10439dd0f66e7ebe89396c3
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Thu Sep 22 23:42:11 2016 +0530

    loleaflet: Smooth reconnection of documents
    
    Change-Id: Id8e2b02ee47e163f046c81949d3d2ce75f330542

diff --git a/loleaflet/src/core/Socket.js b/loleaflet/src/core/Socket.js
index 2c45d8e..3971f3e 100644
--- a/loleaflet/src/core/Socket.js
+++ b/loleaflet/src/core/Socket.js
@@ -74,13 +74,10 @@ L.Socket = L.Class.extend({
 		// TODO: Move the version number somewhere sensible.
 		this._doSend('loolclient ' + this.ProtocolVersionNumber);
 
-		var reconnecting = false;
 		var msg = 'load url=' + this._map.options.doc;
 		if (this._map._docLayer) {
 			// we are reconnecting after a lost connection
-			reconnecting = true;
 			msg += ' part=' + this._map.getCurrentPartNumber();
-			this._map.fire('statusindicator', {statusType : 'reconnected'});
 		}
 		if (this._map.options.timestamp) {
 			msg += ' timestamp=' + this._map.options.timestamp;
@@ -101,10 +98,6 @@ L.Socket = L.Class.extend({
 		}
 		this._msgQueue = [];
 
-		if (reconnecting) {
-			this._map.setPermission(this._map.options.permission);
-		}
-
 		this._map._activate();
 	},
 
@@ -274,6 +267,11 @@ L.Socket = L.Class.extend({
 			this._map._docLayer = docLayer;
 			this._map.addLayer(docLayer);
 			this._map.fire('doclayerinit');
+		} else if (textMsg.startsWith('status:')) {
+			// we are reconnecting ...
+			this._map._docLayer._onMessage('invalidatetiles: EMPTY', null);
+			this._map.fire('statusindicator', {statusType: 'finish'});
+			this._map.setPermission(this._map.options.permission);
 		}
 
 		// these can arrive very early during the startup
diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js
index 7baeaae..d1e8329 100644
--- a/loleaflet/src/map/Map.js
+++ b/loleaflet/src/map/Map.js
@@ -714,18 +714,20 @@ L.Map = L.Evented.extend({
 		clearTimeout(vex.timer);
 
 		if (!this._active) {
-			this._socket.sendMessage('useractive');
-
 			// Only activate when we are connected.
 			if (this._socket.connected()) {
+				this._socket.sendMessage('useractive');
 				this._active = true;
 				this._docLayer._onMessage('invalidatetiles: EMPTY', null);
+			} else {
+				this._active = true;
+				this._socket.initialize(this);
+			}
 
-				if (vex.dialogID > 0) {
-					var id = vex.dialogID;
-					vex.dialogID = -1;
-					return vex.close(id);
-				}
+			if (vex.dialogID > 0) {
+				var id = vex.dialogID;
+				vex.dialogID = -1;
+				return vex.close(id);
 			}
 		}
 
commit 143ce92995e204c4fa58a5eac112ab4bc46a17e1
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Thu Sep 22 23:40:30 2016 +0530

    loleaflet: Don't send 'status' command, server sends it always
    
    Change-Id: Ibcacda08309e887cb80588220fb423726134d959

diff --git a/loleaflet/src/core/Socket.js b/loleaflet/src/core/Socket.js
index 23a6436..2c45d8e 100644
--- a/loleaflet/src/core/Socket.js
+++ b/loleaflet/src/core/Socket.js
@@ -95,7 +95,6 @@ L.Socket = L.Class.extend({
 			msg += ' options=' + JSON.stringify(options);
 		}
 		this._doSend(msg);
-		this._doSend('status');
 		this._doSend('partpagerectangles');
 		for (var i = 0; i < this._msgQueue.length; i++) {
 			this._doSend(this._msgQueue[i].msg, this._msgQueue[i].coords);
commit 7db798992fac2975e7b785ef4c6c42bf5b3c0e21
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Thu Sep 22 21:29:47 2016 +0530

    loleaflet: Set permission to default after reconnecting
    
    Change-Id: I39ce187e47371785bf4a183253349bbdbea9786c

diff --git a/loleaflet/src/control/Permission.js b/loleaflet/src/control/Permission.js
index 8df2297..5be2554 100644
--- a/loleaflet/src/control/Permission.js
+++ b/loleaflet/src/control/Permission.js
@@ -3,7 +3,6 @@
  */
 L.Map.include({
 	setPermission: function (perm) {
-		this._oldPermission = this._permission;
 		this._permission = perm;
 		if (perm === 'edit') {
 			this._socket.sendMessage('requestloksession');
diff --git a/loleaflet/src/core/Socket.js b/loleaflet/src/core/Socket.js
index 4bb4b8e..23a6436 100644
--- a/loleaflet/src/core/Socket.js
+++ b/loleaflet/src/core/Socket.js
@@ -103,7 +103,7 @@ L.Socket = L.Class.extend({
 		this._msgQueue = [];
 
 		if (reconnecting) {
-			this._map.setPermission(this._map._oldPermission);
+			this._map.setPermission(this._map.options.permission);
 		}
 
 		this._map._activate();


More information about the Libreoffice-commits mailing list