Fix disable some actions when no libraries are open#11936
Conversation
|
Hi Kopp , I believe t this is the final version. Can I merge it? (✖﹏✖) |
|
PLEASE KEEP THIS PR OPEN; YOU CAN PUSH CHANGES TO THIS BRANCH AND THE PR WILL BE UPDATED AUTOMATICALLLY |
koppor
left a comment
There was a problem hiding this comment.
Code looks good. Needs to be trled out.
Maybe automated tests could be done wlth TestFX.
We will review it. If it is OK, we will add to the merge queue. If not OK, you will receive comments and should adress it. Just push to your branch then; the PR will be updated. No need to open a new PR. |
This reverts commit 70a8ff3.
| MenuItem saveAllMenuItem = factory.createMenuItem(StandardActions.SAVE_ALL, new SaveAllAction(frame::getLibraryTabs, preferences, dialogService)); | ||
| saveAllMenuItem.disableProperty().bind(Bindings.isEmpty(stateManager.getOpenDatabases())); | ||
|
|
||
| MenuItem newEntryFromPlainTextMenuItem = factory.createMenuItem(StandardActions.NEW_ENTRY_FROM_PLAIN_TEXT, new PlainCitationParserAction(dialogService)); | ||
| newEntryFromPlainTextMenuItem.disableProperty().bind(Bindings.isEmpty(stateManager.getOpenDatabases())); | ||
|
|
There was a problem hiding this comment.
Hello @lzmmxh, thank you for your contribution!
Next time, when you're working on any issue, I recommend taking some time to explore the codebase and look for similar patterns related to what you're working on; especially for "good first issues". These issues are designed to help new contributors get familiar with the code.
If you check the codebase, you'll find similar functionality relevant to this issue. We're asking to disable the "Save All" menu item, and you'll see that the "Save" menu item is already disabled as expected. By looking at how the "Save" option is disabled, you can apply the same approach to this task.
I'm not happy with the changes in this pull request, and they will be reverted in PR #11941.
This PR improves the user interface by disabling certain menu items and toolbar buttons when no library is open.
"Save All" menu item in MainMenu.java is now disabled (greyed out) when there are no open libraries.
"New entry from plain text" menu item in MainMenu.java is now disabled when there are no open libraries.
"Global Search" bar in the main toolbar (MainToolBar.java) is now disabled when there are no open libraries.
"New entry from plain text" button in the main toolbar (MainToolBar.java) is now disabled when there are no open libraries.
Here's the screenshot:
Here's the demo video:
2024-10-12.19-15-50.mp4
Closes #11923
#11923
Mandatory checks
CHANGELOG.mddescribed in a way that is understandable for the average user (if applicable)