Skip to content

Commit

Permalink
Open theme browse in last css dir (#11597)
Browse files Browse the repository at this point in the history
* Open theme browse in last css dir

* add changelog
  • Loading branch information
Siedlerchr authored Aug 7, 2024
1 parent 37d8119 commit 048c1c9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
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

0 comments on commit 048c1c9

Please sign in to comment.