Setting the Alarm

You can assign an alarm to a calendar entry. CCalAlarm specifies the alarm type and the time prior to the scheduled event at which to activate the alarm.

The following shows how to create and initialise a CCalAlarm object, and use it to set an alarm on an entry.

// Set the alarm to a calendar entry 
CCalAlarm* alarm = CCalAlarm::NewL(); // pointer to alarm 
alarm->SetTimeOffset(5); //alarm is set to occur 5 minutes prior to the event 
// set the name of alarm to ‘Buzzing Alarm’ 
_LIT(KAlarmSoundName, "Buzzing Alarm"); 
alarm->SetAlarmSoundNameL(KAlarmSoundName); 
// set the alarm
entry->SetAlarmL(alarm);

If no alarm sound is set, the default alarm sound is used.

To clear an already set alarm from an entry, pass NULL to CCalEntry::SetAlarmL().