[Libreoffice-commits] online.git: loleaflet/src
Henry Castro
hcastro at collabora.com
Tue Oct 3 03:01:15 UTC 2017
loleaflet/src/control/Control.Menubar.js | 8 ++++----
loleaflet/src/layer/tile/TileLayer.js | 21 ++++-----------------
loleaflet/src/map/handler/Map.StateChanges.js | 4 +---
3 files changed, 9 insertions(+), 24 deletions(-)
New commits:
commit d5b76b5d5ce73fcaacd085891d6ae105b5db4a6b
Author: Henry Castro <hcastro at collabora.com>
Date: Mon Oct 2 22:57:44 2017 -0400
loleaflet: use commandvalues to request the list available languages
Change-Id: Ibc312bf4d464dd7446715d7bf51ed208d41e8e6f
diff --git a/loleaflet/src/control/Control.Menubar.js b/loleaflet/src/control/Control.Menubar.js
index fbd818a9..56319ebc 100644
--- a/loleaflet/src/control/Control.Menubar.js
+++ b/loleaflet/src/control/Control.Menubar.js
@@ -320,7 +320,7 @@ L.Control.Menubar = L.Control.extend({
map.on('doclayerinit', this._onDocLayerInit, this);
map.on('addmenu', this._addMenu, this);
- map.on('commandinitialized', this._onInitMenu, this);
+ map.on('commandvalues', this._onInitMenu, this);
},
_addMenu: function (e) {
@@ -345,12 +345,12 @@ L.Control.Menubar = L.Control.extend({
if (e.commandName === '.uno:LanguageStatus') {
var liItem, aItem;
$menuParent = $('#menu-resetlanguage').parent();
- for (var lang in e.data) {
+ for (var lang in e.commandValues) {
liItem = L.DomUtil.create('li', '');
aItem = L.DomUtil.create('a', '', liItem);
- $(aItem).text(e.data[lang]);
+ $(aItem).text(e.commandValues[lang]);
$(aItem).data('type', 'unocommand');
- $(aItem).data('uno', '.uno:LanguageStatus?Language:string=' + encodeURIComponent('Default_' + e.data[lang]));
+ $(aItem).data('uno', '.uno:LanguageStatus?Language:string=' + encodeURIComponent('Default_' + e.commandValues[lang]));
$menuParent.append(liItem);
}
}
diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js
index c18c4004..a5bafca5 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -176,6 +176,7 @@ L.TileLayer = L.GridLayer.extend({
this._levels = {};
this._tiles = {};
this._tileCache = {};
+ this._map._socket.sendMessage('commandvalues command=.uno:LanguageStatus');
this._map._socket.sendMessage('commandvalues command=.uno:ViewAnnotations');
var that = this;
$.contextMenu({
@@ -1045,23 +1046,9 @@ L.TileLayer = L.GridLayer.extend({
_onStateChangedMsg: function (textMsg) {
textMsg = textMsg.substr(14);
var index = textMsg.indexOf('=');
- var commandName, state;
- if (index !== -1)
- {
- commandName = textMsg.substr(0, index);
- state = textMsg.substr(index + 1);
- this._map.fire('commandstatechanged', {commandName : commandName, state : state});
- return;
- }
-
- index = textMsg.indexOf('?');
- if (index !== -1)
- {
- commandName = textMsg.substr(0, index);
- textMsg = textMsg.substr(index + 1);
- state = JSON.parse(textMsg);
- this._map.fire('commandinitialized', {commandName: commandName, data: state});
- }
+ var commandName = index !== -1 ? textMsg.substr(0, index) : '';
+ var state = index !== -1 ? textMsg.substr(index + 1) : '';
+ this._map.fire('commandstatechanged', {commandName : commandName, state : state});
},
_onUnoCommandResultMsg: function (textMsg) {
diff --git a/loleaflet/src/map/handler/Map.StateChanges.js b/loleaflet/src/map/handler/Map.StateChanges.js
index b0abcb11..6c31981e 100644
--- a/loleaflet/src/map/handler/Map.StateChanges.js
+++ b/loleaflet/src/map/handler/Map.StateChanges.js
@@ -25,9 +25,7 @@ L.Map.StateChangeHandler = L.Handler.extend({
},
_onStateChanged: function(e) {
- if (e.commandName.indexOf('?') === -1) {
- this._items[e.commandName] = e.state;
- }
+ this._items[e.commandName] = e.state;
},
getItems: function() {
More information about the Libreoffice-commits
mailing list