From 1301384ab5e4985e8e8355af823eca5d18ee340c Mon Sep 17 00:00:00 2001
From: christinait2022 <108340512+christinait2022@users.noreply.github.com>
Date: Mon, 4 Jul 2022 04:50:38 +0800
Subject: [PATCH] move "Warn about duplicates on import" preferences option
(#8937)
---
CHANGELOG.md | 3 ++-
.../org/jabref/gui/preferences/file/FileTab.fxml | 1 -
.../org/jabref/gui/preferences/file/FileTab.java | 2 --
.../gui/preferences/file/FileTabViewModel.java | 7 -------
.../preferences/importexport/ImportExportTab.fxml | 1 +
.../preferences/importexport/ImportExportTab.java | 6 +++++-
.../importexport/ImportExportTabViewModel.java | 13 ++++++++++++-
7 files changed, 20 insertions(+), 13 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0a7fe09edb2..b24f8d7f46f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -34,10 +34,11 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve
- We improved group expansion arrow that prevent it from activating group when expanding or collapsing. [#7982](https://github.com/JabRef/jabref/issues/7982), [#3176](https://github.com/JabRef/jabref/issues/3176)
- When configured SSL certificates changed, JabRef warns the user to restart to apply the configuration.
- We improved the appearances and logic of the "Manage field names & content" dialog, and renamed it to "Automatic field editor". [#6536](https://github.com/JabRef/jabref/issues/6536)
-- We fixed an issue that caused JabRef to sometimes open multiple instances when "Remote Operation" is enabled. [#8653](https://github.com/JabRef/jabref/issues/8653)
+- We moved the preferences option "Warn about duplicates on import" option from the tab "File" to the tab "Import and Export". [kopper#570](https://github.com/koppor/jabref/issues/570)
### Fixed
+- We fixed an issue that caused JabRef to sometimes open multiple instances when "Remote Operation" is enabled. [#8653](https://github.com/JabRef/jabref/issues/8653)
- We fixed an issue where linked files with the filetype "application/pdf" in an entry were not shown with the correct PDF-Icon in the main table [8930](https://github.com/JabRef/jabref/issues/8930)
- We fixed an issue where "open folder" for linked files did not open the folder and did not select the file unter certain Linux desktop environments [#8679](https://github.com/JabRef/jabref/issues/8679), [#8849](https://github.com/JabRef/jabref/issues/8849)
- We fixed an issue where the content of a big shared database library is not shown [#8788](https://github.com/JabRef/jabref/issues/8788)
diff --git a/src/main/java/org/jabref/gui/preferences/file/FileTab.fxml b/src/main/java/org/jabref/gui/preferences/file/FileTab.fxml
index 8666dfd973f..59b1d7f0e90 100644
--- a/src/main/java/org/jabref/gui/preferences/file/FileTab.fxml
+++ b/src/main/java/org/jabref/gui/preferences/file/FileTab.fxml
@@ -42,5 +42,4 @@
-
diff --git a/src/main/java/org/jabref/gui/preferences/file/FileTab.java b/src/main/java/org/jabref/gui/preferences/file/FileTab.java
index f91f08650a1..88c3768df07 100644
--- a/src/main/java/org/jabref/gui/preferences/file/FileTab.java
+++ b/src/main/java/org/jabref/gui/preferences/file/FileTab.java
@@ -25,7 +25,6 @@ public class FileTab extends AbstractPreferenceTabView impleme
@FXML private RadioButton resolveStrings;
@FXML private TextField resolveStringsForFields;
@FXML private CheckBox alwaysReformatBib;
- @FXML private CheckBox warnAboutDuplicatesOnImport;
@FXML private CheckBox autosaveLocalLibraries;
@FXML private Button autosaveLocalLibrariesHelp;
@@ -48,7 +47,6 @@ public void initialize() {
resolveStringsForFields.disableProperty().bind(doNotResolveStrings.selectedProperty());
alwaysReformatBib.selectedProperty().bindBidirectional(viewModel.alwaysReformatBibProperty());
- warnAboutDuplicatesOnImport.selectedProperty().bindBidirectional(viewModel.warnAboutDuplicatesOnImportProperty());
autosaveLocalLibraries.selectedProperty().bindBidirectional(viewModel.autosaveLocalLibrariesProperty());
ActionFactory actionFactory = new ActionFactory(Globals.getKeyPrefs());
diff --git a/src/main/java/org/jabref/gui/preferences/file/FileTabViewModel.java b/src/main/java/org/jabref/gui/preferences/file/FileTabViewModel.java
index abcefcd1150..3981f4d2c82 100644
--- a/src/main/java/org/jabref/gui/preferences/file/FileTabViewModel.java
+++ b/src/main/java/org/jabref/gui/preferences/file/FileTabViewModel.java
@@ -16,7 +16,6 @@ public class FileTabViewModel implements PreferenceTabViewModel {
private final BooleanProperty resolveStringsProperty = new SimpleBooleanProperty();
private final StringProperty resolveStringsForFieldsProperty = new SimpleStringProperty("");
private final BooleanProperty alwaysReformatBibProperty = new SimpleBooleanProperty();
- private final BooleanProperty warnAboutDuplicatesOnImportProperty = new SimpleBooleanProperty();
private final BooleanProperty autosaveLocalLibraries = new SimpleBooleanProperty();
private final ImportExportPreferences importExportPreferences;
@@ -34,7 +33,6 @@ public void setValues() {
resolveStringsProperty.setValue(importExportPreferences.resolveStrings());
resolveStringsForFieldsProperty.setValue(importExportPreferences.getResolvableFields());
alwaysReformatBibProperty.setValue(importExportPreferences.shouldAlwaysReformatOnSave());
- warnAboutDuplicatesOnImportProperty.setValue(importExportPreferences.shouldWarnAboutDuplicatesOnImport());
autosaveLocalLibraries.setValue(importExportPreferences.shouldAutoSave());
}
@@ -45,7 +43,6 @@ public void storeSettings() {
importExportPreferences.setNonWrappableFields(noWrapFilesProperty.getValue().trim());
importExportPreferences.setResolvableFields(resolveStringsForFieldsProperty.getValue().trim());
importExportPreferences.setAlwaysReformatOnSave(alwaysReformatBibProperty.getValue());
- importExportPreferences.setWarnAboutDuplicatesOnImport(warnAboutDuplicatesOnImportProperty.getValue());
importExportPreferences.setAutoSave(autosaveLocalLibraries.getValue());
}
@@ -77,10 +74,6 @@ public BooleanProperty alwaysReformatBibProperty() {
return alwaysReformatBibProperty;
}
- public BooleanProperty warnAboutDuplicatesOnImportProperty() {
- return warnAboutDuplicatesOnImportProperty;
- }
-
// Autosave
public BooleanProperty autosaveLocalLibrariesProperty() {
return autosaveLocalLibraries;
diff --git a/src/main/java/org/jabref/gui/preferences/importexport/ImportExportTab.fxml b/src/main/java/org/jabref/gui/preferences/importexport/ImportExportTab.fxml
index 7d3756d1bb0..a1fc3bbb64d 100644
--- a/src/main/java/org/jabref/gui/preferences/importexport/ImportExportTab.fxml
+++ b/src/main/java/org/jabref/gui/preferences/importexport/ImportExportTab.fxml
@@ -16,6 +16,7 @@
+
diff --git a/src/main/java/org/jabref/gui/preferences/importexport/ImportExportTab.java b/src/main/java/org/jabref/gui/preferences/importexport/ImportExportTab.java
index 24e03dc5578..86fc0ba223a 100644
--- a/src/main/java/org/jabref/gui/preferences/importexport/ImportExportTab.java
+++ b/src/main/java/org/jabref/gui/preferences/importexport/ImportExportTab.java
@@ -32,6 +32,8 @@ public class ImportExportTab extends AbstractPreferenceTabView apiKeySelector.getSelectionModel().selectFirst());
+
+ warnAboutDuplicatesOnImport.selectedProperty().bindBidirectional(viewModel.warnAboutDuplicatesOnImportProperty());
}
private void updateFetcherApiKey(FetcherApiKey apiKey) {
diff --git a/src/main/java/org/jabref/gui/preferences/importexport/ImportExportTabViewModel.java b/src/main/java/org/jabref/gui/preferences/importexport/ImportExportTabViewModel.java
index e8d31ab8737..3c3fe3472bd 100644
--- a/src/main/java/org/jabref/gui/preferences/importexport/ImportExportTabViewModel.java
+++ b/src/main/java/org/jabref/gui/preferences/importexport/ImportExportTabViewModel.java
@@ -34,6 +34,7 @@
import org.jabref.model.entry.field.Field;
import org.jabref.model.entry.field.FieldFactory;
import org.jabref.model.metadata.SaveOrderConfig;
+import org.jabref.preferences.ImportExportPreferences;
import org.jabref.preferences.PreferencesService;
public class ImportExportTabViewModel implements PreferenceTabViewModel {
@@ -55,19 +56,22 @@ public class ImportExportTabViewModel implements PreferenceTabViewModel {
private final BooleanProperty grobidEnabledProperty = new SimpleBooleanProperty();
private final StringProperty grobidURLProperty = new SimpleStringProperty("");
+ private final BooleanProperty warnAboutDuplicatesOnImportProperty = new SimpleBooleanProperty();
private final DialogService dialogService;
private final PreferencesService preferencesService;
private final DOIPreferences doiPreferences;
private final ImporterPreferences importerPreferences;
private final SaveOrderConfig initialExportOrder;
+ private final ImportExportPreferences importExportPreferences;
- public ImportExportTabViewModel(PreferencesService preferencesService, DOIPreferences doiPreferences, DialogService dialogService) {
+ public ImportExportTabViewModel(PreferencesService preferencesService, DOIPreferences doiPreferences, DialogService dialogService, ImportExportPreferences importExportPreferences) {
this.dialogService = dialogService;
this.preferencesService = preferencesService;
this.importerPreferences = preferencesService.getImporterPreferences();
this.doiPreferences = doiPreferences;
this.initialExportOrder = preferencesService.getExportSaveOrder();
+ this.importExportPreferences = importExportPreferences;
}
@Override
@@ -75,6 +79,7 @@ public void setValues() {
generateKeyOnImportProperty.setValue(importerPreferences.isGenerateNewKeyOnImport());
useCustomDOIProperty.setValue(doiPreferences.isUseCustom());
useCustomDOINameProperty.setValue(doiPreferences.getDefaultBaseURI());
+ warnAboutDuplicatesOnImportProperty.setValue(importExportPreferences.shouldWarnAboutDuplicatesOnImport());
switch (initialExportOrder.getOrderType()) {
case SPECIFIED -> exportInSpecifiedOrderProperty.setValue(true);
@@ -111,6 +116,8 @@ public void storeSettings() {
sortCriteriaProperty.stream().map(SortCriterionViewModel::getCriterion).toList());
preferencesService.storeExportSaveOrder(newSaveOrderConfig);
+ importExportPreferences.setWarnAboutDuplicatesOnImport(warnAboutDuplicatesOnImportProperty.getValue());
+
// API keys
preferencesService.getImporterPreferences().getApiKeys().clear();
preferencesService.getImporterPreferences().getApiKeys().addAll(apiKeys);
@@ -166,6 +173,10 @@ public ObjectProperty selectedApiKeyProperty() {
return selectedApiKeyProperty;
}
+ public BooleanProperty warnAboutDuplicatesOnImportProperty() {
+ return warnAboutDuplicatesOnImportProperty;
+ }
+
public void checkCustomApiKey() {
final String apiKeyName = selectedApiKeyProperty.get().getName();