summaryrefslogtreecommitdiff
authorsandman <sandman>2002-06-09 23:42:42 (UTC)
committer sandman <sandman>2002-06-09 23:42:42 (UTC)
commit1c56ab829f04ea5b127c1c632cec330e47bca524 (patch) (unidiff)
tree30f0bd7c2d124cbf2dc41f32234922d2f3be19a7
parent25d084dd1a4b69cefcf16a889f22feb39d60f541 (diff)
downloadopie-1c56ab829f04ea5b127c1c632cec330e47bca524.zip
opie-1c56ab829f04ea5b127c1c632cec330e47bca524.tar.gz
opie-1c56ab829f04ea5b127c1c632cec330e47bca524.tar.bz2
Fixed a counter bug in alarm timer loop.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/datebook/datebook.cpp14
-rw-r--r--core/pim/datebook/datebook.h2
2 files changed, 9 insertions, 7 deletions
diff --git a/core/pim/datebook/datebook.cpp b/core/pim/datebook/datebook.cpp
index 8614b3f..2c2965e 100644
--- a/core/pim/datebook/datebook.cpp
+++ b/core/pim/datebook/datebook.cpp
@@ -72,25 +72,26 @@
72#define DAY 1 72#define DAY 1
73#define WEEK 2 73#define WEEK 2
74#define WEEKLST 4 74#define WEEKLST 4
75#define MONTH 3 75#define MONTH 3
76 76
77 77
78DateBook::DateBook( QWidget *parent, const char *, WFlags f ) 78DateBook::DateBook( QWidget *parent, const char *, WFlags f )
79 : QMainWindow( parent, "datebook", f ), 79 : QMainWindow( parent, "datebook", f ),
80 aPreset( FALSE ), 80 aPreset( FALSE ),
81 presetTime( -1 ), 81 presetTime( -1 ),
82 startTime( 8 ), // an acceptable default 82 startTime( 8 ), // an acceptable default
83 syncing(FALSE), 83 syncing(FALSE),
84 inSearch(FALSE) 84 inSearch(FALSE),
85 alarmCounter(0)
85{ 86{
86 QTime t; 87 QTime t;
87 t.start(); 88 t.start();
88 db = new DateBookDBHack; 89 db = new DateBookDBHack;
89 qDebug("loading db t=%d", t.elapsed() ); 90 qDebug("loading db t=%d", t.elapsed() );
90 loadSettings(); 91 loadSettings();
91 setCaption( tr("Calendar") ); 92 setCaption( tr("Calendar") );
92 setIcon( Resource::loadPixmap( "datebook_icon" ) ); 93 setIcon( Resource::loadPixmap( "datebook_icon" ) );
93 94
94 setToolBarsMovable( FALSE ); 95 setToolBarsMovable( FALSE );
95 96
96 views = new QWidgetStack( this ); 97 views = new QWidgetStack( this );
@@ -605,24 +606,25 @@ void DateBook::appMessage(const QCString& msg, const QByteArray& data)
605 + tr(" minutes)")) 606 + tr(" minutes)"))
606 : QString("")) 607 : QString(""))
607 + "<BR>" 608 + "<BR>"
608 + (*it).notes() + "</CENTER>"; 609 + (*it).notes() + "</CENTER>";
609 if ( (*it).event().alarmSound() != Event::Silent ) { 610 if ( (*it).event().alarmSound() != Event::Silent ) {
610 bSound = TRUE; 611 bSound = TRUE;
611 } 612 }
612 } 613 }
613 } 614 }
614 if ( found ) { 615 if ( found ) {
615 if ( bSound ) { 616 if ( bSound ) {
616 Sound::soundAlarm(); 617 Sound::soundAlarm();
618 alarmCounter = 0;
617 stopTimer = startTimer( 5000 ); 619 stopTimer = startTimer( 5000 );
618 } 620 }
619 621
620 QDialog dlg( this, 0, TRUE ); 622 QDialog dlg( this, 0, TRUE );
621 QVBoxLayout *vb = new QVBoxLayout( &dlg ); 623 QVBoxLayout *vb = new QVBoxLayout( &dlg );
622 QScrollView *view = new QScrollView( &dlg, "scrollView"); 624 QScrollView *view = new QScrollView( &dlg, "scrollView");
623 view->setResizePolicy( QScrollView::AutoOneFit ); 625 view->setResizePolicy( QScrollView::AutoOneFit );
624 vb->addWidget( view ); 626 vb->addWidget( view );
625 QLabel *lblMsg = new QLabel( msg, &dlg ); 627 QLabel *lblMsg = new QLabel( msg, &dlg );
626 view->addChild( lblMsg ); 628 view->addChild( lblMsg );
627 QPushButton *cmdOk = new QPushButton( tr("OK"), &dlg ); 629 QPushButton *cmdOk = new QPushButton( tr("OK"), &dlg );
628 connect( cmdOk, SIGNAL(clicked()), &dlg, SLOT(accept()) ); 630 connect( cmdOk, SIGNAL(clicked()), &dlg, SLOT(accept()) );
@@ -674,32 +676,30 @@ void DateBook::reload()
674 viewMonth(); 676 viewMonth();
675 syncing = FALSE; 677 syncing = FALSE;
676} 678}
677 679
678void DateBook::flush() 680void DateBook::flush()
679{ 681{
680 syncing = TRUE; 682 syncing = TRUE;
681 db->save(); 683 db->save();
682} 684}
683 685
684void DateBook::timerEvent( QTimerEvent *e ) 686void DateBook::timerEvent( QTimerEvent *e )
685{ 687{
686 static int stop = 0; 688 if ( alarmCounter < 10 ) {
687 if ( stop < 10 ) { 689 alarmCounter++;
688 Sound::soundAlarm(); 690 Sound::soundAlarm();
689 stop++; 691 }
690 } else { 692 else
691 stop = 0;
692 killTimer( e->timerId() ); 693 killTimer( e->timerId() );
693 }
694} 694}
695 695
696void DateBook::changeClock( bool newClock ) 696void DateBook::changeClock( bool newClock )
697{ 697{
698 ampm = newClock; 698 ampm = newClock;
699 // repaint the affected objects... 699 // repaint the affected objects...
700 if (dayView) dayView->redraw(); 700 if (dayView) dayView->redraw();
701 if (weekView) weekView->redraw(); 701 if (weekView) weekView->redraw();
702 if (weekLstView) weekLstView->redraw(); 702 if (weekLstView) weekLstView->redraw();
703} 703}
704 704
705void DateBook::changeWeek( bool m ) 705void DateBook::changeWeek( bool m )
diff --git a/core/pim/datebook/datebook.h b/core/pim/datebook/datebook.h
index d1fe90d..e7be0dd 100644
--- a/core/pim/datebook/datebook.h
+++ b/core/pim/datebook/datebook.h
@@ -111,16 +111,18 @@ private:
111 DateBookMonth *monthView; 111 DateBookMonth *monthView;
112 DateBookWeekLst *weekLstView; 112 DateBookWeekLst *weekLstView;
113 QAction *dayAction, *weekAction, *weekLstAction, *monthAction; 113 QAction *dayAction, *weekAction, *weekLstAction, *monthAction;
114 bool aPreset; // have everything set to alarm? 114 bool aPreset; // have everything set to alarm?
115 int presetTime; // the standard time for the alarm 115 int presetTime; // the standard time for the alarm
116 int startTime; 116 int startTime;
117 bool ampm; 117 bool ampm;
118 bool onMonday; 118 bool onMonday;
119 119
120 bool syncing; 120 bool syncing;
121 bool inSearch; 121 bool inSearch;
122 122
123 int alarmCounter;
124
123 QString checkEvent(const Event &); 125 QString checkEvent(const Event &);
124}; 126};
125 127
126#endif 128#endif