loleaflet/css/mobilewizard.css                   |    5 ++
 loleaflet/src/control/Control.JSDialogBuilder.js |   54 ++++++++++++++++++++++-
 2 files changed, 58 insertions(+), 1 deletion(-)

New commits:
commit a672d064c22944c26bfac69dd741d4ef28259692
Author:     Szymon Kłos <szymon.k...@collabora.com>
AuthorDate: Thu Nov 21 11:42:19 2019 +0100
Commit:     Szymon Kłos <szymon.k...@collabora.com>
CommitDate: Thu Nov 21 11:42:25 2019 +0100

    jsdialog: use uno states for comboboxes, impl FillStyle
    
    Change-Id: I81d8c3d333e8c65291198b010772c8de9d8eb065

diff --git a/loleaflet/css/mobilewizard.css b/loleaflet/css/mobilewizard.css
index 2086caef6..22279d1ff 100644
--- a/loleaflet/css/mobilewizard.css
+++ b/loleaflet/css/mobilewizard.css
@@ -653,4 +653,9 @@
                margin: 24px 0px;
        }
        div#enablecontour + p, #arrangelabel, #SetMinimalRowHeight {clear: 
both;}
+
+       /*TODO: missing icon*/
+       #fillstyle div img {
+               display: none;
+       }
 }
diff --git a/loleaflet/src/control/Control.JSDialogBuilder.js 
b/loleaflet/src/control/Control.JSDialogBuilder.js
index 2205cf9a9..49bac9c56 100644
--- a/loleaflet/src/control/Control.JSDialogBuilder.js
+++ b/loleaflet/src/control/Control.JSDialogBuilder.js
@@ -217,7 +217,6 @@ L.Control.JSDialogBuilder = L.Control.extend({
                        titleClass = 'menu-entry-with-icon'
                }
                var titleSpan = L.DomUtil.create('span', titleClass, leftDiv);
-               titleSpan.innerHTML = data.text;
 
                var rightDiv = L.DomUtil.create('div', 'ui-header-right', 
sectionTitle);
                if (valueNode) {
@@ -228,6 +227,31 @@ L.Control.JSDialogBuilder = L.Control.extend({
                var arrowSpan = L.DomUtil.create('span', 'sub-menu-arrow', 
rightDiv);
                arrowSpan.innerHTML = '>';
 
+               var updateFunction = function() {
+                       var items = builder.map['stateChangeHandler'];
+
+                       var state = null;
+                       if (data.command) {
+                               state = items.getItemValue(data.command);
+                               state = 
builder._getTextForUnoState(data.command, state);
+                       }
+                       if (state) {
+                               console.warn('state: ' + state);
+                               titleSpan.innerHTML = state;
+                       } else {
+                               titleSpan.innerHTML = data.text;
+                       }
+               }
+
+               updateFunction();
+
+               if (data.command) {
+                       builder.map.on('commandstatechanged', function(e) {
+                               if (e.commandName === data.command)
+                                       updateFunction();
+                       }, this);
+               }
+
                var contentDiv = L.DomUtil.create('div', 'ui-content level-' + 
builder._currentDepth + ' mobile-wizard', parentContainer);
                contentDiv.title = data.text;
 
@@ -599,6 +623,34 @@ L.Control.JSDialogBuilder = L.Control.extend({
                return null;
        },
 
+       _getTextForUnoState: function(command, state) {
+               switch (command) {
+               case '.uno:FillStyle':
+
+                       switch (state) {
+                       case 'NONE':
+                               return _('None');
+
+                       case 'SOLID':
+                               return _('Color');
+
+                       case 'GRADIENT':
+                               return _('Gradient');
+
+                       case 'HATCH':
+                               return _('Hatching');
+
+                       case 'BITMAP':
+                               // FIXME: can be bitmap or pattern, for now we 
cant import bitmap
+                               return _('Pattern');
+                       }
+
+                       break;
+               }
+
+               return null;
+       },
+
        _spinfieldControl: function(parentContainer, data, builder, 
customCallback) {
                if (data.label) {
                        var fixedTextData = { text: data.label };
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to