[Kde-pim] Review Request: [Fancy date format] "Today" not updated after midnight

Ingo Klöcker kloecker at kde.org
Tue May 5 22:39:51 BST 2009



> On 2009-05-04 14:01:54, Ingo Klöcker wrote:
> > It's not that easy to fix this bug in KMail. The formatted date is cached in KMail::MessageListView::Core::Item::mFormattedDate for all messages that have been visible in the message list view. Also, KMail::MessageListView::Core::Item uses the DateFormatter provided by KMail::MessageListView::Core::Manager.
> > 
> > So to fix the problem in KMail you have to do two things on midnight:
> > 1.) Call DateFormatter::reset() (see it's API documentation)
> > 2.) Clear mFormattedDate of all Item's. Manager::reloadAllWidgets() might do the trick. At least, it is called if the global date format changes (see Manager::reloadGlobalConfiguration()). Hmm, interestingly Manager has a slot slotHeartBeat() which is supposed to fix date displays. So maybe resetting the DateFormatter on midnight would already be enough to fix the problem in KMail.
> > 
> > I have no idea how this works in KNode, but given that KNode will rather sooner than later use the same (or a very similar) MessageListView as KMail fixing this for KMail will also fix this for a future KNode.
> > 
> > To answer your question: I have no idea how expensive time(0) is. In theory, it just needs to read the time_t stored in the kernel. I'd still prefer the solution described above, i.e. call DateFormatter::reset().
> 
> Olivier Trichet wrote:
>     Do you mean that the internal state (i.e. "mTodayOneSecondBeforeMidnight") of a persistent DateFormatter should be kept sane by the application that use it (with call to reset()) and not by the DateFormatter itself ?
>     (By persistent, I mean a DateFormatter instance that is kept forverer within an application, like in kmail's MessageListView)
>

Yes, that's what I mean. But I see your point. I suggest to write a small test program for comparing the performance of the current version and of your version of DateFormatter::fancy(). (For an example how to write a small benchmark with Qt see http://labs.trolltech.com/blogs/2009/01/23/iterating-efficiently/.) Remember to test this with a release build.


- Ingo


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://reviewboard.kde.org/r/661/#review1054
-----------------------------------------------------------


On 2009-05-03 15:07:57, Olivier Trichet wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://reviewboard.kde.org/r/661/
> -----------------------------------------------------------
> 
> (Updated 2009-05-03 15:07:57)
> 
> 
> Review request for KDE PIM.
> 
> 
> Summary
> -------
> 
> This change checks if the precalculed date/time of the end of the current day is still valid, otherwise it is updated.
> 
> The root of the issue is that KNode's headerview and KMail's MessageListView allocate only one instance of DateFormatter so that "mTodayOneSecondBeforeMidnight" is never updated.
> The article view used static method from DateFormatter and the correct "mTodayOneSecondBeforeMidnight" is used.
> 
> Is it ok to call time() each time fancy() is called ?
> 
> 
> This addresses bug 178035.
>     https://bugs.kde.org/show_bug.cgi?id=178035
> 
> 
> Diffs
> -----
> 
>   trunk/KDE/kdepimlibs/kmime/kmime_dateformatter.cpp 962607 
> 
> Diff: http://reviewboard.kde.org/r/661/diff
> 
> 
> Testing
> -------
> 
> I reproduced the bug last night in KNode and validate the fix tonight.
> 
> 
> Thanks,
> 
> Olivier
> 
>

_______________________________________________
KDE PIM mailing list kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
KDE PIM home page at http://pim.kde.org/


More information about the kde-pim mailing list