-rw-r--r-- | kalarmd/alarmdialog.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/kalarmd/alarmdialog.cpp b/kalarmd/alarmdialog.cpp index bdeee4a..53ff488 100644 --- a/kalarmd/alarmdialog.cpp +++ b/kalarmd/alarmdialog.cpp | |||
@@ -27,16 +27,17 @@ | |||
27 | #include <qvbox.h> | 27 | #include <qvbox.h> |
28 | #include <qapp.h> | 28 | #include <qapp.h> |
29 | #include <qlabel.h> | 29 | #include <qlabel.h> |
30 | #include <qlayout.h> | 30 | #include <qlayout.h> |
31 | #include <qfile.h> | 31 | #include <qfile.h> |
32 | #include <qtimer.h> | 32 | #include <qtimer.h> |
33 | #include <qsound.h> | 33 | #include <qsound.h> |
34 | #include <qpushbutton.h> | 34 | #include <qpushbutton.h> |
35 | #include <qregexp.h> | ||
35 | #ifndef DESKTOP_VERSION | 36 | #ifndef DESKTOP_VERSION |
36 | #define protected public | 37 | #define protected public |
37 | #include <qspinbox.h> | 38 | #include <qspinbox.h> |
38 | #undef protected | 39 | #undef protected |
39 | #else | 40 | #else |
40 | #include <qspinbox.h> | 41 | #include <qspinbox.h> |
41 | #endif | 42 | #endif |
42 | #include <stdlib.h> | 43 | #include <stdlib.h> |
@@ -53,17 +54,17 @@ | |||
53 | #include <qtopia/sound.h> | 54 | #include <qtopia/sound.h> |
54 | 55 | ||
55 | #endif | 56 | #endif |
56 | 57 | ||
57 | #include "alarmdialog.h" | 58 | #include "alarmdialog.h" |
58 | 59 | ||
59 | 60 | ||
60 | AlarmDialog::AlarmDialog(QWidget *parent,const char *name) | 61 | AlarmDialog::AlarmDialog(QWidget *parent,const char *name) |
61 | : QDialog (parent, name, true, Qt::WStyle_StaysOnTop ) | 62 | : QDialog (parent, name, true, Qt::WStyle_Customize |Qt::WStyle_StaysOnTop | Qt::WStyle_DialogBorder) |
62 | { | 63 | { |
63 | setCaption( "KO/Pi Alarm!" ); | 64 | setCaption( "KO/Pi Alarm!" ); |
64 | QVBoxLayout* layout = new QVBoxLayout( this); | 65 | QVBoxLayout* layout = new QVBoxLayout( this); |
65 | QLabel* l = new QLabel("The following event triggered alarm:",this); | 66 | QLabel* l = new QLabel("The following event triggered alarm:",this); |
66 | layout->addWidget ( l ); | 67 | layout->addWidget ( l ); |
67 | l->setAlignment( AlignCenter); | 68 | l->setAlignment( AlignCenter); |
68 | mMessage = new QLabel ( " ", this ); | 69 | mMessage = new QLabel ( " ", this ); |
69 | int fs = 18; | 70 | int fs = 18; |
@@ -227,17 +228,19 @@ bool AlarmDialog::eventNotification( QString mess, int replay , QString fn, boo | |||
227 | if ( !QFile::exists( fn ) ) | 228 | if ( !QFile::exists( fn ) ) |
228 | mFileName = ""; | 229 | mFileName = ""; |
229 | alarmCounter = 0 ; | 230 | alarmCounter = 0 ; |
230 | maxAlarmReplay = replay ; | 231 | maxAlarmReplay = replay ; |
231 | mStopAlarm = false; | 232 | mStopAlarm = false; |
232 | mSilent = false; | 233 | mSilent = false; |
233 | if ( !mMessage->text().stripWhiteSpace().isEmpty() ) { | 234 | if ( !mMessage->text().stripWhiteSpace().isEmpty() ) { |
234 | mMissedAlarmsCombo->show(); | 235 | mMissedAlarmsCombo->show(); |
235 | mMissedAlarmsCombo->insertItem( mMessage->text().stripWhiteSpace() ); | 236 | QString newItem = mMessage->text().stripWhiteSpace(); |
237 | newItem.replace( QRegExp("\n"), QString(" ") ); | ||
238 | mMissedAlarmsCombo->insertItem( newItem ); | ||
236 | mMissedAlarms->setText( "Missed alarms:"); | 239 | mMissedAlarms->setText( "Missed alarms:"); |
237 | } else | 240 | } else |
238 | mMissedAlarmsCombo->hide(); | 241 | mMissedAlarmsCombo->hide(); |
239 | mMessage->setText(mess); | 242 | mMessage->setText(mess); |
240 | int w =sizeHint().width() ; | 243 | int w =sizeHint().width() ; |
241 | int h = sizeHint().height() ; | 244 | int h = sizeHint().height() ; |
242 | int dw = QApplication::desktop()->width(); | 245 | int dw = QApplication::desktop()->width(); |
243 | int dh = QApplication::desktop()->height(); | 246 | int dh = QApplication::desktop()->height(); |
@@ -264,19 +267,19 @@ void AlarmDialog::playSound () | |||
264 | { | 267 | { |
265 | 268 | ||
266 | if (mStopAlarm ) | 269 | if (mStopAlarm ) |
267 | return; | 270 | return; |
268 | if (mSilent ) | 271 | if (mSilent ) |
269 | return; | 272 | return; |
270 | showNormal(); | 273 | showNormal(); |
271 | setActiveWindow(); | 274 | setActiveWindow(); |
272 | mSuspendSpin->setFocus(); | ||
273 | raise(); | 275 | raise(); |
274 | repaint(); | 276 | mSuspendSpin->setFocus(); |
277 | |||
275 | 278 | ||
276 | qApp->processEvents(); | 279 | qApp->processEvents(); |
277 | if ( alarmCounter < maxAlarmReplay && ! mSilent) { | 280 | if ( alarmCounter < maxAlarmReplay && ! mSilent) { |
278 | ++alarmCounter; | 281 | ++alarmCounter; |
279 | #ifdef DESKTOP_VERSION | 282 | #ifdef DESKTOP_VERSION |
280 | mPlayWav = true; | 283 | mPlayWav = true; |
281 | #endif | 284 | #endif |
282 | if ( !mPlayWav || mFileName.length() < 2 ) { | 285 | if ( !mPlayWav || mFileName.length() < 2 ) { |