Skip to content

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

Added delete all selected files functionality

Borislav Sapundzhiev8e37532f228d
diff --git a/data/ext/perspectiveList/perspectiveUI.js b/data/ext/perspectiveList/perspectiveUI.js
index 58d627bde..37d3add93 100644
--- a/data/ext/perspectiveList/perspectiveUI.js
+++ b/data/ext/perspectiveList/perspectiveUI.js
@@ -83,6 +83,18 @@ define(function(require, exports, module) {
}
});
+ $("#" + this.extensionID + "DeleteSelectedFilesButton")
+ .click(function() {
+
+ TSCORE.showConfirmDialog($.i18n.t('ns.dialogs:fileDeleteTitleConfirm'),
+ $.i18n.t('ns.dialogs:selectedFilesDeleteContentConfirm'), function() {
+ TSCORE.selectedFiles.forEach(function(file) {
+ TSCORE.IO.deleteElement(file);
+ TSCORE.PerspectiveManager.removeFileUI(file);
+ });
+ });
+ });
+
$("#" + this.extensionID + "TagButton")
.click(function() {
TSCORE.showAddTagsDialog();
@@ -576,16 +588,20 @@ define(function(require, exports, module) {
var tagButton = $("#" + this.extensionID + "TagButton");
var copyMoveButton = $("#" + this.extensionID + "CopyMoveButton");
+ var deleteSelectedFilesButton = $("#" + this.extensionID + "DeleteSelectedFilesButton");
if (TSCORE.selectedFiles.length > 1) {
tagButton.prop('disabled', false);
copyMoveButton.prop('disabled', false);
+ deleteSelectedFilesButton.prop('disabled', false);
} else if (TSCORE.selectedFiles.length === 1) {
tagButton.prop('disabled', false);
copyMoveButton.prop('disabled', false);
+ deleteSelectedFilesButton.prop('disabled', false);
} else {
tagButton.prop('disabled', true);
copyMoveButton.prop('disabled', true);
+ deleteSelectedFilesButton.prop('disabled', true);
}
};
diff --git a/data/ext/perspectiveList/toolbar.html b/data/ext/perspectiveList/toolbar.html
index e92138fee..703a2a188 100644
--- a/data/ext/perspectiveList/toolbar.html
+++ b/data/ext/perspectiveList/toolbar.html
@@ -29,6 +29,9 @@
<i class="fa fa-folder-o fa-lg fa-fw"></i>&nbsp;<span data-i18n="ns.common:newSubdirectory"></span>
</a></li>
</ul>
+ <button class="btn btn-link" data-i18n="[title]ns.perspectiveList:deleteSelectedFilesTooltip" id="{{id}}DeleteSelectedFilesButton">
+ <i class="fa fa-trash fa-lg"></i>
+ </button>
<button class="btn btn-link" data-i18n="[title]ns.perspectiveList:addRemoveTagsTooltip" id="{{id}}TagButton">
<i class="fa fa-tag fa-lg"></i>
</button>
diff --git a/data/locales/en_US/ns.dialogs.json b/data/locales/en_US/ns.dialogs.json
index 5323d0e52..d3e3b3175 100644
--- a/data/locales/en_US/ns.dialogs.json
+++ b/data/locales/en_US/ns.dialogs.json
@@ -10,6 +10,7 @@
"closingEditedFileContentConfirm": "If you confirm, all the changes you made will be lost.",
"fileDeleteTitleConfirm": "Delete File(s)",
"fileDeleteContentConfirm": "The file __filePath__ will be permanently deleted and cannot be recovered. Are you sure?",
+ "selectedFilesDeleteContentConfirm": "All selected files will be permanently deleted and cannot be recovered. Are you sure?",
"fileSaveTitleConfirm": "Confirm File Save",
"fileSaveContentConfirm": "Do you want to overwrite the current file?",
"errorOpeningLocationAlert": "Error occurred while opening a path! Currently opened location will be closed.",
diff --git a/data/locales/en_US/ns.perspectiveList.json b/data/locales/en_US/ns.perspectiveList.json
index cb57505b0..accaef2af 100644
--- a/data/locales/en_US/ns.perspectiveList.json
+++ b/data/locales/en_US/ns.perspectiveList.json
@@ -19,6 +19,7 @@
"exportToCSVTooltip": "Export current file structure in CSV(Comma Separated Value) format",
"showSubfolderContent": "Content of the Subfolders",
"showSubfolderContentTooltip": "Show Content of the Subfolders",
+ "deleteSelectedFilesTooltip": "Delete Selected Files",
"addRemoveTagsTooltip": "Add or Remove Tags for Selected Files",
"toggleThumbnailsTooltip": "Toggle Thumbnails",
"increasThumbnailsTooltip": "Increase Thumbnails",