Skip to content

TagSpaces is an offline, open source, document manager with tagging support

feature: added show folder properties button in grid toolbar

Ilian Sapundshieve829512c9e9e
diff --git a/app/perspectives/grid-perspective/components/MainContainer.tsx b/app/perspectives/grid-perspective/components/MainContainer.tsx
index 914122647..dd5bfeb99 100644
--- a/app/perspectives/grid-perspective/components/MainContainer.tsx
+++ b/app/perspectives/grid-perspective/components/MainContainer.tsx
@@ -352,7 +352,13 @@ const GridPerspective = (props: Props) => {
selectedEntryPath.current = undefined;
};
- const { classes, selectedEntries, loadParentDirectoryContent, theme } = props;
+ const {
+ classes,
+ selectedEntries,
+ loadParentDirectoryContent,
+ theme,
+ currentDirectoryPath
+ } = props;
const someFileSelected = selectedEntries.length > 1;
@@ -679,7 +685,7 @@ const GridPerspective = (props: Props) => {
if (props.lastSelectedEntry) {
return props.lastSelectedEntry.path;
}
- return props.currentDirectoryPath;
+ return currentDirectoryPath;
};
const keyBindingHandlers = {
@@ -748,9 +754,11 @@ const GridPerspective = (props: Props) => {
fileOperationsEnabled={fileOperationsEnabled()}
openMoveCopyFilesDialog={openMoveCopyFilesDialog}
openDeleteFileDialog={openDeleteFileDialog}
+ openFsEntry={props.openFsEntry}
handleSortingMenu={handleSortingMenu}
handleExportCsvMenu={handleExportCsvMenu}
openSettings={openSettings}
+ directoryPath={currentDirectoryPath}
/>
<GlobalHotKeys
keyMap={keyMap}
diff --git a/app/perspectives/grid-perspective/components/MainToolbar.tsx b/app/perspectives/grid-perspective/components/MainToolbar.tsx
index 62a6b410d..467758598 100644
--- a/app/perspectives/grid-perspective/components/MainToolbar.tsx
+++ b/app/perspectives/grid-perspective/components/MainToolbar.tsx
@@ -30,6 +30,7 @@ import SelectAllIcon from '@material-ui/icons/CheckBox';
import DeSelectAllIcon from '@material-ui/icons/CheckBoxOutlineBlank';
import CopyIcon from '@material-ui/icons/FileCopy';
import DeleteIcon from '@material-ui/icons/Delete';
+import PropertiesIcon from '@material-ui/icons/Info';
import ExportIcon from '@material-ui/icons/AssignmentReturn';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
@@ -40,6 +41,7 @@ import {
actions as LocationIndexActions,
getSearchQuery
} from '-/reducers/location-index';
+import { getAllPropertiesPromise } from '-/services/utils-io';
import { TS } from '-/tagspaces.namespace';
import { actions as AppActions } from '-/reducers/app';
@@ -51,6 +53,7 @@ interface Props {
toggleSelectAllFiles: (event: any) => void;
someFileSelected: boolean;
handleLayoutSwitch: (event: Object) => void;
+ openFsEntry: (fsEntry?: TS.FileSystemEntry) => void;
openAddRemoveTagsDialog: () => void;
fileOperationsEnabled: boolean;
openMoveCopyFilesDialog: () => void;
@@ -62,6 +65,7 @@ interface Props {
searchQuery: TS.SearchQuery;
setSearchQuery: (searchQuery: TS.SearchQuery) => void;
openCurrentDirectory: () => void;
+ directoryPath: string;
}
const MainToolbar = (props: Props) => {
@@ -82,6 +86,22 @@ const MainToolbar = (props: Props) => {
openSettings
} = props;
+ function showProperties() {
+ getAllPropertiesPromise(props.directoryPath)
+ .then((fsEntry: TS.FileSystemEntry) => {
+ props.openFsEntry(fsEntry);
+ return true;
+ })
+ .catch(error =>
+ console.warn(
+ 'Error getting properties for entry: ' +
+ props.directoryPath +
+ ' - ' +
+ error
+ )
+ );
+ }
+
return (
<Toolbar className={classes.topToolbar} data-tid="perspectiveGridToolbar">
<Tooltip title={i18n.t('core:toggleSelectAllFiles')}>
@@ -111,6 +131,15 @@ const MainToolbar = (props: Props) => {
<ParentDirIcon />
</IconButton>
</Tooltip>
+ <Tooltip title={i18n.t('core:directoryPropertiesTitle')}>
+ <IconButton
+ aria-label={i18n.t('core:directoryPropertiesTitle')}
+ data-tid="openFolderProperties"
+ onClick={showProperties}
+ >
+ <PropertiesIcon />
+ </IconButton>
+ </Tooltip>
{layoutType === 'row' ? (
<Tooltip title={i18n.t('core:switchToGridView')}>
<IconButton