[Libreoffice-commits] online.git: loleaflet/src
Szymon Kłos (via logerrit)
logerrit at kemper.freedesktop.org
Fri Oct 4 19:50:28 UTC 2019
loleaflet/src/control/Control.JSDialogBuilder.js | 32 +++++++----------------
1 file changed, 11 insertions(+), 21 deletions(-)
New commits:
commit 02ea937ea21f14fa638f3a6c2caef63e5e1d5a48
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Fri Oct 4 21:44:56 2019 +0200
Commit: Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Fri Oct 4 21:50:10 2019 +0200
jsdialogs: turn combobox into explorable entry
Change-Id: Ic0ab3142afba387d67e80020033d94d225a9d8a8
Reviewed-on: https://gerrit.libreoffice.org/80280
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 1df4efcc6..12557dd95 100644
--- a/loleaflet/src/control/Control.JSDialogBuilder.js
+++ b/loleaflet/src/control/Control.JSDialogBuilder.js
@@ -256,35 +256,25 @@ L.Control.JSDialogBuilder = L.Control.extend({
},
_comboboxControl: function(parentContainer, data, builder) {
+ // TODO: event listener in the next level...
+
if (!data.entries || data.entries.length == 0)
return false;
- var listbox = L.DomUtil.create('select', '', parentContainer);
- listbox.value = builder._cleanText(data.text);
-
- if (data.enabled == 'false')
- $(listbox).attr('disabled', 'disabled');
-
- var selected = null;
- if (parseInt(data.selectedCount) > 0) {
- // TODO: multiselection listbox
- selected = data.selectedEntries[0];
- }
+ var title = data.text;
+ if (data.selectedEntries)
+ title = data.entries[data.selectedEntries[0]];
+ title = builder._cleanText(title);
+ var entries = [];
for (var index in data.entries) {
- var option = L.DomUtil.create('option', '', listbox);
- option.innerHTML = data.entries[index];
-
- if (selected == index)
- $(option).attr('selected', 'selected');
+ var entry = { type: 'fixedtext', text: data.entries[index] };
+ entries.push(entry);
}
- if (data.hidden)
- $(listbox).hide();
+ var contentNode = {type: 'container', children: entries};
- listbox.addEventListener('change', function() {
- builder.callback('combobox', 'change', listbox, this.value, builder);
- });
+ builder._explorableEntry(parentContainer, title, contentNode, builder);
return false;
},
More information about the Libreoffice-commits
mailing list