[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-pim
Subject: Re: [Kde-pim] adding a Todo to the default calendar
From: Reinhold Kainhofer <reinhold () kainhofer ! com>
Date: 2005-02-21 11:24:51
Message-ID: 200502211224.53490.reinhold () kainhofer ! com
[Download RAW message or body]
[Attachment #2 (multipart/signed)]
Am Samstag, 19. Februar 2005 02:35 schrieb Robby Stephenson:
> Hi,
>
> I hope this is the right list to be asking this question. I'd like to use
> libkcal to add a Todo to the user's default calendar frm within my app. But
> I'm not even sure there's such a thing as a "default calendar".
Yes, there is KCal::CalendarResources. Look at korganizer/stdcalendar.cpp or
kpilot/conduits/vcalconduits/ for code regarding the CalendarResources, which
is a subclass of KCal::Calendar (so you'll mostly find actions that work on
Calendar*, don't be confused).
> So perhaps
> I could offer a combobox of available calendars., if such a list were
> readily available.
The list of resources is available through the resource manager, which is part
of CalendarResources.
> But I've been reading through the api docs and it's not clear to me the
> best or canonical way to do this. The konsolekalendar sources seemed to be
> the best bet, but I got lost in figuring out the relationship between
> CalendarResources and ResourceCalendar, etc.
Okay, you need to distinguish between the whole calendar, and the resources
(parts, which might be in different locations, e.g. the birthday resource,
the Exchange resource, the local file resource, etc.). Each CalendarResources
(which is the calendar object, derived from KCal::Calendar) can consist of
several resources (Resource*, derived from ResourceCalendar).
When you work with a calendar, you typically don't need to care about the
resource objects. You just use the API provided by Calendar and
CalendarResources.
The class hierarchy is for the calendar objects (think of them as top-level
calendar):
KCal::Calendar
KCal::CalendarLocal
KCal::CalendarNull
KCal::CalendarResources
and for the resources (think of them as sub-calendars):
KCal::ResourceCalendar
KCal::ResourceCached
KCal::ResourceLocal
KCal::Resource... (in kdepim/kresources/*)
KCal::ResourceKABC
> Is there a good example anywhere of this type of third-part (outside kdepim
> module itself) development? Or better yet, could someone suggest a way?
Hmm, the problem is mainly that libkcal doesn't stay binary compatible (or
even source compatible) between kde releases...
> Essentially, I want to do this:
>
> Calendar* cal = defaultCalendar(); (or allowing user to select one)
> Todo* todo = new Todo();
> ...
> cal->addTodo(todo);
> cal->save();
>
> Also, if the user has no current calendar, is there an accepted default to
> create? I noticed konsolekalendarvariables.cpp uses
> locateLocal( "appdata", "std.ics" )
> to create a calendar, but the method using that doesn't seem to be called
> elsewhere.
That's what korganizer/stdcalendar.cpp does for korganizer.
Cheers,
Reinhold
--
------------------------------------------------------------------
Reinhold Kainhofer, Vienna, Austria
email: reinhold@kainhofer.com, http://reinhold.kainhofer.com/
* Financial and Actuarial Mathematics, TU Wien, http://www.fam.tuwien.ac.at
* K Desktop Environment, http://www.kde.org/, KOrganizer / KPilot maintainer
[Attachment #5 (application/pgp-signature)]
_______________________________________________
kde-pim mailing list
kde-pim@kde.org
https://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