From 4de946bda93cb9244b5d42bba34cd93b9c30f71f Mon Sep 17 00:00:00 2001 From: Siedlerchr Date: Fri, 3 Dec 2021 20:40:22 +0100 Subject: [PATCH] Apply search string to open library when keep search string is selected Add title to window Fixes part of #8054 --- src/main/java/org/jabref/gui/JabRefFrame.java | 7 ++++++- .../org/jabref/gui/search/GlobalSearchResultDialog.java | 2 ++ src/main/resources/l10n/JabRef_en.properties | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/jabref/gui/JabRefFrame.java b/src/main/java/org/jabref/gui/JabRefFrame.java index edb26429e3b..d93a51e9633 100644 --- a/src/main/java/org/jabref/gui/JabRefFrame.java +++ b/src/main/java/org/jabref/gui/JabRefFrame.java @@ -634,7 +634,12 @@ public void init() { stateManager.setSelectedEntries(libraryTab.getSelectedEntries()); // Update active search query when switching between databases - stateManager.activeSearchQueryProperty().set(libraryTab.getCurrentSearchQuery()); + if (prefs.getSearchPreferences().shouldKeepSearchString() && libraryTab.getCurrentSearchQuery().isEmpty() && stateManager.activeSearchQueryProperty().get().isPresent()) { + // apply search query also when opening a new library and keep search string is activated + libraryTab.setCurrentSearchQuery(stateManager.activeSearchQueryProperty().get()); + } else { + stateManager.activeSearchQueryProperty().set(libraryTab.getCurrentSearchQuery()); + } // Update search autocompleter with information for the correct database: libraryTab.updateSearchManager(); diff --git a/src/main/java/org/jabref/gui/search/GlobalSearchResultDialog.java b/src/main/java/org/jabref/gui/search/GlobalSearchResultDialog.java index 5787897b98c..94707f68729 100644 --- a/src/main/java/org/jabref/gui/search/GlobalSearchResultDialog.java +++ b/src/main/java/org/jabref/gui/search/GlobalSearchResultDialog.java @@ -16,6 +16,7 @@ import org.jabref.gui.maintable.columns.SpecialFieldColumn; import org.jabref.gui.preview.PreviewViewer; import org.jabref.gui.util.BaseDialog; +import org.jabref.logic.l10n.Localization; import org.jabref.preferences.PreferencesService; import com.airhacks.afterburner.views.ViewLoader; @@ -39,6 +40,7 @@ public GlobalSearchResultDialog(ExternalFileTypes externalFileTypes, UndoManager this.undoManager = undoManager; this.externalFileTypes = externalFileTypes; + setTitle(Localization.lang("Search results from open libraries")); ViewLoader.view(this) .load() .setAsDialogPane(this); diff --git a/src/main/resources/l10n/JabRef_en.properties b/src/main/resources/l10n/JabRef_en.properties index 13bfc059c62..4dc5a2b677c 100644 --- a/src/main/resources/l10n/JabRef_en.properties +++ b/src/main/resources/l10n/JabRef_en.properties @@ -2395,3 +2395,4 @@ Could\ not\ extract\ Metadata\ from\:\ %0=Could not extract Metadata from: %0 Search\ across\ libraries\ in\ a\ new\ window=Search across libraries in a new window Keep\ search\ string\ across\ libraries=Keep search string across libraries Keep\ dialog\ always\ on\ top=Keep dialog always on top +Search\ results\ from\ open\ libraries=Search results from open libraries