예제 #1
0
/******************************************************************************
*  Add all the current alarms to the list.
*/
void AlarmListView::populate()
{
    KAEvent event;
    KCal::Event::List events;
    KCal::Event::List::ConstIterator it;
    QDateTime now = QDateTime::currentDateTime();
    if(mShowExpired)
    {
        AlarmCalendar *cal = AlarmCalendar::expiredCalendarOpen();
        if(cal)
        {
            events = cal->events();
            for(it = events.begin();  it != events.end();  ++it)
            {
                KCal::Event *kcalEvent = *it;
                if(kcalEvent->alarms().count() > 0)
                {
                    event.set(*kcalEvent);
                    addEntry(event, now);
                }
            }
        }
    }
    events = AlarmCalendar::activeCalendar()->events();
    for(it = events.begin();  it != events.end();  ++it)
    {
        KCal::Event *kcalEvent = *it;
        event.set(*kcalEvent);
        if(mShowExpired  ||  !event.expired())
            addEntry(event, now);
    }
}
예제 #2
0
bool KCalSharedResource::get_event_changes(OSyncDataSource *dsobj, OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx)
{
	OSyncFormatEnv *formatenv = osync_plugin_info_get_format_env(info);
	OSyncObjFormat *objformat = osync_format_env_find_objformat(formatenv, "vevent20");

	KCal::Event::List events = calendar->events();

	for (KCal::Event::List::ConstIterator i = events.begin(); i != events.end(); i++) {

		if ( ! dsobj->has_category((*i)->categories()) )
			continue;

		/* Skip entries from birthday resource. This is just a workaround.
		 * patch by rhuitl
		 * FIXME: todo: add a list of resources to kdepim-sync.conf
		 */
		if ( (*i)->uid().contains("KABC_Birthday") || (*i)->uid().contains("KABC_Anniversary") )
			continue;

		if (!report_incidence(dsobj, sink, info, ctx, *i, objformat))
			return false;
	}

	return true;
}