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

Tamás Zolnai (via logerrit) logerrit at kemper.freedesktop.org
Sat Dec 28 10:39:30 UTC 2019


 loleaflet/src/control/Control.JSDialogBuilder.js |    6 ++++++
 loleaflet/src/control/Control.Menubar.js         |    4 ++--
 loleaflet/src/control/Control.MobileWizard.js    |   23 ++++++++++++++++++-----
 3 files changed, 26 insertions(+), 7 deletions(-)

New commits:
commit 2fe1e1ab8aabc010e8964ed1e3f1654d8abcb6f2
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Sat Dec 28 10:22:07 2019 +0100
Commit:     Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Sat Dec 28 11:39:16 2019 +0100

    mobile-wizard: Fix state of insertion mobile wizard toolbar item.
    
    When user clicks in the document while insertion mobile
    wizard is opened, closing of the mobile wizard is triggered,
    but the toolbar item's state is not updated.
    
    Change-Id: I92b2585b069006e3a21c15ca687126ea49d80a95
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/85911
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Tamás Zolnai <tamas.zolnai at collabora.com>

diff --git a/loleaflet/src/control/Control.MobileWizard.js b/loleaflet/src/control/Control.MobileWizard.js
index 712677c4a..d8145c05a 100644
--- a/loleaflet/src/control/Control.MobileWizard.js
+++ b/loleaflet/src/control/Control.MobileWizard.js
@@ -76,12 +76,13 @@ L.Control.MobileWizard = L.Control.extend({
 		this.map.showSidebar = false;
 		this._isActive = false;
 		this._currentPath = [];
-		if (window.mobileWizard === true) {
-			var toolbar = w2ui['actionbar'];
-			if (toolbar && toolbar.get('mobile_wizard').checked)
-				toolbar.uncheck('mobile_wizard');
+		if (window.mobileWizard === true)
 			window.mobileWizard = false;
-		}
+
+		if (window.insertionMobileWizard === true)
+			window.insertionMobileWizard = false;
+
+		this._updateToolbarItemStateByClose();
 
 		if (!this.map.hasFocus()) {
 			this.map.focus();
@@ -92,6 +93,18 @@ L.Control.MobileWizard = L.Control.extend({
 		document.activeElement.blur();
 	},
 
+	_updateToolbarItemStateByClose: function() {
+		var toolbar = w2ui['actionbar'];
+		if (toolbar)
+		{
+			if (window.mobileWizard === false && toolbar.get('mobile_wizard').checked)
+				toolbar.uncheck('mobile_wizard');
+
+			if (window.insertionMobileWizard === false && toolbar.get('insertion_mobile_wizard').checked)
+				toolbar.uncheck('insertion_mobile_wizard');
+		}
+	},
+
 	getCurrentLevel: function() {
 		return this._currentDepth;
 	},
commit 35763dad713852e81c13ee230ca01fc8536f7fc8
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Sat Dec 28 09:53:37 2019 +0100
Commit:     Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Sat Dec 28 11:39:11 2019 +0100

    mobile-wizard: Fix execution of insert header / footer menu's All item
    
    In desktop case, it depends on the checked state whether we insert
    or delete a header / footer. However, when deletion is triggered
    there is a dialog coming up, what we would like to avoid on mobile.
    So on mobile we allow only insertion by now. So we can add
    "On:bool=true" param to All menu item.
    
    Change-Id: I8ee764c488563b04226cc53e744034b22c0437ff
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/85910
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Tamás Zolnai <tamas.zolnai at collabora.com>

diff --git a/loleaflet/src/control/Control.JSDialogBuilder.js b/loleaflet/src/control/Control.JSDialogBuilder.js
index 916157c99..a79705df8 100644
--- a/loleaflet/src/control/Control.JSDialogBuilder.js
+++ b/loleaflet/src/control/Control.JSDialogBuilder.js
@@ -1446,6 +1446,12 @@ L.Control.JSDialogBuilder = L.Control.extend({
 				if (data.executionType === 'action') {
 					builder.map.menubar._executeAction(undefined, data.id);
 				} else if (!builder.map._clip || !builder.map._clip.filterExecCopyPaste(data.command)) {
+					// Header / footer is already inserted.
+					if ((data.command.startsWith('.uno:InsertPageHeader') ||
+					     data.command.startsWith('.uno:InsertPageFooter')) &&
+					    data.checked && data.checked === true) {
+						return;
+					}
 					builder.map.sendUnoCommand(data.command)
 				}
 			});
diff --git a/loleaflet/src/control/Control.Menubar.js b/loleaflet/src/control/Control.Menubar.js
index 75ec190c8..3f82b442f 100644
--- a/loleaflet/src/control/Control.Menubar.js
+++ b/loleaflet/src/control/Control.Menubar.js
@@ -624,9 +624,9 @@ L.Control.Menubar = L.Control.extend({
 					]},
 					{name: _UNO('.uno:InsertHeaderFooterMenu', 'text'), type: 'menu', menu: [
 						{name: _UNO('.uno:InsertPageHeader', 'text'), type: 'menu', menu: [
-							{name: _('All'), disabled: true, id: 'insertheader', tag: '_ALL_', uno: '.uno:InsertPageHeader?'}]},
+							{name: _('All'), disabled: true, id: 'insertheader', tag: '_ALL_', uno: '.uno:InsertPageHeader?On:bool=true'}]},
 						{name: _UNO('.uno:InsertPageFooter', 'text'), type: 'menu', menu: [
-							{name: _('All'), disabled: true, id: 'insertfooter', tag: '_ALL_', uno: '.uno:InsertPageFooter?'}]}
+							{name: _('All'), disabled: true, id: 'insertfooter', tag: '_ALL_', uno: '.uno:InsertPageFooter?On:bool=true'}]}
 					]},
 					{uno: '.uno:InsertFootnote'},
 					{uno: '.uno:InsertEndnote'},


More information about the Libreoffice-commits mailing list