21
21
import org .jabref .gui .preferences .PreferenceTabViewModel ;
22
22
import org .jabref .gui .slr .StudyCatalogItem ;
23
23
import org .jabref .logic .FilePreferences ;
24
+ import org .jabref .logic .LibraryPreferences ;
24
25
import org .jabref .logic .importer .ImportFormatPreferences ;
25
26
import org .jabref .logic .importer .ImporterPreferences ;
26
27
import org .jabref .logic .importer .SearchBasedFetcher ;
@@ -48,6 +49,9 @@ public class WebSearchTabViewModel implements PreferenceTabViewModel {
48
49
new SimpleListProperty <>(FXCollections .observableArrayList (PlainCitationParserChoice .values ()));
49
50
private final ObjectProperty <PlainCitationParserChoice > defaultPlainCitationParser = new SimpleObjectProperty <>();
50
51
52
+ private final BooleanProperty addImportedEntries = new SimpleBooleanProperty ();
53
+ private final StringProperty addImportedEntriesGroupName = new SimpleStringProperty ("" );
54
+
51
55
private final BooleanProperty useCustomDOIProperty = new SimpleBooleanProperty ();
52
56
private final StringProperty useCustomDOINameProperty = new SimpleStringProperty ("" );
53
57
@@ -67,6 +71,7 @@ public class WebSearchTabViewModel implements PreferenceTabViewModel {
67
71
private final ImporterPreferences importerPreferences ;
68
72
private final FilePreferences filePreferences ;
69
73
private final ImportFormatPreferences importFormatPreferences ;
74
+ private final LibraryPreferences libraryPreferences ;
70
75
71
76
private final ReadOnlyBooleanProperty refAiEnabled ;
72
77
@@ -78,6 +83,7 @@ public WebSearchTabViewModel(CliPreferences preferences, DialogService dialogSer
78
83
this .doiPreferences = preferences .getDOIPreferences ();
79
84
this .filePreferences = preferences .getFilePreferences ();
80
85
this .importFormatPreferences = preferences .getImportFormatPreferences ();
86
+ this .libraryPreferences = preferences .getLibraryPreferences ();
81
87
82
88
this .refAiEnabled = refAiEnabled ;
83
89
@@ -128,6 +134,12 @@ public void setValues() {
128
134
warnAboutDuplicatesOnImportProperty .setValue (importerPreferences .shouldWarnAboutDuplicatesOnImport ());
129
135
shouldDownloadLinkedOnlineFiles .setValue (filePreferences .shouldDownloadLinkedFiles ());
130
136
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
+ }
131
143
defaultPlainCitationParser .setValue (importerPreferences .getDefaultPlainCitationParser ());
132
144
133
145
useCustomDOIProperty .setValue (doiPreferences .isUseCustom ());
@@ -159,7 +171,14 @@ public void storeSettings() {
159
171
importerPreferences .setWarnAboutDuplicatesOnImport (warnAboutDuplicatesOnImportProperty .getValue ());
160
172
filePreferences .setDownloadLinkedFiles (shouldDownloadLinkedOnlineFiles .getValue ());
161
173
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
+ }
162
180
importerPreferences .setDefaultPlainCitationParser (defaultPlainCitationParser .getValue ());
181
+
163
182
grobidPreferences .setGrobidEnabled (grobidEnabledProperty .getValue ());
164
183
grobidPreferences .setGrobidUseAsked (grobidPreferences .isGrobidUseAsked ());
165
184
grobidPreferences .setGrobidURL (grobidURLProperty .getValue ());
@@ -189,6 +208,14 @@ public ObjectProperty<PlainCitationParserChoice> defaultPlainCitationParserPrope
189
208
return defaultPlainCitationParser ;
190
209
}
191
210
211
+ public BooleanProperty getAddImportedEntries () {
212
+ return addImportedEntries ;
213
+ }
214
+
215
+ public StringProperty getAddImportedEntriesGroupName () {
216
+ return addImportedEntriesGroupName ;
217
+ }
218
+
192
219
public BooleanProperty useCustomDOIProperty () {
193
220
return this .useCustomDOIProperty ;
194
221
}
0 commit comments