TagSpaces is an offline, open source, document manager with tagging support
Enable move directories (#1896)
Stanimir824b5c8d970e
diff --git a/app/components/CommonIcons.tsx b/app/components/CommonIcons.tsxindex d2bb2d32e..07f1d67a9 100644--- a/app/components/CommonIcons.tsx+++ b/app/components/CommonIcons.tsx@@ -19,6 +19,7 @@import React from 'react';import ParentFolder from '@mui/icons-material/ReplyOutlined';import Help from '@mui/icons-material/Help';+import InfoOutlined from '@mui/icons-material/InfoOutlined';import Info from '@mui/icons-material/Info';import AnnouncementIcon from '@mui/icons-material/AnnouncementOutlined';import Remove from '@mui/icons-material/RemoveCircleOutline';@@ -32,6 +33,7 @@ import Menu from '@mui/icons-material/Menu';import ArrowBack from '@mui/icons-material/ArrowBack';import ArrowForward from '@mui/icons-material/ArrowForward';import Folder from '@mui/icons-material/Folder';+import File from '@mui/icons-material/InsertDriveFile';import KeyboardReturnIcon from '@mui/icons-material/KeyboardReturn';import SubdirectoryArrowLeftIcon from '@mui/icons-material/SubdirectoryArrowLeft';import Cancel from '@mui/icons-material/DoDisturbOn';@@ -45,6 +47,8 @@ export const NavigateToFolderIcon = props => <KeyboardReturnIcon />;export const FolderIcon = props => <Folder {...props} />;+export const FileIcon = props => <File {...props} />;+export const MainMenuIcon = props => <Menu {...props} />;export const GoBackIcon = props => <ArrowBack {...props} />;@@ -55,6 +59,8 @@ export const HelpIcon = props => <Help {...props} />;export const InfoIcon = props => <AnnouncementIcon {...props} />;+export const InfoTooltipIcon = props => <InfoOutlined {...props} />;+export const FolderPropertiesIcon = props => <Info {...props} />;export const RemoveIcon = props => <Remove {...props} />;diff --git a/app/components/DirectoryListView.tsx b/app/components/DirectoryListView.tsxnew file mode 100644index 000000000..192427db1--- /dev/null+++ b/app/components/DirectoryListView.tsx@@ -0,0 +1,154 @@+import React, { useRef, useState, useEffect } from 'react';+import { connect } from 'react-redux';+import Select from '@mui/material/Select';+import MenuItem from '@mui/material/MenuItem';+import List from '@mui/material/List';+import ListItemText from '@mui/material/ListItemText';+import ListItem from '@mui/material/ListItem';+import ListItemIcon from '@mui/material/ListItemIcon';+import FolderIcon from '@mui/icons-material/FolderOpen';+import { locationType } from '@tagspaces/tagspaces-common/misc';+import { extractContainingDirectoryPath } from '@tagspaces/tagspaces-common/paths';+import AppConfig from '-/AppConfig';+import i18n from '-/services/i18n';+import { TS } from '-/tagspaces.namespace';+import { getCurrentLocationId } from '-/reducers/app';+import { ParentFolderIcon } from '-/components/CommonIcons';+import { getLocations } from '-/reducers/locations';+import PlatformIO from '-/services/platform-facade';++interface Props {+ setTargetDir: (dirPath: string) => void;+ locations: Array<TS.Location>;+ currentLocationId: string;+}+function DirectoryListView(props: Props) {+ const { locations, currentLocationId } = props;+ const chosenLocationId = useRef<string>(currentLocationId);+ const chosenDirectory = useRef<string>();+ const [directoryContent, setDirectoryContent] = useState<+ TS.FileSystemEntry[]+ >([]);++ useEffect(() => {+ const chosenLocation = locations.find(+ location => location.uuid === chosenLocationId.current+ );+ if (chosenLocation) {+ listDirectory(chosenLocation.path);+ }+ }, [chosenLocationId.current]);++ const handleLocationChange = (event: React.ChangeEvent<HTMLInputElement>) => {+ chosenLocationId.current = event.target.value;+ const chosenLocation = locations.find(+ location => location.uuid === chosenLocationId.current+ );+ if (chosenLocation) {+ props.setTargetDir(chosenLocation.path);+ listDirectory(chosenLocation.path);+ }+ };++ function getLocations() {+ return (+ <Select+ onChange={handleLocationChange}+ fullWidth+ value={chosenLocationId.current}+ >+ {locations+ .filter(loc => loc.type === locationType.TYPE_LOCAL)+ .map((location: TS.Location) => (+ <MenuItem key={location.uuid} value={location.uuid}>+ <span style={{ width: '100%' }}>{location.name}</span>+ </MenuItem>+ ))}+ </Select>+ );+ }++ function listDirectory(directoryPath) {+ chosenDirectory.current = directoryPath;+ PlatformIO.listDirectoryPromise(+ directoryPath,+ [], // mode,+ []+ )+ .then(results => {+ if (results !== undefined) {+ setDirectoryContent(results.filter(entry => !entry.isFile));+ }+ return true;+ })+ .catch(error => {+ console.error('listDirectoryPromise', error);+ });+ }++ function getFolderContent() {+ if (directoryContent && directoryContent.length > 0) {+ return directoryContent.map(entry => (+ <ListItem+ title={'Navigate to: ' + entry.path}+ style={{ maxWidth: 250 }}+ onClick={() => {+ props.setTargetDir(entry.path);+ }}+ onDoubleClick={() => {+ listDirectory(entry.path);+ }}+ >+ <ListItemIcon style={{ minWidth: 35 }}>+ <FolderIcon />+ </ListItemIcon>+ <ListItemText primary={entry.name} />+ </ListItem>+ ));+ }+ return (+ <div style={{ padding: 10 }}>{i18n.t('core:noSubFoldersFound')}</div>+ );+ }++ return (+ <div style={{ marginTop: 10 }}>+ {getLocations()}+ <List+ dense+ style={{+ borderRadius: 5,+ maxHeight: 400,+ // @ts-ignore+ overflowY: AppConfig.isFirefox ? 'auto' : 'overlay'+ }}+ >+ <ListItem+ title={i18n.t('core:navigateToParentDirectory')}+ style={{ maxWidth: 250 }}+ button+ onClick={() => {+ listDirectory(+ extractContainingDirectoryPath(chosenDirectory.current)+ );+ }}+ >+ <ListItemIcon style={{ minWidth: 35 }}>+ <ParentFolderIcon />+ </ListItemIcon>+ <ListItemText primary={i18n.t('core:navigateToParentDirectory')} />+ </ListItem>+ {getFolderContent()}+ </List>+ </div>+ );+}++function mapStateToProps(state) {+ return {+ locations: getLocations(state),+ currentLocationId: getCurrentLocationId(state)+ };+}++export default connect(mapStateToProps)(DirectoryListView);diff --git a/app/components/EntryProperties.tsx b/app/components/EntryProperties.tsxindex 6f139cdb0..5debe7c8c 100644--- a/app/components/EntryProperties.tsx+++ b/app/components/EntryProperties.tsx@@ -55,7 +55,7 @@ import {withLeaflet} from 'react-leaflet';import { ButtonGroup, IconButton } from '@mui/material';-import { formatFileSize } from '@tagspaces/tagspaces-common/misc';+import { formatBytes } from '@tagspaces/tagspaces-common/misc';import {extractContainingDirectoryPath,getThumbFileLocationForFile,@@ -233,9 +233,8 @@ function EntryProperties(props: Props) {PlatformIO.getDirSeparator());- const currentEntry = enhanceOpenedEntry(- props.openedEntry,- props.tagDelimiter+ const currentEntry = useRef<OpenedEntry>(+ enhanceOpenedEntry(props.openedEntry, props.tagDelimiter));const [editName, setEditName] = useState<string>(undefined);const editDescription = useRef<string>(undefined);@@ -262,6 +261,17 @@ function EntryProperties(props: Props) {const [ignored, forceUpdate] = useReducer(x => x + 1, 0);const firstRender = useFirstRender();+ useEffect(() => {+ if (!currentEntry.current.isFile) {+ PlatformIO.getDirProperties(currentEntry.current.path).then(+ (dirProps: TS.DirProp) => {+ currentEntry.current.size = dirProps.totalSize;+ forceUpdate();+ }+ );+ }+ }, []);+useEffect(() => {if (editName === entryName && fileNameRef.current) {fileNameRef.current.focus();@@ -283,10 +293,10 @@ function EntryProperties(props: Props) {}, [props.lastThumbnailImageChange]);/*useEffect(() => {- if (props.openedEntry != undefined && currentEntry.description) {+ if (props.openedEntry != undefined && currentEntry.current.description) {const { current } = fileDescriptionRef;if (!current) return;- current.update(currentEntry.description);+ current.update(currentEntry.current.description);}}, [props.openedEntry]);*/@@ -295,7 +305,7 @@ function EntryProperties(props: Props) {const { renameFile, renameDirectory } = props;const path = extractContainingDirectoryPath(- currentEntry.path,+ currentEntry.current.path,PlatformIO.getDirSeparator());const nextPath = path + PlatformIO.getDirSeparator() + editName;@@ -303,8 +313,8 @@ function EntryProperties(props: Props) {props.switchLocationType(props.openedEntry.locationId).then(currentLocationId => {- if (currentEntry.isFile) {- renameFile(currentEntry.path, nextPath)+ if (currentEntry.current.isFile) {+ renameFile(currentEntry.current.path, nextPath).then(() => {props.switchCurrentLocationType(currentLocationId);return true;@@ -314,7 +324,7 @@ function EntryProperties(props: Props) {fileNameRef.current.value = entryName;});} else {- renameDirectory(currentEntry.path, editName)+ renameDirectory(currentEntry.current.path, editName).then(() => {props.switchCurrentLocationType(currentLocationId);return true;@@ -363,12 +373,12 @@ function EntryProperties(props: Props) {props.switchLocationType(props.openedEntry.locationId).then(currentLocationId => {- Pro.MetaOperations.saveFsEntryMeta(currentEntry.path, {+ Pro.MetaOperations.saveFsEntryMeta(currentEntry.current.path, {description: editDescription.current}).then(entryMeta => {editDescription.current = undefined;- props.updateOpenedFile(currentEntry.path, entryMeta);+ props.updateOpenedFile(currentEntry.current.path, entryMeta);props.switchCurrentLocationType(currentLocationId);return true;})@@ -379,8 +389,8 @@ function EntryProperties(props: Props) {props.showNotification(i18n.t('Error saving description'));});});- } else if (currentEntry.description) {- editDescription.current = currentEntry.description;+ } else if (currentEntry.current.description) {+ editDescription.current = currentEntry.current.description;} else {editDescription.current = '';}@@ -396,7 +406,7 @@ function EntryProperties(props: Props) {return true;}if (- !currentEntry.editMode &&+ !currentEntry.current.editMode &&editName === undefined &&editDescription.current === undefined) {@@ -410,7 +420,7 @@ function EntryProperties(props: Props) {return true;}if (- !currentEntry.editMode &&+ !currentEntry.current.editMode &&editName === undefined &&editDescription.current === undefined) {@@ -428,7 +438,7 @@ function EntryProperties(props: Props) {PlatformIO.haveWebDavSupport()) {props.updateThumbnailUrl(- currentEntry.path,+ currentEntry.current.path,PlatformIO.getURLforPath(thumbFilePath));return true;@@ -436,7 +446,7 @@ function EntryProperties(props: Props) {/*return replaceThumbnailURLPromise(filePath, thumbFilePath).then(objUrl => {*/props.updateThumbnailUrl(- currentEntry.path,+ currentEntry.current.path,thumbFilePath// objUrl.tmbPath/*(props.lastThumbnailImageChange@@ -453,9 +463,9 @@ function EntryProperties(props: Props) {});} else {// reset Thumbnail- return getThumbnailURLPromise(currentEntry.path)+ return getThumbnailURLPromise(currentEntry.current.path).then(objUrl => {- props.updateThumbnailUrl(currentEntry.path, objUrl.tmbPath);+ props.updateThumbnailUrl(currentEntry.current.path, objUrl.tmbPath);return true;}).catch(err => {@@ -488,15 +498,15 @@ function EntryProperties(props: Props) {props.switchLocationType(props.openedEntry.locationId).then(currentLocationId => {- Pro.MetaOperations.saveFsEntryMeta(currentEntry.path, { color })+ Pro.MetaOperations.saveFsEntryMeta(currentEntry.current.path, { color }).then(entryMeta => {// if (props.entryPath === props.currentDirectoryPath) {props.setLastBackgroundColorChange(- currentEntry.path,+ currentEntry.current.path,new Date().getTime());// todo handle LastBackgroundColorChange and skip updateOpenedFile- props.updateOpenedFile(currentEntry.path, entryMeta);+ props.updateOpenedFile(currentEntry.current.path, entryMeta);props.switchCurrentLocationType(currentLocationId);/* } else {@@ -519,7 +529,7 @@ function EntryProperties(props: Props) {if (name === 'name') {const initValid = disableConfirmButton.current;let noValid;- if (currentEntry.isFile) {+ if (currentEntry.current.isFile) {noValid = fileNameValidation(value);} else {noValid = dirNameValidation(value);@@ -548,30 +558,32 @@ function EntryProperties(props: Props) {if (action === 'remove-value') {if (!value) {// no tags left in the select element- props.removeAllTags([currentEntry.path]).then(() => {+ props.removeAllTags([currentEntry.current.path]).then(() => {props- .updateOpenedFile(currentEntry.path, { tags: [] })+ .updateOpenedFile(currentEntry.current.path, { tags: [] }).then(() => {props.switchCurrentLocationType(currentLocationId);});});} else {- props.removeTags([currentEntry.path], value).then(() => {+ props.removeTags([currentEntry.current.path], value).then(() => {props.switchCurrentLocationType(currentLocationId);});}} else if (action === 'clear') {- props.removeAllTags([currentEntry.path]).then(() => {+ props.removeAllTags([currentEntry.current.path]).then(() => {props.switchCurrentLocationType(currentLocationId);});} else {// create-option or select-optionconst promises = value.map(tag => {if (- currentEntry.tags === undefined ||- currentEntry.tags.findIndex(obj => obj.title === tag.title) === -1+ currentEntry.current.tags === undefined ||+ currentEntry.current.tags.findIndex(+ obj => obj.title === tag.title+ ) === -1) {- return props.addTags([currentEntry.path], [tag]);+ return props.addTags([currentEntry.current.path], [tag]);}return Promise.resolve(false);});@@ -584,14 +596,18 @@ function EntryProperties(props: Props) {const { classes, isReadOnlyMode, theme, sharingLink } = props;- if (!currentEntry || !currentEntry.path || currentEntry.path === '') {+ if (+ !currentEntry ||+ !currentEntry.current.path ||+ currentEntry.current.path === ''+ ) {return <div />;}function getBgndUrl() {- if (!currentEntry.isFile) {+ if (!currentEntry.current.isFile) {const bgndPath = getBgndFileLocationForDirectory(- currentEntry.path,+ currentEntry.current.path,PlatformIO.getDirSeparator());if (bgndPath !== undefined) {@@ -615,15 +631,15 @@ function EntryProperties(props: Props) {}function getThumbPath() {- if (currentEntry.isFile) {+ if (currentEntry.current.isFile) {return getThumbFileLocationForFile(- currentEntry.path,+ currentEntry.current.path,PlatformIO.getDirSeparator(),false);}return getThumbFileLocationForDirectory(- currentEntry.path,+ currentEntry.current.path,PlatformIO.getDirSeparator());}@@ -650,8 +666,8 @@ function EntryProperties(props: Props) {return undefined;}- const ldtm = currentEntry.lmdt- ? new Date(currentEntry.lmdt)+ const ldtm = currentEntry.current.lmdt+ ? new Date(currentEntry.current.lmdt).toISOString().substring(0, 19).split('T')@@ -660,9 +676,9 @@ function EntryProperties(props: Props) {const changePerspective = (event: any) => {const perspective = event.target.value;- savePerspective(currentEntry.path, perspective)+ savePerspective(currentEntry.current.path, perspective).then((entryMeta: TS.FileSystemEntryMeta) => {- props.updateOpenedFile(currentEntry.path, entryMeta);+ props.updateOpenedFile(currentEntry.current.path, entryMeta);return true;}).catch(error => {@@ -672,8 +688,8 @@ function EntryProperties(props: Props) {};let perspectiveDefault;- if (currentEntry.perspective) {- perspectiveDefault = currentEntry.perspective; // props.perspective;+ if (currentEntry.current.perspective) {+ perspectiveDefault = currentEntry.current.perspective; // props.perspective;} else {perspectiveDefault = 'unspecified'; // perspectives.DEFAULT;}@@ -703,15 +719,16 @@ function EntryProperties(props: Props) {}}- const geoLocation: any = getGeoLocation(currentEntry.tags);+ const geoLocation: any = getGeoLocation(currentEntry.current.tags);- const isCloudLocation = currentEntry.url && currentEntry.url.length > 5;+ const isCloudLocation =+ currentEntry.current.url && currentEntry.current.url.length > 5;- const sanitizedDescription = currentEntry.description- ? convertMarkDown(currentEntry.description, directoryPath)+ const sanitizedDescription = currentEntry.current.description+ ? convertMarkDown(currentEntry.current.description, directoryPath): i18n.t('core:addMarkdownDescription');- const showLinkForDownloading = isCloudLocation && currentEntry.isFile;+ const showLinkForDownloading = isCloudLocation && currentEntry.current.isFile;return (<div className={classes.entryProperties}>@@ -720,7 +737,7 @@ function EntryProperties(props: Props) {<TextFielderror={fileNameError.current}label={- currentEntry.isFile+ currentEntry.current.isFile? i18n.t('core:fileName'): i18n.t('core:folderName')}@@ -729,7 +746,7 @@ function EntryProperties(props: Props) {endAdornment: (<InputAdornment position="end">{!isReadOnlyMode &&- !currentEntry.editMode &&+ !currentEntry.current.editMode &&editDescription.current === undefined && (<div style={{ textAlign: 'right' }}>{editName !== undefined ? (@@ -767,11 +784,11 @@ function EntryProperties(props: Props) {name="name"fullWidth={true}data-tid="fileNameProperties"- defaultValue={entryName} // currentEntry.name}+ defaultValue={entryName} // currentEntry.current.name}inputRef={fileNameRef}onClick={() => {if (- !currentEntry.editMode &&+ !currentEntry.current.editMode &&editName === undefined &&editDescription.current === undefined) {@@ -789,27 +806,29 @@ function EntryProperties(props: Props) {<FormHelperText>{i18n.t('core:' +- (currentEntry.isFile ? 'fileNameHelp' : 'directoryNameHelp')+ (currentEntry.current.isFile+ ? 'fileNameHelp'+ : 'directoryNameHelp'))}</FormHelperText>)}</Grid><Grid item xs={12} style={{ marginTop: 10 }}>- <TagDropContainer entryPath={currentEntry.path}>+ <TagDropContainer entryPath={currentEntry.current.path}><TagsSelectlabel={i18n.t('core:fileTags')}dataTid="PropertiesTagsSelectTID"placeholderText={i18n.t('core:dropHere')}isReadOnlyMode={isReadOnlyMode ||- currentEntry.editMode ||+ currentEntry.current.editMode ||editDescription.current !== undefined ||editName !== undefined}- tags={currentEntry.tags}+ tags={currentEntry.current.tags}tagMode="default"handleChange={handleChange}- selectedEntryPath={currentEntry.path}+ selectedEntryPath={currentEntry.current.path}/></TagDropContainer></Grid>@@ -918,13 +937,13 @@ function EntryProperties(props: Props) {primaryColor={theme.palette.text.primary}toggleEditDescriptionField={!isReadOnlyMode &&- !currentEntry.editMode &&+ !currentEntry.current.editMode &&editName === undefined &&toggleEditDescriptionField}printHTML={printHTML}fileDescriptionRef={fileDescriptionRef}- description={currentEntry.description}+ description={currentEntry.current.description}setEditDescription={md => (editDescription.current = md)}isDarkTheme={theme.palette.mode === 'dark'}currentFolder={directoryPath}@@ -948,8 +967,8 @@ function EntryProperties(props: Props) {margin="dense"fullWidth={true}value={- currentEntry.isFile- ? formatFileSize(currentEntry.size)+ currentEntry.current.size+ ? formatBytes(currentEntry.current.size): i18n.t('core:notAvailable')}label={i18n.t('core:fileSize')}@@ -965,11 +984,11 @@ function EntryProperties(props: Props) {<TextFieldmargin="dense"name="path"- title={currentEntry.url || currentEntry.path}+ title={currentEntry.current.url || currentEntry.current.path}fullWidth={true}label={i18n.t('core:filePath')}data-tid="filePathProperties"- value={currentEntry.path || ''}+ value={currentEntry.current.path || ''}InputProps={{readOnly: true,startAdornment: (@@ -987,9 +1006,9 @@ function EntryProperties(props: Props) {),endAdornment: (<InputAdornment position="end">- {currentEntry.isFile &&+ {currentEntry.current.isFile &&!isReadOnlyMode &&- !currentEntry.editMode &&+ !currentEntry.current.editMode &&editName === undefined &&editDescription.current === undefined && (<Button@@ -1095,7 +1114,7 @@ function EntryProperties(props: Props) {)}</Grid>- {!currentEntry.isFile && (+ {!currentEntry.current.isFile && (<Grid item xs={12} style={{ marginTop: 10 }}><PerspectiveSelectoronChange={changePerspective}@@ -1106,7 +1125,7 @@ function EntryProperties(props: Props) {</Grid>)}- {!currentEntry.isFile && (+ {!currentEntry.current.isFile && (<Grid item xs={12} style={{ marginTop: 5 }}><TextFieldmargin="dense"@@ -1132,7 +1151,7 @@ function EntryProperties(props: Props) {fullWidthstyle={{width: 100,- background: currentEntry.color+ background: currentEntry.current.color}}onClick={toggleBackgroundColorPicker}>@@ -1159,7 +1178,7 @@ function EntryProperties(props: Props) {</IconButton></ProTooltip>))}- {currentEntry.color && (+ {currentEntry.current.color && (<><ProTooltip tooltip={i18n.t('clearFolderColor')}><span>@@ -1186,7 +1205,7 @@ function EntryProperties(props: Props) {</Grid>)}<Grid container item xs={12} spacing={1}>- <Grid item xs={currentEntry.isFile ? 12 : 6}>+ <Grid item xs={currentEntry.current.isFile ? 12 : 6}><ThumbnailTextFieldmargin="dense"label={i18n.t('core:thumbnail')}@@ -1201,7 +1220,7 @@ function EntryProperties(props: Props) {style={{ alignItems: 'center' }}>{!isReadOnlyMode &&- !currentEntry.editMode &&+ !currentEntry.current.editMode &&editName === undefined &&editDescription.current === undefined && (<ProTooltip tooltip={i18n.t('changeThumbnail')}>@@ -1244,7 +1263,7 @@ function EntryProperties(props: Props) {}}/></Grid>- {!currentEntry.isFile && (+ {!currentEntry.current.isFile && (<Grid item xs={6}><ThumbnailTextFieldmargin="dense"@@ -1260,7 +1279,7 @@ function EntryProperties(props: Props) {style={{ alignItems: 'center' }}>{!isReadOnlyMode &&- !currentEntry.editMode &&+ !currentEntry.current.editMode &&editName === undefined &&editDescription.current === undefined && (<ProTooltip@@ -1334,14 +1353,14 @@ function EntryProperties(props: Props) {key={getUuid()}open={isMoveCopyFilesDialogOpened}onClose={toggleMoveCopyFilesDialog}- selectedFiles={[currentEntry.path]}+ selectedFiles={[currentEntry.current.path]}/>)}{ThumbnailChooserDialog && (<ThumbnailChooserDialogopen={isFileThumbChooseDialogOpened}onClose={toggleThumbFilesDialog}- selectedFile={currentEntry.path}+ selectedFile={currentEntry.current.path}thumbPath={getThumbPath()}setThumb={setThumb}/>@@ -1350,9 +1369,9 @@ function EntryProperties(props: Props) {<LinkGeneratorDialogopen={showSharingLinkDialog}onClose={() => setShowSharingLinkDialog(false)}- path={currentEntry.path}+ path={currentEntry.current.path}showNotification={props.showNotification}- locationId={currentEntry.locationId}+ locationId={currentEntry.current.locationId}switchCurrentLocationType={props.switchCurrentLocationType}switchLocationType={props.switchLocationType}/>@@ -1361,16 +1380,16 @@ function EntryProperties(props: Props) {<BgndImgChooserDialogopen={isBgndImgChooseDialogOpened}onClose={toggleBgndImgDialog}- currentDirectoryPath={currentEntry.path}+ currentDirectoryPath={currentEntry.current.path}/>)}{CustomBackgroundDialog && (<CustomBackgroundDialog- color={currentEntry.color}+ color={currentEntry.current.color}open={displayColorPicker}setColor={handleChangeColor}onClose={toggleBackgroundColorPicker}- currentDirectoryPath={currentEntry.path}+ currentDirectoryPath={currentEntry.current.path}/*presetColors={['transparent','#FFFFFF44',diff --git a/app/components/FolderContainer.tsx b/app/components/FolderContainer.tsxindex 628881a62..4ea834e1c 100644--- a/app/components/FolderContainer.tsx+++ b/app/components/FolderContainer.tsx@@ -223,6 +223,7 @@ interface Props {goForward: () => void;searchResultsCount: number;isSearchMode: boolean;+ openMoveCopyFilesDialog: () => void;}function FolderContainer(props: Props) {@@ -663,6 +664,7 @@ function FolderContainer(props: Props) {openRenameDirectoryDialog={() =>setIsRenameEntryDialogOpened(true)}+ openMoveCopyFilesDialog={props.openMoveCopyFilesDialog}/></>)}diff --git a/app/components/InfoIcon.tsx b/app/components/InfoIcon.tsxindex 3f2e58b3f..b670e989e 100644--- a/app/components/InfoIcon.tsx+++ b/app/components/InfoIcon.tsx@@ -17,7 +17,7 @@*/import React from 'react';-import HelpIcon from '@mui/icons-material/InfoOutlined';+import { InfoTooltipIcon } from '-/components/CommonIcons';import Tooltip from '-/components/Tooltip';interface Props {@@ -28,7 +28,7 @@ function InfoIcon(props: Props) {const { tooltip } = props;return (<Tooltip title={tooltip}>- <HelpIcon />+ <InfoTooltipIcon /></Tooltip>);}diff --git a/app/components/PathBreadcrumbs.tsx b/app/components/PathBreadcrumbs.tsxindex d0066ad0f..3f0007f53 100644--- a/app/components/PathBreadcrumbs.tsx+++ b/app/components/PathBreadcrumbs.tsx@@ -68,6 +68,7 @@ interface Props {openFsEntry: (fsEntry: TS.FileSystemEntry) => void;isReadOnlyMode: boolean;openRenameDirectoryDialog: () => void;+ openMoveCopyFilesDialog: () => void;isDesktopMode: boolean;}@@ -90,6 +91,7 @@ function PathBreadcrumbs(props: Props) {openFsEntry,isReadOnlyMode,openRenameDirectoryDialog,+ openMoveCopyFilesDialog,isDesktopMode} = props;@@ -208,10 +210,10 @@ function PathBreadcrumbs(props: Props) {directoryPath={currentDirectoryPath}loadDirectoryContent={loadDirectoryContent}openRenameDirectoryDialog={openRenameDirectoryDialog}+ openMoveCopyFilesDialog={openMoveCopyFilesDialog}openDirectory={openDirectory}reflectCreateEntry={reflectCreateEntry}openFsEntry={openFsEntry}- switchPerspective={switchPerspective}/></>);diff --git a/app/components/SearchAutocomplete.tsx b/app/components/SearchAutocomplete.tsxindex 30b74f4f9..1817a896e 100644--- a/app/components/SearchAutocomplete.tsx+++ b/app/components/SearchAutocomplete.tsx@@ -1433,6 +1433,9 @@ function SearchAutocomplete(props: Props) {#searchAutocompleteComp .MuiAutocomplete-root .MuiInputBase-root {padding: 0 5px 0 5px !important;}+ .MuiAutocomplete-popper {+ min-width: 350px;+ }`}</style><Autocompletediff --git a/app/components/dialogs/FileUploadDialog.tsx b/app/components/dialogs/FileUploadDialog.tsxindex b5073eb0f..148d9ece2 100644--- a/app/components/dialogs/FileUploadDialog.tsx+++ b/app/components/dialogs/FileUploadDialog.tsx@@ -47,6 +47,7 @@ import { TS } from '-/tagspaces.namespace';interface Props {open: boolean;progress?: Array<any>;+ title: string;onClose: () => void;clearUploadDialog: () => void;currentDirectoryPerspective: string;@@ -61,6 +62,7 @@ interface Props {function FileUploadDialog(props: Props) {const { open = false, onClose } = props;+ const targetPath = React.useRef<string>(undefined);function LinearProgressWithLabel(prop) {return (@@ -121,7 +123,12 @@ function FileUploadDialog(props: Props) {);}}- return props.currentDirectoryPath ? props.currentDirectoryPath : '/';+ if (targetPath.current) {+ return targetPath.current;+ } else if (props.currentDirectoryPath) {+ return props.currentDirectoryPath;+ }+ return '/';}return (@@ -135,7 +142,12 @@ function FileUploadDialog(props: Props) {BackdropProps={{ style: { backgroundColor: 'transparent' } }}><DialogTitle data-tid="importDialogTitle">- {i18n.t('core:importDialogTitle')}+ {i18n.t(+ 'core:' ++ (props.title && props.title.length > 0+ ? props.title+ : 'importDialogTitle')+ )}<DialogCloseButton onClose={onClose} /></DialogTitle><DialogContent@@ -153,8 +165,9 @@ function FileUploadDialog(props: Props) {.map(fileProgress => {const percentage = fileProgress.progress;const { path } = fileProgress;+ targetPath.current = path.split('?')[0];const fileName = extractFileName(- path.split('?')[0],+ targetPath.current,PlatformIO.getDirSeparator());let { abort } = fileProgress;diff --git a/app/components/dialogs/MoveCopyFilesDialog.tsx b/app/components/dialogs/MoveCopyFilesDialog.tsxindex a14541b76..1e1be4ece 100644--- a/app/components/dialogs/MoveCopyFilesDialog.tsx+++ b/app/components/dialogs/MoveCopyFilesDialog.tsx@@ -16,9 +16,11 @@**/-import React, { useState, useEffect } from 'react';+import React, { useState, useRef, useReducer, useEffect } from 'react';import { bindActionCreators } from 'redux';import { connect } from 'react-redux';+import { Progress } from 'aws-sdk/clients/s3';+import { formatBytes } from '@tagspaces/tagspaces-common/misc';import Button from '@mui/material/Button';import List from '@mui/material/List';import ListItem from '@mui/material/ListItem';@@ -26,8 +28,6 @@ import ListItemIcon from '@mui/material/ListItemIcon';import ListSubheader from '@mui/material/ListSubheader';import TextField from '@mui/material/TextField';import InputAdornment from '@mui/material/InputAdornment';-import FolderIcon from '@mui/icons-material/Folder';-import FileIcon from '@mui/icons-material/InsertDriveFileOutlined';import DialogActions from '@mui/material/DialogActions';import DialogContent from '@mui/material/DialogContent';import DialogTitle from '@mui/material/DialogTitle';@@ -36,64 +36,144 @@ import FormHelperText from '@mui/material/FormHelperText';import Typography from '@mui/material/Typography';import Dialog from '@mui/material/Dialog';import IconButton from '@mui/material/IconButton';+import { FolderIcon, FileIcon } from '-/components/CommonIcons';import AppConfig from '-/AppConfig';-import { extractFileName } from '@tagspaces/tagspaces-common/paths';import i18n from '-/services/i18n';import PlatformIO from '-/services/platform-facade';import IOActions from '-/reducers/io-actions';import DialogCloseButton from '-/components/dialogs/DialogCloseButton';import useTheme from '@mui/styles/useTheme';import useMediaQuery from '@mui/material/useMediaQuery';+import { actions as AppActions, getSelectedEntries } from '-/reducers/app';+import { TS } from '-/tagspaces.namespace';+import DirectoryListView from '-/components/DirectoryListView';interface Props {open: boolean;onClose: (clearSelection?: boolean) => void;copyFiles: (files: Array<string>, destination: string) => void;+ copyDirs: (+ dirs: Array<string>,+ totalCount: number,+ destination: string,+ onUploadProgress?: (progress: Progress, abort: () => void) => void+ ) => void;moveFiles: (files: Array<string>, destination: string) => void;- selectedFiles: Array<string>;+ moveDirs: (+ dirs: Array<string>,+ totalCount: number,+ destination: string,+ onUploadProgress?: (progress: Progress, abort: () => void) => void+ ) => void;+ selectedEntries: Array<TS.FileSystemEntry>;+ selectedFiles?: Array<string>;+ onUploadProgress: (progress: Progress, abort: () => void) => void;+ toggleUploadDialog: (title?) => void;+ resetProgress: () => void;}function MoveCopyFilesDialog(props: Props) {- const [inputError, setInputError] = useState(false);+ //const [inputError, setInputError] = useState(false);const [disableConfirmButton, setDisableConfirmButton] = useState(true);const [targetPath, setTargetPath] = useState('');+ const dirProp = useRef({});++ const [ignored, forceUpdate] = useReducer(x => x + 1, 0);const { open, onClose } = props;+ let selectedFiles = props.selectedFiles ? props.selectedFiles : [];+ if (props.selectedEntries) {+ selectedFiles = selectedFiles.concat(+ props.selectedEntries+ .filter(fsEntry => fsEntry.isFile)+ .map(fsentry => fsentry.path)+ );+ }++ const selectedDirs = props.selectedEntries+ ? props.selectedEntries+ .filter(fsEntry => !fsEntry.isFile)+ .map(fsentry => fsentry.path)+ : [];++ useEffect(() => {+ if (selectedDirs.length > 0) {+ const promises = selectedDirs.map(dirPath => {+ return PlatformIO.getDirProperties(dirPath).then(prop => {+ dirProp.current[dirPath] = prop;+ return true;+ });+ });+ Promise.all(promises).then(() => forceUpdate());+ }+ }, []);+useEffect(() => {handleValidation();- });+ }, [targetPath]);function handleValidation() {if (targetPath && targetPath.length > 0) {- setInputError(false);+ //setInputError(false);setDisableConfirmButton(false);} else {- setInputError(true);+ //setInputError(true);setDisableConfirmButton(true);}}+ function getEntriesCount(): number {+ let total = 0;+ const arr = Object.values(dirProp.current);+ arr.forEach((n: TS.DirProp) => (total += n.filesCount + n.dirsCount));+ return total;+ }+function handleCopyFiles() {if (!disableConfirmButton) {- props.copyFiles(props.selectedFiles, targetPath);- setInputError(false);- setDisableConfirmButton(true);- setTargetPath('');+ if (selectedFiles.length > 0) {+ props.copyFiles(selectedFiles, targetPath);+ //setInputError(false);+ setDisableConfirmButton(true);+ setTargetPath('');+ }+ if (selectedDirs.length > 0) {+ props.resetProgress();+ props.toggleUploadDialog('copyEntriesTitle');+ props.copyDirs(+ selectedDirs,+ getEntriesCount(),+ targetPath,+ props.onUploadProgress+ );+ }}props.onClose(true);}function handleMoveFiles() {if (!disableConfirmButton) {- props.moveFiles(props.selectedFiles, targetPath);- setInputError(false);- setDisableConfirmButton(true);- setTargetPath('');+ if (selectedFiles.length > 0) {+ props.moveFiles(selectedFiles, targetPath);+ //setInputError(false);+ setDisableConfirmButton(true);+ setTargetPath('');+ }+ if (selectedDirs.length > 0) {+ props.resetProgress();+ props.toggleUploadDialog('moveEntriesTitle');+ props.moveDirs(+ selectedDirs,+ getEntriesCount(),+ targetPath,+ props.onUploadProgress+ );+ }}props.onClose(true);}- function selectDirectory() {+ /*function selectDirectory() {PlatformIO.selectDirectoryDialog().then(selectedPaths => {setTargetPath(selectedPaths[0]);@@ -102,7 +182,7 @@ function MoveCopyFilesDialog(props: Props) {.catch(err => {console.log('selectDirectoryDialog failed with: ' + err);});- }+ }*/function onCloseDialog() {onClose();@@ -119,70 +199,51 @@ function MoveCopyFilesDialog(props: Props) {fullScreen={fullScreen}><DialogTitle>- {i18n.t('core:copyMoveFilesTitle')}+ {i18n.t('core:copyMoveTitle')}<DialogCloseButton onClose={onCloseDialog} /></DialogTitle><DialogContent style={{ overflowX: 'hidden' }}><Listdense- style={{ width: 550, marginLeft: -15 }}+ style={{ width: 550, marginLeft: -15, marginBottom: 20 }}subheader={<ListSubheaderstyle={{ backgroundColor: 'transparent' }}component="div">- {i18n.t('selectedFiles')}+ {i18n.t('selectedFilesAndFolders')}</ListSubheader>}>- {props.selectedFiles &&- props.selectedFiles.length > 0 &&- props.selectedFiles.map(path => (- <ListItem title={path} key={path}>+ {props.selectedEntries &&+ props.selectedEntries.length > 0 &&+ props.selectedEntries.map(entry => (+ <ListItem title={entry.path} key={entry.path}><ListItemIcon>- <FileIcon />+ {entry.isFile ? <FileIcon /> : <FolderIcon />}</ListItemIcon><Typography variant="inherit" noWrap>- {extractFileName(path, PlatformIO.getDirSeparator())}+ {entry.name}+ {dirProp.current[entry.path] &&+ ' (' ++ i18n.t('fileSize') ++ ': ' ++ formatBytes(dirProp.current[entry.path]['totalSize']) ++ ')'}</Typography></ListItem>))}</List>- <FormControl fullWidth={true}>- <TextField- autoFocus- required- margin="dense"- name="targetPath"- placeholder={i18n.t('core:moveCopyToPath')}- fullWidth={true}- data-tid="targetPathInput"- onChange={event => {- const { target } = event;- setTargetPath(target.value);- }}- value={targetPath}- InputProps={{- endAdornment:- PlatformIO.haveObjectStoreSupport() ||- PlatformIO.haveWebDavSupport() ||- AppConfig.isWeb ? (- undefined- ) : (- <InputAdornment position="end" style={{ height: 33 }}>- <IconButton- data-tid="openDirectoryMoveCopyDialog"- onClick={selectDirectory}- size="large"- >- <FolderIcon />- </IconButton>- </InputAdornment>- )- }}- />- {inputError && <FormHelperText>Empty Input Field</FormHelperText>}- </FormControl>+ {targetPath ? (+ <Typography variant="inherit">+ {i18n.t('moveCopyToPath') + ': ' + targetPath}+ </Typography>+ ) : (+ <Typography variant="inherit">+ {i18n.t('chooseTargetLocationAndPath')}+ </Typography>+ )}+ <DirectoryListView setTargetDir={setTargetPath} /></DialogContent><DialogActions><Button data-tid="closeMoveCopyDialog" onClick={() => props.onClose()}>@@ -209,14 +270,28 @@ function MoveCopyFilesDialog(props: Props) {);}+function mapStateToProps(state) {+ return {+ selectedEntries: getSelectedEntries(state)+ };+}+function mapActionCreatorsToProps(dispatch) {return bindActionCreators({copyFiles: IOActions.copyFiles,- moveFiles: IOActions.moveFiles+ moveFiles: IOActions.moveFiles,+ moveDirs: IOActions.moveDirs,+ copyDirs: IOActions.copyDirs,+ toggleUploadDialog: AppActions.toggleUploadDialog,+ onUploadProgress: AppActions.onUploadProgress,+ resetProgress: AppActions.resetProgress},dispatch);}-export default connect(null, mapActionCreatorsToProps)(MoveCopyFilesDialog);+export default connect(+ mapStateToProps,+ mapActionCreatorsToProps+)(MoveCopyFilesDialog);diff --git a/app/components/menus/DirectoryMenu.tsx b/app/components/menus/DirectoryMenu.tsxindex 8ffd53f39..ca43d934e 100644--- a/app/components/menus/DirectoryMenu.tsx+++ b/app/components/menus/DirectoryMenu.tsx@@ -93,6 +93,7 @@ interface Props {) => void;toggleDeleteMultipleEntriesDialog: () => void;openRenameDirectoryDialog: () => void;+ openMoveCopyFilesDialog: () => void;selectedEntries: Array<TS.FileSystemEntry>;currentDirectoryPath: string;lastSelectedEntryPath: string;@@ -231,6 +232,10 @@ function DirectoryMenu(props: Props) {props.openRenameDirectoryDialog();}+ function openMoveCopyDialog() {+ props.openMoveCopyFilesDialog();+ }+/*function showCreateDirectoryDialog() {setIsCreateDirectoryDialogOpened(true);}*/@@ -413,6 +418,7 @@ Do you want to continue?`)openDirectory,reloadDirectory,showRenameDirectoryDialog,+ openMoveCopyDialog,showDeleteDirectoryDialog,showInFileManager,createNewFile,diff --git a/app/containers/MainPage.tsx b/app/containers/MainPage.tsxindex cb3134056..3e2340a98 100644--- a/app/containers/MainPage.tsx+++ b/app/containers/MainPage.tsx@@ -144,7 +144,7 @@ interface Props {isLicenseDialogOpened: boolean;isThirdPartyLibsDialogOpened: boolean;isOnboardingDialogOpened: boolean;- isUploadProgressDialogOpened: boolean;+ isUploadProgressDialogOpened: string | undefined;isProgressDialogOpened: boolean;isProTeaserVisible: boolean;toggleUploadDialog: () => void;@@ -654,6 +654,9 @@ function MainPage(props: Props) {currentDirectoryPath={directoryPath}goBack={goBack}goForward={goForward}+ openMoveCopyFilesDialog={() =>+ setMoveCopyDialogOpened(props.selectedEntries)+ }/>{isFileOpened && (<EntryContainer@@ -750,12 +753,11 @@ function MainPage(props: Props) {openURLExternally={openURLExternally}/>)}- {props.isUploadProgressDialogOpened && (- <FileUploadDialog- open={props.isUploadProgressDialogOpened}- onClose={toggleUploadDialog}- />- )}+ <FileUploadDialog+ open={props.isUploadProgressDialogOpened !== undefined}+ onClose={toggleUploadDialog}+ title={props.isUploadProgressDialogOpened}+ />{props.isProgressDialogOpened && (<ProgressDialogopen={props.isProgressDialogOpened}diff --git a/app/locales/en/core.json b/app/locales/en/core.jsonindex 487efb7e2..c6d78d1f4 100644--- a/app/locales/en/core.json+++ b/app/locales/en/core.json@@ -21,7 +21,9 @@"tagOperationRemoveTag": "Remove Tags","tagOperationCleanTags": "Clean All Tags","copyMoveFilesTitle": "Move or Copy File(s)",+ "copyMoveTitle": "Move or Copy","moveCopyToPath": "Target path",+ "chooseTargetLocationAndPath": "Choose target location and path","moveFilesButton": "Move File(s)","copyFilesButton": "Copy File(s)","editTagMasterName": "Name",@@ -152,6 +154,7 @@"renameFile": "Rename File","newFileName": "New File Name","moveCopyFile": "Move / Copy File",+ "moveCopyDirectory": "Move / Copy Directory","duplicateFile": "Duplicate File","deleteEntry": "Delete","reloadFile": "Reload File",@@ -519,6 +522,8 @@"endpointURL": "Endpoint URL","enableIndexingBySearch": "By enabling this option, the search will deliver better results, but it will take longer","importDialogTitle": "Import Files",+ "copyEntriesTitle": "Copy Entries",+ "moveEntriesTitle": "Move Entries","stopAll": "Stop all","fileExist": "File with the same name already exist","importMacTags": "Import macOS tags",diff --git a/app/package.json b/app/package.jsonindex 70e074c4f..65599f99a 100644--- a/app/package.json+++ b/app/package.json@@ -16,7 +16,7 @@"@tagspaces/extensions": "1.0.78"},"nodeDependencies": {- "@tagspaces/tagspaces-ws": "2.1.24",+ "@tagspaces/tagspaces-ws": "2.1.26","@tagspaces/extensions": "1.0.78","sharp": "0.31.3"}diff --git a/app/perspectives/common/DirectoryMenuItems.tsx b/app/perspectives/common/DirectoryMenuItems.tsxindex 9b20715ca..1d70d4d60 100644--- a/app/perspectives/common/DirectoryMenuItems.tsx+++ b/app/perspectives/common/DirectoryMenuItems.tsx@@ -1,6 +1,7 @@import MenuItem from '@mui/material/MenuItem';import ListItemIcon from '@mui/material/ListItemIcon';import OpenFolderIcon from '@mui/icons-material/SubdirectoryArrowLeft';+import MoveCopy from '@mui/icons-material/FileCopy';import ListItemText from '@mui/material/ListItemText';import i18n from '-/services/i18n';import AutoRenew from '@mui/icons-material/Autorenew';@@ -30,6 +31,7 @@ export function getDirectoryMenuItems(openDirectory?: () => void,reloadDirectory?: () => void,showRenameDirectoryDialog?: () => void,+ openMoveCopyDialog?: () => void,showDeleteDirectoryDialog?: () => void,showInFileManager?: () => void,createNewFile?: () => void,@@ -98,6 +100,24 @@ export function getDirectoryMenuItems(}}+ if (!isReadOnlyMode && openMoveCopyDialog) {+ menuItems.push(+ <MenuItem+ key="fileMenuMoveCopyDirectory"+ data-tid="fileMenuMoveCopyDirectoryTID"+ onClick={() => {+ onClose();+ openMoveCopyDialog();+ }}+ >+ <ListItemIcon>+ <MoveCopy />+ </ListItemIcon>+ <ListItemText primary={i18n.t('core:moveCopyDirectory')} />+ </MenuItem>+ );+ }+if (!isReadOnlyMode && showDeleteDirectoryDialog) {menuItems.push(<MenuItemdiff --git a/app/perspectives/grid-perspective/components/MainContainer.tsx b/app/perspectives/grid-perspective/components/MainContainer.tsxindex 9fb87ba0e..af3e87ce2 100644--- a/app/perspectives/grid-perspective/components/MainContainer.tsx+++ b/app/perspectives/grid-perspective/components/MainContainer.tsx@@ -665,11 +665,11 @@ function GridPerspective(props: Props) {}};- const selectedFilePaths = selectedEntries+ /*const selectedFilePaths = selectedEntries? selectedEntries.filter(fsEntry => fsEntry.isFile).map(fsentry => fsentry.path)- : [];+ : [];*/const sortedDirectories = sortedDirContent.current.filter(entry => !entry.isFile);@@ -900,7 +900,6 @@ function GridPerspective(props: Props) {<MoveCopyFilesDialogopen={isMoveCopyFilesDialogOpened}onClose={() => setIsMoveCopyFilesDialogOpened(false)}- selectedFiles={selectedFilePaths}/>)}{Boolean(fileContextMenuAnchorEl) && (@@ -936,6 +935,7 @@ function GridPerspective(props: Props) {directoryPath={props.lastSelectedEntryPath}loadDirectoryContent={props.loadDirectoryContent}openRenameDirectoryDialog={props.openRenameEntryDialog}+ openMoveCopyFilesDialog={openMoveCopyFilesDialog}openDirectory={props.openDirectory}openFsEntry={props.openFsEntry}perspectiveMode={diff --git a/app/perspectives/grid-perspective/components/MainToolbar.tsx b/app/perspectives/grid-perspective/components/MainToolbar.tsxindex 13b289c3e..f91410b21 100644--- a/app/perspectives/grid-perspective/components/MainToolbar.tsx+++ b/app/perspectives/grid-perspective/components/MainToolbar.tsx@@ -160,31 +160,6 @@ function MainToolbar(props: Props) {<FolderPropertiesIcon /></IconButton></Tooltip>- {/* {layoutType === 'row' ? (- <Tooltip title={i18n.t('core:switchToGridView')}>- <IconButton- aria-label={i18n.t('core:switchToGridView')}- data-tid="gridPerspectiveSwitchLayoutToGrid"- onClick={() => {- handleLayoutSwitch('grid');- }}- >- <ViewGridIcon />- </IconButton>- </Tooltip>- ) : (- <Tooltip title={i18n.t('core:switchToListView')}>- <IconButton- aria-label={i18n.t('core:switchToListView')}- data-tid="gridPerspectiveSwitchLayoutToRow"- onClick={() => {- handleLayoutSwitch('row');- }}- >- <ViewListIcon />- </IconButton>- </Tooltip>- )} */}{!isReadOnlyMode && (<Tooltiptitle={@@ -213,7 +188,7 @@ function MainToolbar(props: Props) {<IconButtonaria-label={i18n.t('core:copyMoveSelectedEntries')}data-tid="gridPerspectiveCopySelectedFiles"- disabled={!fileOperationsEnabled}+ disabled={selectedEntries.length < 1}onClick={openMoveCopyFilesDialog}size="large">diff --git a/app/perspectives/list/components/MainContainer.tsx b/app/perspectives/list/components/MainContainer.tsxindex fe86debf7..adadfdb47 100644--- a/app/perspectives/list/components/MainContainer.tsx+++ b/app/perspectives/list/components/MainContainer.tsx@@ -933,6 +933,7 @@ function GridPerspective(props: Props) {directoryPath={props.lastSelectedEntryPath}loadDirectoryContent={props.loadDirectoryContent}openRenameDirectoryDialog={props.openRenameEntryDialog}+ openMoveCopyFilesDialog={openMoveCopyFilesDialog}openDirectory={props.openDirectory}openFsEntry={props.openFsEntry}perspectiveMode={diff --git a/app/reducers/app.ts b/app/reducers/app.tsindex d2fd4d417..e66349043 100644--- a/app/reducers/app.ts+++ b/app/reducers/app.ts@@ -517,7 +517,8 @@ export default (state: any = initialState, action: any) => {return {...state,// progress: (state.uploadDialogOpened ? state.progress : []),- uploadDialogOpened: !state.uploadDialogOpened+ uploadDialogOpened:+ state.uploadDialogOpened === undefined ? action.title : undefined};//}// return state;@@ -534,7 +535,7 @@ export default (state: any = initialState, action: any) => {return {...state,progress: [],- uploadDialogOpened: false+ uploadDialogOpened: undefined};// }// return state;@@ -1179,8 +1180,9 @@ export const actions = {toggleImportKanBanDialog: () => ({type: types.TOGGLE_IMPORT_KANBAN_DIALOG}),- toggleUploadDialog: () => ({- type: types.TOGGLE_UPLOAD_DIALOG+ toggleUploadDialog: (title = '') => ({+ type: types.TOGGLE_UPLOAD_DIALOG,+ title}),setCurrentDirectoryDirs: dirs => ({type: types.SET_CURRENT_DIRECTORY_DIRS,diff --git a/app/reducers/io-actions.ts b/app/reducers/io-actions.tsindex 4ebf6e5cb..9f3054a69 100644--- a/app/reducers/io-actions.ts+++ b/app/reducers/io-actions.ts@@ -26,7 +26,9 @@ import {getMetaFileLocationForFile,getThumbFileLocationForFile,getBackupFileDir,- normalizePath+ normalizePath,+ extractDirectoryName,+ joinPaths} from '@tagspaces/tagspaces-common/paths';import AppConfig from '-/AppConfig';import { actions as AppActions } from './app';@@ -70,21 +72,39 @@ const actions = {options);},+ moveDirs: (+ paths: Array<string>,+ totalCount: number,+ targetPath: string,+ onProgress = undefined+ ) => (dispatch: (actions: Object) => void) => {+ const promises = paths.map(dirPath => {+ const dirName = extractDirectoryName(+ dirPath,+ PlatformIO.getDirSeparator()+ );+ return PlatformIO.moveDirectoryPromise(+ { path: dirPath, total: totalCount },+ joinPaths(PlatformIO.getDirSeparator(), targetPath, dirName),+ onProgress+ )+ .then(() => {+ console.log('Moving dir from ' + dirPath + ' to ' + targetPath);+ dispatch(AppActions.reflectDeleteEntry(dirPath));+ return true;+ })+ .catch(err => {+ console.warn('Moving dirs failed ', err);+ dispatch(+ AppActions.showNotification(i18n.t('core:copyingDirsFailed'))+ );+ });+ });+ return Promise.all(promises).then(() => true);+ },moveFiles: (paths: Array<string>, targetPath: string) => (dispatch: (actions: Object) => Promise<boolean>) => {- /* const renameJobs = [];- paths.map((path) => {- renameJobs.push(renameFile(path, targetPath + extractFileName(path)));- return true;- });- Promise.all(renameJobs).then(() => {- dispatch(AppActions.showNotification(i18n.t('core:filesMovedSuccessful')));- return true;- }).catch((err) => {- console.warn('Moving files failed with ' + err)- dispatch(AppActions.showNotification(i18n.t('core:movingFilesFailed')));- }); */const moveJobs = paths.map(path => [path,normalizePath(targetPath) +@@ -115,7 +135,10 @@ const actions = {fsEntryMeta.id,PlatformIO.getDirSeparator());- return PlatformIO.moveDirectoryPromise(backupDir, newBackupDir)+ return PlatformIO.moveDirectoryPromise(+ { path: backupDir },+ newBackupDir+ ).then(() => {console.log('Moving revisions successful from ' +@@ -168,6 +191,35 @@ const actions = {);});},+ copyDirs: (+ paths: Array<string>,+ totalCount: number,+ targetPath: string,+ onProgress = undefined+ ) => (dispatch: (actions: Object) => void) => {+ const promises = paths.map(dirPath => {+ const dirName = extractDirectoryName(+ dirPath,+ PlatformIO.getDirSeparator()+ );+ return PlatformIO.copyDirectoryPromise(+ { path: dirPath, total: totalCount },+ joinPaths(PlatformIO.getDirSeparator(), targetPath, dirName),+ onProgress+ )+ .then(() => {+ console.log('Copy dir from ' + dirPath + ' to ' + targetPath);+ return true;+ })+ .catch(err => {+ console.warn('Copy dirs failed ', err);+ dispatch(+ AppActions.showNotification(i18n.t('core:copyingDirsFailed'))+ );+ });+ });+ return Promise.all(promises).then(() => true);+ },copyFiles: (paths: Array<string>, targetPath: string) => (dispatch: (actions: Object) => void) => {diff --git a/app/services/platform-facade.ts b/app/services/platform-facade.tsindex dfb7df763..af83f94f4 100644--- a/app/services/platform-facade.ts+++ b/app/services/platform-facade.ts@@ -57,6 +57,7 @@ import {platformRenameFilePromise,platformRenameDirectoryPromise,platformMoveDirectoryPromise,+ platformCopyDirectoryPromise,platformDeleteFilePromise,platformDeleteDirectoryPromise,platformOpenDirectory,@@ -74,7 +75,8 @@ import {platformLoadExtensions,platformRemoveExtension,platformGetUserDataDir,- platformUnZip+ platformUnZip,+ platformDirProperties} from '@tagspaces/tagspaces-platforms/platform-io';import AppConfig from '-/AppConfig';import { Pro } from '../pro';@@ -337,16 +339,34 @@ export default class PlatformFacade {});};+ static copyDirectoryPromise = (+ param: any,+ newDirPath: string,+ onProgress = undefined+ ): Promise<any> => {+ PlatformFacade.ignoreByWatcher(param.path, newDirPath);++ return platformCopyDirectoryPromise(param, newDirPath, onProgress).then(+ result => {+ PlatformFacade.deignoreByWatcher(param.path, newDirPath);+ return result;+ }+ );+ };+static moveDirectoryPromise = (- dirPath: string,- newDirPath: string+ param: any,+ newDirPath: string,+ onProgress = undefined): Promise<any> => {- PlatformFacade.ignoreByWatcher(dirPath, newDirPath);+ PlatformFacade.ignoreByWatcher(param.path, newDirPath);- return platformMoveDirectoryPromise(dirPath, newDirPath).then(result => {- PlatformFacade.deignoreByWatcher(dirPath, newDirPath);- return result;- });+ return platformMoveDirectoryPromise(param, newDirPath, onProgress).then(+ result => {+ PlatformFacade.deignoreByWatcher(param.path, newDirPath);+ return result;+ }+ );};static loadTextFilePromise = (@@ -535,4 +555,8 @@ export default class PlatformFacade {static unZip(filePath, targetPath): Promise<boolean> {return platformUnZip(filePath, targetPath);}++ static getDirProperties(filePath): Promise<TS.DirProp> {+ return platformDirProperties(filePath);+ }}diff --git a/app/services/utils-io.ts b/app/services/utils-io.tsindex 040004235..01bd0bc38 100644--- a/app/services/utils-io.ts+++ b/app/services/utils-io.ts@@ -213,6 +213,12 @@ export function enhanceOpenedEntry(tags: fineNameTags};}+ } else {+ // ignore wrong size from fs.stats for directories+ return {+ ...entry,+ size: undefined+ };}return entry;}diff --git a/app/tagspaces.namespace.d.ts b/app/tagspaces.namespace.d.tsindex 0e1dd121a..6a4bf5194 100644--- a/app/tagspaces.namespace.d.ts+++ b/app/tagspaces.namespace.d.ts@@ -65,6 +65,12 @@ export namespace TS {color?: string}+ interface DirProp {+ totalSize: number;+ filesCount: number;+ dirsCount: number;+ }+interface SearchQuery {uuid?: string; // for saved searchestitle?: string; // for saved searchesdiff --git a/package-lock.json b/package-lock.jsonindex 90d5640c1..fe45eaad1 100644--- a/package-lock.json+++ b/package-lock.json@@ -22,7 +22,7 @@"@mui/styles": "5.10.15","@mui/x-date-pickers": "^5.0.8","@tagspaces/tagspaces-md": "2.1.6",- "@tagspaces/tagspaces-platforms": "2.1.24",+ "@tagspaces/tagspaces-platforms": "2.1.26","aws-amplify": "^4.3.8","aws-sdk": "^2.1036.0","babel-polyfill": "^6.26.0",@@ -13824,9 +13824,9 @@}},"node_modules/@tagspaces/tagspaces-platforms": {- "version": "2.1.24",- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-platforms/-/tagspaces-platforms-2.1.24.tgz",- "integrity": "sha512-NYWOV4CDoX/PYExtpFqqXSll43QEjcNpy/e6j2HTd91ZF0OVdhPrN+oSUjAFuW8q8OjA1Jz8LBAYDWKr42rlLg==",+ "version": "2.1.26",+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-platforms/-/tagspaces-platforms-2.1.26.tgz",+ "integrity": "sha512-322cQNHgMPdGmOjprbNP7pnZ6JNmiRRfbilVQ5GcQmoDPov+C7yNBscKGANNfhqrZE0QE//kamx7sq8cQQDsSQ==","hasInstallScript": true},"node_modules/@testim/chrome-version": {@@ -59541,9 +59541,9 @@}},"@tagspaces/tagspaces-platforms": {- "version": "2.1.24",- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-platforms/-/tagspaces-platforms-2.1.24.tgz",- "integrity": "sha512-NYWOV4CDoX/PYExtpFqqXSll43QEjcNpy/e6j2HTd91ZF0OVdhPrN+oSUjAFuW8q8OjA1Jz8LBAYDWKr42rlLg=="+ "version": "2.1.26",+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-platforms/-/tagspaces-platforms-2.1.26.tgz",+ "integrity": "sha512-322cQNHgMPdGmOjprbNP7pnZ6JNmiRRfbilVQ5GcQmoDPov+C7yNBscKGANNfhqrZE0QE//kamx7sq8cQQDsSQ=="},"@testim/chrome-version": {"version": "1.1.3",diff --git a/package.json b/package.jsonindex b8d9708d5..f8eb3fc3c 100644--- a/package.json+++ b/package.json@@ -161,7 +161,7 @@"@mui/styles": "5.10.15","@mui/x-date-pickers": "^5.0.8","@tagspaces/tagspaces-md": "2.1.6",- "@tagspaces/tagspaces-platforms": "2.1.24",+ "@tagspaces/tagspaces-platforms": "2.1.26","aws-amplify": "^4.3.8","aws-sdk": "^2.1036.0","babel-polyfill": "^6.26.0",