[Libreoffice-commits] online.git: 2 commits - loleaflet/src
Szymon Kłos (via logerrit)
logerrit at kemper.freedesktop.org
Fri Sep 27 15:05:51 UTC 2019
loleaflet/src/control/Control.JSDialogBuilder.js | 25 ++++++++++++++++++++++-
loleaflet/src/control/Control.MobileWizard.js | 3 +-
2 files changed, 26 insertions(+), 2 deletions(-)
New commits:
commit 962cf621a79db1bfa42498a52f8443ef0c31459f
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Thu Sep 26 15:36:24 2019 +0200
Commit: Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Fri Sep 27 17:05:41 2019 +0200
jsdialogs: show images from JSON for toolbox items
Change-Id: Id388ddd742f3f3812b4f0e6040fbdc24974fea6b
Reviewed-on: https://gerrit.libreoffice.org/79740
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
Tested-by: Szymon Kłos <szymon.klos at collabora.com>
diff --git a/loleaflet/src/control/Control.JSDialogBuilder.js b/loleaflet/src/control/Control.JSDialogBuilder.js
index 25bcfde1a..b2e656847 100644
--- a/loleaflet/src/control/Control.JSDialogBuilder.js
+++ b/loleaflet/src/control/Control.JSDialogBuilder.js
@@ -274,8 +274,15 @@ L.Control.JSDialogBuilder = L.Control.extend({
},
_unoToolButton: function(parentContainer, data, builder) {
- var button = L.DomUtil.create('button', '', parentContainer);
- button.innerHTML = builder._cleanText(data.text);
+ var button = null;
+
+ if (data.image) {
+ button = L.DomUtil.create('img', 'ui-content unobutton', parentContainer);
+ button.src = data.image;
+ } else {
+ button = L.DomUtil.create('button', '', parentContainer);
+ button.innerHTML = builder._cleanText(data.text);
+ }
$(button).click(function () {
builder.map.sendUnoCommand(data.command);
});
commit 15d26c080b26e38d2a9de9009c0c073438aa4ed1
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Thu Sep 26 15:02:01 2019 +0200
Commit: Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Fri Sep 27 17:05:31 2019 +0200
jsdialogs: toolbox items sending UNO commands
Change-Id: Id9c4c6250f2c564418164539a432759bad1727b9
Reviewed-on: https://gerrit.libreoffice.org/79739
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
Tested-by: Szymon Kłos <szymon.klos at collabora.com>
diff --git a/loleaflet/src/control/Control.JSDialogBuilder.js b/loleaflet/src/control/Control.JSDialogBuilder.js
index a6d6d6888..25bcfde1a 100644
--- a/loleaflet/src/control/Control.JSDialogBuilder.js
+++ b/loleaflet/src/control/Control.JSDialogBuilder.js
@@ -52,7 +52,9 @@ L.Control.JSDialogBuilder = L.Control.extend({
if (handler)
handler(parentContainer, data, builder);
- else
+ else if (data.text) {
+ builder._unoToolButton(parentContainer, data, builder);
+ } else
console.warn('Unsupported toolitem type: \"' + data.command + '\"');
}
@@ -271,6 +273,19 @@ L.Control.JSDialogBuilder = L.Control.extend({
return false;
},
+ _unoToolButton: function(parentContainer, data, builder) {
+ var button = L.DomUtil.create('button', '', parentContainer);
+ button.innerHTML = builder._cleanText(data.text);
+ $(button).click(function () {
+ builder.map.sendUnoCommand(data.command);
+ });
+
+ if (data.enabled == 'false')
+ $(button).attr('disabled', 'disabled');
+
+ return false;
+ },
+
_colorControl: function(parentContainer, data) {
var colorContainer = L.DomUtil.create('div', '', parentContainer);
@@ -349,5 +364,6 @@ L.control.jsDialogBuilder = function (options) {
var builder = new L.Control.JSDialogBuilder(options);
builder._setup();
builder.wizard = options.mobileWizard;
+ builder.map = options.map;
return builder;
};
diff --git a/loleaflet/src/control/Control.MobileWizard.js b/loleaflet/src/control/Control.MobileWizard.js
index 0a1498e67..90f567e27 100644
--- a/loleaflet/src/control/Control.MobileWizard.js
+++ b/loleaflet/src/control/Control.MobileWizard.js
@@ -11,6 +11,7 @@ L.Control.MobileWizard = L.Control.extend({
_currentDepth: 0,
onAdd: function (map) {
+ this.map = map;
map.on('mobilewizard', this._onMobileWizard, this);
map.on('closemobilewizard', this._hideWizard, this);
@@ -64,7 +65,7 @@ L.Control.MobileWizard = L.Control.extend({
var content = $('#mobile-wizard-content');
content.empty();
- L.control.jsDialogBuilder({'mobileWizard': this}).build(content.get(0), [data]);
+ L.control.jsDialogBuilder({mobileWizard: this, map: this.map}).build(content.get(0), [data]);
}
}
});
More information about the Libreoffice-commits
mailing list