summaryrefslogtreecommitdiff
path: root/core/pim/datebook/dateentryimpl.cpp
Unidiff
Diffstat (limited to 'core/pim/datebook/dateentryimpl.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/datebook/dateentryimpl.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/core/pim/datebook/dateentryimpl.cpp b/core/pim/datebook/dateentryimpl.cpp
index 1122f79..b2e3e3a 100644
--- a/core/pim/datebook/dateentryimpl.cpp
+++ b/core/pim/datebook/dateentryimpl.cpp
@@ -1,108 +1,111 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#include "dateentryimpl.h" 21#include "dateentryimpl.h"
22#include "repeatentry.h" 22#include "repeatentry.h"
23 23
24#include <qpe/qpeapplication.h> 24#include <qpe/qpeapplication.h>
25#include <qpe/categoryselect.h> 25#include <qpe/categoryselect.h>
26#include <qpe/datebookmonth.h> 26#include <qpe/datebookmonth.h>
27#include <qpe/global.h> 27#include <qpe/global.h>
28#include <qpe/timeconversion.h> 28#include <qpe/timeconversion.h>
29#include <qpe/timestring.h> 29#include <qpe/timestring.h>
30#include <qpe/tzselect.h> 30#include <qpe/tzselect.h>
31 31
32#include <qcheckbox.h> 32#include <qcheckbox.h>
33#include <qcombobox.h> 33#include <qcombobox.h>
34#include <qlayout.h> 34#include <qlayout.h>
35#include <qlineedit.h> 35#include <qlineedit.h>
36#include <qmultilineedit.h> 36#include <qmultilineedit.h>
37#include <qpopupmenu.h> 37#include <qpopupmenu.h>
38#include <qscrollview.h> 38#include <qscrollview.h>
39#include <qspinbox.h> 39#include <qspinbox.h>
40#include <qtoolbutton.h> 40#include <qtoolbutton.h>
41 41
42#include <stdlib.h> 42#include <stdlib.h>
43 43
44#include <stdiostream.h>
45
44/* 46/*
45 * Constructs a DateEntry which is a child of 'parent', with the 47 * Constructs a DateEntry which is a child of 'parent', with the
46 * name 'name' and widget flags set to 'f' 48 * name 'name' and widget flags set to 'f'
47 * 49 *
48 * The dialog will by default be modeless, unless you set 'modal' to 50 * The dialog will by default be modeless, unless you set 'modal' to
49 * TRUE to construct a modal dialog. 51 * TRUE to construct a modal dialog.
50 */ 52 */
51 53
52DateEntry::DateEntry( bool startOnMonday, const QDateTime &start, 54DateEntry::DateEntry( bool startOnMonday, const QDateTime &start,
53 const QDateTime &end, bool whichClock, QWidget* parent, 55 const QDateTime &end, bool whichClock, QWidget* parent,
54 const char* name ) 56 const char* name )
55 : DateEntryBase( parent, name ), 57 : DateEntryBase( parent, name ),
56 ampm( whichClock ), 58 ampm( whichClock ),
57 startWeekOnMonday( startOnMonday ) 59 startWeekOnMonday( startOnMonday )
58{ 60{
59 init(); 61 init();
60 setDates(start,end); 62 setDates(start,end);
63 setFocusProxy(comboDescription);
61} 64}
62 65
63static void addOrPick( QComboBox* combo, const QString& t ) 66static void addOrPick( QComboBox* combo, const QString& t )
64{ 67{
65 for (int i=0; i<combo->count(); i++) { 68 for (int i=0; i<combo->count(); i++) {
66 if ( combo->text(i) == t ) { 69 if ( combo->text(i) == t ) {
67 combo->setCurrentItem(i); 70 combo->setCurrentItem(i);
68 return; 71 return;
69 } 72 }
70 } 73 }
71 combo->setEditText(t); 74 combo->setEditText(t);
72} 75}
73 76
74DateEntry::DateEntry( bool startOnMonday, const Event &event, bool whichClock, 77DateEntry::DateEntry( bool startOnMonday, const Event &event, bool whichClock,
75 QWidget* parent, const char* name ) 78 QWidget* parent, const char* name )
76 : DateEntryBase( parent, name ), 79 : DateEntryBase( parent, name ),
77 ampm( whichClock ), 80 ampm( whichClock ),
78 startWeekOnMonday( startOnMonday ) 81 startWeekOnMonday( startOnMonday )
79{ 82{
80 init(); 83 init();
81 setDates(event.start(),event.end()); 84 setDates(event.start(),event.end());
82 comboCategory->setCategories( event.categories(), "Calendar", tr("Calendar") ); 85 comboCategory->setCategories( event.categories(), "Calendar", tr("Calendar") );
83 if(!event.description().isEmpty()) 86 if(!event.description().isEmpty())
84 addOrPick( comboDescription, event.description() ); 87 addOrPick( comboDescription, event.description() );
85 if(!event.location().isEmpty()) 88 if(!event.location().isEmpty())
86 addOrPick( comboLocation, event.location() ); 89 addOrPick( comboLocation, event.location() );
87 checkAlarm->setChecked( event.hasAlarm() ); 90 checkAlarm->setChecked( event.hasAlarm() );
88 checkAllDay->setChecked( event.type() == Event::AllDay ); 91 checkAllDay->setChecked( event.type() == Event::AllDay );
89 if(!event.notes().isEmpty()) 92 if(!event.notes().isEmpty())
90 editNote->setText(event.notes()); 93 editNote->setText(event.notes());
91 spinAlarm->setValue(event.alarmTime()); 94 spinAlarm->setValue(event.alarmTime());
92 if ( event.alarmSound() != Event::Silent ) 95 if ( event.alarmSound() != Event::Silent )
93 comboSound->setCurrentItem( 1 ); 96 comboSound->setCurrentItem( 1 );
94 if ( event.hasRepeat() ) { 97 if ( event.hasRepeat() ) {
95 rp = event.repeatPattern(); 98 rp = event.repeatPattern();
96 cmdRepeat->setText( tr("Repeat...") ); 99 cmdRepeat->setText( tr("Repeat...") );
97 } 100 }
98 setRepeatLabel(); 101 setRepeatLabel();
99} 102}
100 103
101void DateEntry::setDates( const QDateTime& s, const QDateTime& e ) 104void DateEntry::setDates( const QDateTime& s, const QDateTime& e )
102{ 105{
103 int shour, 106 int shour,
104 ehour; 107 ehour;
105 QString strStart, 108 QString strStart,
106 strEnd; 109 strEnd;
107 startDate = s.date(); 110 startDate = s.date();
108 endDate = e.date(); 111 endDate = e.date();
@@ -131,190 +134,192 @@ void DateEntry::setDates( const QDateTime& s, const QDateTime& e )
131 if ( ehour == 0 ) 134 if ( ehour == 0 )
132 ehour = 12; 135 ehour = 12;
133 strEnd.sprintf( "%d:%02d AM", ehour, e.time().minute() ); 136 strEnd.sprintf( "%d:%02d AM", ehour, e.time().minute() );
134 } 137 }
135 } else { 138 } else {
136 strStart.sprintf( "%02d:%02d", s.time().hour(), s.time().minute() ); 139 strStart.sprintf( "%02d:%02d", s.time().hour(), s.time().minute() );
137 strEnd.sprintf( "%02d:%02d", e.time().hour(), e.time().minute() ); 140 strEnd.sprintf( "%02d:%02d", e.time().hour(), e.time().minute() );
138 } 141 }
139 addOrPick(comboStart, strStart ); 142 addOrPick(comboStart, strStart );
140 endDateChanged( e.date().year(), e.date().month(), e.date().day() ); 143 endDateChanged( e.date().year(), e.date().month(), e.date().day() );
141 addOrPick(comboEnd, strEnd ); 144 addOrPick(comboEnd, strEnd );
142} 145}
143 146
144void DateEntry::init() 147void DateEntry::init()
145{ 148{
146 comboDescription->setInsertionPolicy(QComboBox::AtCurrent); 149 comboDescription->setInsertionPolicy(QComboBox::AtCurrent);
147 comboLocation->setInsertionPolicy(QComboBox::AtCurrent); 150 comboLocation->setInsertionPolicy(QComboBox::AtCurrent);
148 151
149 initCombos(); 152 initCombos();
150 QPopupMenu *m1 = new QPopupMenu( this ); 153 QPopupMenu *m1 = new QPopupMenu( this );
151 startPicker = new DateBookMonth( m1, 0, TRUE ); 154 startPicker = new DateBookMonth( m1, 0, TRUE );
152 m1->insertItem( startPicker ); 155 m1->insertItem( startPicker );
153 buttonStart->setPopup( m1 ); 156 buttonStart->setPopup( m1 );
154 connect( startPicker, SIGNAL( dateClicked( int, int, int ) ), 157 connect( startPicker, SIGNAL( dateClicked( int, int, int ) ),
155 this, SLOT( startDateChanged( int, int, int ) ) ); 158 this, SLOT( startDateChanged( int, int, int ) ) );
156 159
157 //Let start button change both start and end dates 160 //Let start button change both start and end dates
158 connect( startPicker, SIGNAL( dateClicked( int, int, int ) ), 161 connect( startPicker, SIGNAL( dateClicked( int, int, int ) ),
159 this, SLOT( endDateChanged( int, int, int ) ) ); 162 this, SLOT( endDateChanged( int, int, int ) ) );
160 connect( qApp, SIGNAL( clockChanged( bool ) ), 163 connect( qApp, SIGNAL( clockChanged( bool ) ),
161 this, SLOT( slotChangeClock( bool ) ) ); 164 this, SLOT( slotChangeClock( bool ) ) );
162 connect( qApp, SIGNAL(weekChanged(bool)), 165 connect( qApp, SIGNAL(weekChanged(bool)),
163 this, SLOT(slotChangeStartOfWeek(bool)) ); 166 this, SLOT(slotChangeStartOfWeek(bool)) );
164 167
165 QPopupMenu *m2 = new QPopupMenu( this ); 168 QPopupMenu *m2 = new QPopupMenu( this );
166 endPicker = new DateBookMonth( m2, 0, TRUE ); 169 endPicker = new DateBookMonth( m2, 0, TRUE );
167 m2->insertItem( endPicker ); 170 m2->insertItem( endPicker );
168 buttonEnd->setPopup( m2 ); 171 buttonEnd->setPopup( m2 );
169 connect( endPicker, SIGNAL( dateClicked( int, int, int ) ), 172 connect( endPicker, SIGNAL( dateClicked( int, int, int ) ),
170 this, SLOT( endDateChanged( int, int, int ) ) ); 173 this, SLOT( endDateChanged( int, int, int ) ) );
171} 174}
172 175
173/* 176/*
174 * Destroys the object and frees any allocated resources 177 * Destroys the object and frees any allocated resources
175 */ 178 */
176DateEntry::~DateEntry() 179DateEntry::~DateEntry()
177{ 180{
178 // no need to delete child widgets, Qt does it all for us 181 // no need to delete child widgets, Qt does it all for us
182 //cout << "Del: " << comboStart->currentText() << endl;
179} 183}
180 184
181/* 185/*
182 * public slot 186 * public slot
183 */ 187 */
184void DateEntry::endDateChanged( int y, int m, int d ) 188void DateEntry::endDateChanged( int y, int m, int d )
185{ 189{
186 endDate.setYMD( y, m, d ); 190 endDate.setYMD( y, m, d );
187 if ( endDate < startDate ) { 191 if ( endDate < startDate ) {
188 endDate = startDate; 192 endDate = startDate;
189 } 193 }
190 194
191 buttonEnd->setText( TimeString::shortDate( endDate ) ); 195 buttonEnd->setText( TimeString::shortDate( endDate ) );
192 196
193 endPicker->setDate( endDate.year(), endDate.month(), endDate.day() ); 197 endPicker->setDate( endDate.year(), endDate.month(), endDate.day() );
194} 198}
195 199
196static QTime parseTime( const QString& s, bool ampm ) 200static QTime parseTime( const QString& s, bool ampm )
197{ 201{
198 QTime tmpTime; 202 QTime tmpTime;
199 QStringList l = QStringList::split( ':', s ); 203 QStringList l = QStringList::split( ':', s );
200 int hour = l[0].toInt(); 204 int hour = l[0].toInt();
201 if ( ampm ) { 205 if ( ampm ) {
202 int i=0; 206 int i=0;
203 while (i<int(l[1].length()) && l[1][i]>='0' && l[1][i]<='9') 207 while (i<int(l[1].length()) && l[1][i]>='0' && l[1][i]<='9')
204 i++; 208 i++;
205 QString digits = l[1].left(i); 209 QString digits = l[1].left(i);
206 if ( l[1].contains( "PM", FALSE ) ) { 210 if ( l[1].contains( "PM", FALSE ) ) {
207 if ( hour != 12 ) 211 if ( hour != 12 )
208 hour += 12; 212 hour += 12;
209 } else { 213 } else {
210 if ( hour == 12 ) 214 if ( hour == 12 )
211 hour = 0; 215 hour = 0;
212 } 216 }
213 l[1] = digits; 217 l[1] = digits;
214 } 218 }
215 int minute = l[1].toInt(); 219 int minute = l[1].toInt();
216 if ( minute > 59 ) 220 if ( minute > 59 )
217 minute = 59; 221 minute = 59;
218 else if ( minute < 0 ) 222 else if ( minute < 0 )
219 minute = 0; 223 minute = 0;
220 if ( hour > 23 ) { 224 if ( hour > 23 ) {
221 hour = 23; 225 hour = 23;
222 minute = 59; 226 minute = 59;
223 } else if ( hour < 0 ) 227 } else if ( hour < 0 )
224 hour = 0; 228 hour = 0;
225 tmpTime.setHMS( hour, minute, 0 ); 229 tmpTime.setHMS( hour, minute, 0 );
226 return tmpTime; 230 return tmpTime;
227} 231}
228 232
229/* 233/*
230 * public slot 234 * public slot
231 */ 235 */
232void DateEntry::endTimeChanged( const QString &s ) 236void DateEntry::endTimeChanged( const QString &s )
233{ 237{
234 QTime tmpTime = parseTime(s,ampm); 238 QTime tmpTime = parseTime(s,ampm);
235 if ( endDate > startDate || tmpTime >= startTime ) { 239 if ( endDate > startDate || tmpTime >= startTime ) {
236 endTime = tmpTime; 240 endTime = tmpTime;
237 } else { 241 } else {
238 endTime = startTime; 242 endTime = startTime;
239 comboEnd->setCurrentItem( comboStart->currentItem() ); 243 comboEnd->setCurrentItem( comboStart->currentItem() );
240 } 244 }
241} 245}
242 246
243/* 247/*
244 * public slot 248 * public slot
245 */ 249 */
246void DateEntry::startDateChanged( int y, int m, int d ) 250void DateEntry::startDateChanged( int y, int m, int d )
247{ 251{
248 QDate prev = startDate; 252 QDate prev = startDate;
249 startDate.setYMD( y, m, d ); 253 startDate.setYMD( y, m, d );
250 if ( rp.type == Event::Weekly && 254 if ( rp.type == Event::Weekly &&
251 startDate.dayOfWeek() != prev.dayOfWeek() ) { 255 startDate.dayOfWeek() != prev.dayOfWeek() ) {
252 // if we change the start of a weekly repeating event 256 // if we change the start of a weekly repeating event
253 // set the repeating day appropriately 257 // set the repeating day appropriately
254 char mask = 1 << (prev.dayOfWeek()-1); 258 char mask = 1 << (prev.dayOfWeek()-1);
255 rp.days &= (~mask); 259 rp.days &= (~mask);
256 rp.days |= 1 << (startDate.dayOfWeek()-1); 260 rp.days |= 1 << (startDate.dayOfWeek()-1);
257 } 261 }
258 262
259 buttonStart->setText( TimeString::shortDate( startDate ) ); 263 buttonStart->setText( TimeString::shortDate( startDate ) );
260 264
261 // our pickers must be reset... 265 // our pickers must be reset...
262 startPicker->setDate( y, m, d ); 266 startPicker->setDate( y, m, d );
263 endPicker->setDate( y, m, d ); 267 endPicker->setDate( y, m, d );
264} 268}
265 269
266/* 270/*
267 * public slot 271 * public slot
268 */ 272 */
269void DateEntry::startTimeChanged( int index ) 273void DateEntry::startTimeChanged( int index )
270{ 274{
271 startTime = parseTime(comboStart->text(index),ampm); 275 startTime = parseTime(comboStart->text(index),ampm);
272 changeEndCombo( index ); 276 changeEndCombo( index );
277 //cout << "Start: " << comboStart->currentText() << endl;
273} 278}
274/* 279/*
275 * public slot 280 * public slot
276 */ 281 */
277void DateEntry::typeChanged( const QString &s ) 282void DateEntry::typeChanged( const QString &s )
278{ 283{
279 bool b = s != "All Day"; 284 bool b = s != "All Day";
280 buttonStart->setEnabled( b ); 285 buttonStart->setEnabled( b );
281 comboStart->setEnabled( b ); 286 comboStart->setEnabled( b );
282 comboEnd->setEnabled( b ); 287 comboEnd->setEnabled( b );
283} 288}
284/* 289/*
285 * public slot 290 * public slot
286 */ 291 */
287void DateEntry::changeEndCombo( int change ) 292void DateEntry::changeEndCombo( int change )
288{ 293{
289 if ( change + 2 < comboEnd->count() ) 294 if ( change + 2 < comboEnd->count() )
290 change += 2; 295 change += 2;
291 comboEnd->setCurrentItem( change ); 296 comboEnd->setCurrentItem( change );
292 endTimeChanged( comboEnd->currentText() ); 297 endTimeChanged( comboEnd->currentText() );
293} 298}
294 299
295void DateEntry::slotRepeat() 300void DateEntry::slotRepeat()
296{ 301{
297 // Work around for compiler Bug.. 302 // Work around for compiler Bug..
298 RepeatEntry *e; 303 RepeatEntry *e;
299 304
300 // it is better in my opinion to just grab this from the mother, 305 // it is better in my opinion to just grab this from the mother,
301 // since, this dialog doesn't need to keep track of it... 306 // since, this dialog doesn't need to keep track of it...
302 if ( rp.type != Event::NoRepeat ) 307 if ( rp.type != Event::NoRepeat )
303 e = new RepeatEntry( startWeekOnMonday, rp, startDate, this); 308 e = new RepeatEntry( startWeekOnMonday, rp, startDate, this);
304 else 309 else
305 e = new RepeatEntry( startWeekOnMonday, startDate, this ); 310 e = new RepeatEntry( startWeekOnMonday, startDate, this );
306 311
307#if defined(Q_WS_QWS) || defined(_WS_QWS_) 312#if defined(Q_WS_QWS) || defined(_WS_QWS_)
308 e->showMaximized(); 313 e->showMaximized();
309#endif 314#endif
310 if ( e->exec() ) { 315 if ( e->exec() ) {
311 rp = e->repeatPattern(); 316 rp = e->repeatPattern();
312 setRepeatLabel(); 317 setRepeatLabel();
313 } 318 }
314} 319}
315 320
316void DateEntry::slotChangeStartOfWeek( bool onMonday ) 321void DateEntry::slotChangeStartOfWeek( bool onMonday )
317{ 322{
318 startWeekOnMonday = onMonday; 323 startWeekOnMonday = onMonday;
319} 324}
320 325
@@ -337,96 +342,99 @@ Event DateEntry::event()
337 QTime tmp = endTime; 342 QTime tmp = endTime;
338 endTime = startTime; 343 endTime = startTime;
339 startTime = tmp; 344 startTime = tmp;
340 } 345 }
341 // don't set the time if theres no need too 346 // don't set the time if theres no need too
342 if ( ev.type() == Event::AllDay ) { 347 if ( ev.type() == Event::AllDay ) {
343 startTime.setHMS( 0, 0, 0 ); 348 startTime.setHMS( 0, 0, 0 );
344 endTime.setHMS( 23, 59, 59 ); 349 endTime.setHMS( 23, 59, 59 );
345 } 350 }
346 351
347 // adjust start and end times based on timezone 352 // adjust start and end times based on timezone
348 QDateTime start( startDate, startTime ); 353 QDateTime start( startDate, startTime );
349 QDateTime end( endDate, endTime ); 354 QDateTime end( endDate, endTime );
350 time_t start_utc, end_utc; 355 time_t start_utc, end_utc;
351 356
352// qDebug( "tz: %s", timezone->currentZone().latin1() ); 357// qDebug( "tz: %s", timezone->currentZone().latin1() );
353 358
354 // get real timezone 359 // get real timezone
355 QString realTZ; 360 QString realTZ;
356 realTZ = QString::fromLocal8Bit( getenv("TZ") ); 361 realTZ = QString::fromLocal8Bit( getenv("TZ") );
357 362
358 // set timezone 363 // set timezone
359 if ( setenv( "TZ", timezone->currentZone(), true ) != 0 ) 364 if ( setenv( "TZ", timezone->currentZone(), true ) != 0 )
360 qWarning( "There was a problem setting the timezone." ); 365 qWarning( "There was a problem setting the timezone." );
361 366
362 // convert to UTC based on selected TZ (calling tzset internally) 367 // convert to UTC based on selected TZ (calling tzset internally)
363 start_utc = TimeConversion::toUTC( start ); 368 start_utc = TimeConversion::toUTC( start );
364 end_utc = TimeConversion::toUTC( end ); 369 end_utc = TimeConversion::toUTC( end );
365 370
366 // done playing around... put it all back 371 // done playing around... put it all back
367 unsetenv( "TZ" ); 372 unsetenv( "TZ" );
368 if ( !realTZ.isNull() ) 373 if ( !realTZ.isNull() )
369 if ( setenv( "TZ", realTZ, true ) != 0 ) 374 if ( setenv( "TZ", realTZ, true ) != 0 )
370 qWarning( "There was a problem setting the timezone." ); 375 qWarning( "There was a problem setting the timezone." );
371 376
372 // convert UTC to local time (calling tzset internally) 377 // convert UTC to local time (calling tzset internally)
373 ev.setStart( TimeConversion::fromUTC( start_utc ) ); 378 ev.setStart( TimeConversion::fromUTC( start_utc ) );
374 ev.setEnd( TimeConversion::fromUTC( end_utc ) ); 379 ev.setEnd( TimeConversion::fromUTC( end_utc ) );
375 380
376 // we only have one type of sound at the moment... LOUD!!! 381 // we only have one type of sound at the moment... LOUD!!!
377 if ( comboSound->currentItem() != 0 ) 382 if ( comboSound->currentItem() != 0 )
378 st = Event::Loud; 383 st = Event::Loud;
379 else 384 else
380 st = Event::Silent; 385 st = Event::Silent;
381 ev.setAlarm( checkAlarm->isChecked(), spinAlarm->value(), st ); 386 ev.setAlarm( checkAlarm->isChecked(), spinAlarm->value(), st );
382 if ( rp.type != Event::NoRepeat ) 387 if ( rp.type != Event::NoRepeat )
383 ev.setRepeat( TRUE, rp ); 388 ev.setRepeat( TRUE, rp );
384 ev.setNotes( editNote->text() ); 389 ev.setNotes( editNote->text() );
390
391 //cout << "Start: " << comboStart->currentText() << endl;
392
385 return ev; 393 return ev;
386} 394}
387 395
388void DateEntry::setRepeatLabel() 396void DateEntry::setRepeatLabel()
389{ 397{
390 398
391 switch( rp.type ) { 399 switch( rp.type ) {
392 case Event::Daily: 400 case Event::Daily:
393 cmdRepeat->setText( tr("Daily...") ); 401 cmdRepeat->setText( tr("Daily...") );
394 break; 402 break;
395 case Event::Weekly: 403 case Event::Weekly:
396 cmdRepeat->setText( tr("Weekly...") ); 404 cmdRepeat->setText( tr("Weekly...") );
397 break; 405 break;
398 case Event::MonthlyDay: 406 case Event::MonthlyDay:
399 case Event::MonthlyDate: 407 case Event::MonthlyDate:
400 cmdRepeat->setText( tr("Monthly...") ); 408 cmdRepeat->setText( tr("Monthly...") );
401 break; 409 break;
402 case Event::Yearly: 410 case Event::Yearly:
403 cmdRepeat->setText( tr("Yearly...") ); 411 cmdRepeat->setText( tr("Yearly...") );
404 break; 412 break;
405 default: 413 default:
406 cmdRepeat->setText( tr("No Repeat...") ); 414 cmdRepeat->setText( tr("No Repeat...") );
407 } 415 }
408} 416}
409 417
410void DateEntry::setAlarmEnabled( bool alarmPreset, int presetTime, Event::SoundTypeChoice sound ) 418void DateEntry::setAlarmEnabled( bool alarmPreset, int presetTime, Event::SoundTypeChoice sound )
411{ 419{
412 checkAlarm->setChecked( alarmPreset ); 420 checkAlarm->setChecked( alarmPreset );
413 spinAlarm->setValue( presetTime ); 421 spinAlarm->setValue( presetTime );
414 if ( sound != Event::Silent ) 422 if ( sound != Event::Silent )
415 comboSound->setCurrentItem( 1 ); 423 comboSound->setCurrentItem( 1 );
416 else 424 else
417 comboSound->setCurrentItem( 0 ); 425 comboSound->setCurrentItem( 0 );
418} 426}
419 427
420void DateEntry::initCombos() 428void DateEntry::initCombos()
421{ 429{
422 comboStart->clear(); 430 comboStart->clear();
423 comboEnd->clear(); 431 comboEnd->clear();
424 if ( ampm ) { 432 if ( ampm ) {
425 for ( int i = 0; i < 24; i++ ) { 433 for ( int i = 0; i < 24; i++ ) {
426 if ( i == 0 ) { 434 if ( i == 0 ) {
427 comboStart->insertItem( "12:00 AM" ); 435 comboStart->insertItem( "12:00 AM" );
428 comboStart->insertItem( "12:30 AM" ); 436 comboStart->insertItem( "12:30 AM" );
429 comboEnd->insertItem( "12:00 AM" ); 437 comboEnd->insertItem( "12:00 AM" );
430 comboEnd->insertItem( "12:30 AM" ); 438 comboEnd->insertItem( "12:30 AM" );
431 } else if ( i == 12 ) { 439 } else if ( i == 12 ) {
432 comboStart->insertItem( "12:00 PM" ); 440 comboStart->insertItem( "12:00 PM" );