[Kde-pim] KCalCore::Calendar + adding time zones

Patrick Ohly patrick.ohly at gmx.de
Fri Apr 29 14:42:38 BST 2011


Hello!

I have a question about time zone definitions. Suppose that an
application obtains a KTimeZone from KSystemTimeZones, then creates a
new event with dtStart/End using that KTimeZone. Then it adds that event
to a calendar:

void addEvent(const KCalCore::Calendar::Ptr &calendar)
{
    KSystemTimeZones zones;
    KTimeZone berlin = m_zones.zone("Europe/Berlin");
    ...
    event = KCalCore::Event::Ptr(new KCalCore::Event);
    KDateTime berlinstart(QDate(2011, 01, 01),
                          QTime(15, 30, 0),
                          KDateTime::Spec(berlin));
    event->setDtStart(berlinstart);
    ...
    calendar->addEvent(event);
    ...
    ICalTimeZones *zones = calendar->timeZones();
    zones->add(berlin); // does not work! berlin not a ICalTimeZone
}

What about adding the time zone definition to the calendar's zone
definitions? Is that something that the app must do or must not do?

Strictly speaking, the calendar should be self-contained, without
depending on some external definitions. Following that logic, any time
zone definitions used in the calendar must also be part of its
definitions.

But the downside is that these events will forever use the calendar's
copy of the time zone.

My observation is that the code works okay when the system definitions
are not part of the calendar's definitions. The system definitions are
used as fallback when not part of the calendar definitions.

But then why does icalformat_p.cpp's ICalFormatImpl::readICalDateTime()
add system definitions to the calendar's tzlist? That seems inconsistent
to me.

I am asking because I want to get time zone handling right for the
KCal-EDS bridge code [1].

[1] http://wiki.meego.com/Architecture/planning/evolution-data-server

-- 
Bye, Patrick Ohly
--  
Patrick.Ohly at gmx.de
http://www.estamos.de/


_______________________________________________
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