예제 #1
0
Incidence *ICalFormat::fromString(const QString &text)
{
    CalendarLocal cal(mTimeZoneId);
    fromString(&cal, text);

    Incidence *ical = 0;
    Event::List elist = cal.events();
    if(elist.count() > 0)
    {
        ical = elist.first();
    }
    else
    {
        Todo::List tlist = cal.todos();
        if(tlist.count() > 0)
        {
            ical = tlist.first();
        }
        else
        {
            Journal::List jlist = cal.journals();
            if(jlist.count() > 0)
            {
                ical = jlist.first();
            }
        }
    }

    return ical ? ical->clone() : 0;
}
예제 #2
0
void KOEventEditor::loadTemplate( CalendarLocal &cal )
{
  Event::List events = cal.events();
  if ( events.count() == 0 ) {
    KMessageBox::error( this, i18nc( "@info", "Template does not contain a valid event." ) );
  } else {
    readEvent( events.first(), QDate(), true );
  }
}
예제 #3
0
Event::Ptr DndFactory::createDropEvent( const QMimeData *mimeData )
{
  //kDebug();
  Event::Ptr event;
  MemoryCalendar::Ptr calendar( createDropCalendar( mimeData ) );

  if ( calendar ) {
    Event::List events = calendar->events();
    if ( !events.isEmpty() ) {
      event = Event::Ptr( new Event( *events.first() ) );
    }
  }
  return event;
}
예제 #4
0
Event *DndFactory::createDropEvent( const QMimeData *md )
{
  kDebug();
  Event *ev = 0;
  Calendar *cal = createDropCalendar( md );

  if ( cal ) {
    Event::List events = cal->events();
    if ( !events.isEmpty() ) {
      ev = new Event( *events.first() );
    }
    delete cal;
  }
  return ev;
}