On Fr, 2011-04-01 at 11:29 +0200, Patrick Ohly wrote:
> > > I beg to disagree here. The MeeGo version of KCalCore is compiled
> > > differently than the upstream version:
> > > 
> > > #if !defined(KCALCORE_FOR_MEEGO)
> > >         endDate = kdt.date().addDays( -1 );
> > > #else
> > >         endDate = kdt.date();
> > > #endif
> > > 
> > 
> > Go to the kde git, and you will see those there. So the code, as I said, is 
> > from upstream.
> 
> My point is that the MeeGo version of KCalCore is functionally different
> from the one in KDE. That the code is upstream is irrelevant as long as
> ifdefs are used for more fundamental changes than merely getting the
> code to compile on a different platform.

My suspicion all along was that these defines around end date change the
semantic of KCalCore. To verify that, I modified the test program from
BMC #6050 such that it imports an iCalendar 2.0 all-day event and prints
its start/end date after importing into KCalCore.

Code attached, compile/run with:
        rm -rf ~/.calendar && \
        g++ -g test-allday-semantic.cpp `pkg-config --cflags --libs libmkcal ` 
&& \
        ./a.out

In MeeGo with KCalCore 4.1.18 I get
  start QDate("Wed Apr 5 2006") end QDate("Thu Apr 6 2006")

After recompiling that version without KCALCORE_FOR_MEEGO I get:
  start QDate("Wed Apr 5 2006") end QDate("Wed Apr 5 2006")

In other words, the patch changes the semantic of dtEnd() for
applications. Upstream KDE uses "dtEnd() is inclusive", the MeeGo
version uses "dtEnd() is exclusive".

The latter is closer to iCalendar 2.0, but is that a good enough
justification to break compatibility with apps ported from KDE? I don't
think so.

Another possible justification would be that the original semantic
cannot express an "empty" all-day event (start == end). Again I would
consider not modifying the API as more important than this cleanup.

-- 
Best Regards, Patrick Ohly

The content of this message is my personal opinion only and although
I am an employee of Intel, the statements I make here in no way
represent Intel's position on the issue, nor am I authorized to speak
on behalf of Intel on this matter.

/*
 * Calendar - For testing adding alarm to an event
 *
 * Copyright (c) 2010, Intel Corporation.
 * Author: Sirisha Muppavarapu ([email protected])
 *
 * This program is licensed under the terms and conditions of the
 * Apache License, version 2.0.  The full text of the Apache License is at
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 */
#include <QtCore/QCoreApplication>
#include <extendedcalendar.h>
#include <event.h>
#include <notebook.h>
#include <sqlitestorage.h>
#include <kdatetime.h>
#include <duration.h>
#include <icalformat.h>

#include <QDebug>


const char *item =
    "BEGIN:VCALENDAR\n"
    "PRODID:-//Ximian//NONSGML Evolution Calendar//EN\n"
    "VERSION:2.0\n"
    "BEGIN:VEVENT\n"
    "SUMMARY:all day\n"
    "DTSTART;VALUE=DATE:20060405\n"
    "DTEND;VALUE=DATE:20060406\n"
    "UID:foobar\n"
    "END:VEVENT\n"
    "END:VCALENDAR\n";

int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);

    mKCal::ExtendedCalendar::Ptr calendar(new mKCal::ExtendedCalendar(KDateTime::Spec::LocalZone()));
    mKCal::ExtendedStorage::Ptr storage(mKCal::ExtendedCalendar::defaultStorage(calendar));
    storage->open();
    storage->load();

    // import event
    KCalCore::ICalFormat parser;
    if (!parser.fromString(calendar, QString::fromUtf8(item))) {
        qFatal("error parsing iCalendar 2.0 item");
    }

    KCalCore::ICalFormat formatter;
    qDebug() << formatter.toString(KCalCore::Calendar::Ptr(calendar));

    KCalCore::Incidence::List incidences = calendar->incidences();
    qDebug() << incidences;
    KCalCore::Event::Ptr event = incidences[0].staticCast<KCalCore::Event>();
    qDebug() << "start" << event->dtStart().date() << "end" << event->dtEnd().date();

    // MeeGo with FOR_MEEGO define:
    // start QDate("Wed Apr 5 2006") end QDate("Thu Apr 6 2006") 
    // without define:
    // start QDate("Wed Apr 5 2006") end QDate("Wed Apr 5 2006")

    return 0;
}
_______________________________________________
MeeGo-dev mailing list
[email protected]
http://lists.meego.com/listinfo/meego-dev
http://wiki.meego.com/Mailing_list_guidelines

Reply via email to