loleaflet/dist/toolbar/toolbar.js        |    3 ++-
 loleaflet/src/control/Control.Menubar.js |    2 +-
 loleaflet/src/map/Map.js                 |    8 ++++++++
 3 files changed, 11 insertions(+), 2 deletions(-)

New commits:
commit f57e4124035f22d9182c7cda9910e8dc84df5f07
Author: Pranav Kant <pran...@collabora.co.uk>
Date:   Fri Mar 17 13:59:38 2017 +0530

    loleaflet: Tell WOPI host if document was ever modified by user
    
    Change-Id: Ic99136168716d7a01d1388c4f5e1107ef9e64616

diff --git a/loleaflet/dist/toolbar/toolbar.js 
b/loleaflet/dist/toolbar/toolbar.js
index 04e7011c..6bbd3439 100644
--- a/loleaflet/dist/toolbar/toolbar.js
+++ b/loleaflet/dist/toolbar/toolbar.js
@@ -340,7 +340,7 @@ function onClick(id, item, subItem) {
                resizeToolbar();
        }
        else if (id === 'close') {
-               map.fire('postMessage', {msgId: 'UI_Close'});
+               map.fire('postMessage', {msgId: 'UI_Close', args: 
{EverModified: map._everModified}});
                map.remove();
        }
        else if (id === 'specialcharacter') {
@@ -1042,6 +1042,7 @@ map.on('doclayerinit', function () {
        resizeToolbar();
 });
 
+
 map.on('commandstatechanged', function (e) {
        var toolbar = w2ui['toolbar-up'];
        var toolbarUpMore = w2ui['toolbar-up-more'];
diff --git a/loleaflet/src/control/Control.Menubar.js 
b/loleaflet/src/control/Control.Menubar.js
index da2fbee9..c3a51d5f 100644
--- a/loleaflet/src/control/Control.Menubar.js
+++ b/loleaflet/src/control/Control.Menubar.js
@@ -481,7 +481,7 @@ L.Control.Menubar = L.Control.extend({
                        // our host to show revision history mode
                        map.fire('postMessage', {msgId: 'rev-history'});
                } else if (id === 'closedocument') {
-                       map.fire('postMessage', {msgId: 'UI_Close'});
+                       map.fire('postMessage', {msgId: 'UI_Close', args: 
{EverModified: map._everModified}});
                        map.remove();
                }
                else if (id === 'repair') {
diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js
index c1861d37..3d86db2b 100644
--- a/loleaflet/src/map/Map.js
+++ b/loleaflet/src/map/Map.js
@@ -136,6 +136,14 @@ L.Map = L.Evented.extend({
 
                // View color map
                this._viewColors = {};
+
+               // This becomes true if document was ever modified by the user
+               this._everModified = false;
+
+               this.on('commandstatechanged', function(e) {
+                       if (e.commandName === '.uno:ModifiedStatus')
+                               this._everModified = this._everModified || 
(e.state === 'true');
+               }, this);
        },
 
        // public methods that modify map state
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to