JabRef / jabref

Graphical Java application for managing BibTeX and biblatex (.bib) databases
https://devdocs.jabref.org
MIT License
3.53k stars 2.47k forks source link

Deleting multiple linked files should show a single confirmation dialog #9473

Closed HoussemNasri closed 1 year ago

HoussemNasri commented 1 year ago

Follow up to #8659

When multiple linked items are removed, JabRef will show the "Delete the selected file permanently from disk" dialogue for each item separately. E.g., if the user removes 3 linked items, the dialogue asking whether the respective file should be deleted from disk or should just be removed from entry will be shown 3 times.

This is not the expected behaviour - instead the user would expect to answer this dialogue once for all items that were selected. So if the user selects the option "Remove from entry" from the dialogue, then this should be applied to all linked entries that have been selected for removal (not for each entry separately).

Originally posted by @AEgit

To view the linked files of an entry, follow these steps:

  1. Open JabRef and open the entry editor for an item to which multiple files are linked (e.g., article + several supplements)
  2. Navigate to the "General" tab and then go to the row "File"
shreverr commented 1 year ago

Can I work on this issue?

HoussemNasri commented 1 year ago

Sure, go ahead!

github-actions[bot] commented 1 year ago

As a general advice for newcomers: check out Contributing for a start. Also, guidelines for setting up a local workspace is worth having a look at.

Feel free to ask here at GitHub, if you have any issue related questions. If you have questions about how to setup your workspace use JabRef's Gitter chat. Try to open a (draft) pull-request early on, so that people can see you are working on the issue and so that they can see the direction the pull request is heading towards. This way, you will likely receive valuable feedback.

shreverr commented 1 year ago

The deleteFile() method in LinkedFilesEditorViewModel calls delete() method in LinkedFileViewModel. In the delete() method a new dialog opens every time when delete() method is called to delete a file. image image should I move the code of delete() method to deleteFile() method and only use delete() method to delete the file from disk.

This way the the dialog will be called only once.

HoussemNasri commented 1 year ago

I don't think moving delete to deleteFile will fix the issue. The problem here is that whenever a delete event is detected (e.g. User hits the delete keystroke) we are calling deleteFile for each selected file thus multiple dialogs show up. What you want to do is to call deleteFile only once when a delete event occurs.

Also, you don't want to display the same dialog when user tries to delete one file vs multiple files.

Here is an example of what IntelliJ does when user tries to delete a file(s):

One File

image

Multiple Files

image

Code Hint Lookup this class and see what happens when a user hits the delete keystroke

https://github.com/JabRef/jabref/blob/fb80915f390a5c2d9e6b8b7477dee55eca8e8f15/src/main/java/org/jabref/gui/fieldeditors/LinkedFilesEditor.java#L68

Ravitwr commented 1 year ago

Hi @HoussemNasri , I can work on this issue if there are no updates.I think the dialog box gui needs to be moved from LinkedFilesEditorViewModel to LinkedFilesEditor. Also do we want to list file names in case of deletion of multilple files ?

shreverr commented 1 year ago

Hi @Ravitwr , I am currently working on this. I am sorry was not able to work on this last week due to some personal reasons.

009-KumarJi commented 1 year ago

i want to work on this issue. please assign me this issue. :)

HoussemNasri commented 1 year ago

@009-KumarJi Someone already started working on this, there is plenty of other good first issues you can pick from.

hiddevanesch commented 1 year ago

Hi, since there hasn't been much activity regarding this issue, can I please be assigned to this issue? I would like to work on this for a uni project.

AEgit commented 1 year ago

JabRef 5.10--2023-04-02--1896c99 Windows 10 10.0 amd64 Java 19.0.2 JavaFX 20+19

As far as I can tell, this issue has been fixed in the most recent dev version. Well done! There are some other issues with deleting/adding files, but I will create a new issue for that problem, since I am not sure it is linked to the improvements made here.