Bug 515546

Summary: Ledger View New sub-category creation - should the existing Category name check be a case insensitive match
Product: [Applications] kmymoney Reporter: pc <junk_2010>
Component: generalAssignee: KMyMoney Devel Mailing List <kmymoney-devel>
Status: REPORTED ---    
Severity: minor    
Priority: NOR    
Version First Reported In: 5.2.1   
Target Milestone: ---   
Platform: Other   
OS: Other   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description pc 2026-02-05 13:02:30 UTC
SUMMARY

Thank you for the change to be able to create sub-categories directly in the ledger view in Bug 514987.

The changes are working well.

However, there does appear to me to be a small inconsistent behaviour. Others may disagree.

When in the account ledger, if for an entry I start typing in the "Category" box it does a case insensitive match to category names that already exist.

So for example, if there is an existing "Insurance" category, both "Insurance" and "insurance" will match this in the drop down list that appears.

This also happens when I first start to create a new sub-category of "Cycle Insurance" under "Insurance". However, if I have typed "insurance" and then go on typing "insurance:Cycle Insurance" I get a pop-up box error with the text:
"The selected parent account insurance does not exist in the Expense hierarchy".
Which of course is strictly correct.

Everything does of course works as expected if I enter "Insurance:Cycle Insurance".

Would it make sense for the check for an existing Category name to be case insensitive in the case when a new sub-category is being created?


STEPS TO REPRODUCE
1. Have a KMyMoney data file with an existing "Insurance" category
2. In an account ledger view, for an account entry, in the "Category" box type "insurance". KMyMoney does a case-insensitive match.
3. Now continue typing to create the desired new sub-category, for example "insurance: Cycle Insurance"

OBSERVED RESULT
A pop-up box error will appear with the text:
"The selected parent account insurance does not exist in the Expense hierarchy".

EXPECTED RESULT
KMyMoney should use a case insensitive match when checking for an existing "Insurance" category when creating a new "sub-category".


SOFTWARE/OS VERSIONS
Windows: 10
Linux: Ubuntu 2024.04.3 AppImage

ADDITIONAL INFORMATION
Comment 1 pc 2026-02-06 11:23:42 UTC
I realised that there is a flaw in the suggested logic in my original description.
This is because KMyMoney does allow the creation of categories with case sensitivity, such that a case insensitive match could actually, though probably not in practice unless there had been a "mistake", match multiple category names.

So, for example, all of the following names could exist as indivdiual category entries:
    Insurance
    insurance
    inSurance
    InSurance
etc.

I still believe from a "it just works" user point of view the use of a case insensitive match for an existing category is still an idea worth considering. However, the "logic" for existing category name check might need to be something along the lines of:

If case sensitive match of <WORD>:
    Use <WORD> as the category name
If exactly one case insensitive match of <WORD>:
    Use case insensitive match of <WORD> as the category name
If >1 case insensitive match of <WORD>:
    Write message "There is no exact, and there are more than 1 case insensitive, match of <WORD> in the existing Category names"
If zero case insensitive match of <WORD>:
    Write message "There is no match of <WORD> in the existing Category names"
Comment 2 pc 2026-02-06 11:27:28 UTC
Opps, correction to logic in last post...

If [case sensitive match of <WORD>]:
    Use <WORD> as the category name
Else If [exactly one case insensitive match of <WORD>]:
    Use case insensitive match of <WORD> as the category name
Else If [>1 case insensitive match of <WORD>]:
    Write message "There is no exact, and there are more than 1 case insensitive, match of <WORD> in the existing Category names"
Else (zero case sensitive and insensitive match of <WORD>):
    Write message "There is no match of <WORD> in the existing Category names"