author | zautrix <zautrix> | 2005-09-18 23:40:38 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-09-18 23:40:38 (UTC) |
commit | 2d346e4052fd726e657daee4ac3f2bcc7103f5fb (patch) (unidiff) | |
tree | 9952b888e0790bc032ba4e0c3c4165ec283a4139 /kalarmd | |
parent | 06ebec95579816144ee65981835e6e3482e20a28 (diff) | |
download | kdepimpi-2d346e4052fd726e657daee4ac3f2bcc7103f5fb.zip kdepimpi-2d346e4052fd726e657daee4ac3f2bcc7103f5fb.tar.gz kdepimpi-2d346e4052fd726e657daee4ac3f2bcc7103f5fb.tar.bz2 |
wn
-rw-r--r-- | kalarmd/alarmdialog.cpp | 12 | ||||
-rw-r--r-- | kalarmd/simplealarmdaemonimpl.cpp | 11 |
2 files changed, 16 insertions, 7 deletions
diff --git a/kalarmd/alarmdialog.cpp b/kalarmd/alarmdialog.cpp index ddb125a..18ce9da 100644 --- a/kalarmd/alarmdialog.cpp +++ b/kalarmd/alarmdialog.cpp | |||
@@ -238,54 +238,58 @@ bool AlarmDialog::eventNotification( QString mess, int replay , QString fn, boo | |||
238 | maxAlarmReplay = replay ; | 238 | maxAlarmReplay = replay ; |
239 | mStopAlarm = false; | 239 | mStopAlarm = false; |
240 | mSilent = false; | 240 | mSilent = false; |
241 | if ( !mMessage->text().stripWhiteSpace().isEmpty() ) { | 241 | if ( !mMessage->text().stripWhiteSpace().isEmpty() ) { |
242 | mMissedAlarmsCombo->show(); | 242 | mMissedAlarmsCombo->show(); |
243 | QString newItem = mMessage->text().stripWhiteSpace(); | 243 | QString newItem = mMessage->text().stripWhiteSpace(); |
244 | newItem.replace( QRegExp("\n"), QString(" ") ); | 244 | newItem.replace( QRegExp("\n"), QString(" ") ); |
245 | mMissedAlarmsCombo->insertItem( newItem ); | 245 | mMissedAlarmsCombo->insertItem( newItem ); |
246 | mMissedAlarms->setText( "Missed alarms:"); | 246 | mMissedAlarms->setText( "Missed alarms:"); |
247 | } else | 247 | } else |
248 | mMissedAlarmsCombo->hide(); | 248 | mMissedAlarmsCombo->hide(); |
249 | mMessage->setText(mess); | 249 | mMessage->setText(mess); |
250 | int w = minimumSizeHint().width() ; | 250 | int w = minimumSizeHint().width() ; |
251 | int h = minimumSizeHint().height() ; | 251 | int h = minimumSizeHint().height() ; |
252 | int dw = QApplication::desktop()->width(); | 252 | int dw = QApplication::desktop()->width(); |
253 | int dh = QApplication::desktop()->height(); | 253 | int dh = QApplication::desktop()->height(); |
254 | if ( w < 220 ) w = 220; | ||
255 | if ( h < 220 ) h = 220; | ||
254 | setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 256 | setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
255 | hide(); | 257 | showNormal(); |
258 | setActiveWindow(); | ||
259 | raise(); | ||
260 | setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | ||
261 | //hide(); | ||
256 | 262 | ||
257 | #ifndef _WIN32_ | 263 | #ifndef _WIN32_ |
258 | if ( fd_led > 0 ) { | 264 | if ( fd_led > 0 ) { |
259 | statusLED.status = LED_SALARM_ON ; | 265 | statusLED.status = LED_SALARM_ON ; |
260 | ioctl (fd_led, SHARP_LED_SETSTATUS, &statusLED); | 266 | ioctl (fd_led, SHARP_LED_SETSTATUS, &statusLED); |
261 | } | 267 | } |
262 | #endif | 268 | #endif |
263 | okbut->setDefault( true ); | 269 | okbut->setDefault( true ); |
264 | QTimer::singleShot( 1, this, SLOT ( forceRepaint() ) ); | 270 | QTimer::singleShot( 1, this, SLOT ( forceRepaint() ) ); |
265 | // playSoundTimer->start( 1000, true ); | 271 | // playSoundTimer->start( 1000, true ); |
266 | return true; | 272 | return true; |
267 | 273 | ||
268 | } | 274 | } |
269 | 275 | ||
270 | void AlarmDialog::forceRepaint() | 276 | void AlarmDialog::forceRepaint() |
271 | { | 277 | { |
272 | |||
273 | showNormal(); | ||
274 | setActiveWindow(); | 278 | setActiveWindow(); |
275 | raise(); | 279 | repaint(); |
276 | mSuspendSpin->setFocus(); | 280 | mSuspendSpin->setFocus(); |
277 | playSoundTimer->start( 1000, true ); | 281 | playSoundTimer->start( 1000, true ); |
278 | 282 | ||
279 | } | 283 | } |
280 | void AlarmDialog::spinBoxChanged( int v ) | 284 | void AlarmDialog::spinBoxChanged( int v ) |
281 | { | 285 | { |
282 | okbut->setDefault( false ); | 286 | okbut->setDefault( false ); |
283 | mSilent = true; | 287 | mSilent = true; |
284 | } | 288 | } |
285 | 289 | ||
286 | void AlarmDialog::playSound () | 290 | void AlarmDialog::playSound () |
287 | { | 291 | { |
288 | 292 | ||
289 | if (mStopAlarm ) | 293 | if (mStopAlarm ) |
290 | return; | 294 | return; |
291 | if ( mSilent ) | 295 | if ( mSilent ) |
diff --git a/kalarmd/simplealarmdaemonimpl.cpp b/kalarmd/simplealarmdaemonimpl.cpp index a0ac232..8ea8a73 100644 --- a/kalarmd/simplealarmdaemonimpl.cpp +++ b/kalarmd/simplealarmdaemonimpl.cpp | |||
@@ -54,32 +54,37 @@ SimpleAlarmDaemonImpl::SimpleAlarmDaemonImpl( QWidget *parent ) | |||
54 | mAlarmDialog = new AlarmDialog( 0 ); | 54 | mAlarmDialog = new AlarmDialog( 0 ); |
55 | mPopUp = new QPopupMenu( this ); | 55 | mPopUp = new QPopupMenu( this ); |
56 | mPopUp->insertItem( "What's Next?", this, SLOT ( showWN() ) ); | 56 | mPopUp->insertItem( "What's Next?", this, SLOT ( showWN() ) ); |
57 | mPopUp->insertItem( "Next Days!", this, SLOT ( showKO() ) ); | 57 | mPopUp->insertItem( "Next Days!", this, SLOT ( showKO() ) ); |
58 | mPopUp->insertSeparator(); | 58 | mPopUp->insertSeparator(); |
59 | mPopUp->insertItem( "Todo List", this, SLOT ( showTodo() ) ); | 59 | mPopUp->insertItem( "Todo List", this, SLOT ( showTodo() ) ); |
60 | mPopUp->insertSeparator(); | 60 | mPopUp->insertSeparator(); |
61 | mPopUp->insertItem( "Addresses", this, SLOT ( showAdd() ) ); | 61 | mPopUp->insertItem( "Addresses", this, SLOT ( showAdd() ) ); |
62 | mPopUp->insertSeparator(); | 62 | mPopUp->insertSeparator(); |
63 | mPopUp->insertItem( "Edit Journal", this, SLOT ( writeJournal() ) ); | 63 | mPopUp->insertItem( "Edit Journal", this, SLOT ( writeJournal() ) ); |
64 | mPopUp->insertItem( "New Event", this, SLOT ( newEvent() ) ); | 64 | mPopUp->insertItem( "New Event", this, SLOT ( newEvent() ) ); |
65 | mPopUp->insertItem( "New Todo", this, SLOT ( newTodo() ) ); | 65 | mPopUp->insertItem( "New Todo", this, SLOT ( newTodo() ) ); |
66 | mPopUp->insertItem( "New Mail", this, SLOT ( newMail() ) ); | 66 | mPopUp->insertItem( "New Mail", this, SLOT ( newMail() ) ); |
67 | mPopUp->insertSeparator(); | 67 | mPopUp->insertSeparator(); |
68 | mPopUp->insertItem( "Multi Sync", this, SLOT ( ringSync() ) ); | 68 | mPopUp->insertItem( "Multi Sync", this, SLOT ( ringSync() ) ); |
69 | mTimerPopUp = new QPopupMenu( this ); | 69 | mTimerPopUp = new QPopupMenu( this ); |
70 | QFont fon = mTimerPopUp->font(); | ||
71 | int points = (fon.pointSize()*4)/3; | ||
72 | fon.setPointSize( points ); | ||
73 | mTimerPopUp->setFont( fon ); | ||
74 | mPopUp->setFont( fon ); | ||
70 | mBeepPopUp = new QPopupMenu( this ); | 75 | mBeepPopUp = new QPopupMenu( this ); |
71 | mSoundPopUp = new QPopupMenu( this ); | 76 | mSoundPopUp = new QPopupMenu( this ); |
72 | mPausePopUp = new QPopupMenu( this ); | 77 | mPausePopUp = new QPopupMenu( this ); |
73 | QPopupMenu* savePopUp = new QPopupMenu( this ); | 78 | QPopupMenu* savePopUp = new QPopupMenu( this ); |
74 | savePopUp->insertItem( "Save", 0 ); | 79 | savePopUp->insertItem( "Save", 0 ); |
75 | savePopUp->insertItem( "Load", 1 ); | 80 | savePopUp->insertItem( "Load", 1 ); |
76 | mSoundPopUp->insertItem( "Buzzer", 0 ); | 81 | mSoundPopUp->insertItem( "Buzzer", 0 ); |
77 | mSoundPopUp->insertItem( "Wav file", 1 ); | 82 | mSoundPopUp->insertItem( "Wav file", 1 ); |
78 | mPausePopUp->insertItem( " 1 sec", 1 ); | 83 | mPausePopUp->insertItem( " 1 sec", 1 ); |
79 | mPausePopUp->insertItem( " 2 sec", 2 ); | 84 | mPausePopUp->insertItem( " 2 sec", 2 ); |
80 | mPausePopUp->insertItem( " 3 sec", 3 ); | 85 | mPausePopUp->insertItem( " 3 sec", 3 ); |
81 | mPausePopUp->insertItem( " 5 sec", 5 ); | 86 | mPausePopUp->insertItem( " 5 sec", 5 ); |
82 | mPausePopUp->insertItem( "10 sec", 10 ); | 87 | mPausePopUp->insertItem( "10 sec", 10 ); |
83 | mPausePopUp->insertItem( "30 sec", 30 ); | 88 | mPausePopUp->insertItem( "30 sec", 30 ); |
84 | mPausePopUp->insertItem( " 1 min", 60 ); | 89 | mPausePopUp->insertItem( " 1 min", 60 ); |
85 | mPausePopUp->insertItem( " 5 min", 300 ); | 90 | mPausePopUp->insertItem( " 5 min", 300 ); |
@@ -300,59 +305,59 @@ void SimpleAlarmDaemonImpl::recieve( const QCString& msg, const QByteArray& ) | |||
300 | if ( len < 2 ) | 305 | if ( len < 2 ) |
301 | error = true; | 306 | error = true; |
302 | else { | 307 | else { |
303 | tempfilename = mess.mid( 10, len ); | 308 | tempfilename = mess.mid( 10, len ); |
304 | if ( !QFile::exists( tempfilename ) ) | 309 | if ( !QFile::exists( tempfilename ) ) |
305 | error = true; | 310 | error = true; |
306 | } | 311 | } |
307 | if ( error ) { | 312 | if ( error ) { |
308 | mAlarmMessage = "Procedure Alarm\nError - File not found\n"; | 313 | mAlarmMessage = "Procedure Alarm\nError - File not found\n"; |
309 | mAlarmMessage += mess.mid( 10+len+3+9 ); | 314 | mAlarmMessage += mess.mid( 10+len+3+9 ); |
310 | } else { | 315 | } else { |
311 | //qDebug("-----system command %s ",tempfilename.latin1() ); | 316 | //qDebug("-----system command %s ",tempfilename.latin1() ); |
312 | if ( vfork () == 0 ) { | 317 | if ( vfork () == 0 ) { |
313 | execl ( tempfilename.latin1(), 0 ); | 318 | execl ( tempfilename.latin1(), 0 ); |
314 | return; | 319 | return; |
315 | } | 320 | } |
316 | QTimer::singleShot( 10000, this, SLOT ( writeFile() ) ); | 321 | QTimer::singleShot( 5000, this, SLOT ( writeFile() ) ); |
317 | return; | 322 | return; |
318 | } | 323 | } |
319 | 324 | ||
320 | //qDebug("+++++++system command %s ",tempfilename.latin1() ); | 325 | //qDebug("+++++++system command %s ",tempfilename.latin1() ); |
321 | } | 326 | } |
322 | if ( mess.left( 11 ) == "audio_alarm") { | 327 | if ( mess.left( 11 ) == "audio_alarm") { |
323 | bool error = false; | 328 | bool error = false; |
324 | int len = mess.mid( 11 ).find("+++"); | 329 | int len = mess.mid( 11 ).find("+++"); |
325 | if ( len < 2 ) | 330 | if ( len < 2 ) |
326 | error = true; | 331 | error = true; |
327 | else { | 332 | else { |
328 | tempfilename = mess.mid( 11, len ); | 333 | tempfilename = mess.mid( 11, len ); |
329 | if ( !QFile::exists( tempfilename ) ) | 334 | if ( !QFile::exists( tempfilename ) ) |
330 | error = true; | 335 | error = true; |
331 | } | 336 | } |
332 | if ( ! error ) { | 337 | if ( ! error ) { |
333 | filename = tempfilename; | 338 | filename = tempfilename; |
334 | } | 339 | } |
335 | mAlarmMessage = mess.mid( 11+len+3+9 ); | 340 | mAlarmMessage = mess.mid( 11+len+3+9 ); |
336 | //qDebug("audio file command %s ",tempfilename.latin1() ); | 341 | //qDebug("audio file command %s ",tempfilename.latin1() ); |
337 | } | 342 | } |
338 | if ( mess.left( 9 ) == "cal_alarm") { | 343 | if ( mess.left( 9 ) == "cal_alarm") { |
339 | mAlarmMessage = mess.mid( 9 ) ; | 344 | mAlarmMessage = mess.mid( 9 ) ; |
340 | } | 345 | } |
341 | 346 | ||
342 | QTimer::singleShot( 10000, this, SLOT ( writeFile() ) ); | 347 | QTimer::singleShot( 5000, this, SLOT ( writeFile() ) ); |
343 | startAlarm( mAlarmMessage, filename ); | 348 | startAlarm( mAlarmMessage, filename ); |
344 | 349 | ||
345 | } | 350 | } |
346 | 351 | ||
347 | int SimpleAlarmDaemonImpl::getFileNameLen( QString mess ) | 352 | int SimpleAlarmDaemonImpl::getFileNameLen( QString mess ) |
348 | { | 353 | { |
349 | return 0; | 354 | return 0; |
350 | } | 355 | } |
351 | void SimpleAlarmDaemonImpl::startAlarm( QString mess, QString filename ) | 356 | void SimpleAlarmDaemonImpl::startAlarm( QString mess, QString filename ) |
352 | { | 357 | { |
353 | //mAlarmDialog->show(); | 358 | //mAlarmDialog->show(); |
354 | //mAlarmDialog->raise(); | 359 | //mAlarmDialog->raise(); |
355 | mAlarmDialog->eventNotification( mess, mPlayBeeps, filename, wavAlarm,mPausePlay ,mSuspend ); | 360 | mAlarmDialog->eventNotification( mess, mPlayBeeps, filename, wavAlarm,mPausePlay ,mSuspend ); |
356 | } | 361 | } |
357 | 362 | ||
358 | 363 | ||
@@ -629,33 +634,33 @@ void SimpleAlarmDaemonImpl::newMail() | |||
629 | } | 634 | } |
630 | void SimpleAlarmDaemonImpl::showAdd() | 635 | void SimpleAlarmDaemonImpl::showAdd() |
631 | { | 636 | { |
632 | QCopEnvelope e("QPE/Application/kapi", "raise()"); | 637 | QCopEnvelope e("QPE/Application/kapi", "raise()"); |
633 | } | 638 | } |
634 | void SimpleAlarmDaemonImpl::ringSync() | 639 | void SimpleAlarmDaemonImpl::ringSync() |
635 | { | 640 | { |
636 | QCopEnvelope e("QPE/Application/kopi", "-ringSync"); | 641 | QCopEnvelope e("QPE/Application/kopi", "-ringSync"); |
637 | 642 | ||
638 | } | 643 | } |
639 | void SimpleAlarmDaemonImpl::newCountdown() | 644 | void SimpleAlarmDaemonImpl::newCountdown() |
640 | { | 645 | { |
641 | //recieve("cal_alarm", 10 ); | 646 | //recieve("cal_alarm", 10 ); |
642 | } | 647 | } |
643 | void SimpleAlarmDaemonImpl::simulate() | 648 | void SimpleAlarmDaemonImpl::simulate() |
644 | { | 649 | { |
645 | QTimer::singleShot( 10000, this, SLOT ( writeFile() ) ); | 650 | QTimer::singleShot( 5000, this, SLOT ( writeFile() ) ); |
646 | QString filename = getenv("QPEDIR") ; | 651 | QString filename = getenv("QPEDIR") ; |
647 | filename += "/pics/kdepim/korganizer/koalarm.wav"; | 652 | filename += "/pics/kdepim/korganizer/koalarm.wav"; |
648 | startAlarm("Alarm simulation", filename ); | 653 | startAlarm("Alarm simulation", filename ); |
649 | } | 654 | } |
650 | void SimpleAlarmDaemonImpl::showKO() | 655 | void SimpleAlarmDaemonImpl::showKO() |
651 | { | 656 | { |
652 | QCopEnvelope e("QPE/Application/kopi", "-showKO"); | 657 | QCopEnvelope e("QPE/Application/kopi", "-showKO"); |
653 | // testing only | 658 | // testing only |
654 | //QCopEnvelope e("QPE/Application/kopi", "nextView()"); | 659 | //QCopEnvelope e("QPE/Application/kopi", "nextView()"); |
655 | 660 | ||
656 | } | 661 | } |
657 | void SimpleAlarmDaemonImpl::showTodo() | 662 | void SimpleAlarmDaemonImpl::showTodo() |
658 | { | 663 | { |
659 | QCopEnvelope e("QPE/Application/kopi", "-showTodo"); | 664 | QCopEnvelope e("QPE/Application/kopi", "-showTodo"); |
660 | 665 | ||
661 | } | 666 | } |