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

Szymon Kłos (via logerrit) logerrit at kemper.freedesktop.org
Thu Oct 17 16:42:22 UTC 2019


 loleaflet/src/control/Control.JSDialogBuilder.js |   19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

New commits:
commit 8e9a262f036fb9634cdcfdfbf12bbfd5c4f84650
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Thu Oct 17 17:50:39 2019 +0200
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Thu Oct 17 18:42:01 2019 +0200

    jsdialogs: send combobox selections
    
    Change-Id: If81984e23e2e86ea00e916a015c48f866284d046

diff --git a/loleaflet/src/control/Control.JSDialogBuilder.js b/loleaflet/src/control/Control.JSDialogBuilder.js
index d171df0c7..4615a8698 100644
--- a/loleaflet/src/control/Control.JSDialogBuilder.js
+++ b/loleaflet/src/control/Control.JSDialogBuilder.js
@@ -35,6 +35,7 @@ L.Control.JSDialogBuilder = L.Control.extend({
 		this._controlHandlers['edit'] = this._editControl;
 		this._controlHandlers['pushbutton'] = this._pushbuttonControl;
 		this._controlHandlers['combobox'] = this._comboboxControl;
+		this._controlHandlers['comboboxentry'] = this._comboboxEntry;
 		this._controlHandlers['listbox'] = this._comboboxControl;
 		this._controlHandlers['fixedtext'] = this._fixedtextControl;
 		this._controlHandlers['grid'] = this._containerHandler;
@@ -98,7 +99,8 @@ L.Control.JSDialogBuilder = L.Control.extend({
 
 		if (objectType == 'toolbutton' && eventType == 'click') {
 			builder.map.sendUnoCommand(data);
-		} else {
+		} else if (object) {
+			console.log('dialogevent ' + window.sidebarId + ' ' + object.id);
 			builder.map._socket.sendMessage('dialogevent ' + window.sidebarId + ' ' + object.id);
 		}
 	},
@@ -503,7 +505,7 @@ L.Control.JSDialogBuilder = L.Control.extend({
 
 		var entries = [];
 		for (var index in data.entries) {
-			var entry = { type: 'fixedtext', text: data.entries[index], style: 'ui-combobox-text' };
+			var entry = { type: 'comboboxentry', text: data.entries[index], parent: data, style: 'ui-combobox-text' };
 			entries.push(entry);
 		}
 
@@ -514,6 +516,19 @@ L.Control.JSDialogBuilder = L.Control.extend({
 		return false;
 	},
 
+	_comboboxEntry: function(parentContainer, data, builder) {
+		var fixedtext = L.DomUtil.create('p', 'mobile-wizard', parentContainer);
+		fixedtext.innerHTML = builder._cleanText(data.text);
+		fixedtext.parent = data.parent;
+
+		if (data.style && data.style.length)
+			L.DomUtil.addClass(fixedtext, data.style);
+
+		$(fixedtext).click(function () {
+			builder.callback('combobox', 'selected', fixedtext.parent, fixedtext.innerHTML, builder);
+		});
+	},
+
 	_fixedtextControl: function(parentContainer, data, builder) {
 		var fixedtext = L.DomUtil.create('p', 'mobile-wizard', parentContainer);
 		fixedtext.innerHTML = builder._cleanText(data.text);


More information about the Libreoffice-commits mailing list