[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-cd' - 9 commits - loleaflet/dist loleaflet/main.js loleaflet/src wsd/LOOLWSD.cpp

Henry Castro hcastro at collabora.com
Wed Nov 29 03:20:13 UTC 2017


 loleaflet/dist/menubar.css               |    2 -
 loleaflet/dist/toolbar/toolbar.js        |   50 +++++++++++++++----------------
 loleaflet/main.js                        |    1 
 loleaflet/src/control/Control.Menubar.js |   14 ++++++++
 loleaflet/src/core/Socket.js             |   10 +++++-
 loleaflet/src/map/Map.js                 |    6 +++
 wsd/LOOLWSD.cpp                          |    4 ++
 7 files changed, 58 insertions(+), 29 deletions(-)

New commits:
commit 8f8662b57673ea67e1527c8feff90c2ed81a07cb
Author: Henry Castro <hcastro at collabora.com>
Date:   Tue Sep 19 21:46:09 2017 -0400

    loleaflet: fix background color of the top level menu items
    
    Change-Id: I548c700a16664e8acfc6010c1be549e6176f2383
    (cherry picked from commit 0d870d444cbbcd1141319f60834bacb80e8d233f)

diff --git a/loleaflet/dist/menubar.css b/loleaflet/dist/menubar.css
index 67279234..de3bb94e 100644
--- a/loleaflet/dist/menubar.css
+++ b/loleaflet/dist/menubar.css
@@ -40,7 +40,6 @@
 }
 
 .lo-menu a.disabled {
-    background: #efefef;
     cursor: default;
 }
 .lo-menu > li > a.has-submenu {
@@ -70,7 +69,7 @@
     background: #538ecd;
     color: #fff;
 }
