Fix for issue 6966: open all files of multiple entries#7709
Conversation
update 2021.3.3
update 2021.3.8
update 2021.3.9
update 2021.3.11
update 2021.3.12
update 2021.3.15
update 2021.3.17
update 20213.30
update2021.4.5
update 2021.4.28
|
Idea for usabilty: As a user I expect to open the file using "open all files" also when I select one entry. So if I only select one entry => same beahviour as now |
|
In line with @Siedlerchr comment above, what do you think about adding the functionality to the existing "open file" action? So if a user has only a single entry selected, then the linked file of this entry is opened; but if multiple files are selected, then all linked files are opened. |
|
I agree. When one entry selected, if "open all files" has the same behavior as "open file" as @Siedlerchr suggested, which means the function of the new added option totally covers the original one, then why not merge them as one option, just as you proposed. So should I delete |
|
Yes, please! |
…if there is any linked file present; modified CHANGELOG.md; added javadoc
|
Done. I will update detailed description later. |
|
May I ask why these tests are failing? All these failures have the exactly same error: But I didn't change anything in Same as #7705 (comment). |
|
I noticed that the tests are fixed. So, is there still anything more I need to change in my code? |
|
You need to push the commit after merging as well, because the tests are still failing |
| for (BibEntry entry:selectedEntries) { | ||
| if (entry.getFiles().isEmpty()) { | ||
| if (!asked) { | ||
| boolean continu = dialogService.showConfirmationDialogAndWait(Localization.lang("Missing file"), |
There was a problem hiding this comment.
I, personally, don't think it's necessary to present a dialog here to the user. To me it seems obvious that only the files will open from entries that have associated files
So just ignore them.
|
Done. Removed dialog and resolved a conflict in |
| files = entry.getFiles(); | ||
|
|
||
| if ((entry.getFiles().size() > 0) && stateManager.getActiveDatabase().isPresent()) { | ||
| if (files.get(0).isOnlineLink()) { |
There was a problem hiding this comment.
I would exclude online file links. Otherwise you will suddenly have 300 Tabs open in your browser f you select 300 entries and they have at least one link
There was a problem hiding this comment.
What's the difference to selecting 300 entries that have pdf attached?
There was a problem hiding this comment.
Should we set a limit?
For example, if a user is trying to open 100 files, pop out a dialog to ask the user whether to continue or cancel.
But how to determine the limit.
There was a problem hiding this comment.
Yep, that's a good idea. "You are about to open more than 10 files". Continue?
I would simply create a constant with 10. I think that's appropriate.
- Continue / Cancel
| return true; | ||
| } | ||
|
|
||
| Optional<Path> filename = FileHelper.find( |
There was a problem hiding this comment.
No need to check the filename for presence here, just later on try to open the file. Either it works or not.
| LinkedFileViewModel linkedFileViewModel; | ||
|
|
||
| for (BibEntry entry:selectedEntries) { | ||
| if (!entry.getFiles().isEmpty()) { |
There was a problem hiding this comment.
An entry can have multiple files linked. I would suggest you open all
Siedlerchr
left a comment
There was a problem hiding this comment.
some improvements necessary
|
OK. I will fix it. |
…inding; question: open a large number of files
|
Two changes:
Under discussion: how to handle opening a large number of files? |
Done. P.S. Online links are included. Test video: 6966-5.mp4 |
tobiasdiez
left a comment
There was a problem hiding this comment.
Thanks, changle look good to me. Two smaller suggestions
* upstream/main: (71 commits) [Bot] Update CSL styles (#7735) Fix for issue 6966: open all files of multiple entries (#7709) Add simple unit tests (#7696) Add simple unit tests (#7543) Update check-outdated-dependencies.yml Added preset for new entry keybindings and reintroduced defaults (#7705) Select the entry which has smaller dictonary order when merge (#7708) Update CHANGELOG.md fix: make more fields, fomatters, ids and languages sorted by alphabetical order (#7717) Bump libreoffice from 7.1.2 to 7.1.3 (#7721) Bump unoloader from 7.1.2 to 7.1.3 (#7724) Bump org.beryx.jlink from 2.23.7 to 2.23.8 (#7723) Bump org.openjfx.javafxplugin from 0.0.9 to 0.0.10 (#7725) fix: make fields sorted by lexicographical order (#7711) Fix tests Refactoring existing unit tests (#7687) Refactoring and addition of unit tests (#7581) Refactor simple Unit Tests (#7571) Add simple unit tests (#7544) add and extend unit tests (#7685) ...
Fixes #6966
CHANGELOG.mddescribed in a way that is understandable for the average user (if applicable)Added a new function to "Open file" option in the right-click menu.
Now we can open all linked files of the selected entries.
Test videos:
Single entry selected: the behavior remains unchanged
6966-1.mp4
Multiple entries selected
6966-2.mp4
pop out a dialog to ask the user whether to continue, if yes,only open the former and skip the latter6966-3.mp4
6966-4.mp4
To implement these functions, I modified
OpenExternalFileActionand added a new methodhasPresentFileForSelectedEntriesto check if at least one of the selected entries has linked files inActionHelper.