Bug 298491

Summary: Typos in templatemanager.cpp cause locationprovincestate and contactprovincestate not to be loaded or saved to templates
Product: [Applications] digikam Reporter: Guillaume Paumier <guillom.pom>
Component: Usability-i18nAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: caulier.gilles, smit.meh
Priority: NOR    
Version: 2.6.0   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In: 2.6.0
Sentry Crash Report:

Description Guillaume Paumier 2012-04-20 14:08:52 UTC
See below.

Reproducible: Always

Steps to Reproduce:
1. Create a template and fill out the "Location > Province/State" and "Contact > Province/State" fields
2. Save the template and exit digikam
3. Reopen digikam and open the same template
Actual Results:  
The "Location > Province/State" and "Contact > Province/State" fields are empty.

Expected Results:  
The "Location > Province/State" and "Contact > Province/State" fields should load the values saved into the template.

I believe both issues are caused by typos in core/libs/template/templatemanager.cpp.

The first issue is at line 230:
            else if (name2 == QString::fromLatin1("clocationprovincestate"))
should be
            else if (name2 == QString::fromLatin1("locationprovincestate"))

The second issue is an inconsistency between line 258, where the field is called "contactprovincestate":
            else if (name2 == QString::fromLatin1("contactprovincestate"))
and lines 417-419, where it's called "contactprovinceSstate":
            QDomElement contactprovinceSstate = doc.createElement(QString::fromLatin1("contactprovinceSstate"));
            contactprovinceSstate.setAttribute(QString::fromLatin1("value"), t.contactInfo().provinceState);
            elem.appendChild(contactprovinceSstate);

Line numbers refer to the current version of the file in git.

I'm guessing that fixing the issues in templatemanager.cpp isn't enough and that it's also necessary to fix existing templates in ~/.kde4/share/apps/digikam/template.xml, so I preferred to provide a detailed description of the issue rather than a (possibly incomplete) patch.

This issue is reported against the current version in git but it also seems to be present in the 2.5.0 release.
Comment 1 Smit Mehta 2012-04-20 14:32:14 UTC
I confirm it.

I will patch the typos in a while.

@Gilles : Is there a way to modify the existing .xml files in user's comp?
Comment 2 Smit Mehta 2012-04-20 15:08:36 UTC
Git commit b9b253626eca171da6c04b68ac015dd02f165667 by smit mehta.
Committed on 20/04/2012 at 17:07.
Pushed by smitmehta into branch 'master'.

Typos fixed

M  +4    -4    libs/template/templatemanager.cpp

http://commits.kde.org/digikam/b9b253626eca171da6c04b68ac015dd02f165667
Comment 3 caulier.gilles 2012-04-20 16:27:51 UTC
Smit,

Users need to modify xml file hosted in ~/.kde4/share/apps/digikam

Gilles
Comment 4 Smit Mehta 2012-04-20 16:33:41 UTC
Okay then, I dont think we can do anymore here. Shall I close the bug?
Comment 5 caulier.gilles 2012-04-20 17:24:20 UTC
yes, let's go. Don't forget to patch NEWS file...

Gilles
Comment 6 Smit Mehta 2012-04-20 17:30:14 UTC
Git commit af9ebe0ad1bdbc4f54085794273a77c434cf2258 by smit mehta.
Committed on 20/04/2012 at 19:28.
Pushed by smitmehta into branch 'master'.

update

M  +2    -0    NEWS

http://commits.kde.org/digikam/af9ebe0ad1bdbc4f54085794273a77c434cf2258