[Libreoffice-commits] online.git: loleaflet/src

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Oct 31 17:58:12 UTC 2018


 loleaflet/src/map/handler/Map.FileInserter.js |   38 ++++++++++++++------------
 1 file changed, 21 insertions(+), 17 deletions(-)

New commits:
commit ee316b6f208d6b13ad712676bce00f1c5f8a271b
Author:     Tor Lillqvist <tml at collabora.com>
AuthorDate: Wed Oct 31 19:55:42 2018 +0200
Commit:     Tor Lillqvist <tml at collabora.com>
CommitDate: Wed Oct 31 19:55:42 2018 +0200

    Make the inserting of an image just a no-op for now in a mobile app
    
    Bypass the XMLHttpRequest stuff that would be pointless and wrong.
    
    Making inserting an image from the device's photo library (or taken
    right then with the camera even) actually work is not high priority.

diff --git a/loleaflet/src/map/handler/Map.FileInserter.js b/loleaflet/src/map/handler/Map.FileInserter.js
index ce1e62146..c11c23350 100644
--- a/loleaflet/src/map/handler/Map.FileInserter.js
+++ b/loleaflet/src/map/handler/Map.FileInserter.js
@@ -73,27 +73,31 @@ L.Map.FileInserter = L.Handler.extend({
 
 	_sendFile: function (name, file) {
 		var url = this._url;
-		var xmlHttp = new XMLHttpRequest();
 		var socket = this._map._socket;
 		var map = this._map;
-		this._map.showBusy(_('Uploading...'), false);
-		xmlHttp.onreadystatechange = function () {
-			if (xmlHttp.readyState === 4 && xmlHttp.status === 200) {
-				map.hideBusy();
-				socket.sendMessage('insertfile name=' + name + ' type=graphic');
-			}
-		};
-		xmlHttp.open('POST', url, true);
-		var formData = new FormData();
-		formData.append('name', name);
-		formData.append('childid', this._childId);
-		if (file.filename && file.url) {
-			formData.append('url', file.url);
-			formData.append('filename', file.filename);
+		if (window.ThisIsAMobileApp) {
+			console.log('FIXME: image insertion in mobile app');
 		} else {
-			formData.append('file', file);
+			var xmlHttp = new XMLHttpRequest();
+			this._map.showBusy(_('Uploading...'), false);
+			xmlHttp.onreadystatechange = function () {
+				if (xmlHttp.readyState === 4 && xmlHttp.status === 200) {
+					map.hideBusy();
+					socket.sendMessage('insertfile name=' + name + ' type=graphic');
+				}
+			};
+			xmlHttp.open('POST', url, true);
+			var formData = new FormData();
+			formData.append('name', name);
+			formData.append('childid', this._childId);
+			if (file.filename && file.url) {
+				formData.append('url', file.url);
+				formData.append('filename', file.filename);
+			} else {
+				formData.append('file', file);
+			}
+			xmlHttp.send(formData);
 		}
-		xmlHttp.send(formData);
 	},
 
 	_sendURL: function (name, url) {


More information about the Libreoffice-commits mailing list