Bug 473719 - When activating some tools, actions are always enabled at first
Summary: When activating some tools, actions are always enabled at first
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Tools (show other bugs)
Version: git master (please specify the git hash!)
Platform: Microsoft Windows Microsoft Windows
: NOR normal
Target Milestone: ---
Assignee: Dmitry Kazakov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-08-24 11:23 UTC by Alvin Wong
Modified: 2023-08-29 09:07 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alvin Wong 2023-08-24 11:23:23 UTC
SUMMARY
When activating the Select Shapes Tool (DefaultTool) or the reference image tool, the actions in the context menu are always enabled at first, before the current selection has changed.

STEPS TO REPRODUCE
1. Create a text shape
2. Switch back to DefaultTool
3. Right click on canvas

OBSERVED RESULT
Most actions are enabled when they shouldn't be, some (e.g. Group, Ungroup) should not be visible at all.

EXPECTED RESULT
Some actions should not be enabled when no shapes are selected. Group and ungroup actions should not be visible when only one shape is selected and that shape is not ungroupable.

SOFTWARE/OS VERSIONS
Windows: 10

ADDITIONAL INFORMATION
For DefaultTool, the actions are disabled in DefaultTool::updateDistinctiveActions, called from DefaultTool::updateActions, which is called from DefaultTool::activate, but they are then being re-enabled in CanvasData::activateToolActions (KoToolManager.cpp:106), called from KoToolManager::Private::postSwitchTool.
Comment 1 Dmitry Kazakov 2023-08-29 09:07:23 UTC
Git commit c4c0d1a02fb9a2e273c9b4ee67d72821464f4861 by Dmitry Kazakov.
Committed on 29/08/2023 at 11:07.
Pushed by dkazakov into branch 'krita/5.2'.

Fix 'enabled' state of the actions in the Default Tool

The tool manager enables all the actions unconditionally, we should
do that **before** actually calling the tool's activate method.

M  +16   -2    libs/flake/KoToolManager.cpp

https://invent.kde.org/graphics/krita/-/commit/c4c0d1a02fb9a2e273c9b4ee67d72821464f4861
Comment 2 Dmitry Kazakov 2023-08-29 09:07:39 UTC
Git commit 087c9ef921bc70e5bee9ddc646ba4d34ad153e89 by Dmitry Kazakov.
Committed on 29/08/2023 at 11:07.
Pushed by dkazakov into branch 'master'.

Fix 'enabled' state of the actions in the Default Tool

The tool manager enables all the actions unconditionally, we should
do that **before** actually calling the tool's activate method.

M  +16   -2    libs/flake/KoToolManager.cpp

https://invent.kde.org/graphics/krita/-/commit/087c9ef921bc70e5bee9ddc646ba4d34ad153e89