Ejemplo n.º 1
0
bool KonsoleKalendarAdd::addImportedCalendar()
{

// If --file specified, then import into that file
// else, import into the standard calendar

  QString fileName;
  if ( m_variables->getCalendarFile().isEmpty() )
    fileName = locateLocal( "data", "korganizer/std.ics" );
  else
    fileName = m_variables->getCalendarFile();

  CalendarLocal *cal = new CalendarLocal( KPimPrefs::timezone() );
  if ( !cal->load( fileName ) ||
       !cal->load( m_variables->getImportFile() ) ||
       !cal->save( fileName ) ) {
    kdDebug()
      << "konsolekalendaradd.cpp::importCalendar() | "
      << "Can't import file: "
      << m_variables->getImportFile()
      << endl;
    return false;
  }
  kdDebug()
    << "konsolekalendaradd.cpp::importCalendar() | "
    << "Successfully imported file: "
    << m_variables->getImportFile()
    << endl;
  return true;
}
Ejemplo n.º 2
0
bool ResourceLocalDir::doFileLoad(CalendarLocal &cal, const QString &fileName)
{
    if(!cal.load(fileName))
        return false;
    Incidence::List incidences = cal.rawIncidences();
    Incidence::List::ConstIterator it;
    for(it = incidences.constBegin(); it != incidences.constEnd(); ++it)
    {
        Incidence *i = *it;
        if(i) mCalendar.addIncidence(i->clone());
    }
    return true;
}