summaryrefslogtreecommitdiff
authorsandman <sandman>2002-06-09 23:42:42 (UTC)
committer sandman <sandman>2002-06-09 23:42:42 (UTC)
commit1c56ab829f04ea5b127c1c632cec330e47bca524 (patch) (side-by-side diff)
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 @@
#define DAY 1
#define WEEK 2
#define WEEKLST 4
#define MONTH 3
DateBook::DateBook( QWidget *parent, const char *, WFlags f )
: QMainWindow( parent, "datebook", f ),
aPreset( FALSE ),
presetTime( -1 ),
startTime( 8 ), // an acceptable default
syncing(FALSE),
- inSearch(FALSE)
+ inSearch(FALSE),
+ alarmCounter(0)
{
QTime t;
t.start();
db = new DateBookDBHack;
qDebug("loading db t=%d", t.elapsed() );
loadSettings();
setCaption( tr("Calendar") );
setIcon( Resource::loadPixmap( "datebook_icon" ) );
setToolBarsMovable( FALSE );
views = new QWidgetStack( this );
@@ -605,24 +606,25 @@ void DateBook::appMessage(const QCString& msg, const QByteArray& data)
+ tr(" minutes)"))
: QString(""))
+ "<BR>"
+ (*it).notes() + "</CENTER>";
if ( (*it).event().alarmSound() != Event::Silent ) {
bSound = TRUE;
}
}
}
if ( found ) {
if ( bSound ) {
Sound::soundAlarm();
+ alarmCounter = 0;
stopTimer = startTimer( 5000 );
}
QDialog dlg( this, 0, TRUE );
QVBoxLayout *vb = new QVBoxLayout( &dlg );
QScrollView *view = new QScrollView( &dlg, "scrollView");
view->setResizePolicy( QScrollView::AutoOneFit );
vb->addWidget( view );
QLabel *lblMsg = new QLabel( msg, &dlg );
view->addChild( lblMsg );
QPushButton *cmdOk = new QPushButton( tr("OK"), &dlg );
connect( cmdOk, SIGNAL(clicked()), &dlg, SLOT(accept()) );
@@ -674,32 +676,30 @@ void DateBook::reload()
viewMonth();
syncing = FALSE;
}
void DateBook::flush()
{
syncing = TRUE;
db->save();
}
void DateBook::timerEvent( QTimerEvent *e )
{
- static int stop = 0;
- if ( stop < 10 ) {
+ if ( alarmCounter < 10 ) {
+ alarmCounter++;
Sound::soundAlarm();
- stop++;
- } else {
- stop = 0;
+ }
+ else
killTimer( e->timerId() );
- }
}
void DateBook::changeClock( bool newClock )
{
ampm = newClock;
// repaint the affected objects...
if (dayView) dayView->redraw();
if (weekView) weekView->redraw();
if (weekLstView) weekLstView->redraw();
}
void 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:
DateBookMonth *monthView;
DateBookWeekLst *weekLstView;
QAction *dayAction, *weekAction, *weekLstAction, *monthAction;
bool aPreset; // have everything set to alarm?
int presetTime; // the standard time for the alarm
int startTime;
bool ampm;
bool onMonday;
bool syncing;
bool inSearch;
+ int alarmCounter;
+
QString checkEvent(const Event &);
};
#endif