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

Autosave folder and checkbox is remembered #9000

Merged
merged 2 commits into from
Jul 29, 2022
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve
- We fixed "Error while sending to JabRef" when the browser extension interacts with JabRef. [JabRef-Browser-Extension#479](https://github.com/JabRef/JabRef-Browser-Extension/issues/479)
- We fixed a bug where updating group view mode (intersection or union) requires re-selecting groups to take effect. [#6998](https://github.com/JabRef/jabref/issues/6998)
- We fixed a bug that prevented external group metadata changes from being merged. [#8873](https://github.com/JabRef/jabref/issues/8873)
- We fixed the shared database opening dialog to remember autosave folder and tick. [#7516](https://github.com/JabRef/jabref/issues/7516)

### Removed

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,9 @@ private void setPreferences() {
}

sharedDatabasePreferences.setRememberPassword(rememberPassword.get());

sharedDatabasePreferences.setFolder(folder.getValue());
sharedDatabasePreferences.setAutosave(autosave.get());
}

/**
Expand All @@ -225,6 +228,8 @@ private void applyPreferences() {
Optional<String> sharedDatabaseUser = sharedDatabasePreferences.getUser();
Optional<String> sharedDatabasePassword = sharedDatabasePreferences.getPassword();
boolean sharedDatabaseRememberPassword = sharedDatabasePreferences.getRememberPassword();
Optional<String> sharedDatabaseFolder = sharedDatabasePreferences.getFolder();
boolean sharedDatabaseAutosave = sharedDatabasePreferences.getAutosave();
Optional<String> sharedDatabaseKeystoreFile = sharedDatabasePreferences.getKeyStoreFile();

if (sharedDatabaseType.isPresent()) {
Expand All @@ -248,6 +253,9 @@ private void applyPreferences() {
}

rememberPassword.set(sharedDatabaseRememberPassword);

sharedDatabaseFolder.ifPresent(folder::set);
autosave.set(sharedDatabaseAutosave);
}

private boolean isSharedDatabaseAlreadyPresent(DBMSConnectionProperties connectionProperties) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ public class SharedDatabasePreferences {
private static final String SHARED_DATABASE_NAME = "sharedDatabaseName";
private static final String SHARED_DATABASE_USER = "sharedDatabaseUser";
private static final String SHARED_DATABASE_PASSWORD = "sharedDatabasePassword";
private static final String SHARED_DATABASE_FOLDER = "sharedDatabaseFolder";
private static final String SHARED_DATABASE_AUTOSAVE = "sharedDatabaseAutosave";
private static final String SHARED_DATABASE_REMEMBER_PASSWORD = "sharedDatabaseRememberPassword";
private static final String SHARED_DATABASE_USE_SSL = "sharedDatabaseUseSSL";
private static final String SHARED_DATABASE_KEYSTORE_FILE = "sharedDatabaseKeyStoreFile";
Expand Down Expand Up @@ -77,6 +79,14 @@ public boolean getRememberPassword() {
return internalPrefs.getBoolean(SHARED_DATABASE_REMEMBER_PASSWORD, false);
}

public Optional<String> getFolder() {
return getOptionalValue(SHARED_DATABASE_FOLDER);
}

public boolean getAutosave() {
return internalPrefs.getBoolean(SHARED_DATABASE_AUTOSAVE, false);
}

public boolean isUseSSL() {
return internalPrefs.getBoolean(SHARED_DATABASE_USE_SSL, false);
}
Expand Down Expand Up @@ -109,6 +119,14 @@ public void setRememberPassword(boolean rememberPassword) {
internalPrefs.putBoolean(SHARED_DATABASE_REMEMBER_PASSWORD, rememberPassword);
}

public void setFolder(String folder) {
internalPrefs.put(SHARED_DATABASE_FOLDER, folder);
}

public void setAutosave(boolean autosave) {
internalPrefs.putBoolean(SHARED_DATABASE_AUTOSAVE, autosave);
}

public void setUseSSL(boolean useSSL) {
internalPrefs.putBoolean(SHARED_DATABASE_USE_SSL, useSSL);
}
Expand Down