diff --git a/apps/documenteditor/mobile/src/controller/Search.jsx b/apps/documenteditor/mobile/src/controller/Search.jsx index 31b888efc..6c2a34f13 100644 --- a/apps/documenteditor/mobile/src/controller/Search.jsx +++ b/apps/documenteditor/mobile/src/controller/Search.jsx @@ -4,6 +4,7 @@ import { SearchController, SearchView, SearchSettingsView } from '../../../../co import { f7 } from 'framework7-react'; import { withTranslation } from 'react-i18next'; import { Device } from '../../../../common/mobile/utils/device'; +import { observer, inject } from "mobx-react"; class SearchSettings extends SearchSettingsView { constructor(props) { @@ -22,6 +23,8 @@ class SearchSettings extends SearchSettingsView { const show_popover = !Device.phone; const { t } = this.props; const _t = t("Settings", {returnObjects: true}); + const storeAppOptions = this.props.storeAppOptions; + const isEdit = storeAppOptions.isEdit; const markup = ( @@ -34,9 +37,14 @@ class SearchSettings extends SearchSettingsView { this.onFindReplaceClick('find')} /> - this.onFindReplaceClick('replace')} /> - this.onFindReplaceClick('replace')} /> + : null} + {isEdit ? + this.onFindReplaceClick('replace-all')}> + : null} @@ -115,6 +123,6 @@ const Search = withTranslation()(props => { return }); -const SearchSettingsWithTranslation = withTranslation()(SearchSettings); +const SearchSettingsWithTranslation = inject("storeAppOptions")(observer(withTranslation()(SearchSettings))); export {Search, SearchSettingsWithTranslation as SearchSettings} diff --git a/apps/presentationeditor/mobile/src/controller/Search.jsx b/apps/presentationeditor/mobile/src/controller/Search.jsx index 9cf8975d4..497d7a70b 100644 --- a/apps/presentationeditor/mobile/src/controller/Search.jsx +++ b/apps/presentationeditor/mobile/src/controller/Search.jsx @@ -4,6 +4,7 @@ import { SearchController, SearchView, SearchSettingsView } from '../../../../co import { f7 } from 'framework7-react'; import { withTranslation } from 'react-i18next'; import { Device } from '../../../../common/mobile/utils/device'; +import { observer, inject } from "mobx-react"; class SearchSettings extends SearchSettingsView { constructor(props) { @@ -15,6 +16,8 @@ class SearchSettings extends SearchSettingsView { const show_popover = !Device.phone; const { t } = this.props; const _t = t("View.Settings", {returnObjects: true}); + const storeAppOptions = this.props.storeAppOptions; + const isEdit = storeAppOptions.isEdit; const markup = ( @@ -27,9 +30,14 @@ class SearchSettings extends SearchSettingsView { this.onFindReplaceClick('find')} /> - this.onFindReplaceClick('replace')} /> - this.onFindReplaceClick('replace-all')}> + {isEdit ? + this.onFindReplaceClick('replace')} /> + : null} + {isEdit ? + this.onFindReplaceClick('replace-all')}> + : null} @@ -97,6 +105,6 @@ const Search = withTranslation()(props => { return }); -const SearchSettingsWithTranslation = withTranslation()(SearchSettings); +const SearchSettingsWithTranslation = inject("storeAppOptions")(observer(withTranslation()(SearchSettings))); export {Search, SearchSettingsWithTranslation as SearchSettings} diff --git a/apps/presentationeditor/mobile/src/view/settings/Settings.jsx b/apps/presentationeditor/mobile/src/view/settings/Settings.jsx index ff83ceda8..22f9a2339 100644 --- a/apps/presentationeditor/mobile/src/view/settings/Settings.jsx +++ b/apps/presentationeditor/mobile/src/view/settings/Settings.jsx @@ -1,8 +1,9 @@ import React, {Component, useEffect} from 'react'; import {View,Page,Navbar,NavRight,Link,Popup,Popover,Icon,ListItem,List} from 'framework7-react'; -import { withTranslation } from 'react-i18next'; +import { useTranslation } from 'react-i18next'; import {f7} from 'framework7-react'; import {Device} from '../../../../../common/mobile/utils/device'; +import { observer, inject } from "mobx-react"; import ApplicationSettingsController from "../../controller/settings/ApplicationSettings"; import { MacrosSettings } from "./ApplicationSettings"; import DownloadController from "../../controller/settings/Download"; @@ -56,8 +57,8 @@ const routes = [ ]; -const SettingsList = withTranslation()(props => { - const {t} = props; +const SettingsList = inject("storeAppOptions")(observer(props => { + const { t } = useTranslation(); const _t = t('View.Settings', {returnObjects: true}); const navbar = {!props.inPopover && {_t.textDone}} @@ -107,13 +108,20 @@ const SettingsList = withTranslation()(props => { window.open(url, "_blank"); }; + const appOptions = props.storeAppOptions; + let _isEdit = false; + + if (!appOptions.isDisconnected) { + _isEdit = appOptions.isEdit; + } + return ( {navbar} {!props.inPopover && - + } @@ -147,7 +155,7 @@ const SettingsList = withTranslation()(props => { ) -}); +})); class SettingsView extends Component { constructor(props) { diff --git a/apps/spreadsheeteditor/mobile/src/controller/Search.jsx b/apps/spreadsheeteditor/mobile/src/controller/Search.jsx index ee4613c56..f6949e9c6 100644 --- a/apps/spreadsheeteditor/mobile/src/controller/Search.jsx +++ b/apps/spreadsheeteditor/mobile/src/controller/Search.jsx @@ -5,6 +5,7 @@ import { f7 } from 'framework7-react'; import { withTranslation } from 'react-i18next'; import { Dom7 } from 'framework7'; import { Device } from '../../../../common/mobile/utils/device'; +import { observer, inject } from "mobx-react"; class SearchSettings extends SearchSettingsView { constructor(props) { @@ -23,6 +24,8 @@ class SearchSettings extends SearchSettingsView { const show_popover = !Device.phone; const { t } = this.props; const _t = t("View.Settings", { returnObjects: true }); + const storeAppOptions = this.props.storeAppOptions; + const isEdit = storeAppOptions.isEdit; const markup = ( @@ -35,9 +38,14 @@ class SearchSettings extends SearchSettingsView { this.onFindReplaceClick('find')} /> - this.onFindReplaceClick('replace')} /> - this.onFindReplaceClick('replace-all')}> + {isEdit ? + this.onFindReplaceClick('replace')} /> + : null} + {isEdit ? + this.onFindReplaceClick('replace-all')}> + : null} {_t.textSearchIn} @@ -206,6 +214,6 @@ const Search = withTranslation()(props => { return }); -const SearchSettingsWithTranslation = withTranslation()(SearchSettings); +const SearchSettingsWithTranslation = inject("storeAppOptions")(observer(withTranslation()(SearchSettings))); export {Search, SearchSettingsWithTranslation as SearchSettings} \ No newline at end of file diff --git a/apps/spreadsheeteditor/mobile/src/controller/Statusbar.jsx b/apps/spreadsheeteditor/mobile/src/controller/Statusbar.jsx index 6ca23f1da..47d3840c2 100644 --- a/apps/spreadsheeteditor/mobile/src/controller/Statusbar.jsx +++ b/apps/spreadsheeteditor/mobile/src/controller/Statusbar.jsx @@ -195,12 +195,13 @@ const Statusbar = inject('sheets', 'storeAppOptions', 'users')(props => { if (index == api.asc_getActiveWorksheetIndex()) { if (!opened) { - if (!isDisconnected) { + if (isEdit && !isDisconnected) { api.asc_closeCellEditor(); f7.popover.open('#idx-tab-context-menu-popover', target); } } - } else { + } + else { f7.popover.close('#idx-tab-context-menu-popover', false); onTabClicked(i); // Common.Notifications.trigger('sheet:active', index); diff --git a/apps/spreadsheeteditor/mobile/src/view/Statusbar.jsx b/apps/spreadsheeteditor/mobile/src/view/Statusbar.jsx index c4915bbba..7af545d6f 100644 --- a/apps/spreadsheeteditor/mobile/src/view/Statusbar.jsx +++ b/apps/spreadsheeteditor/mobile/src/view/Statusbar.jsx @@ -8,12 +8,13 @@ const viewStyle = { height: 30 }; -const StatusbarView = inject('sheets')(observer(props => { +const StatusbarView = inject('sheets', "storeAppOptions")(observer(props => { const { t } = useTranslation(); const _t = t('Statusbar', {returnObjects: true}); const isAndroid = Device.android; const isPhone = Device.isPhone; - const { sheets } = props; + const { sheets, storeAppOptions } = props; + const isEdit = storeAppOptions.isEdit; const hiddenSheets = sheets.hiddenWorksheets(); const allSheets = sheets.sheets; const getTabClassList = model => `tab ${model.active ? 'active' : ''} ${model.locked ? 'locked' : ''}`; @@ -134,30 +135,32 @@ const StatusbarView = inject('sheets')(observer(props => { - - {isPhone || isAndroid ? ( - - props.onTabMenu('copy')} /> - props.onTabMenu('del')} /> - props.onTabMenu('showMore')} /> - - ) : ( - - props.onTabMenu('copy')} /> - props.onTabMenu('del')} /> - props.onTabMenu('ren')} /> - props.onTabMenu('hide')} /> - {hiddenSheets.length ? ( - props.onTabMenu('unhide')} /> - ) : null} - - )} - + {isEdit ? + + {isPhone || isAndroid ? ( + + props.onTabMenu('copy')} /> + props.onTabMenu('del')} /> + props.onTabMenu('showMore')} /> + + ) : ( + + props.onTabMenu('copy')} /> + props.onTabMenu('del')} /> + props.onTabMenu('ren')} /> + props.onTabMenu('hide')} /> + {hiddenSheets.length ? ( + props.onTabMenu('unhide')} /> + ) : null} + + )} + + : null} {isPhone || isAndroid ? ( diff --git a/apps/spreadsheeteditor/mobile/src/view/settings/Settings.jsx b/apps/spreadsheeteditor/mobile/src/view/settings/Settings.jsx index 3fa8009e5..6d3793350 100644 --- a/apps/spreadsheeteditor/mobile/src/view/settings/Settings.jsx +++ b/apps/spreadsheeteditor/mobile/src/view/settings/Settings.jsx @@ -1,8 +1,9 @@ import React, {Component, useEffect} from 'react'; import {View,Page,Navbar,NavRight,Link,Popup,Popover,Icon,ListItem,List} from 'framework7-react'; -import { withTranslation } from 'react-i18next'; +import { useTranslation } from 'react-i18next'; import {f7} from 'framework7-react'; import {Device} from '../../../../../common/mobile/utils/device'; +import { observer, inject } from "mobx-react"; import SpreadsheetSettingsController from '../../controller/settings/SpreadsheetSettings.jsx'; import ApplicationSettingsController from '../../controller/settings/ApplicationSettings.jsx'; import SpreadsheetInfoController from '../../controller/settings/SpreadsheetInfo.jsx'; @@ -64,8 +65,8 @@ const routes = [ ]; -const SettingsList = withTranslation()(props => { - const {t} = props; +const SettingsList = inject("storeAppOptions")(observer(props => { + const { t } = useTranslation(); const _t = t('View.Settings', {returnObjects: true}); const navbar = {!props.inPopover && {_t.textDone}} @@ -115,14 +116,20 @@ const SettingsList = withTranslation()(props => { window.open(url, "_blank"); }; + const appOptions = props.storeAppOptions; + let _isEdit = false; + if (!appOptions.isDisconnected) { + _isEdit = appOptions.isEdit; + } + return ( {navbar} {!props.inPopover && - + } @@ -156,7 +163,7 @@ const SettingsList = withTranslation()(props => { ) -}); +})); class SettingsView extends Component { constructor(props) {