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

Szymon KÅ‚os (via logerrit) logerrit at kemper.freedesktop.org
Wed Apr 29 07:50:11 UTC 2020


 loleaflet/Makefile.am                        |    2 ++
 loleaflet/src/control/Control.Notebookbar.js |   20 ++++++++++++++++++++
 loleaflet/src/control/Control.StatusBar.js   |   17 -----------------
 loleaflet/src/control/Control.Toolbar.js     |   17 +++++++++++++++++
 loleaflet/src/control/Control.UIManager.js   |   18 ++++++++++++------
 5 files changed, 51 insertions(+), 23 deletions(-)

New commits:
commit df19274705d3c9897b4e8679a0a2daf228c5d756
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Tue Apr 21 14:10:38 2020 +0200
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Wed Apr 29 09:49:52 2020 +0200

    notebookbar: Create toolbars depending on settings
    
    Change-Id: I66a03e9d8e9104b9f7868f24601525d502734e0e
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/93051
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>

diff --git a/loleaflet/Makefile.am b/loleaflet/Makefile.am
index 2fc3a232c..0551a1430 100644
--- a/loleaflet/Makefile.am
+++ b/loleaflet/Makefile.am
@@ -280,6 +280,7 @@ LOLEAFLET_JS =\
 	src/control/Control.TopToolbar.js \
 	src/control/Control.UIManager.js \
 	src/control/Control.DocumentNameInput.js \
+	src/control/Control.Notebookbar.js \
 	src/control/Control.Layers.js \
 	src/control/Search.js \
 	src/control/Permission.js \
@@ -548,6 +549,7 @@ pot:
 		src/control/Control.UserList.js \
 		src/control/Control.UIManager.js \
 		src/control/Control.DocumentNameInput.js \
+		src/control/Control.Notebookbar.js \
 		src/control/Ruler.js \
 		src/control/Signing.js \
 		src/control/Toolbar.js \
diff --git a/loleaflet/src/control/Control.Notebookbar.js b/loleaflet/src/control/Control.Notebookbar.js
new file mode 100644
index 000000000..33084e62a
--- /dev/null
+++ b/loleaflet/src/control/Control.Notebookbar.js
@@ -0,0 +1,20 @@
+/* -*- js-indent-level: 8 -*- */
+/*
+ * L.Control.Notebookbar
+ */
+
+/* global */
+L.Control.Notebookbar = L.Control.extend({
+	options: {
+		docType: ''
+	},
+
+	onAdd: function (map) {
+		this.map = map;
+	},
+
+});
+
+L.control.notebookbar = function (options) {
+	return new L.Control.Notebookbar(options);
+};
diff --git a/loleaflet/src/control/Control.StatusBar.js b/loleaflet/src/control/Control.StatusBar.js
index dd12ec836..9bd0c8d53 100644
--- a/loleaflet/src/control/Control.StatusBar.js
+++ b/loleaflet/src/control/Control.StatusBar.js
@@ -239,23 +239,6 @@ L.Control.StatusBar = L.Control.extend({
 			w2ui['actionbar'].touchStarted = true;
 		});
 
-		this.map.on('search', function (e) {
-			var searchInput = L.DomUtil.get('search-input');
-			var toolbar = w2ui['actionbar'];
-			if (e.count === 0) {
-				toolbar.disable('searchprev');
-				toolbar.disable('searchnext');
-				toolbar.hide('cancelsearch');
-				L.DomUtil.addClass(searchInput, 'search-not-found');
-				$('#findthis').addClass('search-not-found');
-				that.map.resetSelection();
-				setTimeout(function () {
-					$('#findthis').removeClass('search-not-found');
-					L.DomUtil.removeClass(searchInput, 'search-not-found');
-				}, 500);
-			}
-		});
-
 		this.map.on('zoomend', function () {
 			var zoomPercent = 100;
 			var zoomSelected = null;
diff --git a/loleaflet/src/control/Control.Toolbar.js b/loleaflet/src/control/Control.Toolbar.js
index bdfbbee9e..d1db7a681 100644
--- a/loleaflet/src/control/Control.Toolbar.js
+++ b/loleaflet/src/control/Control.Toolbar.js
@@ -987,6 +987,23 @@ function setupToolbar(e) {
 		entry.select();
 	});
 
+	map.on('search', function (e) {
+		var searchInput = L.DomUtil.get('search-input');
+		var toolbar = w2ui['actionbar'];
+		if (e.count === 0) {
+			toolbar.disable('searchprev');
+			toolbar.disable('searchnext');
+			toolbar.hide('cancelsearch');
+			L.DomUtil.addClass(searchInput, 'search-not-found');
+			$('#findthis').addClass('search-not-found');
+			map.resetSelection();
+			setTimeout(function () {
+				$('#findthis').removeClass('search-not-found');
+				L.DomUtil.removeClass(searchInput, 'search-not-found');
+			}, 500);
+		}
+	});
+
 	map.on('hyperlinkclicked', function (e) {
 		if (e.url) {
 			if (e.coordinates) {
diff --git a/loleaflet/src/control/Control.UIManager.js b/loleaflet/src/control/Control.UIManager.js
index 88124c491..14c9eb98b 100644
--- a/loleaflet/src/control/Control.UIManager.js
+++ b/loleaflet/src/control/Control.UIManager.js
@@ -15,17 +15,21 @@ L.Control.UIManager = L.Control.extend({
 	// UI initialization
 
 	initializeBasicUI: function() {
-		var menubar = L.control.menubar();
-		this.map.menubar = menubar;
-		this.map.addControl(menubar);
-
-		this.map.addControl(L.control.statusBar());
+		if (window.mode.isMobile() || !window.enableNotebookbar) {
+			var menubar = L.control.menubar();
+			this.map.menubar = menubar;
+			this.map.addControl(menubar);
+		}
 
 		if (window.mode.isMobile()) {
 			$('#mobile-edit-button').show();
 		} else {
-			this.map.addControl(L.control.topToolbar());
+			if (!window.enableNotebookbar) {
+				this.map.addControl(L.control.topToolbar());
+			}
+
 			this.map.addControl(L.control.signingBar());
+			this.map.addControl(L.control.statusBar());
 		}
 
 		setupToolbar(this.map);
@@ -61,6 +65,8 @@ L.Control.UIManager = L.Control.extend({
 			this.map.addControl(L.control.mobileBottomBar(docType));
 			this.map.addControl(L.control.mobileTopBar(docType));
 			this.map.addControl(L.control.searchBar());
+		} else if (window.enableNotebookbar) {
+			this.map.addControl(L.control.notebookbar({docType: docType}));
 		}
 
 		if (docType === 'spreadsheet') {


More information about the Libreoffice-commits mailing list