-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix option to "Search for unlinked local files" for new library #12738
Conversation
Disables the option to "Search for unlinked local files" in the Lookup menu before the newly created library is saved as the action shold only be available when the .bib file path is known Fixes JabRef#12558
Hi @raquelgraos, thank you for your contribution (and the tests). I suppose this is not expected behavior? @koppor |
Once this is resolved, I think the documentation should also be updated. You can file a PR at https://github.com/JabRef/user-documentation. |
The video misses the part AFTER saving. - Meaning after end of the text
I am sorry that I did not write down steps 6 7 8 there: SAving and then opening the menu agian. |
Yes, I was not referring to the video, but my attempt to test these changes locally:
|
Hi @subhramit @koppor ! Thank you for the feedback! Upon further inspection, I believe the issue lies in the fact that the activeDatabaseProperty() is not notifying changes when saving the library. Immediately after saving (i.e. without restarting JabRef), if the active tab is switched and then switched back to the newly saved library, the option will be enabled. |
@Siedlerchr @calixtus any idea how to fix:
This makes switching back and forth from libraries or restarting JabRef compulsory once the option is disabled (due to unsaved library), to enable it (even after saving). |
If not, I think a saner, more UX-friendly option is to keep the option enabled and show the user a dialog saying "The library needs to be saved." if they try to use it with an unsaved library. |
Hi @subhramit and @Siedlerchr ! But, if you believe this isn't the best route to fixing the issue, I could go back and implement that dialog you suggested. |
If you have time you can start working on the dialog, otherwise I'd wait till @calixtus confirms that there is no other "easy"/"moderately easy" workaround. |
Thank you for your reply! |
We had a discussion. A hint could be event listeners. See this, for instance. That is how buttons are disabled or enabled in the open office panel when a style is chosen. There can be even better/simpler examples - this is the part I work on so came up in mind. More hint: |
Maybe a look into |
Sorry is was not clear, i did not meant event listeners, but the event bus. |
Oh no it's fine - I did mean event listener in that sentence. "Listener" and "event listener" are mostly used interchangeably in Java (I think?) |
Thank you for your input!
But the action should still be available even if some (unsaved) changes were made, am I correct?
I apologise, but I am not sure I completely understood this. When would the library not be open in this case? |
I think so. Point is to ensure that the library is tied to a saved path in the system to allow this.
That may have been a typo - maybe @calixtus meant a property which is not present when a library is not saved* |
It's about being notified as soon as the library is being saved. If the library is saved, changedProperty is set to false. As soon it is set to false, you can check if it has a stored path and the binding can be updated. |
Hi @calixtus! Unfortunately, I don't think the changedProperty in the libraryTab will help in this situation, considering it is set to false when a library is created and, therefore, when saved won't notify. But, I am trying to figure out how to get around this situation. |
Yes, try a bit more. In case you're unable to find a way (in the interest of time and also considering we labeled this a "good first issue" but deeper hurdles came up), you can go forward with the workaround and open an issue stating "Improve UX accessing unlinked files option" describing how it'd be better if it could stay disabled for unsaved libraries, along with all the knowledge about properties required we've gathered so far. |
I will merge to keep things going. In a follow-up when there was more code experience, maybe, the state manager thing can be fixed. Maybe, it's just an update of the state manager on an initial save. |
@trag-bot didn't find any issues in the code! ✅✨ |
I will keep looking into it and if I find any new information I will share! |
Disables the option to "Search for unlinked local files" in the Lookup menu before the newly created library is saved as the action should only be available when the .bib file path is known.
I changed the executable property binding to needsSavedLocalDatabase() to ensure that the action is only available under the defined conditions of the mentioned method.
I developed tests that assert that the action is only executable under those same conditions.
The video below shows the creation of a new library (without saving it) and how the "Search for unliked local files" is now disabled.
bug_fix.webm
Fixes #12558
Mandatory checks
CHANGELOG.md
described in a way that is understandable for the average user (if change is visible to the user)