Bug 413277 - Custom message tags won't be saved
Summary: Custom message tags won't be saved
Status: REPORTED
Alias: None
Product: kmail2
Classification: Applications
Component: config dialog (show other bugs)
Version: 5.9.3
Platform: Debian stable Linux
: NOR normal
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-10-21 13:59 UTC by Freedim
Modified: 2019-10-28 13:45 UTC (History)
0 users

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 Freedim 2019-10-21 13:59:31 UTC
SUMMARY

When I set additional message tags, either from the message's context menu (Mark message As > Add a new tag...) or from the Configuration menu, they never become available as tags to mark a message. Then when I close kmail and re-open it. They have all vanished.

STEPS TO REPRODUCE
1. Go in Configure > Configure kmail... > Appearance > tab "Message tags"
2. Set a new tag (name, font color, toolbar button or not)
3. Click on Apply and OK
4. The tag does not exist in the contextual menu nor in the lists of used or available toolbar buttons.
5. Quit kmail and reopen it, go back to Configure > Configure kmail... > Appearance > tab "Message tags"
6. The custom tag does not exist any more.

OBSERVED RESULT
The custom tags are neither available nor saved over a close/open kmail cycle.

EXPECTED RESULT
The custom tags are available in the context menu and/or as buttons for toolbars an/or as items for menus in the toolbar.

SOFTWARE/OS VERSIONS
OS : Debian stable
KDE Plasma : 5.14.5
Qt : 5.11.3
KDE Frameworks : 5.62.0
Kernel : 5.2.0-kali3-amd64
OS type : 64-bit

Thanks for your attention.
Comment 1 Freedim 2019-10-28 09:37:02 UTC
After a quick look with akonadi console, the error seems to be:

Cannot add or update a child row: a foreign key constraint fails (`akonadi`.`tagtable`, CONSTRAINT `tagtable_ibfk_1` FOREIGN KEY (`parentId`) REFERENCES `tagtable` (`id`) ON DELETE CASCADE ON UPDATE CASCADE)

Which is indeed impossible to process when the TagTable is empty. This constraint demands that the first item ever inserted in TagTable should reference a parentId, which is impossible.

A possible solution I can think of would be to have a generic/dummy item in TagTable by default at installation time.
Comment 2 Freedim 2019-10-28 13:43:39 UTC
(In reply to fredgib from comment #1)
> After a quick look with akonadi console, the error seems to be:
> 
> Cannot add or update a child row: a foreign key constraint fails
> (`akonadi`.`tagtable`, CONSTRAINT `tagtable_ibfk_1` FOREIGN KEY (`parentId`)
> REFERENCES `tagtable` (`id`) ON DELETE CASCADE ON UPDATE CASCADE)
> 
> Which is indeed impossible to process when the TagTable is empty. This
> constraint demands that the first item ever inserted in TagTable should
> reference a parentId, which is impossible.
> 
> A possible solution I can think of would be to have a generic/dummy item in
> TagTable by default at installation time.

I inserted a dummy message tag in TagTable with "parentId" pointing at its own Id.

It allows new customised message tags to be saved with, though with big issues. I always check the box "enable toolbar button" when I create a message tag. When I click on "Apply" in the message tags settings GUI for the first time, it works and displays the new buttons. If I then create another tag/button and click on "Apply", will add a second instance of the previously created button and the newly created button. If I create a third button then click on apply, I will have 3 instances of the first button, 2 instances of the second button and 1 of the last button etc.

The tags list itself only has one instance of each created tag while the button and the options in the menu "Messages > Mark As..." will have multiple instances of the created tags.

If I restart kmail or the pim server with Akonadi console, nothing changes.

If I restart the computer, I now also have the multiple instances appearing in the Configure Kmail > Appearance > Meassage tags GUI. From that point, I can delete the duplicate instances and reach the expected result: A list with my tags and their (unique) corresponding buttons.
Comment 3 Freedim 2019-10-28 13:45:48 UTC
Forgot to mention: I changed the default value of parentId in TagTable to point to my first dummy manually inserted in TagTable. The original default value was "-1"