diff --git a/CHANGELOG.md b/CHANGELOG.md index 61cf25bc5be..c1cfb3cef5d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `# ## [Unreleased] ### Changed +- We added a "Move file to file directory and rename file" option for simultaneously moving and renaming of document file. [#4166](https://github.com/JabRef/jabref/issues/4166) - Use integrated graphics card instead of discrete on macOS [#4070](https://github.com/JabRef/jabref/issues/4070) - We changed the minimum required version of Java to 1.8.0_171, as this is the latest release for which the automatic Java update works. [4093](https://github.com/JabRef/jabref/issues/4093) - The special fields like `Printed` and `Read status` now show gray icons when the row is hovered. diff --git a/src/main/java/org/jabref/gui/fieldeditors/LinkedFileViewModel.java b/src/main/java/org/jabref/gui/fieldeditors/LinkedFileViewModel.java index e1480c08688..f0639545af8 100644 --- a/src/main/java/org/jabref/gui/fieldeditors/LinkedFileViewModel.java +++ b/src/main/java/org/jabref/gui/fieldeditors/LinkedFileViewModel.java @@ -281,6 +281,11 @@ public void moveToDefaultDirectory() { } } + public void moveToDefaultDirectoryAndRename() { + moveToDefaultDirectory(); + rename(); + } + public boolean delete(FileDirectoryPreferences prefs) { Optional file = linkedFile.findIn(databaseContext, prefs); diff --git a/src/main/java/org/jabref/gui/fieldeditors/LinkedFilesEditor.java b/src/main/java/org/jabref/gui/fieldeditors/LinkedFilesEditor.java index 2758f5583cd..153caee75a1 100644 --- a/src/main/java/org/jabref/gui/fieldeditors/LinkedFilesEditor.java +++ b/src/main/java/org/jabref/gui/fieldeditors/LinkedFilesEditor.java @@ -259,6 +259,10 @@ private ContextMenu createContextMenuForFile(LinkedFileViewModel linkedFile) { moveFile.setOnAction(event -> linkedFile.moveToDefaultDirectory()); moveFile.setDisable(linkedFile.getFile().isOnlineLink()); + MenuItem renameAndMoveFile = new MenuItem(Localization.lang("Move file to file directory and rename file")); + renameAndMoveFile.setOnAction(event -> linkedFile.moveToDefaultDirectoryAndRename()); + renameAndMoveFile.setDisable(linkedFile.getFile().isOnlineLink()); + MenuItem deleteFile = new MenuItem(Localization.lang("Permanently delete local file")); deleteFile.setOnAction(event -> viewModel.deleteFile(linkedFile)); deleteFile.setDisable(linkedFile.getFile().isOnlineLink()); @@ -273,7 +277,7 @@ private ContextMenu createContextMenuForFile(LinkedFileViewModel linkedFile) { if (linkedFile.getFile().isOnlineLink()) { menu.getItems().add(download); } - menu.getItems().addAll(renameFile, moveFile, deleteLink, deleteFile); + menu.getItems().addAll(renameFile, moveFile, renameAndMoveFile, deleteLink, deleteFile); return menu; } diff --git a/src/main/resources/l10n/JabRef_en.properties b/src/main/resources/l10n/JabRef_en.properties index e521d6e9272..10a193f6020 100644 --- a/src/main/resources/l10n/JabRef_en.properties +++ b/src/main/resources/l10n/JabRef_en.properties @@ -1185,6 +1185,8 @@ Query\ '%0'\ with\ fetcher\ '%1'\ did\ not\ return\ any\ results.=Query '%0' wit Move\ file=Move file Rename\ file=Rename file +Move\ file\ to\ file\ directory\ and\ rename\ file=Move file to file directory and rename file + Move\ file\ failed=Move file failed Could\ not\ move\ file\ '%0'.=Could not move file '%0'. Could\ not\ find\ file\ '%0'.=Could not find file '%0'. diff --git a/src/main/resources/l10n/JabRef_zh.properties b/src/main/resources/l10n/JabRef_zh.properties index 9d3de79901d..0cefa1dd0a5 100644 --- a/src/main/resources/l10n/JabRef_zh.properties +++ b/src/main/resources/l10n/JabRef_zh.properties @@ -196,7 +196,7 @@ Copied\ keys=已复制 BibTeX 键 Copy=复制 Copy\ BibTeX\ key=复制 BibTeX 键 -Copy\ file\ to\ file\ directory=拷贝文件到文件目录。 +Copy\ file\ to\ file\ directory=拷贝文件到文件目录 Copy\ to\ clipboard=复制到剪贴板 @@ -1181,8 +1181,10 @@ Could\ not\ find\ fetcher\ '%0'=无法找到抓取器 '%0' Running\ query\ '%0'\ with\ fetcher\ '%1'.=使用抓取器'%1'执行请求'%0' Query\ '%0'\ with\ fetcher\ '%1'\ did\ not\ return\ any\ results.=使用抓取器'%1'请求'%0'未返回任何结果。 -Move\ file=移动 文件 -Rename\ file=重命名 文件 +Move\ file=移动文件 +Rename\ file=重命名文件 + +Move\ file\ to\ file\ directory\ and\ rename\ file=移动文件到文件目录重命名文件 Move\ file\ failed=移动文件失败 Could\ not\ move\ file\ '%0'.=无法移动文件 '%0' @@ -1262,7 +1264,7 @@ Enforce\ legal\ characters\ in\ BibTeX\ keys=强制在 BibTeX 键值中使用合 Save\ without\ backup?=保存但不备份? Unable\ to\ create\ backup=无法创建备份 -Move\ file\ to\ file\ directory=移动文件到文件目录。 +Move\ file\ to\ file\ directory=移动文件到文件目录 Rename\ file\ to=将文件更名为 All\ Entries\ (this\ group\ cannot\ be\ edited\ or\ removed)=所有记录(此分组无法被编辑或者删除) static\ group=静态分组