summaryrefslogtreecommitdiffabout
path: root/kalarmd/simplealarmdaemonimpl.cpp
Unidiff
Diffstat (limited to 'kalarmd/simplealarmdaemonimpl.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kalarmd/simplealarmdaemonimpl.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/kalarmd/simplealarmdaemonimpl.cpp b/kalarmd/simplealarmdaemonimpl.cpp
index 294ce7d..2a463b3 100644
--- a/kalarmd/simplealarmdaemonimpl.cpp
+++ b/kalarmd/simplealarmdaemonimpl.cpp
@@ -276,65 +276,67 @@ void SimpleAlarmDaemonImpl::recieve( const QCString& msg, const QByteArray& )
276 else { 276 else {
277 tempfilename = mess.mid( 13, len ); 277 tempfilename = mess.mid( 13, len );
278 if ( !QFile::exists( tempfilename ) ) 278 if ( !QFile::exists( tempfilename ) )
279 error = true; 279 error = true;
280 } 280 }
281 if ( ! error ) { 281 if ( ! error ) {
282 filename = tempfilename; 282 filename = tempfilename;
283 } 283 }
284 mAlarmMessage = mess.mid( 13+len+3 ); 284 mAlarmMessage = mess.mid( 13+len+3 );
285 //qDebug("suspend file %s ",tempfilename.latin1() ); 285 //qDebug("suspend file %s ",tempfilename.latin1() );
286 startAlarm( mAlarmMessage, filename); 286 startAlarm( mAlarmMessage, filename);
287 return; 287 return;
288 } 288 }
289 if ( mess.left( 11 ) == "timer_alarm") { 289 if ( mess.left( 11 ) == "timer_alarm") {
290 mTimerTime = 0; 290 mTimerTime = 0;
291 startAlarm( mess.mid( 11 ), filename ); 291 startAlarm( mess.mid( 11 ), filename );
292 return; 292 return;
293 } 293 }
294 if ( mess.left( 10 ) == "proc_alarm") { 294 if ( mess.left( 10 ) == "proc_alarm") {
295 bool error = false; 295 bool error = false;
296 int len = mess.mid( 10 ).find("+++"); 296 int len = mess.mid( 10 ).find("+++");
297 if ( len < 2 ) 297 if ( len < 2 )
298 error = true; 298 error = true;
299 else { 299 else {
300 tempfilename = mess.mid( 10, len ); 300 tempfilename = mess.mid( 10, len );
301 if ( !QFile::exists( tempfilename ) ) 301 if ( !QFile::exists( tempfilename ) )
302 error = true; 302 error = true;
303 } 303 }
304 if ( error ) { 304 if ( error ) {
305 mAlarmMessage = "Procedure Alarm\nError - File not found\n"; 305 mAlarmMessage = "Procedure Alarm\nError - File not found\n";
306 mAlarmMessage += mess.mid( 10+len+3+9 ); 306 mAlarmMessage += mess.mid( 10+len+3+9 );
307 } else { 307 } else {
308 QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); 308 {
309 QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent");
310 }
309 //qDebug("-----system command %s ",tempfilename.latin1() ); 311 //qDebug("-----system command %s ",tempfilename.latin1() );
310 if ( vfork () == 0 ) { 312 if ( vfork () == 0 ) {
311 execl ( tempfilename.latin1(), 0 ); 313 execl ( tempfilename.latin1(), 0 );
312 return; 314 return;
313 } 315 }
314 return; 316 return;
315 } 317 }
316 318
317 //qDebug("+++++++system command %s ",tempfilename.latin1() ); 319 //qDebug("+++++++system command %s ",tempfilename.latin1() );
318 } 320 }
319 if ( mess.left( 11 ) == "audio_alarm") { 321 if ( mess.left( 11 ) == "audio_alarm") {
320 bool error = false; 322 bool error = false;
321 int len = mess.mid( 11 ).find("+++"); 323 int len = mess.mid( 11 ).find("+++");
322 if ( len < 2 ) 324 if ( len < 2 )
323 error = true; 325 error = true;
324 else { 326 else {
325 tempfilename = mess.mid( 11, len ); 327 tempfilename = mess.mid( 11, len );
326 if ( !QFile::exists( tempfilename ) ) 328 if ( !QFile::exists( tempfilename ) )
327 error = true; 329 error = true;
328 } 330 }
329 if ( ! error ) { 331 if ( ! error ) {
330 filename = tempfilename; 332 filename = tempfilename;
331 } 333 }
332 mAlarmMessage = mess.mid( 11+len+3+9 ); 334 mAlarmMessage = mess.mid( 11+len+3+9 );
333 //qDebug("audio file command %s ",tempfilename.latin1() ); 335 //qDebug("audio file command %s ",tempfilename.latin1() );
334 } 336 }
335 if ( mess.left( 9 ) == "cal_alarm") { 337 if ( mess.left( 9 ) == "cal_alarm") {
336 mAlarmMessage = mess.mid( 9 ) ; 338 mAlarmMessage = mess.mid( 9 ) ;
337 } 339 }
338 340
339 writeFile(); 341 writeFile();
340 startAlarm( mAlarmMessage, filename ); 342 startAlarm( mAlarmMessage, filename );
@@ -589,66 +591,67 @@ void SimpleAlarmDaemonImpl::confTimer( int time )
589 if ( !dia.exec() ) 591 if ( !dia.exec() )
590 return; 592 return;
591 mCustomText = lEdit.text(); 593 mCustomText = lEdit.text();
592 mCustomMinutes = spinh.value()*60+spinm.value(); 594 mCustomMinutes = spinh.value()*60+spinm.value();
593 if ( mCustomMinutes == 0 ) 595 if ( mCustomMinutes == 0 )
594 mCustomMinutes = 1; 596 mCustomMinutes = 1;
595 if ( mCustomMinutes > 1440 ) 597 if ( mCustomMinutes > 1440 )
596 mCustomMinutes = 1440; 598 mCustomMinutes = 1440;
597 mess += mCustomText; 599 mess += mCustomText;
598 minutes = mCustomMinutes; 600 minutes = mCustomMinutes;
599 mRunningTimerText = mCustomText.stripWhiteSpace (); 601 mRunningTimerText = mCustomText.stripWhiteSpace ();
600 int in = mRunningTimerText.find( " " ); 602 int in = mRunningTimerText.find( " " );
601 mRunningTimerText = mRunningTimerText.left ( in ); 603 mRunningTimerText = mRunningTimerText.left ( in );
602 } 604 }
603 else { 605 else {
604 mess+= QString::number ( minutes ) + ( " minutes are past!"); 606 mess+= QString::number ( minutes ) + ( " minutes are past!");
605 int min = minutes; 607 int min = minutes;
606 if ( min % 60 == 0 ) 608 if ( min % 60 == 0 )
607 mRunningTimerText = QString::number ( min/60 ) + ( " hours"); 609 mRunningTimerText = QString::number ( min/60 ) + ( " hours");
608 else 610 else
609 mRunningTimerText = QString::number ( minutes ) + ( " minutes"); 611 mRunningTimerText = QString::number ( minutes ) + ( " minutes");
610 } 612 }
611 } 613 }
612 //minutes = 1; 614 //minutes = 1;
613 615
614 mRunningTimer = QDateTime::currentDateTime().addSecs( minutes * 60 ); 616 mRunningTimer = QDateTime::currentDateTime().addSecs( minutes * 60 );
615 timerMesssage = mess; 617 timerMesssage = mess;
616 AlarmServer::addAlarm ( mRunningTimer,"koalarm",timerMesssage.latin1()); 618 AlarmServer::addAlarm ( mRunningTimer,"koalarm",timerMesssage.latin1());
617 mTimerTime = 1; 619 mTimerTime = 1;
618} 620}
619 621
620void SimpleAlarmDaemonImpl::writeFile() 622void SimpleAlarmDaemonImpl::writeFile()
621{ 623{
622 QCopEnvelope e("QPE/Application/kopi", "-writeFile"); 624 QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent");
625 //QCopEnvelope e("QPE/Application/kopi", "-writeFile");
623} 626}
624void SimpleAlarmDaemonImpl::showWN() 627void SimpleAlarmDaemonImpl::showWN()
625{ 628{
626 QCopEnvelope e("QPE/Application/kopi", "-showWN"); 629 QCopEnvelope e("QPE/Application/kopi", "-showWN");
627} 630}
628void SimpleAlarmDaemonImpl::newTodo() 631void SimpleAlarmDaemonImpl::newTodo()
629{ 632{
630 QCopEnvelope e("QPE/Application/kopi", "-newTodo"); 633 QCopEnvelope e("QPE/Application/kopi", "-newTodo");
631} 634}
632 635
633void SimpleAlarmDaemonImpl::newEvent() 636void SimpleAlarmDaemonImpl::newEvent()
634{ 637{
635 QCopEnvelope e("QPE/Application/kopi", "-newEvent"); 638 QCopEnvelope e("QPE/Application/kopi", "-newEvent");
636 639
637} 640}
638void SimpleAlarmDaemonImpl::newMail() 641void SimpleAlarmDaemonImpl::newMail()
639{ 642{
640 QCopEnvelope e("QPE/Application/ompi", "newMail()"); 643 QCopEnvelope e("QPE/Application/ompi", "newMail()");
641} 644}
642void SimpleAlarmDaemonImpl::showAdd() 645void SimpleAlarmDaemonImpl::showAdd()
643{ 646{
644 QCopEnvelope e("QPE/Application/kapi", "raise()"); 647 QCopEnvelope e("QPE/Application/kapi", "raise()");
645} 648}
646void SimpleAlarmDaemonImpl::ringSync() 649void SimpleAlarmDaemonImpl::ringSync()
647{ 650{
648 QCopEnvelope e("QPE/Application/kopi", "-ringSync"); 651 QCopEnvelope e("QPE/Application/kopi", "-ringSync");
649 652
650} 653}
651void SimpleAlarmDaemonImpl::newCountdown() 654void SimpleAlarmDaemonImpl::newCountdown()
652{ 655{
653 //recieve("cal_alarm", 10 ); 656 //recieve("cal_alarm", 10 );
654} 657}