Bug 154652 - KDateTable::setCustomDatePainting() doesn't do anything
Summary: KDateTable::setCustomDatePainting() doesn't do anything
Status: RESOLVED FIXED
Alias: None
Product: kdelibs
Classification: Frameworks and Libraries
Component: kdeui (show other bugs)
Version: SVN
Platform: Compiled Sources Linux
: HI normal
Target Milestone: ---
Assignee: kdelibs bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-12-26 23:54 UTC by Charles Connell
Modified: 2007-12-31 17:48 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
Fixes bug (687 bytes, patch)
2007-12-27 03:34 UTC, Charles Connell
Details

Note You need to log in before you can comment on or make changes to this 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