-.lo-menu > li {
+.lo-menu > li, .lo-menu > li > a.disabled {
     background: #efefef; /* top-level menus remain greyish */
 }
 .lo-menu > li > a:hover, .lo-menu > li > a:focus, .lo-menu > li > a:active, .lo-menu > li > a.highlighted {
commit a409184f15a0e53e3eae48b012fdaf830f8ad720
Author: Henry Castro <hcastro at collabora.com>
Date:   Sun Sep 17 11:09:02 2017 -0400

    loleaflet: show error when the document is disconnected
    
    Change-Id: I43f8d48002ccb2fc3b6ac9807b72ba6b618d72d2
    (cherry picked from commit 1a493880a496b805c6c577262715cc09b1e3cab2)

diff --git a/loleaflet/src/core/Socket.js b/loleaflet/src/core/Socket.js
index 4c09c7f9..f8f0eba1 100644
--- a/loleaflet/src/core/Socket.js
+++ b/loleaflet/src/core/Socket.js
@@ -250,6 +250,10 @@ L.Socket = L.Class.extend({
 				msg = _('Server is shutting down for maintenance (auto-saving)');
 				postMsgData['Reason'] = 'ShuttingDown';
 			}
+			else if (textMsg === 'docdisconnected') {
+				msg = _('Oops, there is a problem connecting the document');
+				postMsgData['Reason'] = 'DocumentDisconnected';
+			}
 			else if (textMsg === 'recycling') {
 				msg = _('Server is recycling and will be available shortly');
 				this._map._active = false;
commit 45c6cd6df53812c7f15f082a0be8f2c10e4840ff
Author: Henry Castro <hcastro at collabora.com>
Date:   Sun Sep 17 10:33:06 2017 -0400

    wsd: notify when the document is disconnected
    
    Change-Id: I36e6df3c576ff0f02d3b059c2f1db4226d527b49
    (cherry picked from commit bccdd8d4d7c84e4992c16f75bc3be70c7143b7a0)

diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp
index 381c881a..f9c5edc8 100644
--- a/wsd/LOOLWSD.cpp
+++ b/wsd/LOOLWSD.cpp
@@ -1395,6 +1395,7 @@ private:
         {
             auto lock = docBroker->getLock();
             docBroker->assertCorrectThread();
+            docBroker->setCloseReason("docdisconnected");
             docBroker->stop();
         }
     }
commit 71ebd94219ae7903c53782f04528f28ec9e2bd6c
Author: Henry Castro <hcastro at collabora.com>
Date:   Thu Sep 14 17:36:45 2017 -0400

    loleaflet: ignore events before the document is loaded
    
    Change-Id: Icd28854f4430786e1383a7fe6a694f3c7ce9a188
    (cherry picked from commit 105eeddae1f058572cf3b6d13edb5ec7ee61473f)

diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js
index 1d198c58..787d0f8a 100644
--- a/loleaflet/src/map/Map.js
+++ b/loleaflet/src/map/Map.js
@@ -1028,7 +1028,7 @@ L.Map = L.Evented.extend({
 	},
 
 	_handleDOMEvent: function (e) {
-		if (!this._loaded || !this._enabled || L.DomEvent._skipped(e)) { return; }
+		if (!this._docLayer || !this._loaded || !this._enabled || L.DomEvent._skipped(e)) { return; }
 
 		this.lastActiveTime = Date.now();
 
commit 61bbfaefddcd03dc4d578e62f30f05488d58e605
Author: Henry Castro <hcastro at collabora.com>
Date:   Wed Sep 13 17:02:26 2017 -0400

    wsd: debug: log when the wsd is ready to accept connections
    
    Change-Id: I56ea17af47bc85f30e74f5e93b94e0f3f3d95be4
    (cherry picked from commit 2556c2b4418de502a69fac4a2b3267eae91a4c41)

diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp
index 9aa3f986..381c881a 100644
--- a/wsd/LOOLWSD.cpp
+++ b/wsd/LOOLWSD.cpp
@@ -2536,6 +2536,9 @@ int LOOLWSD::innerMain()
 
     /// The main-poll does next to nothing:
     SocketPoll mainWait("main");
+#if ENABLE_DEBUG
+    std::cerr << "Ready to accept connections.\n" << std::endl;
+#endif
 
     const auto startStamp = std::chrono::steady_clock::now();
 
commit 80cb49582d19f53a45e47d5b72731ca2973e532d
Author: Henry Castro <hcastro at collabora.com>
Date:   Wed Sep 13 12:37:10 2017 -0400

    loleaflet: fix background color of the menu item in disabled state
    
    Change-Id: Idbe08dcd1fd1bb885f77478e3ad314be392a140d
    (cherry picked from commit 9c3393fc44875c359518310d61c195cdb27b8b1e)

diff --git a/loleaflet/dist/menubar.css b/loleaflet/dist/menubar.css
index 9d57445b..67279234 100644
--- a/loleaflet/dist/menubar.css
+++ b/loleaflet/dist/menubar.css
@@ -40,6 +40,7 @@
 }
 
 .lo-menu a.disabled {
+    background: #efefef;
     cursor: default;
 }
 .lo-menu > li > a.has-submenu {
commit bfdbc68afef8fd21b2293113ddd2b6e766a9a0de
Author: Henry Castro <hcastro at collabora.com>
Date:   Wed Sep 13 11:09:56 2017 -0400

    loleaflet: ensure initialize map components before the document is loaded
    
    Change-Id: I3b6219926f0f9d0306ef25bc5f9a9145410bac74
    (cherry picked from commit 7c1e1120c63661d84a5696c5b10a961477228e19)

diff --git a/loleaflet/main.js b/loleaflet/main.js
index 48200cd9..041f338d 100644
--- a/loleaflet/main.js
+++ b/loleaflet/main.js
@@ -128,6 +128,7 @@ map.addControl(L.control.columnHeader());
 map.addControl(L.control.rowHeader());
 map.addControl(L.control.contextMenu());
 map.addControl(L.control.menubar());
+map.loadDocument();
 
 window.addEventListener('beforeunload', function () {
 	if (global.map && global.map._socket) {
diff --git a/loleaflet/src/core/Socket.js b/loleaflet/src/core/Socket.js
index 05d7d82b..4c09c7f9 100644
--- a/loleaflet/src/core/Socket.js
+++ b/loleaflet/src/core/Socket.js
@@ -18,6 +18,11 @@ L.Socket = L.Class.extend({
 	initialize: function (map) {
 		console.debug('socket.initialize:');
 		this._map = map;
+		this._msgQueue = [];
+	},
+
+	connect: function() {
+		var map = this._map;
 		try {
 			if (map.options.permission) {
 				map.options.docParams['permission'] = map.options.permission;
@@ -39,7 +44,6 @@ L.Socket = L.Class.extend({
 			this._accessTokenExpireTimeout = setTimeout(L.bind(this._sessionExpiredWarning, this),
 			                                            parseInt(map.options.docParams.access_token_ttl) - Date.now() - tokenExpiryWarning);
 		}
-		this._msgQueue = [];
 	},
 
 	_sessionExpiredWarning: function() {
diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js
index 9553a567..1d198c58 100644
--- a/loleaflet/src/map/Map.js
+++ b/loleaflet/src/map/Map.js
@@ -165,6 +165,10 @@ L.Map = L.Evented.extend({
 		}, this);
 	},
 
+	loadDocument: function() {
+		this._socket.connect();
+	},
+
 	// public methods that modify map state
 
 	getViewId: function (username) {
commit dad8af27fbbf08723c08620b4daf68f0e253db71
Author: Henry Castro <hcastro at collabora.com>
Date:   Mon Sep 4 16:52:30 2017 -0400

    loleaflet: disable toolbar buttons before the document is loaded
    
    (cherry picked from commit b53bcf23ae601687fd8996d66e5a2a56d8c21d8e)
    
    Change-Id: Ia6679414f8eab54366a48b1c431ce9384d2dc8ca

diff --git a/loleaflet/dist/toolbar/toolbar.js b/loleaflet/dist/toolbar/toolbar.js
index d872908c..64d53c4f 100644
--- a/loleaflet/dist/toolbar/toolbar.js
+++ b/loleaflet/dist/toolbar/toolbar.js
@@ -460,47 +460,47 @@ $(function () {
 			{type: 'html', id: 'left'},
 			{type: 'button',  id: 'save', img: 'save', hint: _('Save')},
 			{type: 'break', id: 'savebreak'},
-			{type: 'button',  id: 'undo',  img: 'undo', hint: _('Undo'), uno: 'Undo'},
-			{type: 'button',  id: 'redo',  img: 'redo', hint: _('Redo'), uno: 'Redo'},
-			{type: 'button',  id: 'repair', img: 'repair', hint: _('Document repair')},
+			{type: 'button',  id: 'undo',  img: 'undo', hint: _('Undo'), uno: 'Undo', disabled: true},
+			{type: 'button',  id: 'redo',  img: 'redo', hint: _('Redo'), uno: 'Redo', disabled: true},
+			{type: 'button',  id: 'repair', img: 'repair', hint: _('Document repair'), disabled: true},
 			{type: 'break'},
 			{type: 'html',   id: 'styles', html: '<select class="styles-select"></select>'},
 			{type: 'html',   id: 'fonts', html: '<select class="fonts-select"></select>'},
 			{type: 'html',   id: 'fontsizes', html: '<select class="fontsizes-select"></select>'},
 			{type: 'break'},
-			{type: 'button',  id: 'bold',  img: 'bold', hint: _('Bold'), uno: 'Bold'},
-			{type: 'button',  id: 'italic', img: 'italic', hint: _('Italic'), uno: 'Italic'},
-			{type: 'button',  id: 'underline',  img: 'underline', hint: _('Underline'), uno: 'Underline'},
-			{type: 'button',  id: 'strikeout', img: 'strikeout', hint: _('Strikeout'), uno: 'Strikeout'},
+			{type: 'button',  id: 'bold',  img: 'bold', hint: _('Bold'), uno: 'Bold', disabled: true},
+			{type: 'button',  id: 'italic', img: 'italic', hint: _('Italic'), uno: 'Italic', disabled: true},
+			{type: 'button',  id: 'underline',  img: 'underline', hint: _('Underline'), uno: 'Underline', disabled: true},
+			{type: 'button',  id: 'strikeout', img: 'strikeout', hint: _('Strikeout'), uno: 'Strikeout', disabled: true},
 			{type: 'break', id: 'formatbreak'},
 			{type: 'html',  id: 'fontcolor-html', html: '<div id="fontcolor-wrapper"><input id="fontColorPicker" style="display:none;"></div>'},
 			{type: 'button',  id: 'fontcolor', img: 'color', hint: _('Font color')},
 			{type: 'html',  id: 'backcolor-html', html: '<div id="backcolor-wrapper"><input id="backColorPicker" style="display:none;"></div>'},
 			{type: 'button',  id: 'backcolor', img: 'backcolor', hint: _('Highlighting')},
 			{type: 'break'},
-			{type: 'button',  id: 'leftpara',  img: 'alignleft', hint: _('Align left'), uno: 'LeftPara', unosheet: 'AlignLeft'},
-			{type: 'button',  id: 'centerpara',  img: 'alignhorizontal', hint: _('Center horizontally'), uno: 'CenterPara', unosheet: 'AlignHorizontalCenter'},
-			{type: 'button',  id: 'rightpara',  img: 'alignright', hint: _('Align right'), uno: 'RightPara', unosheet: 'AlignRight'},
-			{type: 'button',  id: 'justifypara',  img: 'alignblock', hint: _('Justified'), uno: 'JustifyPara', unosheet: ''},
+			{type: 'button',  id: 'leftpara',  img: 'alignleft', hint: _('Align left'), uno: 'LeftPara', unosheet: 'AlignLeft', disabled: true},
+			{type: 'button',  id: 'centerpara',  img: 'alignhorizontal', hint: _('Center horizontally'), uno: 'CenterPara', unosheet: 'AlignHorizontalCenter', disabled: true},
+			{type: 'button',  id: 'rightpara',  img: 'alignright', hint: _('Align right'), uno: 'RightPara', unosheet: 'AlignRight', disabled: true},
+			{type: 'button',  id: 'justifypara',  img: 'alignblock', hint: _('Justified'), uno: 'JustifyPara', unosheet: '', disabled: true},
 			{type: 'break',  id: 'wraptextseparator'},
-			{type: 'button',  id: 'wraptext',  img: 'wraptext', hint: _('Wrap Text'), uno: 'WrapText'},
-			{type: 'button',  id: 'togglemergecells',  img: 'togglemergecells', hint: _('Merge and Center Cells'), uno: 'ToggleMergeCells'},
+			{type: 'button',  id: 'wraptext',  img: 'wraptext', hint: _('Wrap Text'), uno: 'WrapText', disabled: true},
+			{type: 'button',  id: 'togglemergecells',  img: 'togglemergecells', hint: _('Merge and Center Cells'), uno: 'ToggleMergeCells', disabled: true},
 			{type: 'break',   id: 'break-toggle'},
-			{type: 'button',  id: 'numberformatcurrency',  img: 'numberformatcurrency', hint: _('Format as Currency'), uno: 'NumberFormatCurrency'},
-			{type: 'button',  id: 'numberformatpercent',  img: 'numberformatpercent', hint: _('Format as Percent'), uno: 'NumberFormatPercent'},
-			{type: 'button',  id: 'numberformatdecimal',  img: 'numberformatdecimal', hint: _('Format as Number'), uno: 'NumberFormatDecimal'},
-			{type: 'button',  id: 'numberformatdate',  img: 'numberformatdate', hint: _('Format as Date'), uno: 'NumberFormatDate'},
-			{type: 'button',  id: 'numberformatincdecimals',  img: 'numberformatincdecimals', hint: _('Add Decimal Place'), uno: 'NumberFormatIncDecimals'},
-			{type: 'button',  id: 'numberformatdecdecimals',  img: 'numberformatdecdecimals', hint: _('Delete Decimal Place'), uno: 'NumberFormatDecDecimals'},
+			{type: 'button',  id: 'numberformatcurrency',  img: 'numberformatcurrency', hint: _('Format as Currency'), uno: 'NumberFormatCurrency', disabled: true},
+			{type: 'button',  id: 'numberformatpercent',  img: 'numberformatpercent', hint: _('Format as Percent'), uno: 'NumberFormatPercent', disabled: true},
+			{type: 'button',  id: 'numberformatdecimal',  img: 'numberformatdecimal', hint: _('Format as Number'), uno: 'NumberFormatDecimal', disabled: true},
+			{type: 'button',  id: 'numberformatdate',  img: 'numberformatdate', hint: _('Format as Date'), uno: 'NumberFormatDate', disabled: true},
+			{type: 'button',  id: 'numberformatincdecimals',  img: 'numberformatincdecimals', hint: _('Add Decimal Place'), uno: 'NumberFormatIncDecimals', disabled: true},
+			{type: 'button',  id: 'numberformatdecdecimals',  img: 'numberformatdecdecimals', hint: _('Delete Decimal Place'), uno: 'NumberFormatDecDecimals', disabled: true},
 			{type: 'break',   id: 'break-number'},
-			{type: 'button',  id: 'sortascending',  img: 'sortascending', hint: _('Sort Ascending'), uno: 'SortAscending'},
-			{type: 'button',  id: 'sortdescending',  img: 'sortdescending', hint: _('Sort Descending'), uno: 'SortDescending'},
+			{type: 'button',  id: 'sortascending',  img: 'sortascending', hint: _('Sort Ascending'), uno: 'SortAscending', disabled: true},
+			{type: 'button',  id: 'sortdescending',  img: 'sortdescending', hint: _('Sort Descending'), uno: 'SortDescending', disabled: true},
 			{type: 'break',   id: 'break-align'},
-			{type: 'button',  id: 'defaultbullet',  img: 'bullet', hint: _('Bullets on/off'), uno: 'DefaultBullet'},
-			{type: 'button',  id: 'defaultnumbering',  img: 'numbering', hint: _('Numbering on/off'), uno: 'DefaultNumbering'},
+			{type: 'button',  id: 'defaultbullet',  img: 'bullet', hint: _('Bullets on/off'), uno: 'DefaultBullet', disabled: true},
+			{type: 'button',  id: 'defaultnumbering',  img: 'numbering', hint: _('Numbering on/off'), uno: 'DefaultNumbering', disabled: true},
 			{type: 'break',   id: 'break-numbering'},
-			{type: 'button',  id: 'incrementindent',  img: 'incrementindent', hint: _('Increase indent'), uno: 'IncrementIndent'},
-			{type: 'button',  id: 'decrementindent',  img: 'decrementindent', hint: _('Decrease indent'), uno: 'DecrementIndent'},
+			{type: 'button',  id: 'incrementindent',  img: 'incrementindent', hint: _('Increase indent'), uno: 'IncrementIndent', disabled: true},
+			{type: 'button',  id: 'decrementindent',  img: 'decrementindent', hint: _('Decrease indent'), uno: 'DecrementIndent', disabled: true},
 			{type: 'break', id: 'incdecindent'},
 			{type: 'html',  id: 'inserttable-html', html: '<div id="inserttable-wrapper"><div id="inserttable-popup" class="inserttable-pop ui-widget ui-widget-content ui-corner-all" style="position: absolute; display: none;"><div class="inserttable-grid"></div><div id="inserttable-status" class="loleaflet-font" style="padding: 5px;"><br/></div></div>'},
 			{type: 'button',  id: 'inserttable',  img: 'inserttable', hint: _('Insert table')},
commit c684a5ff72bf8b4843e70e4b3bd7c560ef6f313c
Author: Henry Castro <hcastro at collabora.com>
Date:   Mon Sep 4 16:32:24 2017 -0400

    loleaflet: add initial menu bar before the document is loaded
    
    Change-Id: I9ab7f87e0ad3f4c9ff11670b8a2675d895a9c812
    (cherry picked from commit a29fa8756dbc9b0686300a0854994bf18b3ea4b6)

diff --git a/loleaflet/src/control/Control.Menubar.js b/loleaflet/src/control/Control.Menubar.js
index 63d29c62..19460338 100644
--- a/loleaflet/src/control/Control.Menubar.js
+++ b/loleaflet/src/control/Control.Menubar.js
@@ -6,6 +6,12 @@
 L.Control.Menubar = L.Control.extend({
 	// TODO: Some mechanism to stop the need to copy duplicate menus (eg. Help)
 	options: {
+		initial: [
+			{name: _('File'), disabled: true},
+			{name: _('Edit'), disabled: true},
+			{name: _('View'), disabled: true},
+			{name: _('Insert'), disabled: true}
+		],
 		text:  [
 			{name: _('File'), id: 'file', type: 'menu', menu: [
 				{name: _('Save'), id: 'save', type: 'action'},
@@ -296,6 +302,7 @@ L.Control.Menubar = L.Control.extend({
 	onAdd: function (map) {
 		this._initialized = false;
 		this._menubarCont = L.DomUtil.get('main-menu');
+		this._initializeMenu(this.options.initial);
 
 		map.on('doclayerinit', this._onDocLayerInit, this);
 		map.on('addmenu', this._addMenu, this);
@@ -320,6 +327,11 @@ L.Control.Menubar = L.Control.extend({
 	},
 
 	_onDocLayerInit: function() {
+		// clear initial menu
+		while (this._menubarCont.hasChildNodes()) {
+			this._menubarCont.removeChild(this._menubarCont.firstChild);
+		}
+
 		// Add document specific menu
 		var docType = this._map.getDocType();
 		if (docType === 'text') {
@@ -734,7 +746,7 @@ L.Control.Menubar = L.Control.extend({
 					L.DomUtil.addClass(liItem, 'readonly');
 				}
 			}
-			var aItem = L.DomUtil.create('a', '', liItem);
+			var aItem = L.DomUtil.create('a', menu[i].disabled ? 'disabled' : '', liItem);
 			aItem.innerHTML = menu[i].name;
 
 			if (menu[i].type === 'menu') {


More information about the Libreoffice-commits mailing list