[kmail2] [Bug 308444] %OLONGTIME template variable does not yield timezone information

Matt Whitlock bugzilla_noreply at kde.org
Wed Jan 11 04:00:56 GMT 2017


https://bugs.kde.org/show_bug.cgi?id=308444

Matt Whitlock <kde at mattwhitlock.name> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kde at mattwhitlock.name

--- Comment #7 from Matt Whitlock <kde at mattwhitlock.name> ---
Created attachment 103342
  --> https://bugs.kde.org/attachment.cgi?id=103342&action=edit
Patch to messagelib that fixes the problem

QDateTime::time() returns a QTime, which conveys no time zone information.
QLocale::toString(const QTime &, QLocale::FormatType) then assumes that the
passed QTime is a local time. This causes a problem when processing a template
in that the time zone information of the Date header in the original message is
ignored, and the time part is then reinterpreted as a local time, which is
incorrect.

Example illustrating the problem:

        Original message header:
        Date: Sun, 1 Jan 2017 13:31:25 -0600

        %OTIMELONG in reply template expands to:
        1:31:25 PM EST

QLocale apparently offers no method to format a QTime with a specific
QTimeZone, so the best that can be done is to convert the QDateTime of the
original message into a local time by calling QDateTime::toLocalTime().

After applying this fix, the above example becomes:

        Original message header:
        Date: Sun, 1 Jan 2017 13:31:25 -0600

        %OTIMELONG in reply template expands to:
        2:31:25 PM EST

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the Kdepim-bugs mailing list