[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-pim
Subject:    Re: [Kde-pim] Calendar::getAllEvents
From:       Cornelius Schumacher <schumacher () kde ! org>
Date:       2002-01-27 13:36:50
[Download RAW message or body]

On Saturday 26 January 2002 15:10, Adriaan de Groot wrote:
> Would a code snippet like the following (based loosely on the libkcal
> from KDE 2.2.2) change the calendar?
>
> 	QList<Event> l = calendar.getAllEvents();
> 	Event *e = l.first();
> 	e->setDescription("Moose");
> 	calendar.save();

Yes, it changes the calendar.

> In other words, do changes to Events in that list affect the Events
> internal to the calendar? Reading the source for the 2.2.2 version of
> the libs, I'd say they do, since it's just a Q(Ptr)List being built
> up with pointers to internal Events. On the other hand, there's the
> comment
>
> // taking a QDateTime, this function will look for an eventlist in
> the dict // with that date attached.
> // this list is dynamically allocated and SHOULD BE DELETED when done
> with! QList<Event> CalendarLocal::eventsForDate(const QDateTime &qdt)
> {
>   return eventsForDate(qdt.date());
> }
>
> suggests otherwise.

This comment is probably outdated (It is at least two years old).

The intended behaviour is the following: As soon as an event (or any 
other subclass of Incidence) object is added to the Calendar by 
addEvent() it is owned by the Calendar object. The Calendar takes care 
of deleting it. All Events returned by the query functions are returned 
as pointers, that means all changes to the returned events are 
immediately visible in the Calendar. You shouldn't delete any Event 
object you get from Calendar.

If there is something behavioung differently it is a bug and should be 
fixed.

The other question is, if the functions of CalendarLocal and especially 
the internal handling of entries really makes sense. It's very old code 
that should probably be revised at some time. But as long as it works...

-- 
Cornelius Schumacher <schumacher@kde.org>
_______________________________________________
kde-pim mailing list
kde-pim@mail.kde.org
http://mail.kde.org/mailman/listinfo/kde-pim
kde-pim home page at http://pim.kde.org/
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic