зеркало из https://github.com/mozilla/pjs.git
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:
Родитель
89765efa78
Коммит
44532a51dd
|
@ -1070,6 +1070,18 @@ icaltimetype oeICalEventImpl::CalculateAlarmTime( icaltimetype date ) {
|
||||||
return result;
|
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)
|
NS_IMETHODIMP oeICalEventImpl::GetStart(oeIDateTime * *start)
|
||||||
{
|
{
|
||||||
*start = m_start;
|
*start = m_start;
|
||||||
|
|
|
@ -115,6 +115,7 @@ public:
|
||||||
icaltimetype GetNextRecurrence( icaltimetype begin );
|
icaltimetype GetNextRecurrence( icaltimetype begin );
|
||||||
icaltimetype GetPreviousOccurrence( icaltimetype beforethis );
|
icaltimetype GetPreviousOccurrence( icaltimetype beforethis );
|
||||||
NS_IMETHODIMP SetParent( oeIICal *parent );
|
NS_IMETHODIMP SetParent( oeIICal *parent );
|
||||||
|
icaltimetype CalculateEventTime( icaltimetype alarmtime );
|
||||||
private:
|
private:
|
||||||
char *m_id;
|
char *m_id;
|
||||||
char *m_syncid;
|
char *m_syncid;
|
||||||
|
|
|
@ -1636,19 +1636,29 @@ void oeICalImpl::SetupAlarmManager() {
|
||||||
if( icaltime_is_null_time( alarmtime ) )
|
if( icaltime_is_null_time( alarmtime ) )
|
||||||
break;
|
break;
|
||||||
if( icaltime_compare( alarmtime, now ) <= 0 ) {
|
if( icaltime_compare( alarmtime, now ) <= 0 ) {
|
||||||
#ifdef ICAL_DEBUG
|
#ifdef ICAL_DEBUG
|
||||||
printf( "ALARM WENT OFF: %s\n", icaltime_as_ical_string( alarmtime ) );
|
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++ ) {
|
for( unsigned int i=0; i<m_observerlist.size(); i++ ) {
|
||||||
nsresult rv;
|
rv = m_observerlist[i]->OnAlarm( eventDisplay );
|
||||||
rv = m_observerlist[i]->OnAlarm( event );
|
|
||||||
#ifdef ICAL_DEBUG
|
#ifdef ICAL_DEBUG
|
||||||
if( NS_FAILED( rv ) ) {
|
if( NS_FAILED( rv ) ) {
|
||||||
printf( "oeICalImpl::SetupAlarmManager() : WARNING Call to observer's onAlarm() unsuccessful: %x\n", rv );
|
printf( "oeICalImpl::SetupAlarmManager() : WARNING Call to observer's onAlarm() unsuccessful: %x\n", rv );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
NS_RELEASE( eventDisplay );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if( icaltime_is_null_time( nextalarm ) )
|
if( icaltime_is_null_time( nextalarm ) )
|
||||||
|
@ -1668,9 +1678,9 @@ void oeICalImpl::SetupAlarmManager() {
|
||||||
m_alarmtimer = nsnull;
|
m_alarmtimer = nsnull;
|
||||||
}
|
}
|
||||||
if( !icaltime_is_null_time( nextalarm ) ) {
|
if( !icaltime_is_null_time( nextalarm ) ) {
|
||||||
#ifdef ICAL_DEBUG
|
#ifdef ICAL_DEBUG
|
||||||
printf( "NEXT ALARM IS: %s\n", icaltime_as_ical_string( nextalarm ) );
|
printf( "NEXT ALARM IS: %s\n", icaltime_as_ical_string( nextalarm ) );
|
||||||
#endif
|
#endif
|
||||||
time_t timediff = icaltime_as_timet( nextalarm ) - icaltime_as_timet( now );
|
time_t timediff = icaltime_as_timet( nextalarm ) - icaltime_as_timet( now );
|
||||||
|
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
|
|
|
@ -170,7 +170,7 @@ interface oeIICalObserver : nsISupports
|
||||||
void onAddItem( in oeIICalEvent e);
|
void onAddItem( in oeIICalEvent e);
|
||||||
void onModifyItem( in oeIICalEvent e, in oeIICalEvent olde );
|
void onModifyItem( in oeIICalEvent e, in oeIICalEvent olde );
|
||||||
void onDeleteItem( in oeIICalEvent e);
|
void onDeleteItem( in oeIICalEvent e);
|
||||||
void onAlarm( in oeIICalEvent e);
|
void onAlarm( in oeIICalEventDisplay e);
|
||||||
};
|
};
|
||||||
|
|
||||||
[scriptable, uuid(7a4fd625-69a8-4008-932e-cccc227b402c)]
|
[scriptable, uuid(7a4fd625-69a8-4008-932e-cccc227b402c)]
|
||||||
|
|
Загрузка…
Ссылка в новой задаче