[Libreoffice-commits] online.git: Branch 'feature/jsdialogs' - 3 commits - loleaflet/src

Szymon Kłos (via logerrit) logerrit at kemper.freedesktop.org
Thu Sep 26 13:43:20 UTC 2019


 loleaflet/src/control/Control.JSDialogBuilder.js |   41 +++++++++++++++++++++--
 loleaflet/src/control/Control.MobileWizard.js    |    3 +
 2 files changed, 40 insertions(+), 4 deletions(-)

New commits:
commit 2bb67af6fa33df5aa809242ec06e50cf3872bb52
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: Thu Sep 26 15:36:24 2019 +0200

    jsdialogs: show images from JSON for toolbox items
    
    Change-Id: Id388ddd742f3f3812b4f0e6040fbdc24974fea6b

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 8f67abb3ae0307e2b24c2aa1d989181fec6351cb
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: Thu Sep 26 15:19:24 2019 +0200

    jsdialogs: toolbox items sending UNO commands
    
    Change-Id: Id9c4c6250f2c564418164539a432759bad1727b9

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]);
 		}
 	}
 });
commit b329ab330fa8e03ba0435ebe82f97ee6c9a5e036
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Thu Sep 26 14:51:50 2019 +0200
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Thu Sep 26 14:59:05 2019 +0200

    jsdialogs: apply checked property for checkbox
    
    Change-Id: Ib42247cd6e35c681dcbdcefce85788617050273f

diff --git a/loleaflet/src/control/Control.JSDialogBuilder.js b/loleaflet/src/control/Control.JSDialogBuilder.js
index 98605e992..a6d6d6888 100644
--- a/loleaflet/src/control/Control.JSDialogBuilder.js
+++ b/loleaflet/src/control/Control.JSDialogBuilder.js
@@ -180,6 +180,9 @@ L.Control.JSDialogBuilder = L.Control.extend({
 		if (data.enabled == 'false')
 			$(radiobutton).attr('disabled', 'disabled');
 
+		if (data.checked == 'true')
+			$(radiobutton).attr('checked', 'checked');
+
 		return false;
 	},
 
@@ -193,6 +196,9 @@ L.Control.JSDialogBuilder = L.Control.extend({
 		if (data.enabled == 'false')
 			$(checkbox).attr('disabled', 'disabled');
 
+		if (data.checked == 'true')
+			$(checkbox).attr('checked', 'checked');
+
 		return false;
 	},
 
@@ -284,8 +290,14 @@ L.Control.JSDialogBuilder = L.Control.extend({
 	},
 
 	_lineWidthControl: function(parentContainer, data, builder) {
-		// TODO: send from the core
-		data.children = [ { text: '0.5' } ];
+		data.children = [ { text: '0.5' },
+							{ text: '0.8' },
+							{ text: '1.0' },
+							{ text: '1.5' },
+							{ text: '2.3' },
+							{ text: '3.0' },
+							{ text: '4.5' },
+							{ text: '6.0' } ];
 		builder._spinfieldControl(parentContainer, data, builder);
 	},
 


More information about the Libreoffice-commits mailing list