summaryrefslogtreecommitdiffabout
path: root/korganizer/calendarview.cpp
authorzautrix <zautrix>2005-06-11 15:15:54 (UTC)
committer zautrix <zautrix>2005-06-11 15:15:54 (UTC)
commit0cfaf22fc5d8f511320813171be84ce3436990c6 (patch) (unidiff)
tree00f858c12e9c810c53acdd816a9fcfe7e880996a /korganizer/calendarview.cpp
parentd4501288ba7414ba89a791dd2c306e9f74eeb3fa (diff)
downloadkdepimpi-0cfaf22fc5d8f511320813171be84ce3436990c6.zip
kdepimpi-0cfaf22fc5d8f511320813171be84ce3436990c6.tar.gz
kdepimpi-0cfaf22fc5d8f511320813171be84ce3436990c6.tar.bz2
fixx
Diffstat (limited to 'korganizer/calendarview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 8d992b9..4b82aa8 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -641,31 +641,33 @@ void CalendarView::checkAlarms()
641{ 641{
642 KConfig *config = KOGlobals::config(); 642 KConfig *config = KOGlobals::config();
643 config->setGroup( "AppRun" ); 643 config->setGroup( "AppRun" );
644 QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) ); 644 QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) );
645 int secto = dt.secsTo( QDateTime::currentDateTime() ); 645 int secto = dt.secsTo( QDateTime::currentDateTime() );
646 int secs = config->readNumEntry( "LatestProgramStop" , secto) - 30; 646 int secs = config->readNumEntry( "LatestProgramStop" , secto) - 30;
647 //secs -= ( 3600 * 24*3 ); // debug only 647 //secs -= ( 3600 * 24*3 ); // debug only
648 QDateTime latest = dt.addSecs ( secs ); 648 QDateTime latest = dt.addSecs ( secs );
649 qDebug("KO: Last termination on %s ", latest.toString().latin1()); 649 qDebug("KO: Last termination on %s ", latest.toString().latin1());
650 QPtrList<Incidence> el = mCalendar->rawIncidences(); 650 QPtrList<Incidence> el = mCalendar->rawIncidences();
651 QPtrList<Incidence> al; 651 QPtrList<Incidence> al;
652 Incidence* inL = el.first(); 652 Incidence* inL = el.first();
653 QDateTime cur = QDateTime::currentDateTime().addSecs(-59);
654 qDebug("KO: Checking alarm until %s ", cur.toString().latin1());
653 while ( inL ) { 655 while ( inL ) {
654 bool ok = false; 656 bool ok = false;
655 int offset = 0; 657 int offset = 0;
656 QDateTime next = inL->getNextAlarmDateTime(& ok, &offset, latest ) ; 658 QDateTime next = inL->getNextAlarmDateTime(& ok, &offset, latest ) ;
657 if ( ok ) { 659 if ( ok ) {
658 //qDebug("OK %s",next.toString().latin1()); 660 //qDebug("OK %s",next.toString().latin1());
659 if ( next < QDateTime::currentDateTime() ) { 661 if ( next < cur ) {
660 al.append( inL ); 662 al.append( inL );
661 //qDebug("found missed alarm: %s ", inL->summary().latin1() ); 663 //qDebug("found missed alarm: %s ", inL->summary().latin1() );
662 } 664 }
663 } 665 }
664 inL = el.next(); 666 inL = el.next();
665 } 667 }
666 if ( al.count() ) { 668 if ( al.count() ) {
667 QDialog* dia = new QDialog( this, "huhu", false, WDestructiveClose | WStyle_StaysOnTop ); 669 QDialog* dia = new QDialog( this, "huhu", false, WDestructiveClose | WStyle_StaysOnTop );
668 dia->setCaption( i18n("KO/Pi: Missing alarms!") ); 670 dia->setCaption( i18n("KO/Pi: Missing alarms!") );
669 QVBoxLayout* lay = new QVBoxLayout( dia ); 671 QVBoxLayout* lay = new QVBoxLayout( dia );
670 lay->setSpacing( 0 ); 672 lay->setSpacing( 0 );
671 lay->setMargin( 0 ); 673 lay->setMargin( 0 );
@@ -823,25 +825,25 @@ void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString &noti )
823 int ms = QDateTime::currentDateTime().secsTo( qdt )*1000; 825 int ms = QDateTime::currentDateTime().secsTo( qdt )*1000;
824 //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000); 826 //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000);
825 mSuspendTimer->start( ms , true ); 827 mSuspendTimer->start( ms , true );
826 828
827} 829}
828 830
829void CalendarView::addAlarm(const QDateTime &qdt, const QString &noti ) 831void CalendarView::addAlarm(const QDateTime &qdt, const QString &noti )
830{ 832{
831 mNextAlarmDateTime = qdt; 833 mNextAlarmDateTime = qdt;
832 //qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); 834 //qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() );
833 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { 835 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) {
834#ifndef DESKTOP_VERSION 836#ifndef DESKTOP_VERSION
835 AlarmServer::addAlarm ( qdt,"koalarm", noti.latin1() ); 837 AlarmServer::addAlarm ( qdt,"koalarm", noti.utf8() );
836#endif 838#endif
837 return; 839 return;
838 } 840 }
839 int maxSec; 841 int maxSec;
840 //maxSec = 5; //testing only 842 //maxSec = 5; //testing only
841 maxSec = 86400+3600; // one day+1hour 843 maxSec = 86400+3600; // one day+1hour
842 mAlarmNotification = noti; 844 mAlarmNotification = noti;
843 int sec = QDateTime::currentDateTime().secsTo( qdt ); 845 int sec = QDateTime::currentDateTime().secsTo( qdt );
844 if ( sec > maxSec ) { 846 if ( sec > maxSec ) {
845 mRecheckAlarmTimer->start( maxSec * 1000 ); 847 mRecheckAlarmTimer->start( maxSec * 1000 );
846 // qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec ); 848 // qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec );
847 return; 849 return;