From 14204e741e678f24c9854a6d956007858b08ef1d Mon Sep 17 00:00:00 2001 From: Carl Christian Snethlage Date: Mon, 18 Oct 2021 21:18:58 +0200 Subject: [PATCH 1/2] Removed two unused preference options --- .../linkedfiles/LinkedFilesTabViewModel.java | 6 +-- .../jabref/preferences/FilePreferences.java | 16 +------- .../jabref/preferences/JabRefPreferences.java | 10 +---- .../preferences/FilePreferenceTest.java | 39 +++++++++---------- 4 files changed, 21 insertions(+), 50 deletions(-) diff --git a/src/main/java/org/jabref/gui/preferences/linkedfiles/LinkedFilesTabViewModel.java b/src/main/java/org/jabref/gui/preferences/linkedfiles/LinkedFilesTabViewModel.java index 80e54e42fba..6bd07120ddb 100644 --- a/src/main/java/org/jabref/gui/preferences/linkedfiles/LinkedFilesTabViewModel.java +++ b/src/main/java/org/jabref/gui/preferences/linkedfiles/LinkedFilesTabViewModel.java @@ -78,8 +78,6 @@ public void setValues() { // External files preferences / Attached files preferences / File preferences mainFileDirectoryProperty.setValue(initialFilePreferences.getFileDirectory().orElse(Path.of("")).toString()); useBibLocationAsPrimaryProperty.setValue(initialFilePreferences.shouldStoreFilesRelativeToBib()); - searchFilesOnOpenProperty.setValue(initialFilePreferences.shouldSearchFilesOnOpen()); - openBrowseOnCreateProperty.setValue(initialFilePreferences.shouldOpenBrowseOnCreate()); fileNamePatternProperty.setValue(initialFilePreferences.getFileNamePattern()); fileDirectoryPatternProperty.setValue(initialFilePreferences.getFileDirectoryPattern()); @@ -102,9 +100,7 @@ public void storeSettings() { useBibLocationAsPrimaryProperty.getValue(), fileNamePatternProperty.getValue(), fileDirectoryPatternProperty.getValue(), - initialFilePreferences.shouldDownloadLinkedFiles(), // set in ImportEntriesViewModel - searchFilesOnOpenProperty.getValue(), - openBrowseOnCreateProperty.getValue())); + initialFilePreferences.shouldDownloadLinkedFiles())); // set in ImportEntriesViewModel // Autolink preferences AutoLinkPreferences.CitationKeyDependency citationKeyDependency = AutoLinkPreferences.CitationKeyDependency.START; diff --git a/src/main/java/org/jabref/preferences/FilePreferences.java b/src/main/java/org/jabref/preferences/FilePreferences.java index 28ca322e925..9ecd65b14e9 100644 --- a/src/main/java/org/jabref/preferences/FilePreferences.java +++ b/src/main/java/org/jabref/preferences/FilePreferences.java @@ -15,25 +15,19 @@ public class FilePreferences { private final String fileNamePattern; private final String fileDirPattern; private boolean shouldDownloadLinkedFiles; - private final boolean shouldSearchFilesOnOpen; - private final boolean shouldOpenBrowseOnCreate; public FilePreferences(String user, String mainFileDirectory, boolean shouldStoreFilesRelativeToBibFile, String fileNamePattern, String fileDirPattern, - boolean shouldDownloadLinkedFiles, - boolean shouldSearchFilesOnOpen, - boolean shouldOpenBrowseOnCreate) { + boolean shouldDownloadLinkedFiles) { this.user = user; this.mainFileDirectory = mainFileDirectory; this.shouldStoreFilesRelativeToBibFile = shouldStoreFilesRelativeToBibFile; this.fileNamePattern = fileNamePattern; this.fileDirPattern = fileDirPattern; this.shouldDownloadLinkedFiles = shouldDownloadLinkedFiles; - this.shouldSearchFilesOnOpen = shouldSearchFilesOnOpen; - this.shouldOpenBrowseOnCreate = shouldOpenBrowseOnCreate; } public String getUser() { @@ -68,12 +62,4 @@ public FilePreferences withShouldDownloadLinkedFiles(boolean newShouldDownloadLi this.shouldDownloadLinkedFiles = newShouldDownloadLinkedFiles; return this; } - - public boolean shouldSearchFilesOnOpen() { - return shouldSearchFilesOnOpen; - } - - public boolean shouldOpenBrowseOnCreate() { - return shouldOpenBrowseOnCreate; - } } diff --git a/src/main/java/org/jabref/preferences/JabRefPreferences.java b/src/main/java/org/jabref/preferences/JabRefPreferences.java index 080dc7c65b0..6cd446ff5dd 100644 --- a/src/main/java/org/jabref/preferences/JabRefPreferences.java +++ b/src/main/java/org/jabref/preferences/JabRefPreferences.java @@ -260,7 +260,6 @@ public class JabRefPreferences implements PreferencesService { public static final String KEY_GEN_FIRST_LETTER_A = "keyGenFirstLetterA"; public static final String ALLOW_INTEGER_EDITION_BIBTEX = "allowIntegerEditionBibtex"; public static final String LOCAL_AUTO_SAVE = "localAutoSave"; - public static final String RUN_AUTOMATIC_FILE_SEARCH = "runAutomaticFileSearch"; public static final String AUTOLINK_REG_EXP_SEARCH_EXPRESSION_KEY = "regExpSearchExpression"; public static final String AUTOLINK_USE_REG_EXP_SEARCH_KEY = "useRegExpSearch"; // bibLocAsPrimaryDir is a misleading antique variable name, we keep it for reason of compatibility @@ -268,7 +267,6 @@ public class JabRefPreferences implements PreferencesService { public static final String SELECTED_FETCHER_INDEX = "selectedFetcherIndex"; public static final String WEB_SEARCH_VISIBLE = "webSearchVisible"; public static final String GROUP_SIDEPANE_VISIBLE = "groupSidepaneVisible"; - public static final String ALLOW_FILE_AUTO_OPEN_BROWSE = "allowFileAutoOpenBrowse"; public static final String CUSTOM_TAB_NAME = "customTabName_"; public static final String CUSTOM_TAB_FIELDS = "customTabFields_"; public static final String ASK_AUTO_NAMING_PDFS_AGAIN = "AskAutoNamingPDFsAgain"; @@ -641,7 +639,6 @@ private JabRefPreferences() { defaults.put(OVERRIDE_DEFAULT_FONT_SIZE, false); defaults.put(AUTOLINK_EXACT_KEY_ONLY, Boolean.FALSE); - defaults.put(RUN_AUTOMATIC_FILE_SEARCH, Boolean.FALSE); defaults.put(LOCAL_AUTO_SAVE, Boolean.FALSE); defaults.put(ALLOW_INTEGER_EDITION_BIBTEX, Boolean.FALSE); // Curly brackets ({}) are the default delimiters, not quotes (") as these cause trouble when they appear within the field value: @@ -650,7 +647,6 @@ private JabRefPreferences() { defaults.put(KEY_GEN_ALWAYS_ADD_LETTER, Boolean.FALSE); defaults.put(EMAIL_SUBJECT, Localization.lang("References")); defaults.put(OPEN_FOLDERS_OF_ATTACHED_FILES, Boolean.FALSE); - defaults.put(ALLOW_FILE_AUTO_OPEN_BROWSE, Boolean.TRUE); defaults.put(WEB_SEARCH_VISIBLE, Boolean.TRUE); defaults.put(GROUP_SIDEPANE_VISIBLE, Boolean.TRUE); defaults.put(SELECTED_FETCHER_INDEX, 0); @@ -2189,9 +2185,7 @@ public FilePreferences getFilePreferences() { getBoolean(STORE_RELATIVE_TO_BIB), get(IMPORT_FILENAMEPATTERN), get(IMPORT_FILEDIRPATTERN), - getBoolean(DOWNLOAD_LINKED_FILES), - getBoolean(RUN_AUTOMATIC_FILE_SEARCH), - getBoolean(ALLOW_FILE_AUTO_OPEN_BROWSE)); + getBoolean(DOWNLOAD_LINKED_FILES)); } @Override @@ -2201,8 +2195,6 @@ public void storeFilePreferences(FilePreferences preferences) { put(IMPORT_FILENAMEPATTERN, preferences.getFileNamePattern()); put(IMPORT_FILEDIRPATTERN, preferences.getFileDirectoryPattern()); putBoolean(DOWNLOAD_LINKED_FILES, preferences.shouldDownloadLinkedFiles()); - putBoolean(RUN_AUTOMATIC_FILE_SEARCH, preferences.shouldSearchFilesOnOpen()); - putBoolean(ALLOW_FILE_AUTO_OPEN_BROWSE, preferences.shouldOpenBrowseOnCreate()); } @Override diff --git a/src/test/java/org/jabref/preferences/FilePreferenceTest.java b/src/test/java/org/jabref/preferences/FilePreferenceTest.java index d97efe91c86..2f8c814054f 100644 --- a/src/test/java/org/jabref/preferences/FilePreferenceTest.java +++ b/src/test/java/org/jabref/preferences/FilePreferenceTest.java @@ -19,14 +19,15 @@ public class FilePreferenceTest { private final String testFileNamePattern = "test"; private final String testFileDirPattern = "test"; private final boolean shouldDownloadLinkedFiles = false; - private final boolean shouldSearchFilesOnOpen = false; - private final boolean shouldOpenBrowseOnCreate = false; @BeforeEach public void setup() { - filePreferences = new FilePreferences(testUser, testMainFileDirectory, shouldStoreFilesRelativeToBibFile, - testFileNamePattern, testFileDirPattern, shouldDownloadLinkedFiles, shouldSearchFilesOnOpen, - shouldOpenBrowseOnCreate); + filePreferences = new FilePreferences(testUser, + testMainFileDirectory, + shouldStoreFilesRelativeToBibFile, + testFileNamePattern, + testFileDirPattern, + shouldDownloadLinkedFiles); } @Test @@ -41,9 +42,12 @@ public void getFileDirectoryNonEmptyTest() { @Test public void getFileDirectoryEmptyTest() { - filePreferences = new FilePreferences(testUser, "", shouldStoreFilesRelativeToBibFile, - testFileNamePattern, testFileDirPattern, shouldDownloadLinkedFiles, shouldSearchFilesOnOpen, - shouldOpenBrowseOnCreate); + filePreferences = new FilePreferences(testUser, + "", + shouldStoreFilesRelativeToBibFile, + testFileNamePattern, + testFileDirPattern, + shouldDownloadLinkedFiles); assertEquals(Optional.empty(), filePreferences.getFileDirectory()); } @@ -71,21 +75,14 @@ public void shouldDownloadLinkedFilesTest() { @ParameterizedTest @ValueSource(booleans = {true, false}) public void withShouldDownloadLinkedFilesTest(boolean newShouldDownloadLinkedFiles) { - FilePreferences expected = new FilePreferences(testUser, testMainFileDirectory, shouldStoreFilesRelativeToBibFile, - testFileNamePattern, testFileDirPattern, newShouldDownloadLinkedFiles, shouldSearchFilesOnOpen, - shouldOpenBrowseOnCreate); + FilePreferences expected = new FilePreferences(testUser, + testMainFileDirectory, + shouldStoreFilesRelativeToBibFile, + testFileNamePattern, + testFileDirPattern, + newShouldDownloadLinkedFiles); assertEquals(expected.shouldDownloadLinkedFiles(), filePreferences.withShouldDownloadLinkedFiles(newShouldDownloadLinkedFiles).shouldDownloadLinkedFiles()); } - - @Test - public void shouldSearchFilesOnOpenTest() { - assertEquals(shouldSearchFilesOnOpen, filePreferences.shouldSearchFilesOnOpen()); - } - - @Test - public void shouldOpenBrowseOnCreateTest() { - assertEquals(shouldOpenBrowseOnCreate, filePreferences.shouldOpenBrowseOnCreate()); - } } From 861ad2053cc0c45d328b31ce7575e77bd812b80a Mon Sep 17 00:00:00 2001 From: Carl Christian Snethlage Date: Mon, 18 Oct 2021 21:21:59 +0200 Subject: [PATCH 2/2] CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 59eea617342..82ff46b4e4d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -52,7 +52,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve ### Removed - +- We removed two orphaned preferences options [#8164](https://github.com/JabRef/jabref/pull/8164)