2121import org .jabref .gui .preferences .PreferenceTabViewModel ;
2222import org .jabref .gui .slr .StudyCatalogItem ;
2323import org .jabref .logic .FilePreferences ;
24+ import org .jabref .logic .LibraryPreferences ;
2425import org .jabref .logic .importer .ImportFormatPreferences ;
2526import org .jabref .logic .importer .ImporterPreferences ;
2627import org .jabref .logic .importer .SearchBasedFetcher ;
@@ -48,6 +49,9 @@ public class WebSearchTabViewModel implements PreferenceTabViewModel {
4849 new SimpleListProperty <>(FXCollections .observableArrayList (PlainCitationParserChoice .values ()));
4950 private final ObjectProperty <PlainCitationParserChoice > defaultPlainCitationParser = new SimpleObjectProperty <>();
5051
52+ private final BooleanProperty addImportedEntries = new SimpleBooleanProperty ();
53+ private final StringProperty addImportedEntriesGroupName = new SimpleStringProperty ("" );
54+
5155 private final BooleanProperty useCustomDOIProperty = new SimpleBooleanProperty ();
5256 private final StringProperty useCustomDOINameProperty = new SimpleStringProperty ("" );
5357
@@ -67,6 +71,7 @@ public class WebSearchTabViewModel implements PreferenceTabViewModel {
6771 private final ImporterPreferences importerPreferences ;
6872 private final FilePreferences filePreferences ;
6973 private final ImportFormatPreferences importFormatPreferences ;
74+ private final LibraryPreferences libraryPreferences ;
7075
7176 private final ReadOnlyBooleanProperty refAiEnabled ;
7277
@@ -78,6 +83,7 @@ public WebSearchTabViewModel(CliPreferences preferences, DialogService dialogSer
7883 this .doiPreferences = preferences .getDOIPreferences ();
7984 this .filePreferences = preferences .getFilePreferences ();
8085 this .importFormatPreferences = preferences .getImportFormatPreferences ();
86+ this .libraryPreferences = preferences .getLibraryPreferences ();
8187
8288 this .refAiEnabled = refAiEnabled ;
8389
@@ -128,6 +134,12 @@ public void setValues() {
128134 warnAboutDuplicatesOnImportProperty .setValue (importerPreferences .shouldWarnAboutDuplicatesOnImport ());
129135 shouldDownloadLinkedOnlineFiles .setValue (filePreferences .shouldDownloadLinkedFiles ());
130136 shouldkeepDownloadUrl .setValue (filePreferences .shouldKeepDownloadUrl ());
137+ addImportedEntries .setValue (libraryPreferences .isAddImportedEntriesEnabled ());
138+ if (libraryPreferences .getAddImportedEntriesGroupName ().isEmpty ()) {
139+ addImportedEntriesGroupName .setValue (Localization .lang ("Imported entries" ));
140+ } else {
141+ addImportedEntriesGroupName .setValue (libraryPreferences .getAddImportedEntriesGroupName ());
142+ }
131143 defaultPlainCitationParser .setValue (importerPreferences .getDefaultPlainCitationParser ());
132144
133145 useCustomDOIProperty .setValue (doiPreferences .isUseCustom ());
@@ -159,7 +171,14 @@ public void storeSettings() {
159171 importerPreferences .setWarnAboutDuplicatesOnImport (warnAboutDuplicatesOnImportProperty .getValue ());
160172 filePreferences .setDownloadLinkedFiles (shouldDownloadLinkedOnlineFiles .getValue ());
161173 filePreferences .setKeepDownloadUrl (shouldkeepDownloadUrl .getValue ());
174+ libraryPreferences .setAddImportedEntries (addImportedEntries .getValue ());
175+ if (addImportedEntriesGroupName .getValue ().isEmpty () || addImportedEntriesGroupName .getValue ().startsWith (" " )) {
176+ libraryPreferences .setAddImportedEntriesGroupName ("" );
177+ } else {
178+ libraryPreferences .setAddImportedEntriesGroupName (addImportedEntriesGroupName .getValue ());
179+ }
162180 importerPreferences .setDefaultPlainCitationParser (defaultPlainCitationParser .getValue ());
181+
163182 grobidPreferences .setGrobidEnabled (grobidEnabledProperty .getValue ());
164183 grobidPreferences .setGrobidUseAsked (grobidPreferences .isGrobidUseAsked ());
165184 grobidPreferences .setGrobidURL (grobidURLProperty .getValue ());
@@ -189,6 +208,14 @@ public ObjectProperty<PlainCitationParserChoice> defaultPlainCitationParserPrope
189208 return defaultPlainCitationParser ;
190209 }
191210
211+ public BooleanProperty getAddImportedEntries () {
212+ return addImportedEntries ;
213+ }
214+
215+ public StringProperty getAddImportedEntriesGroupName () {
216+ return addImportedEntriesGroupName ;
217+ }
218+
192219 public BooleanProperty useCustomDOIProperty () {
193220 return this .useCustomDOIProperty ;
194221 }
0 commit comments