-rw-r--r-- | kalarmd/alarmdialog.cpp | 13 |
1 files changed, 8 insertions, 5 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 @@ #include <qvbox.h> #include <qapp.h> #include <qlabel.h> #include <qlayout.h> #include <qfile.h> #include <qtimer.h> #include <qsound.h> #include <qpushbutton.h> +#include <qregexp.h> #ifndef DESKTOP_VERSION #define protected public #include <qspinbox.h> #undef protected #else #include <qspinbox.h> #endif #include <stdlib.h> @@ -53,17 +54,17 @@ #include <qtopia/sound.h> #endif #include "alarmdialog.h" AlarmDialog::AlarmDialog(QWidget *parent,const char *name) - : QDialog (parent, name, true, Qt::WStyle_StaysOnTop ) + : QDialog (parent, name, true, Qt::WStyle_Customize |Qt::WStyle_StaysOnTop | Qt::WStyle_DialogBorder) { setCaption( "KO/Pi Alarm!" ); QVBoxLayout* layout = new QVBoxLayout( this); QLabel* l = new QLabel("The following event triggered alarm:",this); layout->addWidget ( l ); l->setAlignment( AlignCenter); mMessage = new QLabel ( " ", this ); int fs = 18; @@ -227,17 +228,19 @@ bool AlarmDialog::eventNotification( QString mess, int replay , QString fn, boo if ( !QFile::exists( fn ) ) mFileName = ""; alarmCounter = 0 ; maxAlarmReplay = replay ; mStopAlarm = false; mSilent = false; if ( !mMessage->text().stripWhiteSpace().isEmpty() ) { mMissedAlarmsCombo->show(); - mMissedAlarmsCombo->insertItem( mMessage->text().stripWhiteSpace() ); + QString newItem = mMessage->text().stripWhiteSpace(); + newItem.replace( QRegExp("\n"), QString(" ") ); + mMissedAlarmsCombo->insertItem( newItem ); mMissedAlarms->setText( "Missed alarms:"); } else mMissedAlarmsCombo->hide(); mMessage->setText(mess); int w =sizeHint().width() ; int h = sizeHint().height() ; int dw = QApplication::desktop()->width(); int dh = QApplication::desktop()->height(); @@ -260,23 +263,23 @@ bool AlarmDialog::eventNotification( QString mess, int replay , QString fn, boo } void AlarmDialog::playSound () { if (mStopAlarm ) return; - if (mSilent ) + if ( mSilent ) return; showNormal(); setActiveWindow(); + raise(); mSuspendSpin->setFocus(); - raise(); - repaint(); + qApp->processEvents(); if ( alarmCounter < maxAlarmReplay && ! mSilent) { ++alarmCounter; #ifdef DESKTOP_VERSION mPlayWav = true; #endif if ( !mPlayWav || mFileName.length() < 2 ) { |