[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-4-0' - loleaflet/js loleaflet/src

Jan Holesovsky (via logerrit) logerrit at kemper.freedesktop.org
Wed Jun 12 08:12:54 UTC 2019


 loleaflet/js/toolbar.js                  |   19 ++++++++++++++++++-
 loleaflet/src/control/Control.Menubar.js |   13 +++++++++++++
 2 files changed, 31 insertions(+), 1 deletion(-)

New commits:
commit 368ec07dcee9e25dec0bd305cbf305f9dbff9090
Author:     Jan Holesovsky <kendy at collabora.com>
AuthorDate: Mon Jun 3 14:25:30 2019 +0200
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Wed Jun 12 10:12:36 2019 +0200

    Show the state of the Delete Slide.
    
    When there is only one slide, it cannot be deleted.  Use the information
    from the core to enable or disable the state of the "Delete Slide"
    button in the slide sorter and the menu entry.
    
    Change-Id: I549d4c09b6fd999b14e281976320d1b6f63d64b7
    Reviewed-on: https://gerrit.libreoffice.org/73383
    Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
    Tested-by: Szymon Kłos <szymon.klos at collabora.com>
    (cherry picked from commit 3a1f68dc84dddf252cdd222ab14b2a4635f39251)
    Reviewed-on: https://gerrit.libreoffice.org/73863
    Reviewed-by: Andras Timar <andras.timar at collabora.com>
    Tested-by: Andras Timar <andras.timar at collabora.com>

diff --git a/loleaflet/js/toolbar.js b/loleaflet/js/toolbar.js
index bae578585..cce5b6991 100644
--- a/loleaflet/js/toolbar.js
+++ b/loleaflet/js/toolbar.js
@@ -1952,6 +1952,9 @@ function onCommandStateChanged(e) {
 		if (_inMobileMode()) {
 			toolbarUp = statusbar;
 		}
+		if (map.getDocType() === 'presentation' && (id === 'deletepage' || id === 'insertpage' || id === 'duplicatepage')) {
+			toolbarUp = w2ui['presentation-toolbar'];
+		}
 		if (state === 'enabled') {
 			toolbarUp.enable(id);
 		} else {
@@ -2184,7 +2187,21 @@ function onUpdatePermission(e) {
 
 		toolbar = w2ui['presentation-toolbar'];
 		presentationButtons.forEach(function(id) {
-			toolbar.enable(id);
+			if (id === 'deletepage') {
+				var itemState = map['stateChangeHandler'].getItemValue('.uno:DeletePage');
+			} else if (id === 'insertpage') {
+				itemState = map['stateChangeHandler'].getItemValue('.uno:InsertPage');
+			} else if (id === 'duplicatepage') {
+				itemState = map['stateChangeHandler'].getItemValue('.uno:DuplicatePage');
+			} else {
+				itemState = 'enabled';
+			}
+
+			if (itemState === 'enabled') {
+				toolbar.enable(id);
+			} else {
+				toolbar.disable(id);
+			}
 		});
 
 		toolbar = w2ui['actionbar'];
diff --git a/loleaflet/src/control/Control.Menubar.js b/loleaflet/src/control/Control.Menubar.js
index 1ba848f07..32591f830 100644
--- a/loleaflet/src/control/Control.Menubar.js
+++ b/loleaflet/src/control/Control.Menubar.js
@@ -685,6 +685,19 @@ L.Control.Menubar = L.Control.extend({
 						if (index > 0) {
 							self.options.allowedViewModeActions.splice(index, 1);
 						}
+					} else if (self._map.getDocType() === 'presentation' && (id === 'deletepage' || id === 'insertpage' || id === 'duplicatepage')) {
+						if (id === 'deletepage') {
+							itemState = self._map['stateChangeHandler'].getItemValue('.uno:DeletePage');
+						} else if (id === 'insertpage') {
+							itemState = self._map['stateChangeHandler'].getItemValue('.uno:InsertPage');
+						} else {
+							itemState = self._map['stateChangeHandler'].getItemValue('.uno:DuplicatePage');
+						}
+						if (itemState === 'disabled') {
+							$(aItem).addClass('disabled');
+						} else {
+							$(aItem).removeClass('disabled');
+						}
 					} else {
 						$(aItem).removeClass('disabled');
 					}


More information about the Libreoffice-commits mailing list