Skip to content

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

Replaced "Open Containing Folder" function with "Show in File Manager" function.

HappyDay619a12c4adfd
diff --git a/app/components/FolderContainer.js b/app/components/FolderContainer.js
index a960f2ba0..00de82a53 100644
--- a/app/components/FolderContainer.js
+++ b/app/components/FolderContainer.js
@@ -140,7 +140,8 @@ type Props = {
getNextFile: () => string,
getPrevFile: () => string,
openDirectory: () => void,
- openFile: (path: string) => void,
+ showInFileManager: () => void,
+ openFile: (path: string) => void,
deleteDirectory: (path: string) => void,
reflectCreateEntry: (path: string, isFile: boolean) => void,
loadDirectoryContent: (path: string) => void,
@@ -324,6 +325,7 @@ class FolderContainer extends React.Component<Props, State> {
deleteFile={this.props.deleteFile}
renameFile={this.props.renameFile}
openDirectory={this.props.openDirectory}
+ showInFileManager={this.props.showInFileManager}
currentDirectoryPath={this.props.currentDirectoryPath}
setLastSelectedEntry={this.props.setLastSelectedEntry}
perspectiveCommand={this.state.perspectiveCommand}
@@ -398,6 +400,7 @@ class FolderContainer extends React.Component<Props, State> {
openFileNatively={this.props.openFileNatively}
openDirectory={this.props.openDirectory}
loadParentDirectoryContent={this.props.loadParentDirectoryContent}
+ showInFileManager={this.props.showInFileManager}
reflectCreateEntry={this.props.reflectCreateEntry}
openFile={this.props.openFile}
toggleCreateFileDialog={this.props.toggleCreateFileDialog}
@@ -448,6 +451,7 @@ function mapActionCreatorsToProps(dispatch) {
getNextFile: AppActions.getNextFile,
getPrevFile: AppActions.getPrevFile,
openDirectory: AppActions.openDirectory,
+ showInFileManager: AppActions.showInFileManager,
openFile: AppActions.openFile,
deleteDirectory: AppActions.deleteDirectory,
reflectCreateEntry: AppActions.reflectCreateEntry,
diff --git a/app/components/LocationManager.js b/app/components/LocationManager.js
index 9a0c94120..0c756c56f 100644
--- a/app/components/LocationManager.js
+++ b/app/components/LocationManager.js
@@ -81,6 +81,7 @@ type Props = {
openLocation: (location: Location) => void,
openFileNatively: (path: string) => void,
openDirectory: (path: string) => void,
+ showInFileManager: (path: string) => void,
createDirectoryIndex: (path: string) => void,
addLocation: () => void,
editLocation: () => void,
@@ -780,6 +781,7 @@ class LocationManager extends React.Component<Props, State> {
loadDirectoryContent={this.props.loadDirectoryContent}
openFileNatively={this.props.openFileNatively}
openDirectory={this.props.openDirectory}
+ showInFileManager={this.props.showInFileManager}
openFile={this.props.openFile}
reflectCreateEntry={this.props.reflectCreateEntry}
deleteDirectory={this.props.deleteDirectory}
@@ -809,6 +811,7 @@ function mapDispatchToProps(dispatch) {
reflectCreateEntry: AppActions.reflectCreateEntry,
deleteDirectory: AppActions.deleteDirectory,
openDirectory: AppActions.openDirectory,
+ showInFileManager: AppActions.showInFileManager,
openFileNatively: AppActions.openFileNatively,
openFile: AppActions.openFile,
moveFiles: IOActions.moveFiles
diff --git a/app/components/menus/DirectoryMenu.js b/app/components/menus/DirectoryMenu.js
index fe237b63c..c433d3323 100644
--- a/app/components/menus/DirectoryMenu.js
+++ b/app/components/menus/DirectoryMenu.js
@@ -49,6 +49,7 @@ type Props = {
directoryPath?: string,
loadDirectoryContent: (path: string) => void,
openDirectory: (path: string) => void,
+ showInFileManager: (path: string) => void,
openFile: (path: string, isFile: boolean) => void,
deleteDirectory: (path: string) => void,
reflectCreateEntry?: (path: string, isFile: boolean) => void,
@@ -129,12 +130,7 @@ class DirectoryMenu extends React.Component<Props, State> {
showInFileManager = () => {
this.props.onClose();
- this.props.openFileNatively(this.props.directoryPath); // TODO use openDirectory
- };
-
- showContainingFolderInFileManager = () => {
- this.props.onClose();
- this.props.openDirectory(this.props.directoryPath);
+ this.props.showInFileManager(this.props.directoryPath);
};
addExistingFile = () => {
@@ -375,7 +371,7 @@ class DirectoryMenu extends React.Component<Props, State> {
</MenuItem>
)}
<MenuItem
- data-tid="openDirectoryNatively"
+ data-tid="showInFileManager"
onClick={this.showInFileManager}
>
<ListItemIcon>
@@ -383,7 +379,7 @@ class DirectoryMenu extends React.Component<Props, State> {
</ListItemIcon>
<ListItemText
inset
- primary={i18n.t('core:openDirectoryNatively')}
+ primary={i18n.t('core:showInFileManager')}
/>
</MenuItem>
{!this.props.perspectiveMode && (
diff --git a/app/components/menus/FileMenu.js b/app/components/menus/FileMenu.js
index 351955855..e2361c33c 100644
--- a/app/components/menus/FileMenu.js
+++ b/app/components/menus/FileMenu.js
@@ -43,7 +43,7 @@ type Props = {
openAddRemoveTagsDialog: () => void,
openFile: (path: string) => void,
openFileNatively: (path: string) => void,
- openDirectory: (path: string) => void,
+ showInFileManager: (path: string) => void,
selectedFilePath?: string
};
@@ -71,7 +71,7 @@ class FileMenu extends React.Component<Props> {
showInFileManager = () => {
this.props.onClose();
if (this.props.selectedFilePath) {
- this.props.openDirectory(extractContainingDirectoryPath(this.props.selectedFilePath));
+ this.props.showInFileManager(this.props.selectedFilePath);
}
};
@@ -131,7 +131,7 @@ class FileMenu extends React.Component<Props> {
<ListItemIcon>
<OpenContainingFolder />
</ListItemIcon>
- <ListItemText inset primary={i18n.t('core:openContainingFolder')} />
+ <ListItemText inset primary={i18n.t('core:showInFileManager')} />
</MenuItem>
<Divider />
<MenuItem
diff --git a/app/locales/en/core.json b/app/locales/en/core.json
index b192fad93..ffdc769ee 100644
--- a/app/locales/en/core.json
+++ b/app/locales/en/core.json
@@ -130,6 +130,7 @@
"downloadFile": "Download",
"openFileNatively": "Open File Natively",
"openContainingFolder": "Open Containing Folder",
+ "showInFileManager": "Show in File Manager",
"fullscreen": "Open in Fullscreen",
"renameFile": "Rename File",
"moveCopyFile": "Move / Copy File",
@@ -165,7 +166,6 @@
"reloadDirectory": "Reload Directory",
"newSubdirectory": "New Subdirectory",
"openParentDirectory": "Open Parent Directory",
- "openDirectoryNatively": "Show in File Manager",
"openDirectory": "Open Directory",
"aboutTagSpaces": "About TagSpaces",
"startingHints": "Starting Tips",
diff --git a/app/perspectives/file-manager/index.js b/app/perspectives/file-manager/index.js
index 557891580..a738e44fd 100644
--- a/app/perspectives/file-manager/index.js
+++ b/app/perspectives/file-manager/index.js
@@ -38,7 +38,7 @@ type Props = {
openFileNatively: (path: string) => void,
deleteFile: (path: string) => void,
renameFile: (path: string) => void,
- openDirectory: (path: string) => void,
+ showInFileManager: (path: string) => void,
loadDirectoryContent: (path: string) => void,
directoryContent: Array<FileSystemEntry>
};
@@ -349,7 +349,7 @@ class FileManagerPerspective extends React.Component<Props, State> {
renameFile={this.props.renameFile}
copyFiles={this.props.copyFiles}
moveFiles={this.props.moveFiles}
- openDirectory={this.props.openDirectory}
+ showInFileManager={this.props.showInFileManager}
addRemoveTags={this.props.addRemoveTags}
selectedFilePath={this.state.selectedFilePath}
allTags={this.props.allTags}
diff --git a/app/perspectives/grid-perspective/src/index.js b/app/perspectives/grid-perspective/src/index.js
index 68cd57e3b..d29c4b362 100644
--- a/app/perspectives/grid-perspective/src/index.js
+++ b/app/perspectives/grid-perspective/src/index.js
@@ -104,6 +104,7 @@ type Props = {
deleteDirectory: (path: string) => void,
loadDirectoryContent: (path: string) => void,
openDirectory: (path: string) => void,
+ showInFileManager: (path: string) => void,
openFileNatively: (path: string) => void,
loadParentDirectoryContent: () => void,
setLastSelectedEntry: (entryPath: string | null) => void,
@@ -1015,7 +1016,7 @@ class GridPerspective extends React.Component<Props, State> {
openAddRemoveTagsDialog={this.openAddRemoveTagsDialog}
openFile={this.props.openFile}
openFileNatively={this.props.openFileNatively}
- openDirectory={this.props.openDirectory}
+ showInFileManager={this.props.showInFileManager}
selectedFilePath={this.state.selectedEntryPath}
/>
<DirectoryMenu
@@ -1025,6 +1026,7 @@ class GridPerspective extends React.Component<Props, State> {
directoryPath={this.state.selectedEntryPath}
loadDirectoryContent={this.props.loadDirectoryContent}
openDirectory={this.props.openDirectory}
+ showInFileManager={this.props.showInFileManager}
openFileNatively={this.props.openFileNatively}
openFile={this.props.openFile}
deleteDirectory={this.props.deleteDirectory}
diff --git a/app/reducers/app.js b/app/reducers/app.js
index 307977608..2cb62c509 100644
--- a/app/reducers/app.js
+++ b/app/reducers/app.js
@@ -735,6 +735,9 @@ export const actions = {
openDirectory: (directoryPath: string) => () => {
PlatformIO.openDirectory(directoryPath);
},
+ showInFileManager: (filePath: string) => () => {
+ PlatformIO.showInFileManager(filePath);
+ },
renameDirectory: (directoryPath: string, newDirectoryName: string) => (
dispatch: (actions: Object) => void
) => {
diff --git a/app/services/cordova-io.js b/app/services/cordova-io.js
index 963d666f1..f17738353 100644
--- a/app/services/cordova-io.js
+++ b/app/services/cordova-io.js
@@ -1114,6 +1114,13 @@ export default class CordovaIO {
console.warn('function openDirectory not supported on cordova');
};
+ /**
+ * Opens a directory in the operating system's default file manager, selecting the file
+ */
+ showInFileManager = (filePath: string) => {
+ console.warn('Showing item ' + filePath + ' not supported on cordova');
+ };
+
/**
* Opens a file with the operating system's default program for the type of the file
*/
diff --git a/app/services/electron-io.js b/app/services/electron-io.js
index b1690ba17..ee8a4a5fd 100644
--- a/app/services/electron-io.js
+++ b/app/services/electron-io.js
@@ -742,6 +742,10 @@ export default class ElectronIO {
);
};
+ showInFileManager = (filePath: string): void => {
+ this.electron.shell.showItemInFolder(filePath);
+ };
+
openFile = (filePath: string): void => {
this.electron.shell.openItem(filePath);
};
diff --git a/app/services/platform-io.js b/app/services/platform-io.js
index f8203af34..c95f160d7 100644
--- a/app/services/platform-io.js
+++ b/app/services/platform-io.js
@@ -250,6 +250,9 @@ export default class PlatformIO {
static openDirectory = (dirPath: string): void =>
nativeAPI.openDirectory(dirPath);
+ static showInFileManager = (dirPath: string): void =>
+ nativeAPI.showInFileManager(dirPath);
+
static openFile = (filePath: string): void => nativeAPI.openFile(filePath);
static openUrl = (url: string): void => nativeAPI.openUrl(url);
diff --git a/app/services/webdav-io.js b/app/services/webdav-io.js
index 48ca5744f..591ebf22d 100644
--- a/app/services/webdav-io.js
+++ b/app/services/webdav-io.js
@@ -616,6 +616,15 @@ export default class WebDAVIO {
);
};
+ /**
+ * Opens directory in new tab / window, selecting the file
+ */
+ showInFileManager = (filePath: string) => {
+ console.log(
+ 'Showing item ' + filePath + ' not possible for the web version.'
+ );
+ };
+
/**
* Open the file url in a new tab / window
*/