TagSpaces is an offline, open source, document manager with tagging support
TSN170 add thitdparty libs dialog
Mladen Sapundshiev12a935c85473
diff --git a/app/components/VerticalNavigation.js b/app/components/VerticalNavigation.jsindex c2755f2b1..37c2fbe1d 100644--- a/app/components/VerticalNavigation.js+++ b/app/components/VerticalNavigation.js@@ -28,6 +28,7 @@ import LogoIcon from '../assets/images/icon100x100.svg';import AboutDialog from './dialogs/AboutDialog';import KeyboardDialog from './dialogs/KeyboardDialog';import LicenseDialog from './dialogs/LicenseDialog';+import ThirdPartyLibsDialog from './dialogs/ThirdPartyLibsDialog';import SettingsDialog from './dialogs/SettingsDialog';import CreateDirectoryDialog from './dialogs/CreateDirectoryDialog';import CreateFileDialog from './dialogs/CreateFileDialog';@@ -44,6 +45,7 @@ import {isAboutDialogOpened,isKeysDialogOpened,isLicenseDialogOpened,+ isThirdPartyLibsDialogOpened,isSettingsDialogOpened,isCreateFileDialogOpened,isCreateDirectoryOpened,@@ -70,6 +72,8 @@ type Props = {toggleKeysDialog: () => void,isLicenseDialogOpened: boolean,toggleLicenseDialog: () => void,+ isThirdPartyLibsDialogOpened: boolean,+ toggleThirdPartyLibsDialog: () => void,isSettingsDialogOpened: boolean,toggleSettingsDialog: () => void,setManagementPanelVisibility: boolean => void,@@ -218,6 +222,7 @@ class VerticalNavigation extends React.Component<Props, State> {<AboutDialogopen={this.props.isAboutDialogOpened}toggleLicenseDialog={this.props.toggleLicenseDialog}+ toggleThirdPartyLibsDialog={this.props.toggleThirdPartyLibsDialog}onClose={this.props.toggleAboutDialog}/><KeyboardDialog@@ -228,6 +233,10 @@ class VerticalNavigation extends React.Component<Props, State> {open={this.props.isLicenseDialogOpened}onClose={this.props.toggleLicenseDialog}/>+ <ThirdPartyLibsDialog+ open={this.props.isThirdPartyLibsDialogOpened}+ onClose={this.props.toggleThirdPartyLibsDialog}+ /><SettingsDialogopen={this.props.isSettingsDialogOpened}onClose={this.props.toggleSettingsDialog}@@ -379,6 +388,7 @@ function mapStateToProps(state) {isAboutDialogOpened: isAboutDialogOpened(state),isKeysDialogOpened: isKeysDialogOpened(state),isLicenseDialogOpened: isLicenseDialogOpened(state),+ isThirdPartyLibsDialogOpened: isThirdPartyLibsDialogOpened(state),isSettingsDialogOpened: isSettingsDialogOpened(state),isCreateDirectoryOpened: isCreateDirectoryOpened(state),isCreateFileDialogOpened: isCreateFileDialogOpened(state),@@ -395,6 +405,7 @@ function mapActionCreatorsToProps(dispatch) {toggleSettingsDialog: AppActions.toggleSettingsDialog,toggleKeysDialog: AppActions.toggleKeysDialog,toggleLicenseDialog: AppActions.toggleLicenseDialog,+ toggleThirdPartyLibsDialog: AppActions.toggleThirdPartyLibsDialog,toggleAboutDialog: AppActions.toggleAboutDialog,}, dispatch);}diff --git a/app/components/dialogs/AboutDialog.js b/app/components/dialogs/AboutDialog.jsindex 37b8aa325..d33a87e81 100644--- a/app/components/dialogs/AboutDialog.js+++ b/app/components/dialogs/AboutDialog.js@@ -40,6 +40,7 @@ import AppConfig from '../../config';type Props = {open: boolean,toggleLicenseDialog: () => void,+ toggleThirdPartyLibsDialog: () => void,onClose: () => void};@@ -162,6 +163,12 @@ class AboutDialog extends React.Component<Props, State> {>{i18n.t('core:license')}</Button>+ <Button+ data-tid="openThirdPartyLibsDialog"+ onClick={this.props.toggleThirdPartyLibsDialog}+ >+ {i18n.t('core:thirdPartyLibs')}+ </Button><Buttondata-tid="closeAboutDialog"onClick={this.props.onClose}diff --git a/app/components/dialogs/ThirdPartyLibsDialog.js b/app/components/dialogs/ThirdPartyLibsDialog.jsnew file mode 100644index 000000000..6db753f10--- /dev/null+++ b/app/components/dialogs/ThirdPartyLibsDialog.js@@ -0,0 +1,95 @@+/**+ * TagSpaces - universal file and folder organizer+ * Copyright (C) 2017-present TagSpaces UG (haftungsbeschraenkt)+ *+ * This program is free software: you can redistribute it and/or modify+ * it under the terms of the GNU Affero General Public License (version 3) as+ * published by the Free Software Foundation.+ *+ * This program is distributed in the hope that it will be useful,+ * but WITHOUT ANY WARRANTY; without even the implied warranty of+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ * GNU Affero General Public License for more details.+ *+ * You should have received a copy of the GNU Affero General Public License+ * along with this program. If not, see <https://www.gnu.org/licenses/>.+ *+ * @flow+ */++import React from 'react';+import Button from 'material-ui/Button';+import {+ DialogActions,+ DialogContent,+ DialogTitle,+ withMobileDialog+} from 'material-ui/Dialog';+import GenericDialog from './GenericDialog';+import i18n from '../../services/i18n';+import { loadFileContentPromise } from '../../services/utils-io';+import { Pro } from '../../pro';++const thirdpartylibsUrl = Pro ? './node_modules/@tagspaces/pro/EULA.txt' : './third-party.txt';++type Props = {+ open: boolean,+ onClose: () => void+};++type State = {+ thirdpartylibs?: string+};++class ThirdPartyLibsDialog extends React.Component<Props, State> {+ state = {+ thirdpartylibs: ''+ };++ componentWillMount() {+ loadFileContentPromise(thirdpartylibsUrl, 'text').then(+ (result) => {+ this.setState({+ thirdpartylibs: result+ });+ return true;+ }+ ).catch((err) => {+ console.log('Error loading third party libs file ' + err);+ });+ }++ renderTitle = () => <DialogTitle>{i18n.t('core:thirdPartyLibs')}</DialogTitle>;++ renderContent = () => (+ <DialogContent style={{ overflowY: 'overlay', overflowX: 'auto' }}>+ <pre>{ this.state.thirdpartylibs }</pre>+ </DialogContent>+ );++ renderActions = () => (+ <DialogActions>+ <Button+ data-tid="confirmThirdPartyLibsDialog"+ onClick={this.props.onClose}+ color="primary"+ >+ {i18n.t('core:ok')}+ </Button>+ </DialogActions>+ );++ render() {+ return (+ <GenericDialog+ open={this.props.open}+ onClose={this.props.onClose}+ renderTitle={this.renderTitle}+ renderContent={this.renderContent}+ renderActions={this.renderActions}+ />+ );+ }+}++export default withMobileDialog()(ThirdPartyLibsDialog);diff --git a/app/containers/MainPage.js b/app/containers/MainPage.jsindex b62e5ded0..149a1cb5f 100644--- a/app/containers/MainPage.js+++ b/app/containers/MainPage.js@@ -137,6 +137,7 @@ type Props = {toggleSettingsDialog: () => void, // needed by electron-menustoggleKeysDialog: () => void, // needed by electron-menustoggleLicenseDialog: () => void, // needed by electron-menus+ toggleThirdPartyLibsDialog: () => void, // neede by electron-menustoggleAboutDialog: () => void, // needed by electron-menusopenFileNatively: () => void, // needed by electron-menusgetNextFile: () => void, // needed by electron-menus@@ -504,6 +505,7 @@ function mapDispatchToProps(dispatch) {toggleSettingsDialog: AppActions.toggleSettingsDialog,toggleKeysDialog: AppActions.toggleKeysDialog,toggleLicenseDialog: AppActions.toggleLicenseDialog,+ toggleThirdPartyLibsDialog: AppActions.toggleThirdPartyLibsDialog,toggleAboutDialog: AppActions.toggleAboutDialog,openFileNatively: AppActions.openFileNatively,setUpdateAvailable: AppActions.setUpdateAvailable,diff --git a/app/locales/en/core.json b/app/locales/en/core.jsonindex eed978ace..ee8ec90cd 100644--- a/app/locales/en/core.json+++ b/app/locales/en/core.json@@ -314,5 +314,6 @@"deleteSelectedEntries": "Delete selected entries","showHideDirectories": "Show / hide directories","sort": "Sort",+ "thirdPartyLibs": "THIRD PARTY SOFTWARE","-": "-"}diff --git a/app/reducers/app.js b/app/reducers/app.jsindex ea2414402..54b171c65 100644--- a/app/reducers/app.js+++ b/app/reducers/app.js@@ -74,6 +74,7 @@ export const types = {TOGGLE_ABOUT_DIALOG: 'APP/TOGGLE_ABOUT_DIALOG',TOGGLE_KEYBOARD_DIALOG: 'APP/TOGGLE_KEYBOARD_DIALOG',TOGGLE_LICENSE_DIALOG: 'APP/TOGGLE_LICENSE_DIALOG',+ TOGGLE_THIRD_PARTY_LIBS_DIALOG: 'APP/TOGGLE_THIRD_PARTY_LIBS_DIALOG',TOGGLE_SETTINGS_DIALOG: 'APP/TOGGLE_SETTINGS_DIALOG',TOGGLE_CREATE_DIRECTORY_DIALOG: 'APP/TOGGLE_CREATE_DIRECTORY_DIALOG',TOGGLE_CREATE_FILE_DIALOG: 'APP/TOGGLE_CREATE_FILE_DIALOG',@@ -130,6 +131,7 @@ export const initialState = {keysDialogOpened: false,createFileDialogOpened: false,licenseDialogOpened: false,+ thirdPartyLibsDialogOpened: false,settingsDialogOpened: false,createDirectoryDialogOpened: false,selectDirectoryDialogOpened: false,@@ -211,6 +213,9 @@ export default (state: Object = initialState, action: Object) => {case types.TOGGLE_LICENSE_DIALOG: {return { ...state, licenseDialogOpened: !state.licenseDialogOpened };}+ case types.TOGGLE_THIRD_PARTY_LIBS_DIALOG: {+ return { ...state, thirdPartyLibsDialogOpened: !state.thirdPartyLibsDialogOpened };+ }case types.TOGGLE_SETTINGS_DIALOG: {return { ...state, settingsDialogOpened: !state.settingsDialogOpened };}@@ -582,6 +587,7 @@ export const actions = {toggleAboutDialog: () => ({ type: types.TOGGLE_ABOUT_DIALOG }),toggleKeysDialog: () => ({ type: types.TOGGLE_KEYBOARD_DIALOG }),toggleLicenseDialog: () => ({ type: types.TOGGLE_LICENSE_DIALOG }),+ toggleThirdPartyLibsDialog: () => ({ type: types.TOGGLE_THIRD_PARTY_LIBS_DIALOG }),toggleSettingsDialog: () => ({ type: types.TOGGLE_SETTINGS_DIALOG }),toggleCreateDirectoryDialog: () => ({ type: types.TOGGLE_CREATE_DIRECTORY_DIALOG }),toggleCreateFileDialog: () => ({ type: types.TOGGLE_CREATE_FILE_DIALOG }),@@ -1285,6 +1291,7 @@ export const isFileDragged = (state: Object) => state.app.isFileDragged;export const isAboutDialogOpened = (state: Object) => state.app.aboutDialogOpened;export const isKeysDialogOpened = (state: Object) => state.app.keysDialogOpened;export const isLicenseDialogOpened = (state: Object) => state.app.licenseDialogOpened;+export const isThirdPartyLibsDialogOpened = (state: Object) => state.app.thirdPartyLibsDialogOpened;export const isSettingsDialogOpened = (state: Object) => state.app.settingsDialogOpened;export const isCreateDirectoryOpened = (state: Object) => state.app.createDirectoryDialogOpened;export const isCreateFileDialogOpened = (state: Object) => state.app.createFileDialogOpened;diff --git a/app/services/electron-menus.js b/app/services/electron-menus.jsindex 2336f35a6..7ac49fd8c 100644--- a/app/services/electron-menus.js+++ b/app/services/electron-menus.js@@ -325,6 +325,12 @@ export default function buildDesktopMenu(mainPageProps: Object) {mainPageProps.toggleLicenseDialog();}},+ {+ label: '&' + i18n.t('core:thirdPartyLibs'),+ click: () => {+ mainPageProps.toggleThirdPartyLibsDialog();+ }+ },{label: '&' + i18n.t('core:aboutTagSpaces'),click: () => {