Skip to content

Commit 89316e6

Browse files
Make Web Search 'Configure API key' searchable in preferences #13929 (#13982)
* Make Web Search 'Configure API key' searchable in preferences * Fix Checkstyle empty line issues in PreferencesTab and WebSearchTab * Trigger CI after updating PR description * Fix failing LocalizationConsistencyTest: add missing 'Custom API key' entry * Add changelog entry for searchable API key preferences * Fix list formatting in changelog * Move changelog entry to Unreleased section * Trigger CI * Update changelog wording based on reviewer suggestion
1 parent 32a9a68 commit 89316e6

File tree

5 files changed

+21
-1
lines changed

5 files changed

+21
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv
1111

1212
### Added
1313

14+
- We made the "Configure API key" option in the Web Search preferences tab searchable via preferences search. [#13929](https://github.com/JabRef/jabref/issues/13929)
1415
- We added the integrity check to the jabkit cli application. [#13848](https://github.com/JabRef/jabref/issues/13848)
1516
- We added support for Cygwin-file paths on a Windows Operating System. [#13274](https://github.com/JabRef/jabref/issues/13274)
1617
- We fixed an issue where "Print preview" would throw a `NullPointerException` if no printers were available. [#13708](https://github.com/JabRef/jabref/issues/13708)

jabgui/src/main/java/org/jabref/gui/preferences/PreferencesSearchHandler.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ public void filterTabs(String query) {
7070
* @return True if the tab matches the query.
7171
*/
7272
private boolean tabMatchesQuery(PreferencesTab tab, String query) {
73-
boolean tabNameMatches = tab.getTabName().toLowerCase(Locale.ROOT).contains(query);
73+
boolean tabNameMatches = tab.getSearchKeywords().stream()
74+
.anyMatch(keyword -> keyword.toLowerCase(Locale.ROOT).contains(query));
7475

7576
boolean controlMatches = preferenceTabsControls.get(tab).stream()
7677
.filter(control -> controlMatchesQuery(control, query))

jabgui/src/main/java/org/jabref/gui/preferences/PreferencesTab.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111
*/
1212
public interface PreferencesTab {
1313

14+
default List<String> getSearchKeywords() {
15+
return List.of(getTabName());
16+
}
17+
1418
Node getBuilder();
1519

1620
/**

jabgui/src/main/java/org/jabref/gui/preferences/websearch/WebSearchTab.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package org.jabref.gui.preferences.websearch;
22

3+
import java.util.List;
34
import java.util.Optional;
45

56
import javafx.beans.InvalidationListener;
@@ -56,6 +57,18 @@ public WebSearchTab(ReadOnlyBooleanProperty refAiEnabled) {
5657
.load();
5758
}
5859

60+
@Override
61+
public List<String> getSearchKeywords() {
62+
return List.of(
63+
getTabName(),
64+
Localization.lang("Configure API key"),
65+
Localization.lang("Custom API key"),
66+
"api",
67+
"api key",
68+
"apikey"
69+
);
70+
}
71+
5972
@Override
6073
public String getTabName() {
6174
return Localization.lang("Web search");

jablib/src/main/resources/l10n/JabRef_en.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2008,6 +2008,7 @@ JabRef\ cannot\ access\ the\ file\ because\ it\ is\ being\ used\ by\ another\ pr
20082008
Remove\ line\ breaks=Remove line breaks
20092009
Removes\ all\ line\ breaks\ in\ the\ field\ content.=Removes all line breaks in the field content.
20102010
Web\ search\ fetchers=Web search fetchers
2011+
Custom\ API\ key=Custom API key
20112012
API\ Key\ for\ %0=API Key for %0
20122013
Test\ connection=Test connection
20132014
API\ Key=API Key

0 commit comments

Comments
 (0)