Bug 154652

Summary: KDateTable::setCustomDatePainting() doesn't do anything
Product: [Unmaintained] kdelibs Reporter: Charles Connell <charles>
Component: kdeuiAssignee: kdelibs bugs <kdelibs-bugs-null>
Status: RESOLVED FIXED    
Severity: normal    
Priority: HI    
Version First Reported In: SVN   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: Fixes bug

Description Charles Connell 2007-12-26 23:54:20 UTC
Version:            (using KDE Devel)
Installed from:    Compiled sources
Compiler:          g++ (GCC) 4.1.2 20061115 (prerelease) (SUSE Linux) 
OS:                Linux

The call will not affect the color of the cell that it is supposed to be called on. I can confirm the problem from Kopete code, within a KDatePicker, and alone in the unit test. (I add the call to that. It really should be there anyways).
Comment 1 Charles Connell 2007-12-27 03:34:16 UTC
Created attachment 22694 [details]
Fixes bug

The QHash of and QStrings and DatePaintingMode*'s was being misused. Insertion
and deletion functions were generating strings from
KCalendarSystem::formatDate, but the lookup function was using
QDate.toString(). These two different mechanisms produced a different date
format, so every lookup was a miss.
Comment 2 Michael Pyne 2007-12-27 04:01:11 UTC
I agree with the diagnosis.  I would rather turn the customPaintingModes into a QHash keyed on QDate and drop the calls to formatDate everywhere, but that can't be done without creating a qHash() function, and *that* can't be done since it depends on the KDateTable object.

Is there a reason why KCalendarSystem::formatDate() is used as the hash key or does anyone know if it can be switched to QDate::toString() which depends only on the QDate?  If it can't be switched I would say to apply the patch.
Comment 3 Charles Connell 2007-12-29 20:36:07 UTC
Can I commit the fix?
Comment 4 Michael Pyne 2007-12-29 20:42:12 UTC
I would say commit it.  It's better to have working code even if non-ideal architecturally.  It can be turned into working ideal code later.
Comment 5 Charles Connell 2007-12-31 17:48:55 UTC
Fixed. http://websvn.kde.org/?view=rev&revision=754431