Diffstat (limited to 'kalarmd/simplealarmdaemonimpl.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | kalarmd/simplealarmdaemonimpl.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/kalarmd/simplealarmdaemonimpl.cpp b/kalarmd/simplealarmdaemonimpl.cpp index eff96eb..2acfacf 100644 --- a/kalarmd/simplealarmdaemonimpl.cpp +++ b/kalarmd/simplealarmdaemonimpl.cpp @@ -47,49 +47,53 @@ #include <stdio.h> #include <unistd.h> SimpleAlarmDaemonImpl::SimpleAlarmDaemonImpl( QWidget *parent ) : QLabel( parent ) { mAlarmDialog = new AlarmDialog( 0 ); mPopUp = new QPopupMenu( this ); mPopUp->insertItem( "What's Next?", this, SLOT ( showWN() ) ); mPopUp->insertItem( "Next Days!", this, SLOT ( showKO() ) ); mPopUp->insertSeparator(); mPopUp->insertItem( "Todo List", this, SLOT ( showTodo() ) ); mPopUp->insertSeparator(); mPopUp->insertItem( "Addresses", this, SLOT ( showAdd() ) ); mPopUp->insertSeparator(); mPopUp->insertItem( "Edit Journal", this, SLOT ( writeJournal() ) ); mPopUp->insertItem( "New Event", this, SLOT ( newEvent() ) ); mPopUp->insertItem( "New Todo", this, SLOT ( newTodo() ) ); mPopUp->insertItem( "New Mail", this, SLOT ( newMail() ) ); mPopUp->insertSeparator(); mPopUp->insertItem( "Multi Sync", this, SLOT ( ringSync() ) ); mTimerPopUp = new QPopupMenu( this ); QFont fon = mTimerPopUp->font(); - fon.setPointSize( fon.pointSize() *3/2 ); + int points = 16; + if ( QApplication::desktop()->width() < 480 ) + points = 12; + fon.setPointSize( points ); + //qDebug("point s %d ", fon.pointSize()); mTimerPopUp->setFont( fon ); mPopUp->setFont( fon ); mBeepPopUp = new QPopupMenu( this ); mSoundPopUp = new QPopupMenu( this ); mPausePopUp = new QPopupMenu( this ); QPopupMenu* savePopUp = new QPopupMenu( this ); savePopUp->insertItem( "Save", 0 ); savePopUp->insertItem( "Load", 1 ); mSoundPopUp->insertItem( "Buzzer", 0 ); mSoundPopUp->insertItem( "Wav file", 1 ); mPausePopUp->insertItem( " 1 sec", 1 ); mPausePopUp->insertItem( " 2 sec", 2 ); mPausePopUp->insertItem( " 3 sec", 3 ); mPausePopUp->insertItem( " 5 sec", 5 ); mPausePopUp->insertItem( "10 sec", 10 ); mPausePopUp->insertItem( "30 sec", 30 ); mPausePopUp->insertItem( " 1 min", 60 ); mPausePopUp->insertItem( " 5 min", 300 ); mPausePopUp->insertItem( "10 min", 600 ); mSuspendPopUp = new QPopupMenu( this ); mSuspendPopUp->insertItem( "Off", 0 ); mSuspendPopUp->insertItem( " 1x", 1 ); mSuspendPopUp->insertItem( " 2x", 2 ); mSuspendPopUp->insertItem( " 3x", 3 ); @@ -291,82 +295,80 @@ void SimpleAlarmDaemonImpl::recieve( const QCString& msg, const QByteArray& ) mAlarmMessage = mess.mid( 13+len+3 ); //qDebug("suspend file %s ",tempfilename.latin1() ); startAlarm( mAlarmMessage, filename); return; } if ( mess.left( 11 ) == "timer_alarm") { mTimerTime = 0; startAlarm( mess.mid( 11 ), filename ); return; } if ( mess.left( 10 ) == "proc_alarm") { bool error = false; int len = mess.mid( 10 ).find("+++"); if ( len < 2 ) error = true; else { tempfilename = mess.mid( 10, len ); if ( !QFile::exists( tempfilename ) ) 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"); - } //qDebug("-----system command %s ",tempfilename.latin1() ); if ( vfork () == 0 ) { execl ( tempfilename.latin1(), 0 ); return; } + QTimer::singleShot( 10000, this, SLOT ( writeFile() ) ); return; } //qDebug("+++++++system command %s ",tempfilename.latin1() ); } if ( mess.left( 11 ) == "audio_alarm") { bool error = false; int len = mess.mid( 11 ).find("+++"); if ( len < 2 ) error = true; else { tempfilename = mess.mid( 11, len ); if ( !QFile::exists( tempfilename ) ) error = true; } if ( ! error ) { filename = tempfilename; } mAlarmMessage = mess.mid( 11+len+3+9 ); //qDebug("audio file command %s ",tempfilename.latin1() ); } if ( mess.left( 9 ) == "cal_alarm") { mAlarmMessage = mess.mid( 9 ) ; } - writeFile(); + QTimer::singleShot( 10000, this, SLOT ( writeFile() ) ); startAlarm( mAlarmMessage, filename ); } int SimpleAlarmDaemonImpl::getFileNameLen( QString mess ) { return 0; } void SimpleAlarmDaemonImpl::startAlarm( QString mess, QString filename ) { //mAlarmDialog->show(); //mAlarmDialog->raise(); mAlarmDialog->eventNotification( mess, mPlayBeeps, filename, wavAlarm,mPausePlay ,mSuspend ); } void SimpleAlarmDaemonImpl::fillTimerPopUp() { // qDebug(" timer %d %d ",mTimerPopupConf, mTimerTime ); if ( mTimerPopupConf == mTimerTime ) { if ( mTimerTime ) { int secs = QDateTime::currentDateTime().secsTo ( mRunningTimer ); QTime t ( secs/3600, (secs/60)%60, secs%60 ); @@ -627,49 +629,49 @@ void SimpleAlarmDaemonImpl::newTodo() void SimpleAlarmDaemonImpl::newEvent() { QCopEnvelope e("QPE/Application/kopi", "-newEvent"); } void SimpleAlarmDaemonImpl::newMail() { QCopEnvelope e("QPE/Application/ompi", "newMail()"); } void SimpleAlarmDaemonImpl::showAdd() { QCopEnvelope e("QPE/Application/kapi", "raise()"); } void SimpleAlarmDaemonImpl::ringSync() { QCopEnvelope e("QPE/Application/kopi", "-ringSync"); } void SimpleAlarmDaemonImpl::newCountdown() { //recieve("cal_alarm", 10 ); } void SimpleAlarmDaemonImpl::simulate() { - writeFile(); + QTimer::singleShot( 10000, this, SLOT ( writeFile() ) ); QString filename = getenv("QPEDIR") ; filename += "/pics/kdepim/korganizer/koalarm.wav"; startAlarm("Alarm simulation", filename ); } void SimpleAlarmDaemonImpl::showKO() { QCopEnvelope e("QPE/Application/kopi", "-showKO"); // testing only //QCopEnvelope e("QPE/Application/kopi", "nextView()"); } void SimpleAlarmDaemonImpl::showTodo() { QCopEnvelope e("QPE/Application/kopi", "-showTodo"); } void SimpleAlarmDaemonImpl::writeJournal() { QCopEnvelope e("QPE/Application/kopi", "-showJournal"); } void SimpleAlarmDaemonImpl::mousePressEvent( QMouseEvent * ) { |