Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into Ognimalf/main
Browse files Browse the repository at this point in the history
* upstream/main:
  Autosave folder and checkbox is remembered (JabRef#9000)
  New Crowdin updates (JabRef#8999)
  Sync group view mode and main table (JabRef#8993)
  Bump unoloader from 7.3.4 to 7.3.5 (JabRef#8996)
  Bump libreoffice from 7.3.4 to 7.3.5 (JabRef#8997)
  Bump java-diff-utils from 4.11 to 4.12 (JabRef#8998)
  Fix external group metadata changes are not merged (JabRef#8994)
  New Crowdin updates (JabRef#8995)
  Reworded t in pr (JabRef#8989)
  Fixed checkstyle (JabRef#8990)
  Fix RfcFetcherTest (JabRef#8988)
  Fixes koppor#521 - Allow to drag&drop selected bib entries to other library tabs (JabRef#8982)
  • Loading branch information
Siedlerchr committed Jul 29, 2022
2 parents bd37b6c + bd8ede5 commit 13c0fa8
Show file tree
Hide file tree
Showing 15 changed files with 157 additions and 13 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve
- We added an extra option in the 'Find Unlinked Files' dialog view to ignore unnecessary files like Thumbs.db, DS_Store, etc. [koppor#373](https://github.com/koppor/jabref/issues/373)
- JabRef now writes log files. Linux: `$home/.cache/jabref/logs/version`, Windows: `%APPDATA%\..\Local\harawata\jabref\version\logs`, Mac: `Users/.../Library/Logs/jabref/version`
- We added an importer for Citavi backup files, support ".ctv5bak" and ".ctv6bak" file formats. [#8322](https://github.com/JabRef/jabref/issues/8322)
- We added a feature to drag selected entries and drop them to other opened inactive library tabs [koppor521](https://github.com/koppor/jabref/issues/521).

### Changed

Expand Down Expand Up @@ -58,6 +59,9 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve
- We fixed a bug where switching between themes will cause an error/exception. [#8939](https://github.com/JabRef/jabref/pull/8939)
- We fixed a bug where files that were deleted in the source bibtex file were kept in the index. [#8962](https://github.com/JabRef/jabref/pull/8962)
- We fixed "Error while sending to JabRef" when the browser extension interacts with JabRef. [JabRef-Browser-Extension#479](https://github.com/JabRef/JabRef-Browser-Extension/issues/479)
- We fixed a bug where updating group view mode (intersection or union) requires re-selecting groups to take effect. [#6998](https://github.com/JabRef/jabref/issues/6998)
- We fixed a bug that prevented external group metadata changes from being merged. [#8873](https://github.com/JabRef/jabref/issues/8873)
- We fixed the shared database opening dialog to remember autosave folder and tick. [#7516](https://github.com/JabRef/jabref/issues/7516)

### Removed

Expand Down
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,10 @@ dependencies {

implementation 'commons-cli:commons-cli:1.5.0'

implementation 'org.libreoffice:libreoffice:7.3.4'
implementation 'org.libreoffice:unoloader:7.3.4'
implementation 'org.libreoffice:libreoffice:7.3.5'
implementation 'org.libreoffice:unoloader:7.3.5'

implementation 'io.github.java-diff-utils:java-diff-utils:4.11'
implementation 'io.github.java-diff-utils:java-diff-utils:4.12'
implementation 'info.debatty:java-string-similarity:2.0.0'

antlr3 'org.antlr:antlr:3.5.3'
Expand Down
48 changes: 48 additions & 0 deletions src/main/java/org/jabref/gui/JabRefFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,54 @@ private void initDragAndDrop() {
} else {
tabbedPane.getTabs().remove(dndIndicator);
}
// Accept drag entries from MainTable
if (event.getDragboard().hasContent(DragAndDropDataFormats.ENTRIES)) {
event.acceptTransferModes(TransferMode.COPY);
event.consume();
}
});

this.getScene().setOnDragEntered(event -> {
// It is necessary to setOnDragOver for newly opened tabs
// drag'n'drop on tabs covered dnd on tabbedPane, so dnd on tabs should contain all dnds on tabbedPane
tabbedPane.lookupAll(".tab").forEach(tab -> {
tab.setOnDragOver(tabDragEvent -> {
if (DragAndDropHelper.hasBibFiles(tabDragEvent.getDragboard())) {
tabDragEvent.acceptTransferModes(TransferMode.ANY);
if (!tabbedPane.getTabs().contains(dndIndicator)) {
tabbedPane.getTabs().add(dndIndicator);
}
event.consume();
} else {
tabbedPane.getTabs().remove(dndIndicator);
}

if (tabDragEvent.getDragboard().hasContent(DragAndDropDataFormats.ENTRIES)) {
tabDragEvent.acceptTransferModes(TransferMode.COPY);
tabDragEvent.consume();
}
});
tab.setOnDragExited(event1 -> tabbedPane.getTabs().remove(dndIndicator));
tab.setOnDragDropped(tabDragEvent -> {
if (DragAndDropHelper.hasBibFiles(tabDragEvent.getDragboard())) {
tabbedPane.getTabs().remove(dndIndicator);
List<Path> bibFiles = DragAndDropHelper.getBibFiles(tabDragEvent.getDragboard());
OpenDatabaseAction openDatabaseAction = this.getOpenDatabaseAction();
openDatabaseAction.openFiles(bibFiles, true);
tabDragEvent.setDropCompleted(true);
tabDragEvent.consume();
} else {
for (Tab libraryTab : tabbedPane.getTabs()) {
if (libraryTab.getId().equals(tab.getId()) &&
!tabbedPane.getSelectionModel().getSelectedItem().equals(libraryTab)) {
((LibraryTab) libraryTab).dropEntry(stateManager.getLocalDragboard().getBibEntries());
}
}
tabDragEvent.consume();
}
});
});
event.consume();
});

this.getScene().setOnDragExited(event -> tabbedPane.getTabs().remove(dndIndicator));
Expand Down
9 changes: 9 additions & 0 deletions src/main/java/org/jabref/gui/LibraryTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.Random;

import javafx.animation.PauseTransition;
import javafx.application.Platform;
Expand Down Expand Up @@ -153,6 +154,10 @@ public LibraryTab(JabRefFrame frame,

this.entryEditor = new EntryEditor(this, externalFileTypes);

// set LibraryTab ID for drag'n'drop
// ID content doesn't matter, we only need different tabs to have different ID
this.setId(Long.valueOf(new Random().nextLong()).toString());

Platform.runLater(() -> {
EasyBind.subscribe(changedProperty, this::updateTabTitle);
stateManager.getOpenDatabases().addListener((ListChangeListener<BibDatabaseContext>) c ->
Expand Down Expand Up @@ -758,6 +763,10 @@ public void paste() {
mainTable.paste();
}

public void dropEntry(List<BibEntry> entriesToAdd) {
mainTable.dropEntry(entriesToAdd);
}

public void cut() {
mainTable.cut();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,8 @@ public Node description() {
@Override
public void makeChange(BibDatabaseContext database, NamedCompound undoEdit) {
database.setMetaData(metaDataDiff.getNewMetaData());
// group change is handled by GroupChangeViewModel, so we set the groups root to the original value
// to prevent any inconsistency
metaDataDiff.getGroupDifferences().ifPresent(groupDiff -> database.getMetaData().setGroups(groupDiff.getOriginalGroupRoot()));
}
}
9 changes: 8 additions & 1 deletion src/main/java/org/jabref/gui/maintable/MainTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,12 @@ public void paste() {
}
}

public void dropEntry(List<BibEntry> entriesToAdd) {
for (BibEntry entry : entriesToAdd) {
importHandler.importEntryWithDuplicateCheck(database, (BibEntry) entry.clone());
}
}

private void handleOnDragOver(TableRow<BibEntryTableViewModel> row, BibEntryTableViewModel item, DragEvent event) {
if (event.getDragboard().hasFiles()) {
event.acceptTransferModes(TransferMode.ANY);
Expand Down Expand Up @@ -351,8 +357,9 @@ private void handleOnDragDetected(TableRow<BibEntryTableViewModel> row, BibEntry

// The following is necesary to initiate the drag and drop in javafx, although we don't need the contents
// It doesn't work without
// Drag'n'drop to other tabs use COPY TransferMode, drop to group sidepane use MOVE
ClipboardContent content = new ClipboardContent();
Dragboard dragboard = startDragAndDrop(TransferMode.MOVE);
Dragboard dragboard = startDragAndDrop(TransferMode.COPY_OR_MOVE);
content.put(DragAndDropDataFormats.ENTRIES, "");
dragboard.setContent(content);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ public MainTableDataModel(BibDatabaseContext context, PreferencesService prefere

entriesFiltered = new FilteredList<>(entriesViewModel);
entriesFiltered.predicateProperty().bind(
EasyBind.combine(stateManager.activeGroupProperty(), stateManager.activeSearchQueryProperty(), (groups, query) -> entry -> isMatched(groups, query, entry))
EasyBind.combine(stateManager.activeGroupProperty(),
stateManager.activeSearchQueryProperty(),
groupsPreferences.groupViewModeProperty(),
(groups, query, groupViewMode) -> entry -> isMatched(groups, query, entry))
);

IntegerProperty resultSize = new SimpleIntegerProperty();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,9 @@ private void setPreferences() {
}

sharedDatabasePreferences.setRememberPassword(rememberPassword.get());

sharedDatabasePreferences.setFolder(folder.getValue());
sharedDatabasePreferences.setAutosave(autosave.get());
}

/**
Expand All @@ -225,6 +228,8 @@ private void applyPreferences() {
Optional<String> sharedDatabaseUser = sharedDatabasePreferences.getUser();
Optional<String> sharedDatabasePassword = sharedDatabasePreferences.getPassword();
boolean sharedDatabaseRememberPassword = sharedDatabasePreferences.getRememberPassword();
Optional<String> sharedDatabaseFolder = sharedDatabasePreferences.getFolder();
boolean sharedDatabaseAutosave = sharedDatabasePreferences.getAutosave();
Optional<String> sharedDatabaseKeystoreFile = sharedDatabasePreferences.getKeyStoreFile();

if (sharedDatabaseType.isPresent()) {
Expand All @@ -248,6 +253,9 @@ private void applyPreferences() {
}

rememberPassword.set(sharedDatabaseRememberPassword);

sharedDatabaseFolder.ifPresent(folder::set);
autosave.set(sharedDatabaseAutosave);
}

private boolean isSharedDatabaseAlreadyPresent(DBMSConnectionProperties connectionProperties) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public static Optional<GroupDiff> compare(MetaData originalMetaData, MetaData ne
final Optional<GroupTreeNode> newGroups = newMetaData.getGroups();

if (!originalGroups.equals(newGroups)) {
return Optional.of(new GroupDiff(newGroups.orElse(null), originalGroups.orElse(null)));
return Optional.of(new GroupDiff(originalGroups.orElse(null), newGroups.orElse(null)));
} else {
return Optional.empty();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ public class SharedDatabasePreferences {
private static final String SHARED_DATABASE_NAME = "sharedDatabaseName";
private static final String SHARED_DATABASE_USER = "sharedDatabaseUser";
private static final String SHARED_DATABASE_PASSWORD = "sharedDatabasePassword";
private static final String SHARED_DATABASE_FOLDER = "sharedDatabaseFolder";
private static final String SHARED_DATABASE_AUTOSAVE = "sharedDatabaseAutosave";
private static final String SHARED_DATABASE_REMEMBER_PASSWORD = "sharedDatabaseRememberPassword";
private static final String SHARED_DATABASE_USE_SSL = "sharedDatabaseUseSSL";
private static final String SHARED_DATABASE_KEYSTORE_FILE = "sharedDatabaseKeyStoreFile";
Expand Down Expand Up @@ -77,6 +79,14 @@ public boolean getRememberPassword() {
return internalPrefs.getBoolean(SHARED_DATABASE_REMEMBER_PASSWORD, false);
}

public Optional<String> getFolder() {
return getOptionalValue(SHARED_DATABASE_FOLDER);
}

public boolean getAutosave() {
return internalPrefs.getBoolean(SHARED_DATABASE_AUTOSAVE, false);
}

public boolean isUseSSL() {
return internalPrefs.getBoolean(SHARED_DATABASE_USE_SSL, false);
}
Expand Down Expand Up @@ -109,6 +119,14 @@ public void setRememberPassword(boolean rememberPassword) {
internalPrefs.putBoolean(SHARED_DATABASE_REMEMBER_PASSWORD, rememberPassword);
}

public void setFolder(String folder) {
internalPrefs.put(SHARED_DATABASE_FOLDER, folder);
}

public void setAutosave(boolean autosave) {
internalPrefs.putBoolean(SHARED_DATABASE_AUTOSAVE, autosave);
}

public void setUseSSL(boolean useSSL) {
internalPrefs.putBoolean(SHARED_DATABASE_USE_SSL, useSSL);
}
Expand Down
39 changes: 38 additions & 1 deletion src/main/resources/l10n/JabRef_fr.properties
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ Unable\ to\ monitor\ file\ changes.\ Please\ close\ files\ and\ processes\ and\

%0/%1\ entries=%0/%1 entrées

Export\ operation\ finished\ successfully.=L'opération d'export s'est terminée avec succès.
Reveal\ in\ File\ Explorer=Montrer dans l'explorateur de fichiers

%0\ matches\ the\ regular\ expression\ <b>%1</b>=%0 correspond à l'expression régulière <b>%1</b>
Expand Down Expand Up @@ -703,16 +705,23 @@ Remove\ group=Supprimer le groupe
Remove\ group\ and\ subgroups=Supprimer le groupe et les sous-groupes
Remove\ groups\ and\ subgroups=Supprimer les groupes et les sous-groupes
Remove\ all\ selected\ groups\ and\ keep\ their\ subgroups?=Supprimer tous les groupes sélectionnés et conserver leurs sous-groupes ?
Remove\ group\ "%0"\ and\ keep\ its\ subgroups?=Supprimer le groupe « %0 » et conserver ses sous-groupes ?
Remove\ groups=Supprimer les groupes
Removed\ all\ selected\ groups.=Tous les groupes sélectionnés ont été supprimés.
Remove\ group\ "%0"\ and\ its\ subgroups?=Supprimer le groupe « %0 » et ses sous-groupes ?
Removed\ group\ "%0"\ and\ its\ subgroups.=Groupe « %0 » et ses sous-groupes supprimés.
Remove\ all\ selected\ groups\ and\ their\ subgroups?=Supprimer tous les groupes sélectionnés et leurs sous-groupes ?
Removed\ all\ selected\ groups\ and\ their\ subgroups.=Tous les groupes sélectionnés et leurs sous-groupes ont été supprimés.
Remove\ link=Supprimer le lien
Expand Down Expand Up @@ -825,6 +834,12 @@ Size=Taille
Skipped\ -\ No\ PDF\ linked=Sauté - Pas de PDF lié
Skipped\ -\ PDF\ does\ not\ exist=Omis - Le PDF n'existe pas
JabRef\ skipped\ the\ entry.=JabRef a ignoré l'entrée.
Import\ error=Erreur d'importation
Open\ library\ error=Erreur d'ouverture du fichier
Please\ check\ your\ library\ file\ for\ wrong\ syntax.=Veuillez vérifier la syntaxe de votre fichier bibliographique.
SourceTab\ error=Erreur de SourceTab
User\ input\ via\ entry-editor\ in\ `{}bibtex\ source`\ tab\ led\ to\ failure.=La saisie de l'utilisateur via l'éditeur d'entrée dans l'onglet `{}bibtex source` a conduit à un échec.

Sort\ subgroups=Trier les sous-groupes

Expand Down Expand Up @@ -1244,6 +1259,7 @@ Connection\ failed\!=Échec de la connexion \!
Connection\ successful\!=Connexion réussie \!

SSL\ Configuration=Configuration SSL
SSL\ configuration\ changed=Configuration SSL modifiée
SSL\ certificate\ file=Fichier de certificat SSL
Duplicate\ Certificates=Dupliquer les certificats
You\ already\ added\ this\ certificate=Vous avez déjà ajouté ce certificat
Expand Down Expand Up @@ -1283,6 +1299,7 @@ Please\ open\ %0\ manually.=Veuillez ouvrir manuellement %0 .
The\ link\ has\ been\ copied\ to\ the\ clipboard.=Le lien a été copié dans le presse-papiers.

Open\ %0\ file=Ouvrir le fichier %0
Could\ not\ detect\ terminal\ automatically.\ Please\ define\ a\ custom\ terminal\ in\ the\ preferences.=Impossible de détecter le terminal automatiquement. Veuillez définir un terminal personnalisé dans les préférences.

Cannot\ delete\ file=Le fichier ne peut pas être supprimé
File\ permission\ error=Erreur due aux permissions du fichier
Expand Down Expand Up @@ -1670,6 +1687,8 @@ Issue\ report\ successful=Signalement de l'anomalie réussi
Your\ issue\ was\ reported\ in\ your\ browser.=Votre anomalie a été affichée dans votre navigateur.
The\ log\ and\ exception\ information\ was\ copied\ to\ your\ clipboard.=Le journal et les informations d'anomalie ont été copiées dans votre presse-papier.
Please\ paste\ this\ information\ (with\ Ctrl+V)\ in\ the\ issue\ description.=Veuillez coller ces informations (avec Ctrl+V) dans la description de l'anomalie.
Last\ notification=Dernière notification
Check\ the\ event\ log\ to\ see\ all\ notifications=Consultez le journal des événements pour voir toutes les notifications
Host=Hôte
Port=Port
Expand Down Expand Up @@ -2477,4 +2496,22 @@ Success\!\ Finished\ writing\ metadata.=Succès \! Écriture des métadonnées t
Custom\ API\ key=Clef d'API personnalisée
Check\ %0\ API\ Key\ Setting=Vérifier les paramètres de la clef d'API %0


Edit\ field\ value=Modifier la valeur du champ
Two\ fields=Deux champs
Overwrite\ Non\ empty\ fields=Écraser les champs non vides
Set=Définir
Append=Ajouter
Clear\ field=Vider le champ
Field\ value=Valeur du champ
Edit\ field\ value\ of\ selected\ entries=Modifier la valeur du champ pour les entrées sélectionnées
Rename=Renommer
New\ field\ name=Nouveau nom de champ
Copy\ value=Copier la valeur
Move\ value=Déplacer la valeur
Swap\ values=Permuter les valeurs
Copy\ or\ move\ the\ value\ of\ one\ field\ to\ another=Copier ou déplacer la valeur d'un champ vers un autre
Automatic\ field\ editor=Éditeur automatique de champs
(Note\:\ If\ original\ entries\ lack\ keywords\ to\ qualify\ for\ the\ new\ group\ configuration,\ confirming\ here\ will\ add\ them)=(Note \: si les entrées originales n'ont pas de mots-clefs correspondant à la nouvelle configuration du groupe, confirmer ici les ajoutera)
Assign=Assigner
Do\ not\ assign=Ne pas assigner
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ void compareWithChangedGroup() {

Optional<GroupDiff> groupDiff = GroupDiff.compare(originalMetaData, newMetaData);

Optional<GroupDiff> expectedGroupDiff = Optional.of(new GroupDiff(newMetaData.getGroups().get(), originalMetaData.getGroups().get()));
Optional<GroupDiff> expectedGroupDiff = Optional.of(new GroupDiff(originalMetaData.getGroups().get(), newMetaData.getGroups().get()));

assertEquals(expectedGroupDiff.get().getNewGroupRoot(), groupDiff.get().getNewGroupRoot());
assertEquals(expectedGroupDiff.get().getOriginalGroupRoot(), groupDiff.get().getOriginalGroupRoot());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import static org.junit.jupiter.api.Assertions.assertEquals;

@FetcherTest
@Disabled("CiteSeer is down as of 2022-07-18")
class CiteSeerTest {

private CiteSeer fetcher = new CiteSeer();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package org.jabref.logic.importer.fetcher;

import java.io.IOException;
import java.net.URL;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.Collections;
import java.util.List;
import java.util.Optional;

import org.jabref.logic.importer.FetcherException;
import org.jabref.logic.importer.ImportFormatPreferences;
import org.jabref.logic.importer.SearchBasedFetcher;
import org.jabref.model.entry.BibEntry;
Expand Down Expand Up @@ -63,13 +63,19 @@ void searchByTitle() throws Exception {
}

@Test
void searchById() throws FetcherException {
void searchById() throws Exception {
bibEntry.setField(StandardField.URLDATE, LocalDate.now().format(DateTimeFormatter.ISO_DATE));
assertEquals(Optional.of(bibEntry), fetcher.performSearchById("90002164"));
}

@Test
void searchByUrlUsingId() throws Exception {
doiEntry.setField(StandardField.URLDATE, LocalDate.now().format(DateTimeFormatter.ISO_DATE));
assertEquals(Optional.of(doiEntry), fetcher.performSearchById("https://www.jstor.org/stable/10.1086/501484?seq=1"));
}

@Test
void fetchPDF() throws IOException, FetcherException {
void fetchPDF() throws Exception {
Optional<URL> url = fetcher.findFullText(bibEntry);
assertEquals(Optional.of(new URL("https://www.jstor.org/stable/pdf/90002164.pdf")), url);
}
Expand Down
Loading

0 comments on commit 13c0fa8

Please sign in to comment.