Пример #1
0
KDateTime Event::dateTime( DateTimeRole role ) const
{
  switch ( role ) {
  case RoleRecurrenceStart:
  case RoleAlarmStartOffset:
  case RoleStartTimeZone:
  case RoleSort:
    return dtStart();
  case RoleCalendarHashing:
    return !recurs() && !isMultiDay() ? dtStart() :
                                        KDateTime();
  case RoleAlarmEndOffset:
  case RoleEndTimeZone:
  case RoleEndRecurrenceBase:
  case RoleEnd:
  case RoleDisplayEnd:
    return dtEnd();
  case RoleAlarm:
    if ( alarms().isEmpty() ) {
      return KDateTime();
    } else {
      Alarm::Ptr alarm = alarms().first();
      return alarm->hasStartOffset() ? dtStart() : dtEnd();
    }

  default:
    return KDateTime();
  }
}
Пример #2
0
void CompatOutlook9::fixAlarms( const Incidence::Ptr &incidence )
{
  if ( !incidence ) {
    return;
  }
  Alarm::List alarms = incidence->alarms();
  Alarm::List::Iterator it;
  for ( it = alarms.begin(); it != alarms.end(); ++it ) {
    Alarm::Ptr al = *it;
    if ( al && al->hasStartOffset() ) {
      Duration offsetDuration = al->startOffset();
      int offs = offsetDuration.asSeconds();
      if ( offs > 0 ) {
        offsetDuration = Duration( -offs );
      }
      al->setStartOffset( offsetDuration );
    }
  }
}