loleaflet/src/control/Control.JSDialogBuilder.js |   25 +++++++-------
 loleaflet/src/control/Control.Toolbar.js         |   41 +++++++++++++++++++++++
 loleaflet/src/layer/tile/CalcTileLayer.js        |    2 -
 loleaflet/src/layer/tile/ImpressTileLayer.js     |    4 +-
 loleaflet/src/layer/tile/WriterTileLayer.js      |    4 +-
 5 files changed, 60 insertions(+), 16 deletions(-)

New commits:
commit 8af06d13fa62d1d5a539e4cab25967bb51853345
Author:     mert <mert.tu...@collabora.com>
AuthorDate: Wed Dec 4 13:55:34 2019 +0300
Commit:     Mert Tümer <mert.tu...@collabora.com>
CommitDate: Wed Dec 4 12:07:52 2019 +0100

    Make quickbar color buttons open mobilewizard
    
    Change-Id: I44f2f6d29b2d9830068cb37d6ab4975f8d971778
    Reviewed-on: https://gerrit.libreoffice.org/84396
    Reviewed-by: Mert Tümer <mert.tu...@collabora.com>
    Tested-by: Mert Tümer <mert.tu...@collabora.com>

diff --git a/loleaflet/src/control/Control.JSDialogBuilder.js 
b/loleaflet/src/control/Control.JSDialogBuilder.js
index 7de526461..66ec0eb26 100644
--- a/loleaflet/src/control/Control.JSDialogBuilder.js
+++ b/loleaflet/src/control/Control.JSDialogBuilder.js
@@ -82,7 +82,6 @@ L.Control.JSDialogBuilder = L.Control.extend({
        _toolitemHandler: function(parentContainer, data, builder) {
                if (data.command) {
                        var handler = builder._toolitemHandlers[data.command];
-
                        if (handler)
                                handler(parentContainer, data, builder);
                        else if (data.text) {
@@ -284,16 +283,21 @@ L.Control.JSDialogBuilder = L.Control.extend({
                builder.build(contentDiv, [contentNode]);
                builder._currentDepth--;
 
-               $(contentDiv).hide();
-               if (builder.wizard) {
-                       $(sectionTitle).click(function() {
-                               builder.wizard.goLevelDown(contentDiv);
-                               if (contentNode.onshow)
-                                       contentNode.onshow();
-                       });
-               } else {
-                       console.debug('Builder used outside of mobile wizard: 
please implement the click handler');
+               if (!data.nosubmenu)
+               {
+                       $(contentDiv).hide();
+                       if (builder.wizard) {
+                               $(sectionTitle).click(function() {
+                                       builder.wizard.goLevelDown(contentDiv);
+                                       if (contentNode.onshow)
+                                               contentNode.onshow();
+                               });
+                       } else {
+                               console.debug('Builder used outside of mobile 
wizard: please implement the click handler');
+                       }
                }
+               else
+                       $(sectionTitle).hide();
        },
 
        _calcFunctionEntry: function(parentContainer, data, contentNode, 
builder) {
@@ -1469,7 +1473,6 @@ L.Control.JSDialogBuilder = L.Control.extend({
                        var childObject = needsToCreateContainer ? 
L.DomUtil.createWithId('div', childData.id, parent) : parent;
 
                        var handler = this._controlHandlers[childType];
-
                        var twoPanelsAsChildren = childData.children
                                && (childData.children.length == 4 || 
childData.children.length == 5)
                                && childData.children[0] && 
childData.children[0].type == 'panel'
diff --git a/loleaflet/src/control/Control.Toolbar.js 
b/loleaflet/src/control/Control.Toolbar.js
index 0426015c2..2f735f033 100644
--- a/loleaflet/src/control/Control.Toolbar.js
+++ b/loleaflet/src/control/Control.Toolbar.js
@@ -250,6 +250,12 @@ function onClick(e, id, item, subItem) {
        else if (item.id === 'remotegraphic') {
                map.fire('postMessage', {msgId: 'UI_InsertGraphic'});
        }
+       else if (id === 'fontcolor' && typeof e.color === 'undefined') {
+               map.fire('mobilewizard', getColorPickerData('Font Color'));
+       }
+       else if (id === 'backcolor' && typeof e.color === 'undefined') {
+               map.fire('mobilewizard', getColorPickerData('Highlight Color'));
+       }
        else if (id === 'fontcolor' && typeof e.color !== 'undefined') {
                onColorPick(id, e.color);
        }
@@ -684,6 +690,41 @@ function insertShapes(mobile) {
        });
 }
 
+function getColorPickerData(type) {
+       var uno;
+       if (type === 'Font Color') {
+               if (map.getDocType() === 'spreadsheet')
+                       uno = '.uno:Color';
+               else if (map.getDocType() === 'presentation')
+                       uno = '.uno:Color';
+               else
+                       uno = '.uno:FontColor';
+       } else if (type === 'Highlight Color') {
+               if (map.getDocType() === 'spreadsheet')
+                       uno = '.uno:BacgroundColor';
+               else if (map.getDocType() === 'presentation')
+                       uno = '.uno:CharBackColor';
+               else
+                       uno = '.uno:BackColor';
+       }
+       var data = {
+               id: 'box',
+               type: 'window',
+               text: type,
+               enabled: 'true',
+               children: [
+                       {
+                               type: 'toolitem',
+                               text: '',
+                               command: uno,
+                               nosubmenu: true
+                       }
+               ],
+               vertical: 'true'
+       };
+       return data;
+}
+
 function onColorPick(id, color) {
        if (map.getPermission() !== 'edit') {
                return;
diff --git a/loleaflet/src/layer/tile/CalcTileLayer.js 
b/loleaflet/src/layer/tile/CalcTileLayer.js
index 3d39bac9c..2fabe44d2 100644
--- a/loleaflet/src/layer/tile/CalcTileLayer.js
+++ b/loleaflet/src/layer/tile/CalcTileLayer.js
@@ -79,7 +79,7 @@ L.CalcTileLayer = L.TileLayer.extend({
                        {type: 'button',  id: 'underline',  img: 'underline', 
hint: _UNO('.uno:Underline'), uno: 'Underline'},
                        {type: 'button',  id: 'strikeout', img: 'strikeout', 
hint: _UNO('.uno:Strikeout'), uno: 'Strikeout'},
                        {type: 'break'},
-                       {type: 'text-color',  id: 'fontcolor', img: 
'textcolor', hint: _UNO('.uno:FontColor')},
+                       {type: 'button',  id: 'fontcolor', img: 'textcolor', 
hint: _UNO('.uno:FontColor')},
 //                     {type: 'color',  id: 'backcolor', img: 'backcolor', 
hint: _UNO('.uno:BackgroundColor')},
                        {type: 'button',  id: 'togglemergecells',  img: 
'togglemergecells', hint: _UNO('.uno:ToggleMergeCells', 'spreadsheet', true), 
uno: 'ToggleMergeCells', disabled: true},
 //                     {type: 'break', id: 'breakmergecells'},
diff --git a/loleaflet/src/layer/tile/ImpressTileLayer.js 
b/loleaflet/src/layer/tile/ImpressTileLayer.js
index 5b4fd90aa..70c109593 100644
--- a/loleaflet/src/layer/tile/ImpressTileLayer.js
+++ b/loleaflet/src/layer/tile/ImpressTileLayer.js
@@ -120,8 +120,8 @@ L.ImpressTileLayer = L.TileLayer.extend({
 //                     {type: 'button',  id: 'italic', img: 'italic', hint: 
_UNO('.uno:Italic'), uno: 'Italic'},
                        {type: 'button',  id: 'underline',  img: 'underline', 
hint: _UNO('.uno:Underline'), uno: 'Underline'},
                        {type: 'button',  id: 'strikeout', img: 'strikeout', 
hint: _UNO('.uno:Strikeout'), uno: 'Strikeout'},
-                       {type: 'text-color',  id: 'fontcolor', img: 
'textcolor', hint: _UNO('.uno:FontColor')},
-                       {type: 'color',  id: 'backcolor', img: 'backcolor', 
hint: _UNO('.uno:BackgroundColor')},
+                       {type: 'button',  id: 'fontcolor', img: 'textcolor', 
hint: _UNO('.uno:FontColor')},
+                       {type: 'button',  id: 'backcolor', img: 'backcolor', 
hint: _UNO('.uno:BackgroundColor')},
                        {type: 'menu', id: 'textalign', img: 'alignblock', 
hint: _UNO('.uno:TextAlign'),
                                items: [
                                        {id: 'leftpara',    text: 
_UNO('.uno:LeftPara', '', true),    icon: 'alignleft', uno: 'LeftPara'},
diff --git a/loleaflet/src/layer/tile/WriterTileLayer.js 
b/loleaflet/src/layer/tile/WriterTileLayer.js
index 7bf6759bd..9ac4a11e0 100644
--- a/loleaflet/src/layer/tile/WriterTileLayer.js
+++ b/loleaflet/src/layer/tile/WriterTileLayer.js
@@ -60,8 +60,8 @@ L.WriterTileLayer = L.TileLayer.extend({
                        {type: 'button',  id: 'underline',  img: 'underline', 
hint: _UNO('.uno:Underline'), uno: 'Underline'},
                        {type: 'button',  id: 'strikeout', img: 'strikeout', 
hint: _UNO('.uno:Strikeout'), uno: 'Strikeout'},
                        {type: 'break'},
-                       {type: 'text-color',  id: 'fontcolor', img: 
'textcolor', hint: _UNO('.uno:FontColor')},
-                       {type: 'color',  id: 'backcolor', img: 'backcolor', 
hint: _UNO('.uno:BackgroundColor')},
+                       {type: 'button',  id: 'fontcolor', img: 'textcolor', 
hint: _UNO('.uno:FontColor')},
+                       {type: 'button',  id: 'backcolor', img: 'backcolor', 
hint: _UNO('.uno:BackgroundColor')},
                        {type: 'button',  id: 'leftpara',  img: 'alignleft', 
hint: _UNO('.uno:LeftPara', '', true), uno: 'LeftPara', unosheet: 'AlignLeft', 
disabled: true},
                        {type: 'button',  id: 'centerpara',  img: 
'alignhorizontal', hint: _UNO('.uno:CenterPara', '', true), uno: 'CenterPara', 
unosheet: 'AlignHorizontalCenter', disabled: true},
                        {type: 'button',  id: 'rightpara',  img: 'alignright', 
hint: _UNO('.uno:RightPara', '', true), uno: 'RightPara', unosheet: 
'AlignRight', disabled: true},
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to