Skip to content

Commit

Permalink
fix logic
Browse files Browse the repository at this point in the history
  • Loading branch information
Siedlerchr committed Nov 6, 2023
1 parent 97fa0c9 commit 1a531e7
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 10 deletions.
5 changes: 3 additions & 2 deletions src/main/java/org/jabref/gui/LibraryTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,7 @@ private boolean showDeleteConfirmationDialog(int numberOfEntries) {
* @return true if user confirm to delete attached files
*/
private boolean showLinkedFileDeleteConfirmationDialog(List<LinkedFile> linkedFileList) {
if (preferencesService.getFilePreferences().alwaysDeleteLinkedFile()) {
if (preferencesService.getFilePreferences().confirmDeleteLinkedFile()) {
return true;
}
String title = Localization.lang("Delete attached file(s)");
Expand All @@ -755,7 +755,8 @@ private boolean showLinkedFileDeleteConfirmationDialog(List<LinkedFile> linkedFi
okButton,
cancelButton,
Localization.lang("Always delete attached file(s)"),
optOut -> preferencesService.getFilePreferences().setAlwaysDeleteLinkedFile(optOut));
// false => confirm delete
optOut -> preferencesService.getFilePreferences().confirmDeleteLinkedFile(!optOut));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,6 @@
</GridPane>

<Label styleClass="sectionHeader" text="%Attached files"/>
<CheckBox fx:id="confirmLinkedFileDelete" text="%Always delete attached file(s)"/>
<CheckBox fx:id="confirmLinkedFileDelete" text="%Show confirmation dialog when deleting files"/>

</fx:root>
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public void setValues() {
fulltextIndex.setValue(filePreferences.shouldFulltextIndexLinkedFiles());
fileNamePatternProperty.setValue(filePreferences.getFileNamePattern());
fileDirectoryPatternProperty.setValue(filePreferences.getFileDirectoryPattern());
confirmLinkedFileDeleteProperty.setValue(filePreferences.alwaysDeleteLinkedFile());
confirmLinkedFileDeleteProperty.setValue(filePreferences.confirmDeleteLinkedFile());

// Autolink preferences
switch (autoLinkPreferences.getCitationKeyDependency()) {
Expand Down Expand Up @@ -112,7 +112,7 @@ public void storeSettings() {
}

autoLinkPreferences.setRegularExpression(autolinkRegexKeyProperty.getValue());
filePreferences.setAlwaysDeleteLinkedFile(confirmLinkedFileDeleteProperty.getValue());
filePreferences.confirmDeleteLinkedFile(confirmLinkedFileDeleteProperty.getValue());
}

ValidationStatus mainFileDirValidationStatus() {
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/org/jabref/preferences/FilePreferences.java
Original file line number Diff line number Diff line change
Expand Up @@ -184,15 +184,15 @@ public Path getBackupDirectory() {
return this.backupDirectory.getValue();
}

public boolean alwaysDeleteLinkedFile() {
public boolean confirmDeleteLinkedFile() {
return confirmDeleteLinkedFile.get();
}

public BooleanProperty alwaysDeleteLinkedFileProperty() {
public BooleanProperty confirmDeleteLinkedFileProperty() {
return confirmDeleteLinkedFile;
}

public void setAlwaysDeleteLinkedFile(boolean confirmLinkedFileDelete) {
public void confirmDeleteLinkedFile(boolean confirmLinkedFileDelete) {
this.confirmDeleteLinkedFile.set(confirmLinkedFileDelete);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2176,7 +2176,7 @@ public FilePreferences getFilePreferences() {
put(EXTERNAL_FILE_TYPES, ExternalFileTypes.toStringList(filePreferences.getExternalFileTypes())));
EasyBind.listen(filePreferences.createBackupProperty(), (obs, oldValue, newValue) -> putBoolean(CREATE_BACKUP, newValue));
EasyBind.listen(filePreferences.backupDirectoryProperty(), (obs, oldValue, newValue) -> put(BACKUP_DIRECTORY, newValue.toString()));
EasyBind.listen(filePreferences.alwaysDeleteLinkedFileProperty(), (obs, oldValue, newValue) -> putBoolean(CONFIRM_LINKED_FILE_DELETE, newValue));
EasyBind.listen(filePreferences.confirmDeleteLinkedFileProperty(), (obs, oldValue, newValue) -> putBoolean(CONFIRM_LINKED_FILE_DELETE, newValue));

return filePreferences;
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/l10n/JabRef_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -855,6 +855,7 @@ Show\ 'Lastname,\ Firstname'=Show 'Lastname, Firstname'
Show\ BibTeX\ source\ by\ default=Show BibTeX source by default

Show\ confirmation\ dialog\ when\ deleting\ entries=Show confirmation dialog when deleting entries
Show\ confirmation\ dialog\ when\ deleting\ files=Show confirmation dialog when deleting files

Persist\ password\ between\ sessions=Persist password between sessions

Expand Down Expand Up @@ -2450,7 +2451,6 @@ On\ page\ %0=On page %0
Found\ matches\ in\ Annotations\:=Found matches in Annotations:
Attached\ files=Attached files
Always\ delete\ attached\ file(s)=Always delete attached file(s)
Delete\ attached\ file(s)=Delete attached file(s)
Following\ attached\ file(s)\ will\ be\ deleted=Following attached file(s) will be deleted
Delete\ attached\ files=Delete attached files
Expand Down

0 comments on commit 1a531e7

Please sign in to comment.