diff --git a/apps/presentationeditor/mobile/locale/en.json b/apps/presentationeditor/mobile/locale/en.json index 4352f6615..4988d8b44 100644 --- a/apps/presentationeditor/mobile/locale/en.json +++ b/apps/presentationeditor/mobile/locale/en.json @@ -35,7 +35,20 @@ "textPrint": "Print", "textPresentationInfo": "Presentation Info", "textHelp": "Help", - "textAbout": "About" + "textAbout": "About", + "textBack": "Back", + "textUnitOfMeasurement": "Unit Of Measurement", + "textCentimeter": "Centimeter", + "textPoint": "Point", + "textInch": "Inch", + "textSpellcheck": "Spell Checking", + "textMacrosSettings": "Macros Settings", + "textDisableAll": "Disable All", + "textDisableAllMacrosWithoutNotification": "Disable all macros without notification", + "textShowNotification": "Show Notification", + "textDisableAllMacrosWithNotification": "Disable all macros with notification", + "textEnableAll": "Enable All", + "textEnableAllMacrosWithoutNotification": "Enable all macros without notification" } } } \ No newline at end of file diff --git a/apps/presentationeditor/mobile/src/controller/settings/ApplicationSettings.jsx b/apps/presentationeditor/mobile/src/controller/settings/ApplicationSettings.jsx new file mode 100644 index 000000000..c976d1f66 --- /dev/null +++ b/apps/presentationeditor/mobile/src/controller/settings/ApplicationSettings.jsx @@ -0,0 +1,43 @@ +import React, { Component } from "react"; +import { ApplicationSettings } from "../../view/settings/ApplicationSettings"; + +class ApplicationSettingsController extends Component { + constructor(props) { + super(props); + } + + setUnitMeasurement(value) { + const api = Common.EditorApi.get(); + value = (value!==null) ? parseInt(value) : Common.Utils.Metric.getDefaultMetric(); + Common.Utils.Metric.setCurrentMetric(value); + // Common.localStorage.setItem("pe-mobile-settings-unit", value); + api.asc_SetDocumentUnits((value==Common.Utils.Metric.c_MetricUnits.inch) ? Asc.c_oAscDocumentUnits.Inch : ((value==Common.Utils.Metric.c_MetricUnits.pt) ? Asc.c_oAscDocumentUnits.Point : Asc.c_oAscDocumentUnits.Millimeter)); + } + + switchSpellCheck(value) { + const api = Common.EditorApi.get(); + // let state = value === '1' ? true : false; + // Common.localStorage.setItem("pe-mobile-spellcheck", state ? 1 : 0); + // Common.Utils.InternalSettings.set("pe-mobile-spellcheck", state); + api.asc_setSpellCheck(value); + } + + setMacrosSettings(value) { + Common.Utils.InternalSettings.set("pe-mobile-macros-mode", value); + // Common.localStorage.setItem("pe-mobile-macros-mode", value); + } + + + render() { + return ( + + ) + } +} + + +export default ApplicationSettingsController; \ No newline at end of file diff --git a/apps/presentationeditor/mobile/src/store/applicationSettings.js b/apps/presentationeditor/mobile/src/store/applicationSettings.js new file mode 100644 index 000000000..b69eed851 --- /dev/null +++ b/apps/presentationeditor/mobile/src/store/applicationSettings.js @@ -0,0 +1,20 @@ +import {action, observable} from 'mobx'; + +export class storeApplicationSettings { + + @observable unitMeasurement = 0; + @observable isSpellChecking = true; + @observable macrosMode = 0; + + @action changeUnitMeasurement(value) { + this.unitMeasurement = +value; + } + + @action changeSpellCheck(value) { + this.isSpellChecking = value; + } + + @action changeMacrosSettings(value) { + this.macrosMode = +value; + } +} \ No newline at end of file diff --git a/apps/presentationeditor/mobile/src/store/mainStore.js b/apps/presentationeditor/mobile/src/store/mainStore.js index 05abdf386..3a22172b7 100644 --- a/apps/presentationeditor/mobile/src/store/mainStore.js +++ b/apps/presentationeditor/mobile/src/store/mainStore.js @@ -2,6 +2,7 @@ // import {storeDocumentSettings} from './documentSettings'; // import {storeFocusObjects} from "./focusObjects"; import {storeUsers} from '../../../../common/mobile/lib/store/users'; +import {storeApplicationSettings} from './applicationSettings'; // import {storeTextSettings} from "./textSettings"; // import {storeParagraphSettings} from "./paragraphSettings"; // import {storeShapeSettings} from "./shapeSettings"; @@ -13,6 +14,7 @@ export const stores = { // storeFocusObjects: new storeFocusObjects(), // storeDocumentSettings: new storeDocumentSettings(), users: new storeUsers(), + storeApplicationSettings: new storeApplicationSettings() // storeTextSettings: new storeTextSettings(), // storeParagraphSettings: new storeParagraphSettings(), // storeShapeSettings: new storeShapeSettings(), diff --git a/apps/presentationeditor/mobile/src/view/settings/ApplicationSettings.jsx b/apps/presentationeditor/mobile/src/view/settings/ApplicationSettings.jsx new file mode 100644 index 000000000..9fbb4f59f --- /dev/null +++ b/apps/presentationeditor/mobile/src/view/settings/ApplicationSettings.jsx @@ -0,0 +1,90 @@ +import React, {Fragment} from "react"; +import { observer, inject } from "mobx-react"; +import { Page, Navbar, List, ListItem, BlockTitle, Toggle } from "framework7-react"; +import { useTranslation } from "react-i18next"; + +const PageApplicationSettings = props => { + const { t } = useTranslation(); + const _t = t("View.Settings", { returnObjects: true }); + const store = props.storeApplicationSettings; + const unitMeasurement = store.unitMeasurement; + const isSpellChecking = store.isSpellChecking; + + const changeMeasureSettings = value => { + store.changeUnitMeasurement(value); + props.setUnitMeasurement(value); + }; + + // set mode + // const appOptions = props.storeAppOptions; + // const _isEdit = appOptions.isEdit; + // const _isShowMacros = (!appOptions.isDisconnected && appOptions.customization) ? appOptions.customization.macros !== false : true; + + return ( + + + {/* {_isEdit && */} + + {_t.textUnitOfMeasurement} + + changeMeasureSettings(0)}> + changeMeasureSettings(1)}> + changeMeasureSettings(2)}> + + + + {_t.textSpellcheck} + { + store.changeSpellCheck(!isSpellChecking); + props.switchSpellCheck(!isSpellChecking); + }} + /> + + + + {/* } */} + {/* {_isShowMacros && */} + + + + {/* } */} + + ); +}; + +const PageMacrosSettings = props => { + const { t } = useTranslation(); + const _t = t("View.Settings", { returnObjects: true }); + const store = props.storeApplicationSettings; + const macrosMode = store.macrosMode; + + const changeMacros = value => { + store.changeMacrosSettings(value); + props.setMacrosSettings(value); + }; + + return ( + + + + changeMacros(2)}> + changeMacros(0)}> + changeMacros(1)}> + + + ); +}; + +const ApplicationSettings = inject("storeApplicationSettings")(observer(PageApplicationSettings)); +const MacrosSettings = inject("storeApplicationSettings")(observer(PageMacrosSettings)); + +export {ApplicationSettings, MacrosSettings}; \ No newline at end of file diff --git a/apps/presentationeditor/mobile/src/view/settings/Settings.jsx b/apps/presentationeditor/mobile/src/view/settings/Settings.jsx index 47dcc250c..fb1e66dbf 100644 --- a/apps/presentationeditor/mobile/src/view/settings/Settings.jsx +++ b/apps/presentationeditor/mobile/src/view/settings/Settings.jsx @@ -3,12 +3,22 @@ import {View,Page,Navbar,NavRight,Link,Popup,Popover,Icon,ListItem,List} from 'f import { withTranslation } from 'react-i18next'; import {f7} from 'framework7-react'; import {Device} from '../../../../../common/mobile/utils/device'; +import ApplicationSettingsController from "../../controller/settings/ApplicationSettings"; +import { MacrosSettings } from "./ApplicationSettings"; const routes = [ { path: '/', component: 'TSettingsView' }, + { + path: '/application-settings/', + component: ApplicationSettingsController + }, + { + path: '/macros-settings/', + component: MacrosSettings + } /*{ path: '/presentation-settings/', component: PresentationSettingsController, @@ -45,7 +55,7 @@ const SettingsList = withTranslation()(props => { - +