OnAlarm functions now will receive an instance of oeIICalEventDisplay with the displaydate set to

the date for which the alarm went off
This commit is contained in:
mostafah%oeone.com 2002-09-06 15:23:00 +00:00
Родитель 89765efa78
Коммит 44532a51dd
4 изменённых файлов: 30 добавлений и 7 удалений

Просмотреть файл

@ -1070,6 +1070,18 @@ icaltimetype oeICalEventImpl::CalculateAlarmTime( icaltimetype date ) {
return result;
}
icaltimetype oeICalEventImpl::CalculateEventTime( icaltimetype alarmtime ) {
icaltimetype result = alarmtime;
if( strcasecmp( m_alarmunits, "days" ) == 0 )
icaltime_adjust( &result, (signed long)m_alarmlength, 0, 0, 0 );
else if( strcasecmp( m_alarmunits, "hours" ) == 0 )
icaltime_adjust( &result, 0, (signed long)m_alarmlength, 0, 0 );
else
icaltime_adjust( &result, 0, 0, (signed long)m_alarmlength, 0 );
return result;
}
NS_IMETHODIMP oeICalEventImpl::GetStart(oeIDateTime * *start)
{
*start = m_start;

Просмотреть файл

@ -115,6 +115,7 @@ public:
icaltimetype GetNextRecurrence( icaltimetype begin );
icaltimetype GetPreviousOccurrence( icaltimetype beforethis );
NS_IMETHODIMP SetParent( oeIICal *parent );
icaltimetype CalculateEventTime( icaltimetype alarmtime );
private:
char *m_id;
char *m_syncid;

Просмотреть файл

@ -1636,19 +1636,29 @@ void oeICalImpl::SetupAlarmManager() {
if( icaltime_is_null_time( alarmtime ) )
break;
if( icaltime_compare( alarmtime, now ) <= 0 ) {
#ifdef ICAL_DEBUG
#ifdef ICAL_DEBUG
printf( "ALARM WENT OFF: %s\n", icaltime_as_ical_string( alarmtime ) );
#endif
#endif
nsresult rv;
oeIICalEventDisplay* eventDisplay;
rv = NS_NewICalEventDisplay( event, &eventDisplay );
#ifdef ICAL_DEBUG
if( NS_FAILED( rv ) ) {
printf( "oeICalImpl::SetupAlarmManager() : WARNING Cannot create oeIICalEventDisplay instance: %x\n", rv );
}
#endif
icaltimetype eventtime = event->CalculateEventTime( alarmtime );
eventDisplay->SetDisplayDate( ConvertToPrtime( eventtime ) );
for( unsigned int i=0; i<m_observerlist.size(); i++ ) {
nsresult rv;
rv = m_observerlist[i]->OnAlarm( event );
rv = m_observerlist[i]->OnAlarm( eventDisplay );
#ifdef ICAL_DEBUG
if( NS_FAILED( rv ) ) {
printf( "oeICalImpl::SetupAlarmManager() : WARNING Call to observer's onAlarm() unsuccessful: %x\n", rv );
}
#endif
}
NS_RELEASE( eventDisplay );
}
else {
if( icaltime_is_null_time( nextalarm ) )
@ -1668,9 +1678,9 @@ void oeICalImpl::SetupAlarmManager() {
m_alarmtimer = nsnull;
}
if( !icaltime_is_null_time( nextalarm ) ) {
#ifdef ICAL_DEBUG
#ifdef ICAL_DEBUG
printf( "NEXT ALARM IS: %s\n", icaltime_as_ical_string( nextalarm ) );
#endif
#endif
time_t timediff = icaltime_as_timet( nextalarm ) - icaltime_as_timet( now );
nsresult rv;

Просмотреть файл

@ -170,7 +170,7 @@ interface oeIICalObserver : nsISupports
void onAddItem( in oeIICalEvent e);
void onModifyItem( in oeIICalEvent e, in oeIICalEvent olde );
void onDeleteItem( in oeIICalEvent e);
void onAlarm( in oeIICalEvent e);
void onAlarm( in oeIICalEventDisplay e);
};
[scriptable, uuid(7a4fd625-69a8-4008-932e-cccc227b402c)]