Exemplo 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;
}
Exemplo n.º 2
0
/******************************************************************************
* If a function is defined to convert alarms to the current format, call it to
* convert an individual file within the overall resource.
*/
KCalendar::Status AlarmResource::checkCompatibility(CalendarLocal& calendar, const QString& filename, FixFunc conv, bool* wrongType)
{
	if (wrongType)
		*wrongType = false;
	KCalendar::Status compat = KCalendar::Incompatible;   // assume the worst
	if (mFixFunction)
	{
		// Check whether the version is compatible (and convert it if desired)
		compat = (*mFixFunction)(calendar, filename, this, conv, wrongType);
		if (compat == KCalendar::Converted)
			calendar.save(filename);
	}
	return compat;
}