author | zautrix <zautrix> | 2005-04-08 22:39:42 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-04-08 22:39:42 (UTC) |
commit | c4bab697d650c249cdff45b753b9e6df2a817877 (patch) (unidiff) | |
tree | 2726d1686d42e9d3e42aae780d766df94465281a /kalarmd/alarmdialog.cpp | |
parent | 9667e6f2589d5b2080cca928814f382761f8dda6 (diff) | |
download | kdepimpi-c4bab697d650c249cdff45b753b9e6df2a817877.zip kdepimpi-c4bab697d650c249cdff45b753b9e6df2a817877.tar.gz kdepimpi-c4bab697d650c249cdff45b753b9e6df2a817877.tar.bz2 |
alarmdialog fix
-rw-r--r-- | kalarmd/alarmdialog.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/kalarmd/alarmdialog.cpp b/kalarmd/alarmdialog.cpp index 53ff488..65073f6 100644 --- a/kalarmd/alarmdialog.cpp +++ b/kalarmd/alarmdialog.cpp | |||
@@ -124,32 +124,33 @@ AlarmDialog::AlarmDialog(QWidget *parent,const char *name) | |||
124 | 124 | ||
125 | QVBox * bbox = new QVBox ( this ); | 125 | QVBox * bbox = new QVBox ( this ); |
126 | layout->addWidget ( bbox ); | 126 | layout->addWidget ( bbox ); |
127 | bbox->layout()->setSpacing( 2 ); | 127 | bbox->layout()->setSpacing( 2 ); |
128 | labb = new QLabel("Press \"Cancel\" or \"Esc\" to suspend!",bbox); | 128 | labb = new QLabel("Press \"Cancel\" or \"Esc\" to suspend!",bbox); |
129 | labb->setAlignment(AlignCenter); | 129 | labb->setAlignment(AlignCenter); |
130 | mSuspendButton = new QPushButton( "Suspend", bbox); | 130 | mSuspendButton = new QPushButton( "Suspend", bbox); |
131 | QPushButton* silen = new QPushButton( " Stop sound ", bbox); | 131 | QPushButton* silen = new QPushButton( " Stop sound ", bbox); |
132 | QPushButton* okbut = new QPushButton( "Ok", bbox); | 132 | QPushButton* okbut = new QPushButton( "Ok", bbox); |
133 | mSuspendButton->setFont( fo ); | 133 | mSuspendButton->setFont( fo ); |
134 | silen->setFont( fo ); | 134 | silen->setFont( fo ); |
135 | okbut->setFont( fo ); | 135 | okbut->setFont( fo ); |
136 | okbut->setDefault( true ); | 136 | okbut->setDefault( true ); |
137 | connect (silen , SIGNAL( clicked() ), this, SLOT (silent() ) ); | 137 | connect (silen , SIGNAL( clicked() ), this, SLOT (silent() ) ); |
138 | connect (mSuspendButton, SIGNAL( clicked() ), this, SLOT (slotSuspend() ) ); | 138 | connect (mSuspendButton, SIGNAL( clicked() ), this, SLOT (slotSuspend() ) ); |
139 | connect (okbut , SIGNAL( clicked() ), this, SLOT (slotOk() ) ); | 139 | connect (okbut , SIGNAL( clicked() ), this, SLOT (slotOk() ) ); |
140 | connect (mSuspendSpin , SIGNAL( valueChanged ( int ) ), this, SLOT ( spinBoxChanged( int ) ) ); | ||
140 | #ifndef _WIN32_ | 141 | #ifndef _WIN32_ |
141 | if ( QFile::exists ( "/dev/sharp_led" ) ) | 142 | if ( QFile::exists ( "/dev/sharp_led" ) ) |
142 | fd_led = open ( "/dev/sharp_led", O_RDWR|O_NONBLOCK ); | 143 | fd_led = open ( "/dev/sharp_led", O_RDWR|O_NONBLOCK ); |
143 | else | 144 | else |
144 | #endif | 145 | #endif |
145 | fd_led = 0; | 146 | fd_led = 0; |
146 | statusLED.which = SHARP_LED_SALARM; | 147 | statusLED.which = SHARP_LED_SALARM; |
147 | mSilent = false; | 148 | mSilent = false; |
148 | mSuspendCounter = 0; | 149 | mSuspendCounter = 0; |
149 | setServerNotification( true ); | 150 | setServerNotification( true ); |
150 | } | 151 | } |
151 | void AlarmDialog::reject () | 152 | void AlarmDialog::reject () |
152 | { | 153 | { |
153 | QTimer::singleShot ( 3000, this, SLOT (suspend()) ); | 154 | QTimer::singleShot ( 3000, this, SLOT (suspend()) ); |
154 | slotSuspend(); | 155 | slotSuspend(); |
155 | } | 156 | } |
@@ -249,32 +250,36 @@ bool AlarmDialog::eventNotification( QString mess, int replay , QString fn, boo | |||
249 | raise(); | 250 | raise(); |
250 | //qApp->processEvents(); | 251 | //qApp->processEvents(); |
251 | //repaint(); | 252 | //repaint(); |
252 | qApp->processEvents(); | 253 | qApp->processEvents(); |
253 | 254 | ||
254 | #ifndef _WIN32_ | 255 | #ifndef _WIN32_ |
255 | if ( fd_led > 0 ) { | 256 | if ( fd_led > 0 ) { |
256 | statusLED.status = LED_SALARM_ON ; | 257 | statusLED.status = LED_SALARM_ON ; |
257 | ioctl (fd_led, SHARP_LED_SETSTATUS, &statusLED); | 258 | ioctl (fd_led, SHARP_LED_SETSTATUS, &statusLED); |
258 | } | 259 | } |
259 | #endif | 260 | #endif |
260 | playSoundTimer->start( 1000, true ); | 261 | playSoundTimer->start( 1000, true ); |
261 | return true; | 262 | return true; |
262 | 263 | ||
263 | } | 264 | } |
264 | 265 | ||
266 | void AlarmDialog::spinBoxChanged( int ) | ||
267 | { | ||
268 | mSilent = true; | ||
269 | } | ||
265 | 270 | ||
266 | void AlarmDialog::playSound () | 271 | void AlarmDialog::playSound () |
267 | { | 272 | { |
268 | 273 | ||
269 | if (mStopAlarm ) | 274 | if (mStopAlarm ) |
270 | return; | 275 | return; |
271 | if ( mSilent ) | 276 | if ( mSilent ) |
272 | return; | 277 | return; |
273 | showNormal(); | 278 | showNormal(); |
274 | setActiveWindow(); | 279 | setActiveWindow(); |
275 | raise(); | 280 | raise(); |
276 | mSuspendSpin->setFocus(); | 281 | mSuspendSpin->setFocus(); |
277 | 282 | ||
278 | 283 | ||
279 | qApp->processEvents(); | 284 | qApp->processEvents(); |
280 | if ( alarmCounter < maxAlarmReplay && ! mSilent) { | 285 | if ( alarmCounter < maxAlarmReplay && ! mSilent) { |