summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/tools/clock/clock.cpp8
-rw-r--r--noncore/tools/clock/setAlarm.cpp1
2 files changed, 5 insertions, 4 deletions
diff --git a/noncore/tools/clock/clock.cpp b/noncore/tools/clock/clock.cpp
index 6f570c5..097ea90 100644
--- a/noncore/tools/clock/clock.cpp
+++ b/noncore/tools/clock/clock.cpp
@@ -130,69 +130,69 @@ Clock::Clock( QWidget * parent, const char * name, WFlags f )
130 alarmBtn->setMaximumSize(60,30); 130 alarmBtn->setMaximumSize(60,30);
131 gl->addWidget( alarmBtn, 1, 2 ); 131 gl->addWidget( alarmBtn, 1, 2 );
132 alarmBtn->setText( tr( "Set Alarm" ) ); 132 alarmBtn->setText( tr( "Set Alarm" ) );
133 133
134 connect( set, SIGNAL( pressed() ), SLOT( slotSet() ) ); 134 connect( set, SIGNAL( pressed() ), SLOT( slotSet() ) );
135 connect( reset, SIGNAL( clicked() ), SLOT( slotReset() ) ); 135 connect( reset, SIGNAL( clicked() ), SLOT( slotReset() ) );
136 136
137 connect( alarmBtn, SIGNAL( clicked() ), SLOT( slotSetAlarm() ) ); 137 connect( alarmBtn, SIGNAL( clicked() ), SLOT( slotSetAlarm() ) );
138 connect( snoozeBtn, SIGNAL( clicked() ), SLOT( slotSnooze() ) ); 138 connect( snoozeBtn, SIGNAL( clicked() ), SLOT( slotSnooze() ) );
139 connect( alarmOffBtn, SIGNAL( clicked() ), SLOT( slotToggleAlarm() ) ); 139 connect( alarmOffBtn, SIGNAL( clicked() ), SLOT( slotToggleAlarm() ) );
140 140
141 connect( qApp, SIGNAL(appMessage(const QCString&, const QByteArray&)), 141 connect( qApp, SIGNAL(appMessage(const QCString&, const QByteArray&)),
142 this, SLOT(appMessage(const QCString&, const QByteArray&)) ); 142 this, SLOT(appMessage(const QCString&, const QByteArray&)) );
143 143
144 t = new QTimer( this ); 144 t = new QTimer( this );
145 connect( t, SIGNAL( timeout() ), SLOT( updateClock() ) ); 145 connect( t, SIGNAL( timeout() ), SLOT( updateClock() ) );
146 t->start( 1000 ); 146 t->start( 1000 );
147 147
148 connect( qApp, SIGNAL( timeChanged() ), SLOT( updateClock() ) ); 148 connect( qApp, SIGNAL( timeChanged() ), SLOT( updateClock() ) );
149 149
150 swatch_running = FALSE; 150 swatch_running = FALSE;
151 swatch_totalms = 0; 151 swatch_totalms = 0;
152 152
153 connect( qApp, SIGNAL(clockChanged(bool)), this, SLOT(changeClock(bool)) ); 153 connect( qApp, SIGNAL(clockChanged(bool)), this, SLOT(changeClock(bool)) );
154 154
155 QString tmp = config.readEntry("clockAlarmHour", ""); 155 QString tmp = config.readEntry("clockAlarmHour", "");
156 bool ok; 156 bool ok;
157 hour = tmp.toInt(&ok,10); 157 hour = tmp.toInt(&ok,10);
158 tmp = config.readEntry("clockAlarmMinute",""); 158 tmp = config.readEntry("clockAlarmMinute","");
159 minute = tmp.toInt(&ok,10); 159 minute = tmp.toInt(&ok,10);
160 160
161 if( config.readEntry("clockAlarmSet","FALSE") == "TRUE") { 161 if( config.readEntry("clockAlarmSet","FALSE") == "TRUE") {
162 alarmOffBtn->setText( tr( "Alarm On" ) ); 162 alarmOffBtn->setText( tr( "Alarm Is On" ) );
163 alarmBool=TRUE; 163 alarmBool=TRUE;
164 snoozeBtn->show(); 164 snoozeBtn->show();
165 } else { 165 } else {
166 alarmOffBtn->setText( tr( "Alarm Off" ) ); 166 alarmOffBtn->setText( tr( "Alarm Is Off" ) );
167 alarmBool=FALSE; 167 alarmBool=FALSE;
168 snoozeBtn->hide(); 168 snoozeBtn->hide();
169 } 169 }
170 170
171 QTimer::singleShot( 0, this, SLOT(updateClock()) ); 171 QTimer::singleShot( 0, this, SLOT(updateClock()) );
172 modeSelect(0); 172 modeSelect(0);
173} 173}
174 174
175Clock::~Clock() 175Clock::~Clock()
176{ 176{
177 toggleScreenSaver( true ); 177 toggleScreenSaver( true );
178} 178}
179 179
180void Clock::updateClock() 180void Clock::updateClock()
181{ 181{
182 if ( clockRB->isChecked() ) { 182 if ( clockRB->isChecked() ) {
183 QTime tm = QDateTime::currentDateTime().time(); 183 QTime tm = QDateTime::currentDateTime().time();
184 QString s; 184 QString s;
185 if ( ampm ) { 185 if ( ampm ) {
186 int hour = tm.hour(); 186 int hour = tm.hour();
187 if (hour == 0) 187 if (hour == 0)
188 hour = 12; 188 hour = 12;
189 if (hour > 12) 189 if (hour > 12)
190 hour -= 12; 190 hour -= 12;
191 s.sprintf( "%2d%c%02d", hour, ':', tm.minute() ); 191 s.sprintf( "%2d%c%02d", hour, ':', tm.minute() );
192 ampmLabel->setText( (tm.hour() >= 12) ? "PM" : "AM" ); 192 ampmLabel->setText( (tm.hour() >= 12) ? "PM" : "AM" );
193 ampmLabel->show(); 193 ampmLabel->show();
194 } else { 194 } else {
195 s.sprintf( "%2d%c%02d", tm.hour(), ':', tm.minute() ); 195 s.sprintf( "%2d%c%02d", tm.hour(), ':', tm.minute() );
196 ampmLabel->hide(); 196 ampmLabel->hide();
197 } 197 }
198 lcd->display( s ); 198 lcd->display( s );
@@ -297,71 +297,71 @@ void Clock::slotSetAlarm()
297 snoozeTime=setAlarmDlg->SnoozeSlider->value(); 297 snoozeTime=setAlarmDlg->SnoozeSlider->value();
298 if(ampm) { 298 if(ampm) {
299 if(setAlarmDlg->Pm_RadioButton->isChecked() && hour < 12 ) 299 if(setAlarmDlg->Pm_RadioButton->isChecked() && hour < 12 )
300 hour+=12; 300 hour+=12;
301 } 301 }
302 config.writeEntry("clockAlarmHour", tmp.setNum( hour ),10); 302 config.writeEntry("clockAlarmHour", tmp.setNum( hour ),10);
303 config.writeEntry("clockAlarmMinute",tmp.setNum( minute ),10); 303 config.writeEntry("clockAlarmMinute",tmp.setNum( minute ),10);
304 config.writeEntry("clockAlarmSnooze",tmp.setNum( snoozeTime ),10); 304 config.writeEntry("clockAlarmSnooze",tmp.setNum( snoozeTime ),10);
305 config.write(); 305 config.write();
306 } 306 }
307} 307}
308 308
309void Clock::slotSnooze() 309void Clock::slotSnooze()
310{ 310{
311 bSound=FALSE; 311 bSound=FALSE;
312 int warn; 312 int warn;
313 QTime t = QTime::currentTime(); 313 QTime t = QTime::currentTime();
314 QDateTime whenl( when.date(), t.addSecs( snoozeTime*60)); 314 QDateTime whenl( when.date(), t.addSecs( snoozeTime*60));
315 when=whenl; 315 when=whenl;
316 AlarmServer::addAlarm( when, 316 AlarmServer::addAlarm( when,
317 "QPE/Application/clock", 317 "QPE/Application/clock",
318 "alarm(QDateTime,int)", warn ); 318 "alarm(QDateTime,int)", warn );
319 319
320} 320}
321 321
322//toggles alarm on/off 322//toggles alarm on/off
323void Clock::slotToggleAlarm() 323void Clock::slotToggleAlarm()
324{ 324{
325 Config config( "qpe" ); 325 Config config( "qpe" );
326 config.setGroup("Time"); 326 config.setGroup("Time");
327 if(alarmBool) { 327 if(alarmBool) {
328 config.writeEntry("clockAlarmSet","FALSE"); 328 config.writeEntry("clockAlarmSet","FALSE");
329 alarmOffBtn->setText( tr( "Alarm Off" ) ); 329 alarmOffBtn->setText( tr( "Alarm Is Off" ) );
330 snoozeBtn->hide(); 330 snoozeBtn->hide();
331 alarmBool=FALSE; 331 alarmBool=FALSE;
332 alarmOff(); 332 alarmOff();
333 } else { 333 } else {
334 config.writeEntry("clockAlarmSet","TRUE"); 334 config.writeEntry("clockAlarmSet","TRUE");
335 alarmOffBtn->setText( tr( "Alarm On" ) ); 335 alarmOffBtn->setText( tr( "Alarm Is On" ) );
336 snoozeBtn->show(); 336 snoozeBtn->show();
337 alarmBool=TRUE; 337 alarmBool=TRUE;
338 alarmOn(); 338 alarmOn();
339 } 339 }
340 config.write(); 340 config.write();
341} 341}
342 342
343void Clock::alarmOn() 343void Clock::alarmOn()
344{ 344{
345 QDate d = QDate::currentDate(); 345 QDate d = QDate::currentDate();
346 QTime tm((int)hour,(int)minute,0); 346 QTime tm((int)hour,(int)minute,0);
347 qDebug("Time set "+tm.toString()); 347 qDebug("Time set "+tm.toString());
348 QTime t = QTime::currentTime(); 348 QTime t = QTime::currentTime();
349 if( t > tm) 349 if( t > tm)
350 d = d.addDays(1); 350 d = d.addDays(1);
351 int warn; 351 int warn;
352 QDateTime whenl(d,tm); 352 QDateTime whenl(d,tm);
353 when=whenl; 353 when=whenl;
354 AlarmServer::addAlarm( when, 354 AlarmServer::addAlarm( when,
355 "QPE/Application/clock", 355 "QPE/Application/clock",
356 "alarm(QDateTime,int)", warn ); 356 "alarm(QDateTime,int)", warn );
357 QMessageBox::message("Note","Alarm is set for:\n"+ whenl.toString()); 357 QMessageBox::message("Note","Alarm is set for:\n"+ whenl.toString());
358} 358}
359 359
360void Clock::alarmOff() 360void Clock::alarmOff()
361{ 361{
362 int warn; 362 int warn;
363 bSound=FALSE; 363 bSound=FALSE;
364 AlarmServer::deleteAlarm( when, 364 AlarmServer::deleteAlarm( when,
365 "QPE/Application/clock", 365 "QPE/Application/clock",
366 "alarm(QDateTime,int)", warn ); 366 "alarm(QDateTime,int)", warn );
367 qDebug("Alarm Off "+ when.toString()); 367 qDebug("Alarm Off "+ when.toString());
diff --git a/noncore/tools/clock/setAlarm.cpp b/noncore/tools/clock/setAlarm.cpp
index 01e52f6..6b95e6a 100644
--- a/noncore/tools/clock/setAlarm.cpp
+++ b/noncore/tools/clock/setAlarm.cpp
@@ -40,64 +40,65 @@ Set_Alarm::Set_Alarm( QWidget* parent, const char* name, bool modal, WFlags fl
40 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); 40 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
41 41
42 Set_AlarmLayout = new QGridLayout( this ); 42 Set_AlarmLayout = new QGridLayout( this );
43 Set_AlarmLayout->setSpacing( 6 ); 43 Set_AlarmLayout->setSpacing( 6 );
44 Set_AlarmLayout->setMargin( 11 ); 44 Set_AlarmLayout->setMargin( 11 );
45 45
46 TextLabel1 = new QLabel( this, "TextLabel1" ); 46 TextLabel1 = new QLabel( this, "TextLabel1" );
47 TextLabel1->setText( tr( "Hour" ) ); 47 TextLabel1->setText( tr( "Hour" ) );
48 48
49 Set_AlarmLayout->addWidget( TextLabel1, 0, 0 ); 49 Set_AlarmLayout->addWidget( TextLabel1, 0, 0 );
50 50
51 TextLabel2 = new QLabel( this, "TextLabel2" ); 51 TextLabel2 = new QLabel( this, "TextLabel2" );
52 TextLabel2->setText( tr( "Minute" ) ); 52 TextLabel2->setText( tr( "Minute" ) );
53 53
54 Set_AlarmLayout->addMultiCellWidget( TextLabel2, 0, 0, 1, 2 ); 54 Set_AlarmLayout->addMultiCellWidget( TextLabel2, 0, 0, 1, 2 );
55 55
56 Hour_Slider = new QSlider( this, "Hour_Slider" ); 56 Hour_Slider = new QSlider( this, "Hour_Slider" );
57 Hour_Slider->setPageStep( 1); 57 Hour_Slider->setPageStep( 1);
58 Hour_Slider->setOrientation( QSlider::Horizontal ); 58 Hour_Slider->setOrientation( QSlider::Horizontal );
59 connect(Hour_Slider, SIGNAL( valueChanged(int)),this,SLOT(slotChangeHour(int))); 59 connect(Hour_Slider, SIGNAL( valueChanged(int)),this,SLOT(slotChangeHour(int)));
60 60
61 Set_AlarmLayout->addWidget( Hour_Slider, 2, 0 ); 61 Set_AlarmLayout->addWidget( Hour_Slider, 2, 0 );
62 62
63 Hour_LCDNumber = new QLCDNumber( this, "Hour_LCDNumber" ); 63 Hour_LCDNumber = new QLCDNumber( this, "Hour_LCDNumber" );
64 Hour_LCDNumber->setFrameShape( QLCDNumber::Box ); 64 Hour_LCDNumber->setFrameShape( QLCDNumber::Box );
65 Hour_LCDNumber->setFrameShadow( QLCDNumber::Plain ); 65 Hour_LCDNumber->setFrameShadow( QLCDNumber::Plain );
66 Hour_LCDNumber->setSegmentStyle( QLCDNumber::Flat ); 66 Hour_LCDNumber->setSegmentStyle( QLCDNumber::Flat );
67 67
68 Set_AlarmLayout->addWidget( Hour_LCDNumber, 1, 0 ); 68 Set_AlarmLayout->addWidget( Hour_LCDNumber, 1, 0 );
69 69
70 Minute_Slider = new QSlider( this, "Minute_Slider" ); 70 Minute_Slider = new QSlider( this, "Minute_Slider" );
71 Minute_Slider->setMaxValue( 59); 71 Minute_Slider->setMaxValue( 59);
72 Minute_Slider->setPageStep( 1);
72 Minute_Slider->setOrientation( QSlider::Horizontal ); 73 Minute_Slider->setOrientation( QSlider::Horizontal );
73 connect(Minute_Slider, SIGNAL( valueChanged(int)),this,SLOT(slotChangeMinute(int))); 74 connect(Minute_Slider, SIGNAL( valueChanged(int)),this,SLOT(slotChangeMinute(int)));
74 75
75 Set_AlarmLayout->addMultiCellWidget( Minute_Slider, 2, 2, 1, 2 ); 76 Set_AlarmLayout->addMultiCellWidget( Minute_Slider, 2, 2, 1, 2 );
76 77
77 Minute_LCDNumber = new QLCDNumber( this, "Minute_LCDNumber" ); 78 Minute_LCDNumber = new QLCDNumber( this, "Minute_LCDNumber" );
78 Minute_LCDNumber->setFrameShape( QLCDNumber::Box ); 79 Minute_LCDNumber->setFrameShape( QLCDNumber::Box );
79 Minute_LCDNumber->setFrameShadow( QLCDNumber::Plain ); 80 Minute_LCDNumber->setFrameShadow( QLCDNumber::Plain );
80 Minute_LCDNumber->setSegmentStyle( QLCDNumber::Flat ); 81 Minute_LCDNumber->setSegmentStyle( QLCDNumber::Flat );
81 82
82 Set_AlarmLayout->addMultiCellWidget( Minute_LCDNumber, 1, 1, 1, 2 ); 83 Set_AlarmLayout->addMultiCellWidget( Minute_LCDNumber, 1, 1, 1, 2 );
83 84
84 Am_RadioButton = new QRadioButton( this, "Am_RadioButton" ); 85 Am_RadioButton = new QRadioButton( this, "Am_RadioButton" );
85 Am_RadioButton->setText( tr( "AM" ) ); 86 Am_RadioButton->setText( tr( "AM" ) );
86 Am_RadioButton->setChecked(TRUE); 87 Am_RadioButton->setChecked(TRUE);
87 connect( Am_RadioButton, SIGNAL(toggled(bool)),this,SLOT( amButtonToggled(bool))); 88 connect( Am_RadioButton, SIGNAL(toggled(bool)),this,SLOT( amButtonToggled(bool)));
88 89
89 Set_AlarmLayout->addMultiCellWidget( Am_RadioButton, 0, 1, 3, 4 ); 90 Set_AlarmLayout->addMultiCellWidget( Am_RadioButton, 0, 1, 3, 4 );
90 91
91 92
92 Pm_RadioButton = new QRadioButton( this, "Pm_RadioButton" ); 93 Pm_RadioButton = new QRadioButton( this, "Pm_RadioButton" );
93 Pm_RadioButton->setText( tr( "PM" ) ); 94 Pm_RadioButton->setText( tr( "PM" ) );
94 connect( Pm_RadioButton, SIGNAL(toggled(bool)),this,SLOT( pmButtonToggled(bool))); 95 connect( Pm_RadioButton, SIGNAL(toggled(bool)),this,SLOT( pmButtonToggled(bool)));
95 96
96 Set_AlarmLayout->addMultiCellWidget(Pm_RadioButton, 1, 2, 3, 4 ); 97 Set_AlarmLayout->addMultiCellWidget(Pm_RadioButton, 1, 2, 3, 4 );
97 98
98 TextLabel3 = new QLabel( this, "TextLabel3" ); 99 TextLabel3 = new QLabel( this, "TextLabel3" );
99 TextLabel3->setText( tr( "Snooze Delay\n(minutes)" ) ); 100 TextLabel3->setText( tr( "Snooze Delay\n(minutes)" ) );
100 101
101 Set_AlarmLayout->addMultiCellWidget( TextLabel3, 3, 3, 0, 1 ); 102 Set_AlarmLayout->addMultiCellWidget( TextLabel3, 3, 3, 0, 1 );
102 103
103 Snooze_LCDNumber = new QLCDNumber( this, "Snooze_LCDNumber" ); 104 Snooze_LCDNumber = new QLCDNumber( this, "Snooze_LCDNumber" );