summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRash419 <rashesh.padia@collabora.com>2022-06-21 17:11:05 +0530
committerRashesh Padia <rasheshpadia419@gmail.com>2022-06-27 12:31:07 +0530
commit976afd6658c8703e0d554fcecb36ca5d2df9e086 (patch)
tree50c47e6182c28f8d2931391923157440bc12108e
parentAvoid TypeError by not using undefined function (diff)
downloadonline-976afd6658c8703e0d554fcecb36ca5d2df9e086.tar.gz
online-976afd6658c8703e0d554fcecb36ca5d2df9e086.zip
fix: CheckFileInfo - HideSaveOption, HideExportOption and HidePrintOption do not work in NB
fix: after switching to Notebookbar view and back again to Classic View; the Save icon reappears. Signed-off-by: Rash419 <rashesh.padia@collabora.com> Change-Id: I8fda18a9148c679209f0de99b80526393a965720
-rw-r--r--browser/src/control/Control.Notebookbar.js5
-rw-r--r--browser/src/control/Control.NotebookbarCalc.js24
-rw-r--r--browser/src/control/Control.NotebookbarDraw.js50
-rw-r--r--browser/src/control/Control.NotebookbarImpress.js50
-rw-r--r--browser/src/control/Control.NotebookbarWriter.js24
-rw-r--r--browser/src/control/Control.UIManager.js3
6 files changed, 86 insertions, 70 deletions
diff --git a/browser/src/control/Control.Notebookbar.js b/browser/src/control/Control.Notebookbar.js
index e4a20e3bc2..473b25afcb 100644
--- a/browser/src/control/Control.Notebookbar.js
+++ b/browser/src/control/Control.Notebookbar.js
@@ -244,17 +244,18 @@ L.Control.Notebookbar = L.Control.extend({
},
getShortcutsBarData: function() {
+ var hasSave = !this._map['wopi'].HideSaveOption;
return [
{
'id': 'shortcutstoolbox',
'type': 'toolbox',
'children': [
- {
+ hasSave ? {
'id': 'save',
'type': 'toolitem',
'text': _('Save'),
'command': '.uno:Save'
- }
+ } : {}
]
}
];
diff --git a/browser/src/control/Control.NotebookbarCalc.js b/browser/src/control/Control.NotebookbarCalc.js
index cf56fee86d..7a92b2533f 100644
--- a/browser/src/control/Control.NotebookbarCalc.js
+++ b/browser/src/control/Control.NotebookbarCalc.js
@@ -86,19 +86,21 @@ L.Control.NotebookbarCalc = L.Control.NotebookbarWriter.extend({
var hasShare = this._map['wopi'].EnableShare;
var hasGroupedDownloadAs = !!window.groupDownloadAsForNb;
var hasRunMacro = !(window.enableMacrosExecution === 'false');
+ var hasSave = !this._map['wopi'].HideSaveOption;
var content = [
- {
- 'type': 'toolbox',
- 'children': [
- {
- 'id': 'file-save',
- 'type': 'bigtoolitem',
- 'text': _('Save'),
- 'command': '.uno:Save'
- }
- ]
- },
+ hasSave ?
+ {
+ 'type': 'toolbox',
+ 'children': [
+ {
+ 'id': 'file-save',
+ 'type': 'bigtoolitem',
+ 'text': _('Save'),
+ 'command': '.uno:Save'
+ }
+ ]
+ } : {},
hasSaveAs ?
{
'id': 'file-saveas',
diff --git a/browser/src/control/Control.NotebookbarDraw.js b/browser/src/control/Control.NotebookbarDraw.js
index c370261694..591553bc33 100644
--- a/browser/src/control/Control.NotebookbarDraw.js
+++ b/browser/src/control/Control.NotebookbarDraw.js
@@ -7,19 +7,21 @@
L.Control.NotebookbarDraw = L.Control.NotebookbarImpress.extend({
getShortcutsBarData: function() {
+ var hasSave = !this._map['wopi'].HideSaveOption;
return [
- {
- 'id': 'shortcutstoolbox',
- 'type': 'toolbox',
- 'children': [
- {
- 'id': 'save',
- 'type': 'toolitem',
- 'text': _('Save'),
- 'command': '.uno:Save'
- }
- ]
- }
+ hasSave ?
+ {
+ 'id': 'shortcutstoolbox',
+ 'type': 'toolbox',
+ 'children': [
+ {
+ 'id': 'save',
+ 'type': 'toolitem',
+ 'text': _('Save'),
+ 'command': '.uno:Save'
+ }
+ ]
+ } : {}
];
},
@@ -128,19 +130,21 @@ L.Control.NotebookbarDraw = L.Control.NotebookbarImpress.extend({
var hasPrint = !this._map['wopi'].HidePrintOption;
var hasSaveAs = !this._map['wopi'].UserCanNotWriteRelative;
var hasShare = this._map['wopi'].EnableShare;
+ var hasSave = !this._map['wopi'].HideSaveOption;
var content = [
- {
- 'type': 'toolbox',
- 'children': [
- {
- 'id': 'file-save',
- 'type': 'bigtoolitem',
- 'text': _('Save'),
- 'command': '.uno:Save'
- }
- ]
- },
+ hasSave ?
+ {
+ 'type': 'toolbox',
+ 'children': [
+ {
+ 'id': 'file-save',
+ 'type': 'bigtoolitem',
+ 'text': _('Save'),
+ 'command': '.uno:Save'
+ }
+ ]
+ } : {},
hasSaveAs ?
{
'id': 'file-saveas',
diff --git a/browser/src/control/Control.NotebookbarImpress.js b/browser/src/control/Control.NotebookbarImpress.js
index 87c8acfb86..7d2424d829 100644
--- a/browser/src/control/Control.NotebookbarImpress.js
+++ b/browser/src/control/Control.NotebookbarImpress.js
@@ -7,19 +7,21 @@
L.Control.NotebookbarImpress = L.Control.NotebookbarWriter.extend({
getShortcutsBarData: function() {
+ var hasSave = !this._map['wopi'].HideSaveOption;
return [
- {
- 'id': 'shortcutstoolbox',
- 'type': 'toolbox',
- 'children': [
- {
- 'id': 'save',
- 'type': 'toolitem',
- 'text': _('Save'),
- 'command': '.uno:Save'
- }
- ]
- }
+ hasSave ?
+ {
+ 'id': 'shortcutstoolbox',
+ 'type': 'toolbox',
+ 'children': [
+ {
+ 'id': 'save',
+ 'type': 'toolitem',
+ 'text': _('Save'),
+ 'command': '.uno:Save'
+ }
+ ]
+ } : {}
];
},
@@ -142,19 +144,21 @@ L.Control.NotebookbarImpress = L.Control.NotebookbarWriter.extend({
var hasShare = this._map['wopi'].EnableShare;
var hasGroupedDownloadAs = !!window.groupDownloadAsForNb;
var hasRunMacro = !(window.enableMacrosExecution === 'false');
+ var hasSave = !this._map['wopi'].HideSaveOption;
var content = [
- {
- 'type': 'toolbox',
- 'children': [
- {
- 'id': 'file-save',
- 'type': 'bigtoolitem',
- 'text': _('Save'),
- 'command': '.uno:Save'
- }
- ]
- },
+ hasSave ?
+ {
+ 'type': 'toolbox',
+ 'children': [
+ {
+ 'id': 'file-save',
+ 'type': 'bigtoolitem',
+ 'text': _('Save'),
+ 'command': '.uno:Save'
+ }
+ ]
+ } : {},
hasSaveAs ?
{
'id': 'file-saveas',
diff --git a/browser/src/control/Control.NotebookbarWriter.js b/browser/src/control/Control.NotebookbarWriter.js
index 63a508ed0b..68336dbfa4 100644
--- a/browser/src/control/Control.NotebookbarWriter.js
+++ b/browser/src/control/Control.NotebookbarWriter.js
@@ -94,19 +94,21 @@ L.Control.NotebookbarWriter = L.Control.Notebookbar.extend({
var hasShare = this._map['wopi'].EnableShare;
var hasGroupedDownloadAs = !!window.groupDownloadAsForNb;
var hasRunMacro = !(window.enableMacrosExecution === 'false');
+ var hasSave = !this._map['wopi'].HideSaveOption;
var content = [
- {
- 'type': 'toolbox',
- 'children': [
- {
- 'id': 'file-save',
- 'type': 'bigtoolitem',
- 'text': _('Save'),
- 'command': '.uno:Save'
- }
- ]
- },
+ hasSave ?
+ {
+ 'type': 'toolbox',
+ 'children': [
+ {
+ 'id': 'file-save',
+ 'type': 'bigtoolitem',
+ 'text': _('Save'),
+ 'command': '.uno:Save'
+ }
+ ]
+ } : {},
hasSaveAs ?
{
'id': 'file-saveas',
diff --git a/browser/src/control/Control.UIManager.js b/browser/src/control/Control.UIManager.js
index 4fabfe59f0..a8c3e8a6a5 100644
--- a/browser/src/control/Control.UIManager.js
+++ b/browser/src/control/Control.UIManager.js
@@ -246,6 +246,9 @@ L.Control.UIManager = L.Control.extend({
this.map.topToolbar = L.control.topToolbar();
this.map.addControl(this.map.topToolbar);
+ //update the toolbar according to CheckFileInfo
+ this.map.topToolbar.onWopiProps(this.map.wopi);
+
this.map.menubar._onDocLayerInit();
this.map.topToolbar.onDocLayerInit();
this.map.sendInitUNOCommands();