From kde-pim Sun Jan 27 21:34:57 2002 From: Adriaan de Groot Date: Sun, 27 Jan 2002 21:34:57 +0000 To: kde-pim Subject: Re: [Kde-pim] Calendar::getAllEvents X-MARC-Message: https://marc.info/?l=kde-pim&m=101216737406898 On Sunday 27 January 2002 14:36, Cornelius Schumacher wrote: > 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 l = calendar.getAllEvents(); > > Event *e = l.first(); > > e->setDescription("Moose"); > > calendar.save(); > > Yes, it changes the calendar. Could we add const QList &CalendarLocal::getAllEvents() { return *mCal ... oh, rats. The internal data structure isn't a list at all. I'm just wondering about how we can make things like searching in a calendar fast for applications in general. What KPilot does now is: 1) get the list of all events 2) search it to find an Event * with a particular Pilot id 3) throw it away perhaps a find() function could be implemented in Calendar? > This comment is probably outdated (It is at least two years old). OK, I'll take your word for it :) > 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. Excellent. Can we add that as a comment to calendar.h? _______________________________________________ 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/