summaryrefslogtreecommitdiffabout
path: root/kalarmd
authorzautrix <zautrix>2005-04-03 04:33:19 (UTC)
committer zautrix <zautrix>2005-04-03 04:33:19 (UTC)
commitf6c8249db564c1276d4c7ed5ad88c6fbac361b8d (patch) (unidiff)
tree8e5b6e2d6f9a7bc00326f7c0115bf2af53ae9ce8 /kalarmd
parent40e5edc1ab153144f0e824ad2d3a0ab37357e408 (diff)
downloadkdepimpi-f6c8249db564c1276d4c7ed5ad88c6fbac361b8d.zip
kdepimpi-f6c8249db564c1276d4c7ed5ad88c6fbac361b8d.tar.gz
kdepimpi-f6c8249db564c1276d4c7ed5ad88c6fbac361b8d.tar.bz2
fixes
Diffstat (limited to 'kalarmd') (more/less context) (ignore whitespace changes)
-rw-r--r--kalarmd/alarmdialog.cpp13
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
@@ -29,12 +29,13 @@
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>
@@ -55,13 +56,13 @@
55#endif 56#endif
56 57
57#include "alarmdialog.h" 58#include "alarmdialog.h"
58 59
59 60
60AlarmDialog::AlarmDialog(QWidget *parent,const char *name) 61AlarmDialog::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);
@@ -229,13 +230,15 @@ bool AlarmDialog::eventNotification( QString mess, int replay , QString fn, boo
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() ;
@@ -262,19 +265,19 @@ bool AlarmDialog::eventNotification( QString mess, int replay , QString fn, boo
262 265
263void AlarmDialog::playSound () 266void 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();
275 raise();
272 mSuspendSpin->setFocus(); 276 mSuspendSpin->setFocus();
273 raise(); 277
274 repaint();
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;