summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kalarmd/alarmdialog.cpp36
-rw-r--r--kalarmd/alarmdialog.h2
-rw-r--r--kalarmd/simplealarmdaemonimpl.cpp9
3 files changed, 29 insertions, 18 deletions
diff --git a/kalarmd/alarmdialog.cpp b/kalarmd/alarmdialog.cpp
index 65073f6..d72a8c2 100644
--- a/kalarmd/alarmdialog.cpp
+++ b/kalarmd/alarmdialog.cpp
@@ -94,15 +94,15 @@ AlarmDialog::AlarmDialog(QWidget *parent,const char *name)
playSoundTimer->stop();
layout->addWidget ( mMissedAlarms );
mMissedAlarmsCombo = new QComboBox ( this );
layout->addWidget ( mMissedAlarmsCombo );
- QLabel* labb = new QLabel("Suspend duration (minutes):",this);
+ QLabel* labb = new QLabel("Suspend\nduration\n(minutes):",this);
labb->setAlignment(AlignCenter);
- layout->addWidget ( labb );
+ //layout->addWidget ( labb );
fo = font();
int pointSize = 36;
if ( QApplication::desktop()->width() <= 320 )
pointSize = 18;
fo.setPointSize( pointSize );
mSuspendSpin = new QSpinBox(1,1440,1,this);
@@ -116,23 +116,24 @@ AlarmDialog::AlarmDialog(QWidget *parent,const char *name)
mSuspendSpin->downButton ()->setFixedSize( QSize( 8*baseSize, 5*baseSize ));
#endif
mSuspendSpin->setFixedSize( 18*baseSize, 10*baseSize+2 );
mSuspendSpin->setButtonSymbols( QSpinBox::PlusMinus );
QHBoxLayout* layoutSpin = new QHBoxLayout( layout );
layoutSpin->addStretch ();
+ layoutSpin->addWidget ( labb );
layoutSpin->addWidget ( mSuspendSpin );
layoutSpin->addStretch ();
QVBox * bbox = new QVBox ( this );
layout->addWidget ( bbox );
bbox->layout()->setSpacing( 2 );
labb = new QLabel("Press \"Cancel\" or \"Esc\" to suspend!",bbox);
labb->setAlignment(AlignCenter);
mSuspendButton = new QPushButton( "Suspend", bbox);
QPushButton* silen = new QPushButton( " Stop sound ", bbox);
- QPushButton* okbut = new QPushButton( "Ok", bbox);
+ okbut = new QPushButton( "Ok", bbox);
mSuspendButton->setFont( fo );
silen->setFont( fo );
okbut->setFont( fo );
okbut->setDefault( true );
connect (silen , SIGNAL( clicked() ), this, SLOT (silent() ) );
connect (mSuspendButton, SIGNAL( clicked() ), this, SLOT (slotSuspend() ) );
@@ -238,36 +239,44 @@ bool AlarmDialog::eventNotification( QString mess, int replay , QString fn, boo
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 w = minimumSizeHint().width() ;
+ int h = minimumSizeHint().height() ;
int dw = QApplication::desktop()->width();
int dh = QApplication::desktop()->height();
setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
- show();
- raise();
- //qApp->processEvents();
- //repaint();
- qApp->processEvents();
+ hide();
#ifndef _WIN32_
if ( fd_led > 0 ) {
statusLED.status = LED_SALARM_ON ;
ioctl (fd_led, SHARP_LED_SETSTATUS, &statusLED);
}
#endif
- playSoundTimer->start( 1000, true );
+ okbut->setDefault( true );
+ QTimer::singleShot( 1, this, SLOT ( forceRepaint() ) );
+ // playSoundTimer->start( 1000, true );
return true;
}
-void AlarmDialog::spinBoxChanged( int )
+void AlarmDialog::forceRepaint()
{
+
+ showNormal();
+ setActiveWindow();
+ raise();
+ playSoundTimer->start( 1000, true );
+
+}
+void AlarmDialog::spinBoxChanged( int v )
+{
+ okbut->setDefault( false );
mSilent = true;
}
void AlarmDialog::playSound ()
{
@@ -276,15 +285,12 @@ void AlarmDialog::playSound ()
if ( mSilent )
return;
showNormal();
setActiveWindow();
raise();
mSuspendSpin->setFocus();
-
-
- qApp->processEvents();
if ( alarmCounter < maxAlarmReplay && ! mSilent) {
++alarmCounter;
#ifdef DESKTOP_VERSION
mPlayWav = true;
#endif
if ( !mPlayWav || mFileName.length() < 2 ) {
diff --git a/kalarmd/alarmdialog.h b/kalarmd/alarmdialog.h
index 1e4636c..52e681a 100644
--- a/kalarmd/alarmdialog.h
+++ b/kalarmd/alarmdialog.h
@@ -47,12 +47,13 @@ class AlarmDialog : public QDialog {
bool eventNotification(QString m, int replay , QString m2 , bool, int, int );
int getSuspendTime( );
void setSuspendTime( int );
void setServerNotification( bool b );
public slots:
+ void forceRepaint();
void spinBoxChanged( int );
void slotOk();
void slotSuspend();
void reject () ;
void silent () ;
void accept();
@@ -60,12 +61,13 @@ class AlarmDialog : public QDialog {
void playSound ();
signals:
// void suspendSignal(int duration);
void addAlarm(const QDateTime &, const QString & );
private:
+ QPushButton* okbut;
int alarmCounter;
int mPauseCount;
int mSuspendCounter;
int maxAlarmReplay;
QTimer* playSoundTimer;
bool mStopAlarm;
diff --git a/kalarmd/simplealarmdaemonimpl.cpp b/kalarmd/simplealarmdaemonimpl.cpp
index 294ce7d..2a463b3 100644
--- a/kalarmd/simplealarmdaemonimpl.cpp
+++ b/kalarmd/simplealarmdaemonimpl.cpp
@@ -302,13 +302,15 @@ void SimpleAlarmDaemonImpl::recieve( const QCString& msg, const QByteArray& )
error = true;
}
if ( error ) {
mAlarmMessage = "Procedure Alarm\nError - File not found\n";
mAlarmMessage += mess.mid( 10+len+3+9 );
} else {
- QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent");
+ {
+ QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent");
+ }
//qDebug("-----system command %s ",tempfilename.latin1() );
if ( vfork () == 0 ) {
execl ( tempfilename.latin1(), 0 );
return;
}
return;
@@ -615,14 +617,15 @@ void SimpleAlarmDaemonImpl::confTimer( int time )
timerMesssage = mess;
AlarmServer::addAlarm ( mRunningTimer,"koalarm",timerMesssage.latin1());
mTimerTime = 1;
}
void SimpleAlarmDaemonImpl::writeFile()
-{
- QCopEnvelope e("QPE/Application/kopi", "-writeFile");
+{
+ QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent");
+ //QCopEnvelope e("QPE/Application/kopi", "-writeFile");
}
void SimpleAlarmDaemonImpl::showWN()
{
QCopEnvelope e("QPE/Application/kopi", "-showWN");
}
void SimpleAlarmDaemonImpl::newTodo()