loleaflet/src/control/Control.JSDialogBuilder.js |   32 +++++++----------------
 1 file changed, 11 insertions(+), 21 deletions(-)

New commits:
commit 02ea937ea21f14fa638f3a6c2caef63e5e1d5a48
Author:     Szymon Kłos <szymon.k...@collabora.com>
AuthorDate: Fri Oct 4 21:44:56 2019 +0200
Commit:     Szymon Kłos <szymon.k...@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.k...@collabora.com>
    Tested-by: Szymon Kłos <szymon.k...@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;
        },
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to