loleaflet/src/control/Control.NotebookbarBuilder.js |   16 ++++++++++++++++
 1 file changed, 16 insertions(+)

New commits:
commit 0197763d6f02ddb39b0f017b174582905ca75390
Author:     Szymon Kłos <szymon.k...@collabora.com>
AuthorDate: Fri May 8 11:24:10 2020 +0200
Commit:     Szymon Kłos <szymon.k...@collabora.com>
CommitDate: Fri May 8 15:22:24 2020 +0200

    notebookbar: use proper save action
    
    Change-Id: I83f777f2d47c554365a8aa0305be9b5ef0cb4650
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/93709
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Szymon Kłos <szymon.k...@collabora.com>

diff --git a/loleaflet/src/control/Control.NotebookbarBuilder.js 
b/loleaflet/src/control/Control.NotebookbarBuilder.js
index 4a91b8e56..809af3c35 100644
--- a/loleaflet/src/control/Control.NotebookbarBuilder.js
+++ b/loleaflet/src/control/Control.NotebookbarBuilder.js
@@ -41,6 +41,7 @@ L.Control.NotebookbarBuilder = 
L.Control.JSDialogBuilder.extend({
                this._toolitemHandlers['.uno:ConditionalFormatMenu'] = 
this._conditionalFormatControl;
                this._toolitemHandlers['.uno:SetDefault'] = 
this._clearFormattingControl;
                this._toolitemHandlers['.uno:Presentation'] = 
this._startPresentationControl;
+               this._toolitemHandlers['.uno:Save'] = this._saveControl;
 
                this._toolitemHandlers['.uno:SelectWidth'] = function() {};
                this._toolitemHandlers['.uno:SetOutline'] = function() {};
@@ -389,6 +390,21 @@ L.Control.NotebookbarBuilder = 
L.Control.JSDialogBuilder.extend({
                });
        },
 
+       _saveControl: function(parentContainer, data, builder) {
+               var control = builder._unoToolButton(parentContainer, data, 
builder);
+
+               $(control.container).unbind('click');
+               $(control.container).click(function () {
+                       // Save only when not read-only.
+                       if (builder.map._permission !== 'readonly') {
+                               builder.map.fire('postMessage', {msgId: 
'UI_Save'});
+                               if 
(!builder.map._disableDefaultAction['UI_Save']) {
+                                       builder.map.save(false, false);
+                               }
+                       }
+               });
+       },
+
        build: function(parent, data, hasVerticalParent, parentHasManyChildren) 
{
                this._amendJSDialogData(data);
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to