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

Add button for a user to reset the cite command to the default value. #10580

Merged
merged 3 commits into from
Oct 26, 2023
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 @@ -12,6 +12,7 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv
### Added

- We added a dropdown menu to let users change the reference library during AUX file import. [#10472](https://github.com/JabRef/jabref/issues/10472)
- We added a button to let users reset the cite command to the default value. [#10569](https://github.com/JabRef/jabref/issues/10569)

### Changed

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="200.0"/>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="200.0"/>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="150.0"/>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="20.0"/>
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" vgrow="SOMETIMES"/>
Expand All @@ -60,6 +60,15 @@
styleClass="icon-button,narrow"
prefHeight="20.0" prefWidth="20.0"
GridPane.columnIndex="2" GridPane.rowIndex="2"/>
<Button styleClass="icon-button,narrow" onAction="#resetCiteCommandToDefault"
prefHeight="20.0" prefWidth="20.0" GridPane.columnIndex="3" GridPane.rowIndex="2">
<graphic>
<JabRefIconView glyph="REFRESH"/>
</graphic>
<tooltip>
<Tooltip text="%Reset to default"/>
</tooltip>
</Button>
</GridPane>
</HBox>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,9 @@ void useTerminalCommandBrowse() {
void useFileBrowserSpecialCommandBrowse() {
viewModel.customFileBrowserBrowse();
}

@FXML
void resetCiteCommandToDefault() {
viewModel.resetCiteCommandToDefault();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -227,4 +227,8 @@ public BooleanProperty useCustomFileBrowserProperty() {
public StringProperty customFileBrowserCommandProperty() {
return this.customFileBrowserCommandProperty;
}

public void resetCiteCommandToDefault() {
this.citeCommandProperty.setValue(preferences.getExternalApplicationsPreferences().getDefaultCiteCommand());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ public class ExternalApplicationsPreferences {
private final BooleanProperty shouldAutoOpenEmailAttachmentsFolder;
private final StringProperty citeCommand;

private final StringProperty defaultCiteCommand;

private final BooleanProperty useCustomTerminal;
private final StringProperty customTerminalCommand;
private final BooleanProperty useCustomFileBrowser;
Expand All @@ -20,6 +22,7 @@ public class ExternalApplicationsPreferences {
public ExternalApplicationsPreferences(String eMailSubject,
boolean shouldAutoOpenEmailAttachmentsFolder,
String citeCommand,
String defaultCiteCommand,
boolean useCustomTerminal,
String customTerminalCommand,
boolean useCustomFileBrowser,
Expand All @@ -29,6 +32,7 @@ public ExternalApplicationsPreferences(String eMailSubject,
this.eMailSubject = new SimpleStringProperty(eMailSubject);
this.shouldAutoOpenEmailAttachmentsFolder = new SimpleBooleanProperty(shouldAutoOpenEmailAttachmentsFolder);
this.citeCommand = new SimpleStringProperty(citeCommand);
this.defaultCiteCommand = new SimpleStringProperty(defaultCiteCommand);
this.useCustomTerminal = new SimpleBooleanProperty(useCustomTerminal);
this.customTerminalCommand = new SimpleStringProperty(customTerminalCommand);
this.useCustomFileBrowser = new SimpleBooleanProperty(useCustomFileBrowser);
Expand Down Expand Up @@ -131,4 +135,8 @@ public StringProperty kindleEmailProperty() {
public void setKindleEmail(String kindleEmail) {
this.kindleEmail.set(kindleEmail);
}

public String getDefaultCiteCommand() {
return defaultCiteCommand.getValue();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1791,6 +1791,7 @@ public ExternalApplicationsPreferences getExternalApplicationsPreferences() {
get(EMAIL_SUBJECT),
getBoolean(OPEN_FOLDERS_OF_ATTACHED_FILES),
get(CITE_COMMAND),
(String) defaults.get(CITE_COMMAND),
!getBoolean(USE_DEFAULT_CONSOLE_APPLICATION), // mind the !
get(CONSOLE_COMMAND),
!getBoolean(USE_DEFAULT_FILE_BROWSER_APPLICATION), // mind the !
Expand Down
Loading