summaryrefslogtreecommitdiff
Side-by-side diff
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
@@ -78,13 +78,14 @@
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();
@@ -611,12 +612,13 @@ void DateBook::appMessage(const QCString& msg, const QByteArray& data)
}
}
}
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");
@@ -680,20 +682,18 @@ 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...
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
@@ -117,10 +117,12 @@ private:
bool ampm;
bool onMonday;
bool syncing;
bool inSearch;
+ int alarmCounter;
+
QString checkEvent(const Event &);
};
#endif