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

Open theme browse in last css dir #11597

Merged
merged 2 commits into from
Aug 7, 2024
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 @@ -32,6 +32,7 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv
- JabRef does not show finished background tasks in the status bar popup. [#11574](https://github.com/JabRef/jabref/pull/11574)
- We enhanced the indexing speed. [#11502](https://github.com/JabRef/jabref/pull/11502)
- ⚠️ Renamed command line parameters `embeddBibfileInPdf` to `embedBibFileInPdf`, `writeMetadatatoPdf` to `writeMetadataToPdf`, and `writeXMPtoPdf` to `writeXmpToPdf`. [#11575](https://github.com/JabRef/jabref/pull/11575)
- The browse button for a Custom theme now opens in the directory of the current used CSS file [#11597](https://github.com/JabRef/jabref/pull/11597)

### Fixed

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ public class GeneralTabViewModel implements PreferenceTabViewModel {

private final BooleanProperty themeSyncOsProperty = new SimpleBooleanProperty();

private final StringProperty customPathToThemeProperty = new SimpleStringProperty();
// init with empty string to avoid npe in accessing
private final StringProperty customPathToThemeProperty = new SimpleStringProperty("");

private final BooleanProperty fontOverrideProperty = new SimpleBooleanProperty();
private final StringProperty fontSizeProperty = new SimpleStringProperty();
Expand Down Expand Up @@ -334,10 +335,14 @@ public StringProperty customPathToThemeProperty() {
}

public void importCSSFile() {

String fileDir = customPathToThemeProperty.getValue().isEmpty() ? preferences.getInternalPreferences().getLastPreferencesExportPath().toString()
: customPathToThemeProperty.getValue();

FileDialogConfiguration fileDialogConfiguration = new FileDialogConfiguration.Builder()
.addExtensionFilter(StandardFileType.CSS)
.withDefaultExtension(StandardFileType.CSS)
.withInitialDirectory(preferences.getInternalPreferences().getLastPreferencesExportPath()).build();
.withInitialDirectory(fileDir).build();

dialogService.showFileOpenDialog(fileDialogConfiguration).ifPresent(file ->
customPathToThemeProperty.setValue(file.toAbsolutePath().toString()));
Expand Down
Loading