loleaflet/dist/toolbar/toolbar.js |   13 ++++++++++++-
 loleaflet/src/core/Socket.js      |    6 +++---
 loleaflet/src/map/Map.js          |    8 +++-----
 wsd/LOOLWSD.cpp                   |    9 ++++++++-
 4 files changed, 26 insertions(+), 10 deletions(-)

New commits:
commit 5a3ef42b9aaf4597244e7806a1f0f196c442a1fc
Author: Pranav Kant <pran...@collabora.co.uk>
Date:   Tue Dec 13 19:38:05 2016 +0530

    tdf#104157: Fix Content-Type and add Content-Disposition for pdf
    
    Change-Id: I07a02a621f0f067b9810d0f92bd3b9fff112af54
    Reviewed-on: https://gerrit.libreoffice.org/35460
    Reviewed-by: pranavk <pran...@collabora.co.uk>
    Tested-by: pranavk <pran...@collabora.co.uk>

diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp
index 8d2f8d29..673758cc 100644
--- a/wsd/LOOLWSD.cpp
+++ b/wsd/LOOLWSD.cpp
@@ -700,10 +700,17 @@ private:
             LOG_INF("HTTP request for: " << filePath.toString());
             if (filePath.isAbsolute() && File(filePath).exists())
             {
+                std::string contentType = getContentType(fileName);
                 response.set("Access-Control-Allow-Origin", "*");
+                if (Poco::Path(fileName).getExtension() == "pdf")
+                {
+                    contentType = "application/pdf";
+                    response.set("Content-Disposition", "attachment; 
filename=\"" + fileName + "\"");
+                }
+
                 try
                 {
-                    response.sendFile(filePath.toString(), 
getContentType(fileName));
+                    response.sendFile(filePath.toString(), contentType);
                     responded = true;
                 }
                 catch (const Exception& exc)
commit ca9db78e10697766500ae445bfec2bd9ce6a3184
Author: Pranav Kant <pran...@collabora.co.uk>
Date:   Mon Dec 12 14:55:50 2016 +0530

    loleaflet: Remove troublesome extra argument to replace()
    
    This errors out in firefox (in some versions).
    
    Change-Id: I4c1d77249ec6883b70c961ffe8239157a0d6466c
    Reviewed-on: https://gerrit.libreoffice.org/35459
    Reviewed-by: pranavk <pran...@collabora.co.uk>
    Tested-by: pranavk <pran...@collabora.co.uk>

diff --git a/loleaflet/src/core/Socket.js b/loleaflet/src/core/Socket.js
index 5c0d834b..a7c18ebc 100644
--- a/loleaflet/src/core/Socket.js
+++ b/loleaflet/src/core/Socket.js
@@ -54,7 +54,7 @@ L.Socket = L.Class.extend({
                        if (typeof msg === 'string') {
                                L.Log.log(msg, L.OUTGOING, coords);
                                if (this._map._docLayer && 
this._map._docLayer._debug) {
-                                       console.log(+new Date() + ' 
%cOUTGOING%c: ' + msg.concat(' ').replace(' ', '%c ', 1), 
'background:#fbb;color:black', 'color:red', 'color:black');
+                                       console.log(+new Date() + ' 
%cOUTGOING%c: ' + msg.concat(' ').replace(' ', '%c '), 
'background:#fbb;color:black', 'color:red', 'color:black');
                                }
                        }
                }
@@ -69,7 +69,7 @@ L.Socket = L.Class.extend({
                if (typeof msg === 'string') {
                        L.Log.log(msg, L.OUTGOING, coords);
                        if (this._map._docLayer && this._map._docLayer._debug) {
-                               console.log(+new Date() + ' %cOUTGOING%c: ' + 
msg.concat(' ').replace(' ', '%c ', 1), 'background:#fbb;color:black', 
'color:red', 'color:black');
+                               console.log(+new Date() + ' %cOUTGOING%c: ' + 
msg.concat(' ').replace(' ', '%c '), 'background:#fbb;color:black', 
'color:red', 'color:black');
                        }
                }
 
@@ -134,7 +134,7 @@ L.Socket = L.Class.extend({
                }
 
                if (this._map._docLayer && this._map._docLayer._debug) {
-                       console.log(+new Date() + ' %cINCOMING%c: ' + 
textMsg.concat(' ').replace(' ', '%c ', 1), 'background:#ddf;color:black', 
'color:blue', 'color:black');
+                       console.log(+new Date() + ' %cINCOMING%c: ' + 
textMsg.concat(' ').replace(' ', '%c '), 'background:#ddf;color:black', 
'color:blue', 'color:black');
                }
 
                var command = this.parseServerCmd(textMsg);
commit 6d84bb1aa89c4e9bdb18610395ff293a0bc31963
Author: Pranav Kant <pran...@collabora.co.uk>
Date:   Mon Dec 12 13:49:04 2016 +0530

    loleaflet: Don't use w2ui directly from loleaflet
    
    Use events, 'hidebusy', 'showbusy' to interact with toolbar.
    In some cases, it may happen that w2ui usage in loleaflet happens
    before browser loads w2ui.js (as it is in <script> tag after the
    one which loads loleaflet).
    
    Change-Id: I9b1b249ede72ed01f97cf31fd3f93780312530bc
    Reviewed-on: https://gerrit.libreoffice.org/35458
    Reviewed-by: pranavk <pran...@collabora.co.uk>
    Tested-by: pranavk <pran...@collabora.co.uk>

diff --git a/loleaflet/dist/toolbar/toolbar.js 
b/loleaflet/dist/toolbar/toolbar.js
index 76f44553..e174cfe5 100644
--- a/loleaflet/dist/toolbar/toolbar.js
+++ b/loleaflet/dist/toolbar/toolbar.js
@@ -2,7 +2,7 @@
  * LibreOffice Online toolbar
  */
 
-/* global $ map closebutton w2ui vex _ */
+/* global $ map closebutton w2ui w2utils vex _ */
 
 function onDelete(e) {
        if (e !== false) {
@@ -729,6 +729,17 @@ function onFormulaBarBlur() {
        }, 250);
 }
 
+map.on('hidebusy', function() {
+       // If locked, unlock
+       if (w2ui['toolbar-down'].box.firstChild.className === 'w2ui-lock') {
+               w2utils.unlock(w2ui['toolbar-down'].box);
+       }
+});
+
+map.on('showbusy', function(e) {
+       w2utils.lock(w2ui['toolbar-down'].box, e.label, true);
+});
+
 map.on('wopiprops', function(e) {
        if (e.HideSaveOption) {
                w2ui['toolbar-up'].hide('save');
diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js
index f692ea37..6fcbcf7f 100644
--- a/loleaflet/src/map/Map.js
+++ b/loleaflet/src/map/Map.js
@@ -2,7 +2,7 @@
  * L.Map is the central class of the API - it is used to create a map.
  */
 
-/* global vex $ w2ui w2utils */
+/* global vex $ */
 L.Map = L.Evented.extend({
 
        options: {
@@ -156,7 +156,7 @@ L.Map = L.Evented.extend({
                // If document is already loaded, ask the toolbar widget to 
show busy
                // status on the bottom statusbar
                if (this._docLayer) {
-                       w2utils.lock(w2ui['toolbar-down'].box, label, true);
+                       this.fire('showbusy', {label: label});
                        return;
                }
 
@@ -170,9 +170,7 @@ L.Map = L.Evented.extend({
        },
 
        hideBusy: function () {
-               if (w2ui['toolbar-down'].box.firstChild.className === 
'w2ui-lock') {
-                       w2utils.unlock(w2ui['toolbar-down'].box);
-               }
+               this.fire('hidebusy');
 
                if (this.hasLayer(this._progressBar)) {
                        this.removeLayer(this._progressBar);
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to