Bug 446148 - Non-brush preset resources can be explicitly assigned to "All Untagged"
Summary: Non-brush preset resources can be explicitly assigned to "All Untagged"
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Resource Management (show other bugs)
Version: nightly build (please specify the git hash!)
Platform: Appimage Linux
: NOR normal
Target Milestone: ---
Assignee: Emmet O'Neill
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-11-27 01:47 UTC by tomtomtomreportingin
Modified: 2021-11-30 06:10 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description tomtomtomreportingin 2021-11-27 01:47:41 UTC
SUMMARY
In 5.0 git e650032 (11/26/21) and 5.1 git 4a272ff (11/26/21), non-brush preset resources can be explicitly assigned to "All Untagged". Ironically, this makes them no longer appear under "All Untagged". This tagging is not shown in the resource manager and I'm not sure how to reverse this process outside of deleting the entire database cache.

STEPS TO REPRODUCE
1. Open the Gamut Masks docker.
2. Right-click "Dominant Hue with Accent" and hover over "Assign to Tag".

OBSERVED RESULT
The user can assign the resource to "All Untagged". This can also be observed in other types of resources such as Gradients, Patterns, and Palettes.

EXPECTED RESULT
The user shouldn't be able to explicitly assign a resource to that tag.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Debian sid
KDE Plasma Version: 5.23.3
KDE Frameworks Version: 5.88.0
Qt Version: 5.12.11 (appimage)
Comment 1 Tiar 2021-11-29 17:37:57 UTC
For Brush Presets, the relevant code is in KisResourceItemChooserContextMenu.cpp. I assumed that other resource choosers have the same context menu and it works there too, but it seems not. So, they either use different code (probably all broken since I haven't touched it?) or there is some other issue.

The code in the ContextMenu is a bit hard to read but you can see at the beginning of the big function that there is a part that removes all special tags from the lists of tags. That's what should get rid of "All" and "All Untagged" tags. Maybe they have incorrect ids (not -1 and -2 like for brush presets)?
Comment 2 Emmet O'Neill 2021-11-30 06:06:02 UTC
Git commit 43b10e374180700577c012ea3a0f4c844046f664 by Emmet O'Neill.
Committed on 30/11/2021 at 06:05.
Pushed by emmetoneill into branch 'krita/5.0'.

Resources: Safe assert tagResource tag->id() is valid.

M  +3    -2    libs/resources/KisTagResourceModel.cpp

https://invent.kde.org/graphics/krita/commit/43b10e374180700577c012ea3a0f4c844046f664
Comment 3 Emmet O'Neill 2021-11-30 06:06:10 UTC
Git commit ea99c6a98d6e53b369a0df4269e63aed7ff7363c by Emmet O'Neill.
Committed on 30/11/2021 at 06:05.
Pushed by emmetoneill into branch 'krita/5.0'.

Prevent 'Special' tags from showing up in right click assignemnt menu.

More clean-up in this class is necessary. I don't like how assigned tags
are shown in the assignable tags list.

M  +22   -31   libs/resourcewidgets/KisResourceItemChooserContextMenu.cpp

https://invent.kde.org/graphics/krita/commit/ea99c6a98d6e53b369a0df4269e63aed7ff7363c
Comment 4 Emmet O'Neill 2021-11-30 06:09:55 UTC
Git commit 48b1261b1168d8545d53ca7748017905cd08bcc2 by Emmet O'Neill.
Committed on 30/11/2021 at 06:09.
Pushed by emmetoneill into branch 'master'.

Resources: Safe assert tagResource tag->id() is valid.


(cherry picked from commit 43b10e374180700577c012ea3a0f4c844046f664)

M  +3    -2    libs/resources/KisTagResourceModel.cpp

https://invent.kde.org/graphics/krita/commit/48b1261b1168d8545d53ca7748017905cd08bcc2
Comment 5 Emmet O'Neill 2021-11-30 06:10:45 UTC
Git commit 41f1e1fc2b3b9b45cf4efb509ce67965f4f58afa by Emmet O'Neill.
Committed on 30/11/2021 at 06:10.
Pushed by emmetoneill into branch 'master'.

Prevent 'Special' tags from showing up in right click assignemnt menu.

More clean-up in this class is necessary. I don't like how assigned tags
are shown in the assignable tags list.


(cherry picked from commit ea99c6a98d6e53b369a0df4269e63aed7ff7363c)

M  +22   -31   libs/resourcewidgets/KisResourceItemChooserContextMenu.cpp

https://invent.kde.org/graphics/krita/commit/41f1e1fc2b3b9b45cf4efb509ce67965f4f58afa