Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix bug where main file directory is not set correctly #5215

Merged
merged 1 commit into from
Aug 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ public FileTabViewModel(DialogService dialogService, JabRefPreferences preferenc
);
}

@Override
public void setValues() {
openLastStartupProperty.setValue(preferences.getBoolean(JabRefPreferences.OPEN_LAST_EDITED));
backupOldFileProperty.setValue(preferences.getBoolean(JabRefPreferences.BACKUP));
Expand All @@ -88,7 +89,7 @@ public void setValues() {
selectedNewLineSeparatorProperty.setValue(preferences.getNewLineSeparator());
alwaysReformatBibProperty.setValue(preferences.getBoolean(JabRefPreferences.REFORMAT_FILE_ON_SAVE_AND_EXPORT));

mainFileDirProperty.setValue(preferences.getAsOptional(StandardField.FILE + FilePreferences.DIR_SUFFIX).orElse(""));
mainFileDirProperty.setValue(preferences.getAsOptional(StandardField.FILE.getName() + FilePreferences.DIR_SUFFIX).orElse(""));
useBibLocationAsPrimaryProperty.setValue(preferences.getBoolean(JabRefPreferences.BIB_LOC_AS_PRIMARY_DIR));
if (preferences.getBoolean(JabRefPreferences.AUTOLINK_USE_REG_EXP_SEARCH_KEY)) { // Flipped around
autolinkUseRegexProperty.setValue(true);
Expand All @@ -104,6 +105,7 @@ public void setValues() {
autosaveLocalLibraries.setValue(preferences.getBoolean(JabRefPreferences.LOCAL_AUTO_SAVE));
}

@Override
public void storeSettings() {
preferences.putBoolean(JabRefPreferences.OPEN_LAST_EDITED, openLastStartupProperty.getValue());
preferences.putBoolean(JabRefPreferences.BACKUP, backupOldFileProperty.getValue());
Expand All @@ -119,7 +121,7 @@ public void storeSettings() {
preferences.setNewLineSeparator(selectedNewLineSeparatorProperty.getValue());
preferences.putBoolean(JabRefPreferences.REFORMAT_FILE_ON_SAVE_AND_EXPORT, alwaysReformatBibProperty.getValue());

preferences.put(StandardField.FILE + FilePreferences.DIR_SUFFIX, mainFileDirProperty.getValue());
preferences.put(StandardField.FILE.getName() + FilePreferences.DIR_SUFFIX, mainFileDirProperty.getValue());
preferences.putBoolean(JabRefPreferences.BIB_LOC_AS_PRIMARY_DIR, useBibLocationAsPrimaryProperty.getValue());
preferences.putBoolean(JabRefPreferences.AUTOLINK_USE_REG_EXP_SEARCH_KEY, autolinkUseRegexProperty.getValue());
preferences.putBoolean(JabRefPreferences.AUTOLINK_EXACT_KEY_ONLY, autolinkFileExactBibtexProperty.getValue());
Expand All @@ -133,6 +135,7 @@ ValidationStatus mainFileDirValidationStatus() {
return mainFileDirValidator.getValidationStatus();
}

@Override
public boolean validateSettings() {
ValidationStatus status = mainFileDirValidationStatus();
if (!status.isValid()) {
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/org/jabref/preferences/JabRefPreferences.java
Original file line number Diff line number Diff line change
Expand Up @@ -896,6 +896,7 @@ private static void insertDefaultCleanupPreset(Map<String, Object> storage) {
storage.put(CLEANUP_FORMATTERS, convertListToString(Cleanups.DEFAULT_SAVE_ACTIONS.getAsStringList(OS.NEWLINE)));
}

@Override
public EntryEditorPreferences getEntryEditorPreferences() {
return new EntryEditorPreferences(getEntryEditorTabList(),
getLatexFieldFormatterPreferences(),
Expand Down Expand Up @@ -1589,7 +1590,7 @@ private NameFormatterPreferences getNameFormatterPreferences() {

public FileLinkPreferences getFileLinkPreferences() {
return new FileLinkPreferences(
Collections.singletonList(get(StandardField.FILE + FilePreferences.DIR_SUFFIX)),
Collections.singletonList(get(StandardField.FILE.getName() + FilePreferences.DIR_SUFFIX)),
fileDirForDatabase);
}

Expand Down Expand Up @@ -2034,6 +2035,7 @@ public Map<String, SortType> getMainTableColumnSortTypes() {
return map;
}

@Override
public FileDragDropPreferenceType getEntryEditorFileLinkPreference() {
return FileDragDropPreferenceType.valueOf(get(ENTRY_EDITOR_DRAG_DROP_PREFERENCE_TYPE));
}
Expand Down