32 #include <tqstringlist.h>
34 #include <tdemessagebox.h>
35 #include <tdelocale.h>
37 #include <libkcal/calendarresources.h>
39 #include "knotes/resourcemanager.h"
41 #include "knotesalarm.h"
42 #include "knotesglobalconfig.h"
45 KNotesAlarm::KNotesAlarm( KNotesResourceManager *manager, TQObject *parent, const char *name )
46 : TQObject( parent, name ),
48 m_checkTimer( 0, "m_checkTimer" )
52 connect( &m_checkTimer, TQ_SIGNAL(timeout()), TQ_SLOT(checkAlarms()) );
53 m_checkTimer.start( 1000 * KNotesGlobalConfig::self()->checkInterval() );
56 void KNotesAlarm::checkAlarms()
58 TQDateTime from = KNotesGlobalConfig::self()->alarmsLastChecked().addSecs( 1 );
59 if ( !from.isValid() )
62 KNotesGlobalConfig::self()->setAlarmsLastChecked( TQDateTime::currentDateTime() );
63 TQValueList<KCal::Alarm *> alarms = m_manager->alarms( from, KNotesGlobalConfig::self()->alarmsLastChecked() );
67 TQValueList<KCal::Alarm *>::ConstIterator it;
68 for ( it = alarms.constBegin(); it != alarms.constEnd(); ++it )
70 KCal::Incidence *incidence = (*it)->parent();
71 notes += incidence->summary();
74 if ( !notes.isEmpty() )
75 KMessageBox::informationList( 0, i18n( "The following notes triggered alarms:"), notes, i18n( "Alarm") );
79 #include "knotesalarm.moc"
|