summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-10-09 23:48:12 (UTC)
committer zautrix <zautrix>2005-10-09 23:48:12 (UTC)
commitdad8e8745591620c951cefd835ea7ea727db8925 (patch) (unidiff)
treec7352262bfc07f50b5b63b7ea034bdecdaa8732c
parent6d084862c396f58c949e713e9b159ec20743fd8a (diff)
downloadkdepimpi-dad8e8745591620c951cefd835ea7ea727db8925.zip
kdepimpi-dad8e8745591620c951cefd835ea7ea727db8925.tar.gz
kdepimpi-dad8e8745591620c951cefd835ea7ea727db8925.tar.bz2
timer message
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kalarmd/simplealarmdaemonimpl.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/kalarmd/simplealarmdaemonimpl.cpp b/kalarmd/simplealarmdaemonimpl.cpp
index c1e064c..553e377 100644
--- a/kalarmd/simplealarmdaemonimpl.cpp
+++ b/kalarmd/simplealarmdaemonimpl.cpp
@@ -103,98 +103,99 @@ SimpleAlarmDaemonImpl::SimpleAlarmDaemonImpl( QWidget *parent )
103 mBeepPopUp->insertItem( "Replay",mSoundPopUp ); 103 mBeepPopUp->insertItem( "Replay",mSoundPopUp );
104 mBeepPopUp->insertItem( "Config",savePopUp ); 104 mBeepPopUp->insertItem( "Config",savePopUp );
105 mBeepPopUp->insertItem( "300", 300 ); 105 mBeepPopUp->insertItem( "300", 300 );
106 mBeepPopUp->insertItem( "180", 180 ); 106 mBeepPopUp->insertItem( "180", 180 );
107 mBeepPopUp->insertItem( "60", 60 ); 107 mBeepPopUp->insertItem( "60", 60 );
108 mBeepPopUp->insertItem( "30", 30 ); 108 mBeepPopUp->insertItem( "30", 30 );
109 mBeepPopUp->insertItem( "10", 10 ); 109 mBeepPopUp->insertItem( "10", 10 );
110 mBeepPopUp->insertItem( "3", 3 ); 110 mBeepPopUp->insertItem( "3", 3 );
111 mBeepPopUp->insertItem( "1", 1 ); 111 mBeepPopUp->insertItem( "1", 1 );
112 mBeepPopUp->insertItem( "Off", 0 ); 112 mBeepPopUp->insertItem( "Off", 0 );
113 mBeepPopUp->insertSeparator(); 113 mBeepPopUp->insertSeparator();
114 mBeepPopUp->insertItem( "Simulate", 1000 ); 114 mBeepPopUp->insertItem( "Simulate", 1000 );
115 mBeepPopUp->setCheckable( true ); 115 mBeepPopUp->setCheckable( true );
116 mPopUp->insertSeparator(); 116 mPopUp->insertSeparator();
117 mPopUp->insertItem( "Play beeps", mBeepPopUp ); 117 mPopUp->insertItem( "Play beeps", mBeepPopUp );
118 mPopUp->insertSeparator(); 118 mPopUp->insertSeparator();
119 mPopUp->insertItem( "Timer", mTimerPopUp ); 119 mPopUp->insertItem( "Timer", mTimerPopUp );
120 //mPopUp->insertSeparator(); 120 //mPopUp->insertSeparator();
121 //mPopUp->insertItem( "Simulate", this, SLOT ( simulate() ) ); 121 //mPopUp->insertItem( "Simulate", this, SLOT ( simulate() ) );
122 122
123 mPopUp->resize( mPopUp->sizeHint() ); 123 mPopUp->resize( mPopUp->sizeHint() );
124 mPlayBeeps = 60; 124 mPlayBeeps = 60;
125 mBeepPopUp->setItemChecked ( mPlayBeeps, true ); 125 mBeepPopUp->setItemChecked ( mPlayBeeps, true );
126 connect ( mBeepPopUp, SIGNAL( activated ( int ) ), this, SLOT (slotPlayBeep( int ) ) ); 126 connect ( mBeepPopUp, SIGNAL( activated ( int ) ), this, SLOT (slotPlayBeep( int ) ) );
127 connect ( mTimerPopUp, SIGNAL( activated ( int ) ), this, SLOT (confTimer( int ) ) ); 127 connect ( mTimerPopUp, SIGNAL( activated ( int ) ), this, SLOT (confTimer( int ) ) );
128 connect ( mTimerPopUp, SIGNAL(aboutToShow() ), this, SLOT ( showTimer( ) ) ); 128 connect ( mTimerPopUp, SIGNAL(aboutToShow() ), this, SLOT ( showTimer( ) ) );
129 connect ( mSoundPopUp, SIGNAL( activated ( int ) ), this, SLOT (confSound( int ) ) ); 129 connect ( mSoundPopUp, SIGNAL( activated ( int ) ), this, SLOT (confSound( int ) ) );
130 connect ( mPausePopUp, SIGNAL( activated ( int ) ), this, SLOT (confPause( int ) ) ); 130 connect ( mPausePopUp, SIGNAL( activated ( int ) ), this, SLOT (confPause( int ) ) );
131 connect ( mSuspendPopUp, SIGNAL( activated ( int ) ), this, SLOT (confSuspend( int ) ) ); 131 connect ( mSuspendPopUp, SIGNAL( activated ( int ) ), this, SLOT (confSuspend( int ) ) );
132 connect ( savePopUp, SIGNAL( activated ( int ) ), this, SLOT (saveSlot( int ) ) ); 132 connect ( savePopUp, SIGNAL( activated ( int ) ), this, SLOT (saveSlot( int ) ) );
133 mTimerTime = 0; 133 mTimerTime = 0;
134 mCustomText = "Custom Text"; 134 mCustomText = "Custom Text";
135 mCustomMinutes = 7; 135 mCustomMinutes = 7;
136 mTimerPopupConf = 1; 136 mTimerPopupConf = 1;
137 fillTimerPopUp(); 137 fillTimerPopUp();
138 mPausePlay = 0; 138 mPausePlay = 0;
139 confPause( 1 ); 139 confPause( 1 );
140 mSuspend = 0; 140 mSuspend = 0;
141 confSuspend( 0 ); 141 confSuspend( 0 );
142 if ( QApplication::desktop()->width() < 480 ) { 142 if ( QApplication::desktop()->width() < 480 ) {
143 wavAlarm = false; 143 wavAlarm = false;
144 mSoundPopUp->setItemChecked ( 0, true ); 144 mSoundPopUp->setItemChecked ( 0, true );
145 } 145 }
146 else { 146 else {
147 wavAlarm = true; 147 wavAlarm = true;
148 mSoundPopUp->setItemChecked ( 1, true ); 148 mSoundPopUp->setItemChecked ( 1, true );
149 } 149 }
150 saveSlot( 1 ); 150 saveSlot( 1 );
151 mTimerStartLabel = new QLabel( 0 ); 151 mTimerStartLabel = new QLabel( 0, 0, WType_Popup );
152 mTimerStartLabel->setCaption( "Timer started!"); 152 //mTimerStartLabel->setCaption( "Timer started!");
153 mTimerStartLabel->setAlignment ( Qt::AlignCenter ) ;
153 fon = mTimerPopUp->font(); 154 fon = mTimerPopUp->font();
154 fon.setBold( true ); 155 fon.setBold( true );
155 points = (fon.pointSize()*2); 156 points = (fon.pointSize()*2);
156 fon.setPointSize( points ); 157 fon.setPointSize( points );
157 mTimerStartLabel->setFont( fon ); 158 mTimerStartLabel->setFont( fon );
158} 159}
159 160
160SimpleAlarmDaemonImpl::~SimpleAlarmDaemonImpl() 161SimpleAlarmDaemonImpl::~SimpleAlarmDaemonImpl()
161{ 162{
162 //delete mPopUp; 163 //delete mPopUp;
163 delete mAlarmDialog; 164 delete mAlarmDialog;
164 delete mTimerStartLabel; 165 delete mTimerStartLabel;
165} 166}
166 167
167void SimpleAlarmDaemonImpl::saveSlot( int load ) 168void SimpleAlarmDaemonImpl::saveSlot( int load )
168{ 169{
169 QString fileName = QDir::homeDirPath() +"/.kopialarmrc"; 170 QString fileName = QDir::homeDirPath() +"/.kopialarmrc";
170 //qDebug("save %d ", load ); 171 //qDebug("save %d ", load );
171 QFile file( fileName ); 172 QFile file( fileName );
172 if ( load ) { 173 if ( load ) {
173 if( !QFile::exists( fileName) ) 174 if( !QFile::exists( fileName) )
174 return; 175 return;
175 if (!file.open( IO_ReadOnly ) ) { 176 if (!file.open( IO_ReadOnly ) ) {
176 return ; 177 return ;
177 } 178 }
178 QString line; 179 QString line;
179 bool ok; 180 bool ok;
180 int val; 181 int val;
181 int len; 182 int len;
182 while ( file.readLine( line, 1024 ) > 0 ) { 183 while ( file.readLine( line, 1024 ) > 0 ) {
183 //qDebug("read %s ", line.latin1()); 184 //qDebug("read %s ", line.latin1());
184 len = line.length(); 185 len = line.length();
185 if ( line.left(4 ) == "PPAU" ) { 186 if ( line.left(4 ) == "PPAU" ) {
186 val = line.mid( 4,len-5).toInt( &ok ); 187 val = line.mid( 4,len-5).toInt( &ok );
187 if ( ok ) { 188 if ( ok ) {
188 confPause( val ); 189 confPause( val );
189 } 190 }
190 } 191 }
191 if ( line.left(4 ) == "SUCO" ) { 192 if ( line.left(4 ) == "SUCO" ) {
192 val = line.mid( 4,len-5).toInt( &ok ); 193 val = line.mid( 4,len-5).toInt( &ok );
193 if ( ok ) 194 if ( ok )
194 confSuspend ( val ); 195 confSuspend ( val );
195 } 196 }
196 if ( line.left(4 ) == "WAAL" ) { 197 if ( line.left(4 ) == "WAAL" ) {
197 val = line.mid( 4,len-5).toInt( &ok ); 198 val = line.mid( 4,len-5).toInt( &ok );
198 if ( ok ) 199 if ( ok )
199 confSound( val ); 200 confSound( val );
200 201
@@ -574,104 +575,104 @@ void SimpleAlarmDaemonImpl::confTimer( int time )
574 spinm.setFixedSize( 110,62 ); 575 spinm.setFixedSize( 110,62 );
575 lay.addWidget( &hbox); 576 lay.addWidget( &hbox);
576 QLabel lab5 ("Timer fires at:", &dia ); 577 QLabel lab5 ("Timer fires at:", &dia );
577 lab5.setAlignment( AlignCenter ); 578 lab5.setAlignment( AlignCenter );
578 lay.addWidget( &lab5); 579 lay.addWidget( &lab5);
579 KODateLabel dl ( &dia ); 580 KODateLabel dl ( &dia );
580 dl.setAlignment( AlignCenter ); 581 dl.setAlignment( AlignCenter );
581 dl.setFont( fo ); 582 dl.setFont( fo );
582 connect ( &spinh, SIGNAL ( valueChanged (int)), &dl, SLOT ( slot_hours( int ) ) ); 583 connect ( &spinh, SIGNAL ( valueChanged (int)), &dl, SLOT ( slot_hours( int ) ) );
583 connect ( &spinm, SIGNAL ( valueChanged (int)), &dl, SLOT ( slot_minutes( int ) ) ); 584 connect ( &spinm, SIGNAL ( valueChanged (int)), &dl, SLOT ( slot_minutes( int ) ) );
584 lay.addWidget( &dl); 585 lay.addWidget( &dl);
585 spinh.setValue( mCustomMinutes/60 ); 586 spinh.setValue( mCustomMinutes/60 );
586 spinm.setValue( mCustomMinutes%60 ); 587 spinm.setValue( mCustomMinutes%60 );
587 QPushButton ok ( "Start timer", &dia); 588 QPushButton ok ( "Start timer", &dia);
588 ok.setDefault( true ); 589 ok.setDefault( true );
589 ok.setFont( fo ); 590 ok.setFont( fo );
590 spinh.setFocus(); 591 spinh.setFocus();
591 lay.addWidget( &ok); 592 lay.addWidget( &ok);
592 connect ( &ok, SIGNAL (clicked()), &dia, SLOT ( accept() ) ); 593 connect ( &ok, SIGNAL (clicked()), &dia, SLOT ( accept() ) );
593 dia.resize( dia.sizeHint().width(), dia.sizeHint().height() ); 594 dia.resize( dia.sizeHint().width(), dia.sizeHint().height() );
594 595
595 if ( !dia.exec() ) 596 if ( !dia.exec() )
596 return; 597 return;
597 mCustomText = lEdit.text(); 598 mCustomText = lEdit.text();
598 mCustomMinutes = spinh.value()*60+spinm.value(); 599 mCustomMinutes = spinh.value()*60+spinm.value();
599 if ( mCustomMinutes == 0 ) 600 if ( mCustomMinutes == 0 )
600 mCustomMinutes = 1; 601 mCustomMinutes = 1;
601 if ( mCustomMinutes > 1440 ) 602 if ( mCustomMinutes > 1440 )
602 mCustomMinutes = 1440; 603 mCustomMinutes = 1440;
603 mess += mCustomText; 604 mess += mCustomText;
604 disp = mCustomText; 605 disp = mCustomText;
605 minutes = mCustomMinutes; 606 minutes = mCustomMinutes;
606 mRunningTimerText = mCustomText.stripWhiteSpace (); 607 mRunningTimerText = mCustomText.stripWhiteSpace ();
607 int in = mRunningTimerText.find( " " ); 608 int in = mRunningTimerText.find( " " );
608 mRunningTimerText = mRunningTimerText.left ( in ); 609 mRunningTimerText = mRunningTimerText.left ( in );
609 } 610 }
610 else { 611 else {
611 mess += mTimerPopUp->text( minutes ); 612 mess += mTimerPopUp->text( minutes );
612 disp = mTimerPopUp->text( minutes ); 613 disp = mTimerPopUp->text( minutes );
613 mRunningTimerText = mTimerPopUp->text( minutes ); 614 mRunningTimerText = mTimerPopUp->text( minutes );
614 minutes -= 10; 615 minutes -= 10;
615 } 616 }
616 } 617 }
617 //minutes = 1; 618 //minutes = 1;
618 619
619 mRunningTimer = QDateTime::currentDateTime().addSecs( minutes * 60 ); 620 mRunningTimer = QDateTime::currentDateTime().addSecs( minutes * 60 );
620 timerMesssage = mess; 621 timerMesssage = mess;
621 AlarmServer::addAlarm ( mRunningTimer,"koalarm",timerMesssage.utf8()); 622 AlarmServer::addAlarm ( mRunningTimer,"koalarm",timerMesssage.utf8());
622 mTimerStartLabel->setText( disp ); 623 mTimerStartLabel->setText( disp + "\n\nTimer started!" );
623 int w = 200; 624 int w = mTimerStartLabel->sizeHint().width()+20;
624 int h = mTimerStartLabel->sizeHint().height() ; 625 int h = mTimerStartLabel->sizeHint().height()+40 ;
625 int dw = QApplication::desktop()->width(); 626 int dw = QApplication::desktop()->width();
626 int dh = QApplication::desktop()->height(); 627 int dh = QApplication::desktop()->height();
627 mTimerStartLabel->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 628 mTimerStartLabel->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
628 mTimerStartLabel->show(); 629 mTimerStartLabel->show();
629 QTimer::singleShot( 2000, mTimerStartLabel, SLOT ( hide() ) ); 630 QTimer::singleShot( 3000, mTimerStartLabel, SLOT ( hide() ) );
630 mTimerTime = 1; 631 mTimerTime = 1;
631} 632}
632 633
633void SimpleAlarmDaemonImpl::writeFile() 634void SimpleAlarmDaemonImpl::writeFile()
634{ 635{
635 QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); 636 QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent");
636 //QCopEnvelope e("QPE/Application/kopi", "-writeFile"); 637 //QCopEnvelope e("QPE/Application/kopi", "-writeFile");
637} 638}
638void SimpleAlarmDaemonImpl::showWN() 639void SimpleAlarmDaemonImpl::showWN()
639{ 640{
640 QCopEnvelope e("QPE/Application/kopi", "-showWN"); 641 QCopEnvelope e("QPE/Application/kopi", "-showWN");
641} 642}
642void SimpleAlarmDaemonImpl::newTodo() 643void SimpleAlarmDaemonImpl::newTodo()
643{ 644{
644 QCopEnvelope e("QPE/Application/kopi", "-newTodo"); 645 QCopEnvelope e("QPE/Application/kopi", "-newTodo");
645} 646}
646 647
647void SimpleAlarmDaemonImpl::newEvent() 648void SimpleAlarmDaemonImpl::newEvent()
648{ 649{
649 QCopEnvelope e("QPE/Application/kopi", "-newEvent"); 650 QCopEnvelope e("QPE/Application/kopi", "-newEvent");
650 651
651} 652}
652void SimpleAlarmDaemonImpl::newMail() 653void SimpleAlarmDaemonImpl::newMail()
653{ 654{
654 QCopEnvelope e("QPE/Application/ompi", "newMail()"); 655 QCopEnvelope e("QPE/Application/ompi", "newMail()");
655} 656}
656void SimpleAlarmDaemonImpl::showAdd() 657void SimpleAlarmDaemonImpl::showAdd()
657{ 658{
658 QCopEnvelope e("QPE/Application/kapi", "raise()"); 659 QCopEnvelope e("QPE/Application/kapi", "raise()");
659} 660}
660void SimpleAlarmDaemonImpl::ringSync() 661void SimpleAlarmDaemonImpl::ringSync()
661{ 662{
662 QCopEnvelope e("QPE/Application/kopi", "-ringSync"); 663 QCopEnvelope e("QPE/Application/kopi", "-ringSync");
663 664
664} 665}
665void SimpleAlarmDaemonImpl::newCountdown() 666void SimpleAlarmDaemonImpl::newCountdown()
666{ 667{
667 //recieve("cal_alarm", 10 ); 668 //recieve("cal_alarm", 10 );
668} 669}
669void SimpleAlarmDaemonImpl::simulate() 670void SimpleAlarmDaemonImpl::simulate()
670{ 671{
671 QTimer::singleShot( 5000, this, SLOT ( writeFile() ) ); 672 QTimer::singleShot( 5000, this, SLOT ( writeFile() ) );
672 QString filename = getenv("QPEDIR") ; 673 QString filename = getenv("QPEDIR") ;
673 filename += "/pics/kdepim/korganizer/koalarm.wav"; 674 filename += "/pics/kdepim/korganizer/koalarm.wav";
674 startAlarm("Alarm simulation", filename ); 675 startAlarm("Alarm simulation", filename );
675} 676}
676void SimpleAlarmDaemonImpl::showKO() 677void SimpleAlarmDaemonImpl::showKO()
677{ 678{