author | simon <simon> | 2002-04-30 14:28:04 (UTC) |
---|---|---|
committer | simon <simon> | 2002-04-30 14:28:04 (UTC) |
commit | b7b0040f0a8069d36e3f5ad0bed0ce992dd30780 (patch) (unidiff) | |
tree | 39ac29f14f3e2e153af816b7a9f0f2d821bb075a | |
parent | 972fbb128294c821ff0f13ea59a83edb015d571e (diff) | |
download | opie-b7b0040f0a8069d36e3f5ad0bed0ce992dd30780.zip opie-b7b0040f0a8069d36e3f5ad0bed0ce992dd30780.tar.gz opie-b7b0040f0a8069d36e3f5ad0bed0ce992dd30780.tar.bz2 |
- no default args in method impls
- resolved parameter shadowing problem
-rw-r--r-- | core/pim/datebook/clickablelabel.cpp | 6 | ||||
-rw-r--r-- | core/pim/datebook/datebookday.cpp | 8 | ||||
-rw-r--r-- | core/pim/datebook/datebookweek.cpp | 2 | ||||
-rw-r--r-- | core/pim/datebook/datebookweeklst.cpp | 12 | ||||
-rw-r--r-- | core/pim/datebook/timepicker.cpp | 4 |
5 files changed, 16 insertions, 16 deletions
diff --git a/core/pim/datebook/clickablelabel.cpp b/core/pim/datebook/clickablelabel.cpp index 1dd0d15..128bebb 100644 --- a/core/pim/datebook/clickablelabel.cpp +++ b/core/pim/datebook/clickablelabel.cpp | |||
@@ -1,88 +1,88 @@ | |||
1 | #include "clickablelabel.h" | 1 | #include "clickablelabel.h" |
2 | #include <stdio.h> | 2 | #include <stdio.h> |
3 | 3 | ||
4 | ClickableLabel::ClickableLabel(QWidget* parent = 0, | 4 | ClickableLabel::ClickableLabel(QWidget* parent, |
5 | const char* name = 0, | 5 | const char* name, |
6 | WFlags fl = 0) : | 6 | WFlags fl) : |
7 | QLabel(parent,name,fl) | 7 | QLabel(parent,name,fl) |
8 | { | 8 | { |
9 | textInverted=false; | 9 | textInverted=false; |
10 | isToggle=false; | 10 | isToggle=false; |
11 | isDown=false; | 11 | isDown=false; |
12 | showState(false); | 12 | showState(false); |
13 | setFrameShadow(Sunken); | 13 | setFrameShadow(Sunken); |
14 | } | 14 | } |
15 | 15 | ||
16 | void ClickableLabel::setToggleButton(bool t) { | 16 | void ClickableLabel::setToggleButton(bool t) { |
17 | isToggle=t; | 17 | isToggle=t; |
18 | } | 18 | } |
19 | 19 | ||
20 | void ClickableLabel::mousePressEvent( QMouseEvent *e ) { | 20 | void ClickableLabel::mousePressEvent( QMouseEvent *e ) { |
21 | if (isToggle && isDown) { | 21 | if (isToggle && isDown) { |
22 | showState(false); | 22 | showState(false); |
23 | } else { | 23 | } else { |
24 | showState(true); | 24 | showState(true); |
25 | } | 25 | } |
26 | } | 26 | } |
27 | 27 | ||
28 | void ClickableLabel::mouseReleaseEvent( QMouseEvent *e ) { | 28 | void ClickableLabel::mouseReleaseEvent( QMouseEvent *e ) { |
29 | if (rect().contains(e->pos()) && isToggle) isDown=!isDown; | 29 | if (rect().contains(e->pos()) && isToggle) isDown=!isDown; |
30 | 30 | ||
31 | if (isToggle && isDown) { | 31 | if (isToggle && isDown) { |
32 | showState(true); | 32 | showState(true); |
33 | } else { | 33 | } else { |
34 | showState(false); | 34 | showState(false); |
35 | } | 35 | } |
36 | 36 | ||
37 | if (rect().contains(e->pos())) { | 37 | if (rect().contains(e->pos())) { |
38 | if (isToggle) { | 38 | if (isToggle) { |
39 | emit toggled(isDown); | 39 | emit toggled(isDown); |
40 | } | 40 | } |
41 | emit clicked(); | 41 | emit clicked(); |
42 | } | 42 | } |
43 | } | 43 | } |
44 | 44 | ||
45 | void ClickableLabel::mouseMoveEvent( QMouseEvent *e ) { | 45 | void ClickableLabel::mouseMoveEvent( QMouseEvent *e ) { |
46 | if (rect().contains(e->pos())) { | 46 | if (rect().contains(e->pos())) { |
47 | if (isToggle && isDown) { | 47 | if (isToggle && isDown) { |
48 | showState(false); | 48 | showState(false); |
49 | } else { | 49 | } else { |
50 | showState(true); | 50 | showState(true); |
51 | } | 51 | } |
52 | } else { | 52 | } else { |
53 | if (isToggle && isDown) { | 53 | if (isToggle && isDown) { |
54 | showState(true); | 54 | showState(true); |
55 | } else { | 55 | } else { |
56 | showState(false); | 56 | showState(false); |
57 | } | 57 | } |
58 | } | 58 | } |
59 | } | 59 | } |
60 | 60 | ||
61 | void ClickableLabel::showState(bool on) { | 61 | void ClickableLabel::showState(bool on) { |
62 | if (on) { | 62 | if (on) { |
63 | //setFrameShape(Panel); | 63 | //setFrameShape(Panel); |
64 | setInverted(true); | 64 | setInverted(true); |
65 | setBackgroundMode(PaletteHighlight); | 65 | setBackgroundMode(PaletteHighlight); |
66 | } else { | 66 | } else { |
67 | //setFrameShape(NoFrame); | 67 | //setFrameShape(NoFrame); |
68 | setInverted(false); | 68 | setInverted(false); |
69 | setBackgroundMode(PaletteBackground); | 69 | setBackgroundMode(PaletteBackground); |
70 | } | 70 | } |
71 | repaint(); | 71 | repaint(); |
72 | } | 72 | } |
73 | 73 | ||
74 | void ClickableLabel::setInverted(bool on) { | 74 | void ClickableLabel::setInverted(bool on) { |
75 | if ( (!textInverted && on) || (textInverted && !on) ) { | 75 | if ( (!textInverted && on) || (textInverted && !on) ) { |
76 | QPalette pal=palette(); | 76 | QPalette pal=palette(); |
77 | QColor col=pal.color(QPalette::Normal, QColorGroup::Foreground); | 77 | QColor col=pal.color(QPalette::Normal, QColorGroup::Foreground); |
78 | col.setRgb(255-col.red(),255-col.green(),255-col.blue()); | 78 | col.setRgb(255-col.red(),255-col.green(),255-col.blue()); |
79 | pal.setColor(QPalette::Normal, QColorGroup::Foreground, col); | 79 | pal.setColor(QPalette::Normal, QColorGroup::Foreground, col); |
80 | setPalette(pal); | 80 | setPalette(pal); |
81 | textInverted=!textInverted; | 81 | textInverted=!textInverted; |
82 | } | 82 | } |
83 | } | 83 | } |
84 | 84 | ||
85 | void ClickableLabel::setOn(bool on) { | 85 | void ClickableLabel::setOn(bool on) { |
86 | isDown=on; | 86 | isDown=on; |
87 | showState(isDown); | 87 | showState(isDown); |
88 | } | 88 | } |
diff --git a/core/pim/datebook/datebookday.cpp b/core/pim/datebook/datebookday.cpp index d5daab2..67a88e9 100644 --- a/core/pim/datebook/datebookday.cpp +++ b/core/pim/datebook/datebookday.cpp | |||
@@ -232,322 +232,322 @@ void DateBookDay::redraw() | |||
232 | void DateBookDay::getEvents() | 232 | void DateBookDay::getEvents() |
233 | { | 233 | { |
234 | widgetList.clear(); | 234 | widgetList.clear(); |
235 | 235 | ||
236 | QValueList<EffectiveEvent> eventList = db->getEffectiveEvents( currDate, | 236 | QValueList<EffectiveEvent> eventList = db->getEffectiveEvents( currDate, |
237 | currDate ); | 237 | currDate ); |
238 | QValueListIterator<EffectiveEvent> it; | 238 | QValueListIterator<EffectiveEvent> it; |
239 | for ( it = eventList.begin(); it != eventList.end(); ++it ) { | 239 | for ( it = eventList.begin(); it != eventList.end(); ++it ) { |
240 | DateBookDayWidget* w = new DateBookDayWidget( *it, this ); | 240 | DateBookDayWidget* w = new DateBookDayWidget( *it, this ); |
241 | connect( w, SIGNAL( deleteMe( const Event & ) ), | 241 | connect( w, SIGNAL( deleteMe( const Event & ) ), |
242 | this, SIGNAL( removeEvent( const Event & ) ) ); | 242 | this, SIGNAL( removeEvent( const Event & ) ) ); |
243 | connect( w, SIGNAL( editMe( const Event & ) ), | 243 | connect( w, SIGNAL( editMe( const Event & ) ), |
244 | this, SIGNAL( editEvent( const Event & ) ) ); | 244 | this, SIGNAL( editEvent( const Event & ) ) ); |
245 | connect( w, SIGNAL( beamMe( const Event & ) ), | 245 | connect( w, SIGNAL( beamMe( const Event & ) ), |
246 | this, SIGNAL( beamEvent( const Event & ) ) ); | 246 | this, SIGNAL( beamEvent( const Event & ) ) ); |
247 | widgetList.append( w ); | 247 | widgetList.append( w ); |
248 | } | 248 | } |
249 | } | 249 | } |
250 | 250 | ||
251 | static int place( const DateBookDayWidget *item, bool *used, int maxn ) | 251 | static int place( const DateBookDayWidget *item, bool *used, int maxn ) |
252 | { | 252 | { |
253 | int place = 0; | 253 | int place = 0; |
254 | int start = item->event().start().hour(); | 254 | int start = item->event().start().hour(); |
255 | QTime e = item->event().end(); | 255 | QTime e = item->event().end(); |
256 | int end = e.hour(); | 256 | int end = e.hour(); |
257 | if ( e.minute() < 5 ) | 257 | if ( e.minute() < 5 ) |
258 | end--; | 258 | end--; |
259 | if ( end < start ) | 259 | if ( end < start ) |
260 | end = start; | 260 | end = start; |
261 | while ( place < maxn ) { | 261 | while ( place < maxn ) { |
262 | bool free = TRUE; | 262 | bool free = TRUE; |
263 | int s = start; | 263 | int s = start; |
264 | while( s <= end ) { | 264 | while( s <= end ) { |
265 | if ( used[10*s+place] ) { | 265 | if ( used[10*s+place] ) { |
266 | free = FALSE; | 266 | free = FALSE; |
267 | break; | 267 | break; |
268 | } | 268 | } |
269 | s++; | 269 | s++; |
270 | } | 270 | } |
271 | if ( free ) break; | 271 | if ( free ) break; |
272 | place++; | 272 | place++; |
273 | } | 273 | } |
274 | if ( place == maxn ) { | 274 | if ( place == maxn ) { |
275 | return -1; | 275 | return -1; |
276 | } | 276 | } |
277 | while( start <= end ) { | 277 | while( start <= end ) { |
278 | used[10*start+place] = TRUE; | 278 | used[10*start+place] = TRUE; |
279 | start++; | 279 | start++; |
280 | } | 280 | } |
281 | return place; | 281 | return place; |
282 | } | 282 | } |
283 | 283 | ||
284 | 284 | ||
285 | void DateBookDay::relayoutPage( bool fromResize ) | 285 | void DateBookDay::relayoutPage( bool fromResize ) |
286 | { | 286 | { |
287 | setUpdatesEnabled( FALSE ); | 287 | setUpdatesEnabled( FALSE ); |
288 | if ( !fromResize ) | 288 | if ( !fromResize ) |
289 | getEvents(); // no need we already have them! | 289 | getEvents(); // no need we already have them! |
290 | 290 | ||
291 | int wCount = widgetList.count(); | 291 | int wCount = widgetList.count(); |
292 | int wid = view->columnWidth(0)-1; | 292 | int wid = view->columnWidth(0)-1; |
293 | int n = 1; | 293 | int n = 1; |
294 | 294 | ||
295 | if ( wCount < 20 ) { | 295 | if ( wCount < 20 ) { |
296 | for ( int i = 0; i < wCount; ) { | 296 | for ( int i = 0; i < wCount; ) { |
297 | DateBookDayWidget *w = widgetList.at(i); | 297 | DateBookDayWidget *w = widgetList.at(i); |
298 | int x = 0; | 298 | int x = 0; |
299 | int xp = 0; | 299 | int xp = 0; |
300 | QRect geom = w->geometry(); | 300 | QRect geom = w->geometry(); |
301 | geom.setX( x ); | 301 | geom.setX( x ); |
302 | geom.setWidth( wid ); | 302 | geom.setWidth( wid ); |
303 | while ( xp < n && intersects( w, geom ) ) { | 303 | while ( xp < n && intersects( w, geom ) ) { |
304 | x += wid; | 304 | x += wid; |
305 | xp++; | 305 | xp++; |
306 | geom.moveBy( wid, 0 ); | 306 | geom.moveBy( wid, 0 ); |
307 | } | 307 | } |
308 | if ( xp >= n ) { | 308 | if ( xp >= n ) { |
309 | n++; | 309 | n++; |
310 | wid = ( view->columnWidth(0)-1 ) / n; | 310 | wid = ( view->columnWidth(0)-1 ) / n; |
311 | i = 0; | 311 | i = 0; |
312 | } else { | 312 | } else { |
313 | w->setGeometry( geom ); | 313 | w->setGeometry( geom ); |
314 | i++; | 314 | i++; |
315 | } | 315 | } |
316 | } | 316 | } |
317 | view->setContentsPos( 0, startTime * view->rowHeight(0) ); | 317 | view->setContentsPos( 0, startTime * view->rowHeight(0) ); |
318 | } else { | 318 | } else { |
319 | 319 | ||
320 | 320 | ||
321 | int hours[24]; | 321 | int hours[24]; |
322 | memset( hours, 0, 24*sizeof( int ) ); | 322 | memset( hours, 0, 24*sizeof( int ) ); |
323 | bool overFlow = FALSE; | 323 | bool overFlow = FALSE; |
324 | for ( int i = 0; i < wCount; i++ ) { | 324 | for ( int i = 0; i < wCount; i++ ) { |
325 | DateBookDayWidget *w = widgetList.at(i); | 325 | DateBookDayWidget *w = widgetList.at(i); |
326 | int start = w->event().start().hour(); | 326 | int start = w->event().start().hour(); |
327 | QTime e = w->event().end(); | 327 | QTime e = w->event().end(); |
328 | int end = e.hour(); | 328 | int end = e.hour(); |
329 | if ( e.minute() < 5 ) | 329 | if ( e.minute() < 5 ) |
330 | end--; | 330 | end--; |
331 | if ( end < start ) | 331 | if ( end < start ) |
332 | end = start; | 332 | end = start; |
333 | while( start <= end ) { | 333 | while( start <= end ) { |
334 | hours[start]++; | 334 | hours[start]++; |
335 | if ( hours[start] >= 10 ) | 335 | if ( hours[start] >= 10 ) |
336 | overFlow = TRUE; | 336 | overFlow = TRUE; |
337 | ++start; | 337 | ++start; |
338 | } | 338 | } |
339 | if ( overFlow ) | 339 | if ( overFlow ) |
340 | break; | 340 | break; |
341 | } | 341 | } |
342 | for ( int i = 0; i < 24; i++ ) { | 342 | for ( int i = 0; i < 24; i++ ) { |
343 | n = QMAX( n, hours[i] ); | 343 | n = QMAX( n, hours[i] ); |
344 | } | 344 | } |
345 | wid = ( view->columnWidth(0)-1 ) / n; | 345 | wid = ( view->columnWidth(0)-1 ) / n; |
346 | 346 | ||
347 | bool used[24*10]; | 347 | bool used[24*10]; |
348 | memset( used, FALSE, 24*10*sizeof( bool ) ); | 348 | memset( used, FALSE, 24*10*sizeof( bool ) ); |
349 | 349 | ||
350 | for ( int i = 0; i < wCount; i++ ) { | 350 | for ( int i = 0; i < wCount; i++ ) { |
351 | DateBookDayWidget *w = widgetList.at(i); | 351 | DateBookDayWidget *w = widgetList.at(i); |
352 | int xp = place( w, used, n ); | 352 | int xp = place( w, used, n ); |
353 | if ( xp != -1 ) { | 353 | if ( xp != -1 ) { |
354 | QRect geom = w->geometry(); | 354 | QRect geom = w->geometry(); |
355 | geom.setX( xp*wid ); | 355 | geom.setX( xp*wid ); |
356 | geom.setWidth( wid ); | 356 | geom.setWidth( wid ); |
357 | w->setGeometry( geom ); | 357 | w->setGeometry( geom ); |
358 | } | 358 | } |
359 | } | 359 | } |
360 | view->setContentsPos( 0, startTime * view->rowHeight(0) ); | 360 | view->setContentsPos( 0, startTime * view->rowHeight(0) ); |
361 | } | 361 | } |
362 | setUpdatesEnabled( TRUE ); | 362 | setUpdatesEnabled( TRUE ); |
363 | return; | 363 | return; |
364 | } | 364 | } |
365 | 365 | ||
366 | DateBookDayWidget *DateBookDay::intersects( const DateBookDayWidget *item, const QRect &geom ) | 366 | DateBookDayWidget *DateBookDay::intersects( const DateBookDayWidget *item, const QRect &geom ) |
367 | { | 367 | { |
368 | int i = 0; | 368 | int i = 0; |
369 | DateBookDayWidget *w = widgetList.at(i); | 369 | DateBookDayWidget *w = widgetList.at(i); |
370 | int wCount = widgetList.count(); | 370 | int wCount = widgetList.count(); |
371 | while ( i < wCount && w != item ) { | 371 | while ( i < wCount && w != item ) { |
372 | if ( w->geometry().intersects( geom ) ) { | 372 | if ( w->geometry().intersects( geom ) ) { |
373 | return w; | 373 | return w; |
374 | } | 374 | } |
375 | w = widgetList.at(++i); | 375 | w = widgetList.at(++i); |
376 | } | 376 | } |
377 | 377 | ||
378 | return 0; | 378 | return 0; |
379 | } | 379 | } |
380 | 380 | ||
381 | 381 | ||
382 | QDate DateBookDay::date() const | 382 | QDate DateBookDay::date() const |
383 | { | 383 | { |
384 | return currDate; | 384 | return currDate; |
385 | } | 385 | } |
386 | 386 | ||
387 | void DateBookDay::setStartViewTime( int startHere ) | 387 | void DateBookDay::setStartViewTime( int startHere ) |
388 | { | 388 | { |
389 | startTime = startHere; | 389 | startTime = startHere; |
390 | dayView()->clearSelection(); | 390 | dayView()->clearSelection(); |
391 | QTableSelection ts; | 391 | QTableSelection ts; |
392 | ts.init( startTime, 0 ); | 392 | ts.init( startTime, 0 ); |
393 | ts.expandTo( startTime, 0 ); | 393 | ts.expandTo( startTime, 0 ); |
394 | dayView()->addSelection( ts ); | 394 | dayView()->addSelection( ts ); |
395 | } | 395 | } |
396 | 396 | ||
397 | int DateBookDay::startViewTime() const | 397 | int DateBookDay::startViewTime() const |
398 | { | 398 | { |
399 | return startTime; | 399 | return startTime; |
400 | } | 400 | } |
401 | 401 | ||
402 | void DateBookDay::slotWeekChanged( bool bStartOnMonday ) | 402 | void DateBookDay::slotWeekChanged( bool bStartOnMonday ) |
403 | { | 403 | { |
404 | header->setStartOfWeek( bStartOnMonday ); | 404 | header->setStartOfWeek( bStartOnMonday ); |
405 | // redraw(); | 405 | // redraw(); |
406 | } | 406 | } |
407 | 407 | ||
408 | void DateBookDay::keyPressEvent(QKeyEvent *e) | 408 | void DateBookDay::keyPressEvent(QKeyEvent *e) |
409 | { | 409 | { |
410 | switch(e->key()) { | 410 | switch(e->key()) { |
411 | case Key_Up: | 411 | case Key_Up: |
412 | view->moveUp(); | 412 | view->moveUp(); |
413 | break; | 413 | break; |
414 | case Key_Down: | 414 | case Key_Down: |
415 | view->moveDown(); | 415 | view->moveDown(); |
416 | break; | 416 | break; |
417 | case Key_Left: | 417 | case Key_Left: |
418 | setDate(QDate(currDate).addDays(-1)); | 418 | setDate(QDate(currDate).addDays(-1)); |
419 | break; | 419 | break; |
420 | case Key_Right: | 420 | case Key_Right: |
421 | setDate(QDate(currDate).addDays(1)); | 421 | setDate(QDate(currDate).addDays(1)); |
422 | break; | 422 | break; |
423 | default: | 423 | default: |
424 | e->ignore(); | 424 | e->ignore(); |
425 | } | 425 | } |
426 | } | 426 | } |
427 | 427 | ||
428 | //=========================================================================== | 428 | //=========================================================================== |
429 | 429 | ||
430 | DateBookDayWidget::DateBookDayWidget( const EffectiveEvent &e, | 430 | DateBookDayWidget::DateBookDayWidget( const EffectiveEvent &e, |
431 | DateBookDay *db ) | 431 | DateBookDay *db ) |
432 | : QWidget( db->dayView()->viewport() ), ev( e ), dateBook( db ) | 432 | : QWidget( db->dayView()->viewport() ), ev( e ), dateBook( db ) |
433 | { | 433 | { |
434 | bool whichClock = db->dayView()->whichClock(); | 434 | bool whichClock = db->dayView()->whichClock(); |
435 | 435 | ||
436 | // why would someone use "<"? Oh well, fix it up... | 436 | // why would someone use "<"? Oh well, fix it up... |
437 | // I wonder what other things may be messed up... | 437 | // I wonder what other things may be messed up... |
438 | QString strDesc = ev.description(); | 438 | QString strDesc = ev.description(); |
439 | int where = strDesc.find( "<" ); | 439 | int where = strDesc.find( "<" ); |
440 | while ( where != -1 ) { | 440 | while ( where != -1 ) { |
441 | strDesc.remove( where, 1 ); | 441 | strDesc.remove( where, 1 ); |
442 | strDesc.insert( where, "<" ); | 442 | strDesc.insert( where, "<" ); |
443 | where = strDesc.find( "<", where ); | 443 | where = strDesc.find( "<", where ); |
444 | } | 444 | } |
445 | 445 | ||
446 | QString strCat; | 446 | QString strCat; |
447 | // ### Fix later... | 447 | // ### Fix later... |
448 | // QString strCat = ev.category(); | 448 | // QString strCat = ev.category(); |
449 | // where = strCat.find( "<" ); | 449 | // where = strCat.find( "<" ); |
450 | // while ( where != -1 ) { | 450 | // while ( where != -1 ) { |
451 | // strCat.remove( where, 1 ); | 451 | // strCat.remove( where, 1 ); |
452 | // strCat.insert( where, "<" ); | 452 | // strCat.insert( where, "<" ); |
453 | // where = strCat.find( "<", where ); | 453 | // where = strCat.find( "<", where ); |
454 | // } | 454 | // } |
455 | 455 | ||
456 | QString strNote = ev.notes(); | 456 | QString strNote = ev.notes(); |
457 | where = strNote.find( "<" ); | 457 | where = strNote.find( "<" ); |
458 | while ( where != -1 ) { | 458 | while ( where != -1 ) { |
459 | strNote.remove( where, 1 ); | 459 | strNote.remove( where, 1 ); |
460 | strNote.insert( where, "<" ); | 460 | strNote.insert( where, "<" ); |
461 | where = strNote.find( "<", where ); | 461 | where = strNote.find( "<", where ); |
462 | } | 462 | } |
463 | 463 | ||
464 | text = "<b>" + strDesc + "</b><br>" + "<i>" | 464 | text = "<b>" + strDesc + "</b><br>" + "<i>" |
465 | + strCat + "</i>" | 465 | + strCat + "</i>" |
466 | + "<br><b>" + tr("Start") + "</b>: "; | 466 | + "<br><b>" + tr("Start") + "</b>: "; |
467 | 467 | ||
468 | 468 | ||
469 | if ( e.startDate() != ev.date() ) { | 469 | if ( e.startDate() != ev.date() ) { |
470 | // multi-day event. Show start date | 470 | // multi-day event. Show start date |
471 | text += TimeString::longDateString( e.startDate() ); | 471 | text += TimeString::longDateString( e.startDate() ); |
472 | } else { | 472 | } else { |
473 | // Show start time. | 473 | // Show start time. |
474 | text += TimeString::timeString( ev.start(), whichClock, FALSE ); | 474 | text += TimeString::timeString( ev.start(), whichClock, FALSE ); |
475 | } | 475 | } |
476 | 476 | ||
477 | text += "<br><b>" + tr("End") + "</b>: "; | 477 | text += "<br><b>" + tr("End") + "</b>: "; |
478 | if ( e.endDate() != ev.date() ) { | 478 | if ( e.endDate() != ev.date() ) { |
479 | // multi-day event. Show end date | 479 | // multi-day event. Show end date |
480 | text += TimeString::longDateString( e.endDate() ); | 480 | text += TimeString::longDateString( e.endDate() ); |
481 | } else { | 481 | } else { |
482 | // Show end time. | 482 | // Show end time. |
483 | text += TimeString::timeString( ev.end(), whichClock, FALSE ); | 483 | text += TimeString::timeString( ev.end(), whichClock, FALSE ); |
484 | } | 484 | } |
485 | text += "<br><br>" + strNote; | 485 | text += "<br><br>" + strNote; |
486 | setBackgroundMode( PaletteBase ); | 486 | setBackgroundMode( PaletteBase ); |
487 | 487 | ||
488 | QTime s = ev.start(); | 488 | QTime start = ev.start(); |
489 | QTime e = ev.end(); | 489 | QTime end = ev.end(); |
490 | int y = s.hour()*60+s.minute(); | 490 | int y = start.hour()*60+start.minute(); |
491 | int h = e.hour()*60+e.minute()-y; | 491 | int h = end.hour()*60+end.minute()-y; |
492 | int rh = dateBook->dayView()->rowHeight(0); | 492 | int rh = dateBook->dayView()->rowHeight(0); |
493 | y = y*rh/60; | 493 | y = y*rh/60; |
494 | h = h*rh/60; | 494 | h = h*rh/60; |
495 | if ( h < 3 ) | 495 | if ( h < 3 ) |
496 | h = 3; | 496 | h = 3; |
497 | geom.setY( y ); | 497 | geom.setY( y ); |
498 | geom.setHeight( h ); | 498 | geom.setHeight( h ); |
499 | } | 499 | } |
500 | 500 | ||
501 | DateBookDayWidget::~DateBookDayWidget() | 501 | DateBookDayWidget::~DateBookDayWidget() |
502 | { | 502 | { |
503 | } | 503 | } |
504 | 504 | ||
505 | void DateBookDayWidget::paintEvent( QPaintEvent *e ) | 505 | void DateBookDayWidget::paintEvent( QPaintEvent *e ) |
506 | { | 506 | { |
507 | QPainter p( this ); | 507 | QPainter p( this ); |
508 | p.setPen( QColor(100, 100, 100) ); | 508 | p.setPen( QColor(100, 100, 100) ); |
509 | p.setBrush( QColor( 255, 240, 230 ) ); // based on priority? | 509 | p.setBrush( QColor( 255, 240, 230 ) ); // based on priority? |
510 | p.drawRect(rect()); | 510 | p.drawRect(rect()); |
511 | 511 | ||
512 | int y = 0; | 512 | int y = 0; |
513 | int d = 0; | 513 | int d = 0; |
514 | 514 | ||
515 | if ( ev.event().hasAlarm() ) { | 515 | if ( ev.event().hasAlarm() ) { |
516 | p.drawPixmap( width() - 16, 0, Resource::loadPixmap( "bell" ) ); | 516 | p.drawPixmap( width() - 16, 0, Resource::loadPixmap( "bell" ) ); |
517 | y = 20; | 517 | y = 20; |
518 | d = 20; | 518 | d = 20; |
519 | } | 519 | } |
520 | 520 | ||
521 | if ( ev.event().hasRepeat() ) { | 521 | if ( ev.event().hasRepeat() ) { |
522 | p.drawPixmap( width() - 16, y, Resource::loadPixmap( "repeat" ) ); | 522 | p.drawPixmap( width() - 16, y, Resource::loadPixmap( "repeat" ) ); |
523 | d = 20; | 523 | d = 20; |
524 | } | 524 | } |
525 | 525 | ||
526 | QSimpleRichText rt( text, font() ); | 526 | QSimpleRichText rt( text, font() ); |
527 | rt.setWidth( geom.width() - d - 6 ); | 527 | rt.setWidth( geom.width() - d - 6 ); |
528 | rt.draw( &p, 3, 0, e->region(), colorGroup() ); | 528 | rt.draw( &p, 3, 0, e->region(), colorGroup() ); |
529 | } | 529 | } |
530 | 530 | ||
531 | void DateBookDayWidget::mousePressEvent( QMouseEvent *e ) | 531 | void DateBookDayWidget::mousePressEvent( QMouseEvent *e ) |
532 | { | 532 | { |
533 | QPopupMenu m; | 533 | QPopupMenu m; |
534 | m.insertItem( tr( "Edit" ), 1 ); | 534 | m.insertItem( tr( "Edit" ), 1 ); |
535 | m.insertItem( tr( "Delete" ), 2 ); | 535 | m.insertItem( tr( "Delete" ), 2 ); |
536 | m.insertItem( tr( "Beam" ), 3 ); | 536 | m.insertItem( tr( "Beam" ), 3 ); |
537 | int r = m.exec( e->globalPos() ); | 537 | int r = m.exec( e->globalPos() ); |
538 | if ( r == 1 ) { | 538 | if ( r == 1 ) { |
539 | emit editMe( ev.event() ); | 539 | emit editMe( ev.event() ); |
540 | } else if ( r == 2 ) { | 540 | } else if ( r == 2 ) { |
541 | emit deleteMe( ev.event() ); | 541 | emit deleteMe( ev.event() ); |
542 | } else if ( r == 3 ) { | 542 | } else if ( r == 3 ) { |
543 | emit beamMe( ev.event() ); | 543 | emit beamMe( ev.event() ); |
544 | } | 544 | } |
545 | } | 545 | } |
546 | 546 | ||
547 | void DateBookDayWidget::setGeometry( const QRect &r ) | 547 | void DateBookDayWidget::setGeometry( const QRect &r ) |
548 | { | 548 | { |
549 | geom = r; | 549 | geom = r; |
550 | setFixedSize( r.width()+1, r.height()+1 ); | 550 | setFixedSize( r.width()+1, r.height()+1 ); |
551 | dateBook->dayView()->moveChild( this, r.x(), r.y()-1 ); | 551 | dateBook->dayView()->moveChild( this, r.x(), r.y()-1 ); |
552 | show(); | 552 | show(); |
553 | } | 553 | } |
diff --git a/core/pim/datebook/datebookweek.cpp b/core/pim/datebook/datebookweek.cpp index e9fcc39..6532ba4 100644 --- a/core/pim/datebook/datebookweek.cpp +++ b/core/pim/datebook/datebookweek.cpp | |||
@@ -359,329 +359,329 @@ DateBookWeek::DateBookWeek( bool ap, bool startOnMonday, DateBookDB *newDB, | |||
359 | 359 | ||
360 | lblDesc = new QLabel( this, "event label" ); | 360 | lblDesc = new QLabel( this, "event label" ); |
361 | lblDesc->setFrameStyle( QFrame::Plain | QFrame::Box ); | 361 | lblDesc->setFrameStyle( QFrame::Plain | QFrame::Box ); |
362 | lblDesc->setBackgroundColor( yellow ); | 362 | lblDesc->setBackgroundColor( yellow ); |
363 | lblDesc->hide(); | 363 | lblDesc->hide(); |
364 | 364 | ||
365 | tHide = new QTimer( this ); | 365 | tHide = new QTimer( this ); |
366 | 366 | ||
367 | connect( view, SIGNAL( showDay( int ) ), | 367 | connect( view, SIGNAL( showDay( int ) ), |
368 | this, SLOT( showDay( int ) ) ); | 368 | this, SLOT( showDay( int ) ) ); |
369 | connect( view, SIGNAL(signalShowEvent(const EffectiveEvent&)), | 369 | connect( view, SIGNAL(signalShowEvent(const EffectiveEvent&)), |
370 | this, SLOT(slotShowEvent(const EffectiveEvent&)) ); | 370 | this, SLOT(slotShowEvent(const EffectiveEvent&)) ); |
371 | connect( view, SIGNAL(signalHideEvent()), | 371 | connect( view, SIGNAL(signalHideEvent()), |
372 | this, SLOT(slotHideEvent()) ); | 372 | this, SLOT(slotHideEvent()) ); |
373 | connect( header, SIGNAL( dateChanged( int, int ) ), | 373 | connect( header, SIGNAL( dateChanged( int, int ) ), |
374 | this, SLOT( dateChanged( int, int ) ) ); | 374 | this, SLOT( dateChanged( int, int ) ) ); |
375 | connect( tHide, SIGNAL( timeout() ), | 375 | connect( tHide, SIGNAL( timeout() ), |
376 | lblDesc, SLOT( hide() ) ); | 376 | lblDesc, SLOT( hide() ) ); |
377 | connect( header->spinYear, SIGNAL(valueChanged(int)), | 377 | connect( header->spinYear, SIGNAL(valueChanged(int)), |
378 | this, SLOT(slotYearChanged(int)) ); | 378 | this, SLOT(slotYearChanged(int)) ); |
379 | connect( qApp, SIGNAL(weekChanged(bool)), | 379 | connect( qApp, SIGNAL(weekChanged(bool)), |
380 | this, SLOT(slotWeekChanged(bool)) ); | 380 | this, SLOT(slotWeekChanged(bool)) ); |
381 | connect( qApp, SIGNAL(clockChanged(bool)), | 381 | connect( qApp, SIGNAL(clockChanged(bool)), |
382 | this, SLOT(slotClockChanged(bool))); | 382 | this, SLOT(slotClockChanged(bool))); |
383 | setDate(QDate::currentDate()); | 383 | setDate(QDate::currentDate()); |
384 | 384 | ||
385 | } | 385 | } |
386 | 386 | ||
387 | void DateBookWeek::keyPressEvent(QKeyEvent *e) | 387 | void DateBookWeek::keyPressEvent(QKeyEvent *e) |
388 | { | 388 | { |
389 | switch(e->key()) { | 389 | switch(e->key()) { |
390 | case Key_Up: | 390 | case Key_Up: |
391 | view->scrollBy(0, -20); | 391 | view->scrollBy(0, -20); |
392 | break; | 392 | break; |
393 | case Key_Down: | 393 | case Key_Down: |
394 | view->scrollBy(0, 20); | 394 | view->scrollBy(0, 20); |
395 | break; | 395 | break; |
396 | case Key_Left: | 396 | case Key_Left: |
397 | setDate(date().addDays(-7)); | 397 | setDate(date().addDays(-7)); |
398 | break; | 398 | break; |
399 | case Key_Right: | 399 | case Key_Right: |
400 | setDate(date().addDays(7)); | 400 | setDate(date().addDays(7)); |
401 | break; | 401 | break; |
402 | default: | 402 | default: |
403 | e->ignore(); | 403 | e->ignore(); |
404 | } | 404 | } |
405 | } | 405 | } |
406 | 406 | ||
407 | void DateBookWeek::showDay( int day ) | 407 | void DateBookWeek::showDay( int day ) |
408 | { | 408 | { |
409 | QDate d; | 409 | QDate d; |
410 | d = dateFromWeek( _week, year, bStartOnMonday ); | 410 | d = dateFromWeek( _week, year, bStartOnMonday ); |
411 | day--; | 411 | day--; |
412 | d = d.addDays( day ); | 412 | d = d.addDays( day ); |
413 | emit showDate( d.year(), d.month(), d.day() ); | 413 | emit showDate( d.year(), d.month(), d.day() ); |
414 | } | 414 | } |
415 | 415 | ||
416 | void DateBookWeek::setDate( int y, int m, int d ) | 416 | void DateBookWeek::setDate( int y, int m, int d ) |
417 | { | 417 | { |
418 | QDate date; | 418 | QDate date; |
419 | date.setYMD( y, m, d ); | 419 | date.setYMD( y, m, d ); |
420 | setDate(QDate(y, m, d)); | 420 | setDate(QDate(y, m, d)); |
421 | } | 421 | } |
422 | 422 | ||
423 | void DateBookWeek::setDate(QDate date) | 423 | void DateBookWeek::setDate(QDate date) |
424 | { | 424 | { |
425 | dow = date.dayOfWeek(); | 425 | dow = date.dayOfWeek(); |
426 | int w, y; | 426 | int w, y; |
427 | calcWeek( date, w, y, bStartOnMonday ); | 427 | calcWeek( date, w, y, bStartOnMonday ); |
428 | header->setDate( y, w ); | 428 | header->setDate( y, w ); |
429 | } | 429 | } |
430 | 430 | ||
431 | void DateBookWeek::dateChanged( int y, int w ) | 431 | void DateBookWeek::dateChanged( int y, int w ) |
432 | { | 432 | { |
433 | year = y; | 433 | year = y; |
434 | _week = w; | 434 | _week = w; |
435 | getEvents(); | 435 | getEvents(); |
436 | } | 436 | } |
437 | 437 | ||
438 | QDate DateBookWeek::date() const | 438 | QDate DateBookWeek::date() const |
439 | { | 439 | { |
440 | QDate d; | 440 | QDate d; |
441 | d = dateFromWeek( _week - 1, year, bStartOnMonday ); | 441 | d = dateFromWeek( _week - 1, year, bStartOnMonday ); |
442 | if ( bStartOnMonday ) | 442 | if ( bStartOnMonday ) |
443 | d = d.addDays( 7 + dow - 1 ); | 443 | d = d.addDays( 7 + dow - 1 ); |
444 | else { | 444 | else { |
445 | if ( dow == 7 ) | 445 | if ( dow == 7 ) |
446 | d = d.addDays( dow ); | 446 | d = d.addDays( dow ); |
447 | else | 447 | else |
448 | d = d.addDays( 7 + dow ); | 448 | d = d.addDays( 7 + dow ); |
449 | } | 449 | } |
450 | return d; | 450 | return d; |
451 | } | 451 | } |
452 | 452 | ||
453 | void DateBookWeek::getEvents() | 453 | void DateBookWeek::getEvents() |
454 | { | 454 | { |
455 | QDate startWeek = weekDate(); | 455 | QDate startWeek = weekDate(); |
456 | 456 | ||
457 | QDate endWeek = startWeek.addDays( 6 ); | 457 | QDate endWeek = startWeek.addDays( 6 ); |
458 | QValueList<EffectiveEvent> eventList = db->getEffectiveEvents(startWeek, | 458 | QValueList<EffectiveEvent> eventList = db->getEffectiveEvents(startWeek, |
459 | endWeek); | 459 | endWeek); |
460 | view->showEvents( eventList ); | 460 | view->showEvents( eventList ); |
461 | view->moveToHour( startTime ); | 461 | view->moveToHour( startTime ); |
462 | } | 462 | } |
463 | 463 | ||
464 | void DateBookWeek::slotShowEvent( const EffectiveEvent &ev ) | 464 | void DateBookWeek::slotShowEvent( const EffectiveEvent &ev ) |
465 | { | 465 | { |
466 | if ( tHide->isActive() ) | 466 | if ( tHide->isActive() ) |
467 | tHide->stop(); | 467 | tHide->stop(); |
468 | 468 | ||
469 | // why would someone use "<"? Oh well, fix it up... | 469 | // why would someone use "<"? Oh well, fix it up... |
470 | // I wonder what other things may be messed up... | 470 | // I wonder what other things may be messed up... |
471 | QString strDesc = ev.description(); | 471 | QString strDesc = ev.description(); |
472 | int where = strDesc.find( "<" ); | 472 | int where = strDesc.find( "<" ); |
473 | while ( where != -1 ) { | 473 | while ( where != -1 ) { |
474 | strDesc.remove( where, 1 ); | 474 | strDesc.remove( where, 1 ); |
475 | strDesc.insert( where, "<" ); | 475 | strDesc.insert( where, "<" ); |
476 | where = strDesc.find( "<", where ); | 476 | where = strDesc.find( "<", where ); |
477 | } | 477 | } |
478 | 478 | ||
479 | QString strCat; | 479 | QString strCat; |
480 | // ### FIX later... | 480 | // ### FIX later... |
481 | // QString strCat = ev.category(); | 481 | // QString strCat = ev.category(); |
482 | // where = strCat.find( "<" ); | 482 | // where = strCat.find( "<" ); |
483 | // while ( where != -1 ) { | 483 | // while ( where != -1 ) { |
484 | // strCat.remove( where, 1 ); | 484 | // strCat.remove( where, 1 ); |
485 | // strCat.insert( where, "<" ); | 485 | // strCat.insert( where, "<" ); |
486 | // where = strCat.find( "<", where ); | 486 | // where = strCat.find( "<", where ); |
487 | // } | 487 | // } |
488 | 488 | ||
489 | QString strNote = ev.notes(); | 489 | QString strNote = ev.notes(); |
490 | where = strNote.find( "<" ); | 490 | where = strNote.find( "<" ); |
491 | while ( where != -1 ) { | 491 | while ( where != -1 ) { |
492 | strNote.remove( where, 1 ); | 492 | strNote.remove( where, 1 ); |
493 | strNote.insert( where, "<" ); | 493 | strNote.insert( where, "<" ); |
494 | where = strNote.find( "<", where ); | 494 | where = strNote.find( "<", where ); |
495 | } | 495 | } |
496 | 496 | ||
497 | QString str = "<b>" + strDesc + "</b><br>" + "<i>" | 497 | QString str = "<b>" + strDesc + "</b><br>" + "<i>" |
498 | + strCat + "</i>" | 498 | + strCat + "</i>" |
499 | + "<br>" + TimeString::longDateString( ev.date() ) | 499 | + "<br>" + TimeString::longDateString( ev.date() ) |
500 | + "<br><b>" + QObject::tr("Start") + "</b>: "; | 500 | + "<br><b>" + QObject::tr("Start") + "</b>: "; |
501 | 501 | ||
502 | if ( ev.startDate() != ev.date() ) { | 502 | if ( ev.startDate() != ev.date() ) { |
503 | // multi-day event. Show start date | 503 | // multi-day event. Show start date |
504 | str += TimeString::longDateString( ev.startDate() ); | 504 | str += TimeString::longDateString( ev.startDate() ); |
505 | } else { | 505 | } else { |
506 | // Show start time. | 506 | // Show start time. |
507 | str += TimeString::timeString(ev.start(), ampm, FALSE ); | 507 | str += TimeString::timeString(ev.start(), ampm, FALSE ); |
508 | } | 508 | } |
509 | 509 | ||
510 | str += "<br><b>" + QObject::tr("End") + "</b>: "; | 510 | str += "<br><b>" + QObject::tr("End") + "</b>: "; |
511 | if ( ev.endDate() != ev.date() ) { | 511 | if ( ev.endDate() != ev.date() ) { |
512 | // multi-day event. Show end date | 512 | // multi-day event. Show end date |
513 | str += TimeString::longDateString( ev.endDate() ); | 513 | str += TimeString::longDateString( ev.endDate() ); |
514 | } else { | 514 | } else { |
515 | // Show end time. | 515 | // Show end time. |
516 | str += TimeString::timeString( ev.end(), ampm, FALSE ); | 516 | str += TimeString::timeString( ev.end(), ampm, FALSE ); |
517 | } | 517 | } |
518 | str += "<br><br>" + strNote; | 518 | str += "<br><br>" + strNote; |
519 | 519 | ||
520 | lblDesc->setText( str ); | 520 | lblDesc->setText( str ); |
521 | lblDesc->resize( lblDesc->sizeHint() ); | 521 | lblDesc->resize( lblDesc->sizeHint() ); |
522 | // move the label so it is "centerd" horizontally... | 522 | // move the label so it is "centerd" horizontally... |
523 | lblDesc->move( QMAX(0,(width() - lblDesc->width()) / 2), 0 ); | 523 | lblDesc->move( QMAX(0,(width() - lblDesc->width()) / 2), 0 ); |
524 | lblDesc->show(); | 524 | lblDesc->show(); |
525 | } | 525 | } |
526 | 526 | ||
527 | void DateBookWeek::slotHideEvent() | 527 | void DateBookWeek::slotHideEvent() |
528 | { | 528 | { |
529 | tHide->start( 2000, true ); | 529 | tHide->start( 2000, true ); |
530 | } | 530 | } |
531 | 531 | ||
532 | void DateBookWeek::setStartViewTime( int startHere ) | 532 | void DateBookWeek::setStartViewTime( int startHere ) |
533 | { | 533 | { |
534 | startTime = startHere; | 534 | startTime = startHere; |
535 | view->moveToHour( startTime ); | 535 | view->moveToHour( startTime ); |
536 | } | 536 | } |
537 | 537 | ||
538 | int DateBookWeek::startViewTime() const | 538 | int DateBookWeek::startViewTime() const |
539 | { | 539 | { |
540 | return startTime; | 540 | return startTime; |
541 | } | 541 | } |
542 | 542 | ||
543 | void DateBookWeek::redraw() | 543 | void DateBookWeek::redraw() |
544 | { | 544 | { |
545 | getEvents(); | 545 | getEvents(); |
546 | } | 546 | } |
547 | 547 | ||
548 | void DateBookWeek::slotYearChanged( int y ) | 548 | void DateBookWeek::slotYearChanged( int y ) |
549 | { | 549 | { |
550 | int totWeek; | 550 | int totWeek; |
551 | QDate d( y, 12, 31 ); | 551 | QDate d( y, 12, 31 ); |
552 | int throwAway; | 552 | int throwAway; |
553 | calcWeek( d, totWeek, throwAway, bStartOnMonday ); | 553 | calcWeek( d, totWeek, throwAway, bStartOnMonday ); |
554 | while ( totWeek == 1 ) { | 554 | while ( totWeek == 1 ) { |
555 | d = d.addDays( -1 ); | 555 | d = d.addDays( -1 ); |
556 | calcWeek( d, totWeek, throwAway, bStartOnMonday ); | 556 | calcWeek( d, totWeek, throwAway, bStartOnMonday ); |
557 | } | 557 | } |
558 | if ( totWeek != totalWeeks() ) | 558 | if ( totWeek != totalWeeks() ) |
559 | setTotalWeeks( totWeek ); | 559 | setTotalWeeks( totWeek ); |
560 | } | 560 | } |
561 | 561 | ||
562 | 562 | ||
563 | void DateBookWeek::setTotalWeeks( int numWeeks ) | 563 | void DateBookWeek::setTotalWeeks( int numWeeks ) |
564 | { | 564 | { |
565 | header->spinWeek->setMaxValue( numWeeks ); | 565 | header->spinWeek->setMaxValue( numWeeks ); |
566 | } | 566 | } |
567 | 567 | ||
568 | int DateBookWeek::totalWeeks() const | 568 | int DateBookWeek::totalWeeks() const |
569 | { | 569 | { |
570 | return header->spinWeek->maxValue(); | 570 | return header->spinWeek->maxValue(); |
571 | } | 571 | } |
572 | 572 | ||
573 | void DateBookWeek::slotWeekChanged( bool onMonday ) | 573 | void DateBookWeek::slotWeekChanged( bool onMonday ) |
574 | { | 574 | { |
575 | bStartOnMonday = onMonday; | 575 | bStartOnMonday = onMonday; |
576 | view->setStartOfWeek( bStartOnMonday ); | 576 | view->setStartOfWeek( bStartOnMonday ); |
577 | header->setStartOfWeek( bStartOnMonday ); | 577 | header->setStartOfWeek( bStartOnMonday ); |
578 | redraw(); | 578 | redraw(); |
579 | } | 579 | } |
580 | 580 | ||
581 | void DateBookWeek::slotClockChanged( bool ap ) | 581 | void DateBookWeek::slotClockChanged( bool ap ) |
582 | { | 582 | { |
583 | ampm = ap; | 583 | ampm = ap; |
584 | } | 584 | } |
585 | 585 | ||
586 | // return the date at the beginning of the week... | 586 | // return the date at the beginning of the week... |
587 | QDate DateBookWeek::weekDate() const | 587 | QDate DateBookWeek::weekDate() const |
588 | { | 588 | { |
589 | return dateFromWeek( _week, year, bStartOnMonday ); | 589 | return dateFromWeek( _week, year, bStartOnMonday ); |
590 | } | 590 | } |
591 | 591 | ||
592 | // this used to only be needed by datebook.cpp, but now we need it inside | 592 | // this used to only be needed by datebook.cpp, but now we need it inside |
593 | // week view since | 593 | // week view since |
594 | // we need to be able to figure out our total number of weeks on the fly... | 594 | // we need to be able to figure out our total number of weeks on the fly... |
595 | // this is probably the best place to put it.. | 595 | // this is probably the best place to put it.. |
596 | 596 | ||
597 | // For Weeks that start on Monday... (EASY!) | 597 | // For Weeks that start on Monday... (EASY!) |
598 | // At the moment we will use ISO 8601 method for computing | 598 | // At the moment we will use ISO 8601 method for computing |
599 | // the week. Granted, other countries use other methods, | 599 | // the week. Granted, other countries use other methods, |
600 | // bet we aren't doing any Locale stuff at the moment. So, | 600 | // bet we aren't doing any Locale stuff at the moment. So, |
601 | // this should pass. This Algorithim is public domain and | 601 | // this should pass. This Algorithim is public domain and |
602 | // available at: | 602 | // available at: |
603 | // http://personal.ecu.edu/mccartyr/ISOwdALG.txt | 603 | // http://personal.ecu.edu/mccartyr/ISOwdALG.txt |
604 | // the week number is return, and the year number is returned in year | 604 | // the week number is return, and the year number is returned in year |
605 | // for Instance 2001/12/31 is actually the first week in 2002. | 605 | // for Instance 2001/12/31 is actually the first week in 2002. |
606 | // There is a more mathematical definition, but I will implement it when | 606 | // There is a more mathematical definition, but I will implement it when |
607 | // we are pass our deadline. | 607 | // we are pass our deadline. |
608 | 608 | ||
609 | // For Weeks that start on Sunday... (ahh... home rolled) | 609 | // For Weeks that start on Sunday... (ahh... home rolled) |
610 | // okay, if Jan 1 is on Friday or Saturday, | 610 | // okay, if Jan 1 is on Friday or Saturday, |
611 | // it will go to the pervious | 611 | // it will go to the pervious |
612 | // week... | 612 | // week... |
613 | 613 | ||
614 | bool calcWeek( const QDate &d, int &week, int &year, | 614 | bool calcWeek( const QDate &d, int &week, int &year, |
615 | bool startOnMonday = false ) | 615 | bool startOnMonday ) |
616 | { | 616 | { |
617 | int weekNumber; | 617 | int weekNumber; |
618 | int yearNumber; | 618 | int yearNumber; |
619 | 619 | ||
620 | // remove a pesky warning, (Optimizations on g++) | 620 | // remove a pesky warning, (Optimizations on g++) |
621 | weekNumber = -1; | 621 | weekNumber = -1; |
622 | int jan1WeekDay = QDate(d.year(), 1, 1).dayOfWeek(); | 622 | int jan1WeekDay = QDate(d.year(), 1, 1).dayOfWeek(); |
623 | int dayOfWeek = d.dayOfWeek(); | 623 | int dayOfWeek = d.dayOfWeek(); |
624 | 624 | ||
625 | if ( !d.isValid() ) | 625 | if ( !d.isValid() ) |
626 | return false; | 626 | return false; |
627 | 627 | ||
628 | if ( startOnMonday ) { | 628 | if ( startOnMonday ) { |
629 | // find the Jan1Weekday; | 629 | // find the Jan1Weekday; |
630 | if ( d.dayOfYear() <= ( 8 - jan1WeekDay) && jan1WeekDay > 4 ) { | 630 | if ( d.dayOfYear() <= ( 8 - jan1WeekDay) && jan1WeekDay > 4 ) { |
631 | yearNumber = d.year() - 1; | 631 | yearNumber = d.year() - 1; |
632 | if ( jan1WeekDay == 5 || ( jan1WeekDay == 6 && QDate::leapYear(yearNumber) ) ) | 632 | if ( jan1WeekDay == 5 || ( jan1WeekDay == 6 && QDate::leapYear(yearNumber) ) ) |
633 | weekNumber = 53; | 633 | weekNumber = 53; |
634 | else | 634 | else |
635 | weekNumber = 52; | 635 | weekNumber = 52; |
636 | } else | 636 | } else |
637 | yearNumber = d.year(); | 637 | yearNumber = d.year(); |
638 | if ( yearNumber == d.year() ) { | 638 | if ( yearNumber == d.year() ) { |
639 | int totalDays = 365; | 639 | int totalDays = 365; |
640 | if ( QDate::leapYear(yearNumber) ) | 640 | if ( QDate::leapYear(yearNumber) ) |
641 | totalDays++; | 641 | totalDays++; |
642 | if ( ((totalDays - d.dayOfYear()) < (4 - dayOfWeek) ) | 642 | if ( ((totalDays - d.dayOfYear()) < (4 - dayOfWeek) ) |
643 | || (jan1WeekDay == 7) && (totalDays - d.dayOfYear()) < 3) { | 643 | || (jan1WeekDay == 7) && (totalDays - d.dayOfYear()) < 3) { |
644 | yearNumber++; | 644 | yearNumber++; |
645 | weekNumber = 1; | 645 | weekNumber = 1; |
646 | } | 646 | } |
647 | } | 647 | } |
648 | if ( yearNumber == d.year() ) { | 648 | if ( yearNumber == d.year() ) { |
649 | int j = d.dayOfYear() + (7 - dayOfWeek) + ( jan1WeekDay - 1 ); | 649 | int j = d.dayOfYear() + (7 - dayOfWeek) + ( jan1WeekDay - 1 ); |
650 | weekNumber = j / 7; | 650 | weekNumber = j / 7; |
651 | if ( jan1WeekDay > 4 ) | 651 | if ( jan1WeekDay > 4 ) |
652 | weekNumber--; | 652 | weekNumber--; |
653 | } | 653 | } |
654 | } else { | 654 | } else { |
655 | // it's better to keep these cases separate... | 655 | // it's better to keep these cases separate... |
656 | if ( d.dayOfYear() <= (7 - jan1WeekDay) && jan1WeekDay > 4 | 656 | if ( d.dayOfYear() <= (7 - jan1WeekDay) && jan1WeekDay > 4 |
657 | && jan1WeekDay != 7 ) { | 657 | && jan1WeekDay != 7 ) { |
658 | yearNumber = d.year() - 1; | 658 | yearNumber = d.year() - 1; |
659 | if ( jan1WeekDay == 6 | 659 | if ( jan1WeekDay == 6 |
660 | || (jan1WeekDay == 7 && QDate::leapYear(yearNumber) ) ) { | 660 | || (jan1WeekDay == 7 && QDate::leapYear(yearNumber) ) ) { |
661 | weekNumber = 53; | 661 | weekNumber = 53; |
662 | }else | 662 | }else |
663 | weekNumber = 52; | 663 | weekNumber = 52; |
664 | } else | 664 | } else |
665 | yearNumber = d.year(); | 665 | yearNumber = d.year(); |
666 | if ( yearNumber == d.year() ) { | 666 | if ( yearNumber == d.year() ) { |
667 | int totalDays = 365; | 667 | int totalDays = 365; |
668 | if ( QDate::leapYear( yearNumber ) ) | 668 | if ( QDate::leapYear( yearNumber ) ) |
669 | totalDays++; | 669 | totalDays++; |
670 | if ( ((totalDays - d.dayOfYear()) < (4 - dayOfWeek % 7)) ) { | 670 | if ( ((totalDays - d.dayOfYear()) < (4 - dayOfWeek % 7)) ) { |
671 | yearNumber++; | 671 | yearNumber++; |
672 | weekNumber = 1; | 672 | weekNumber = 1; |
673 | } | 673 | } |
674 | } | 674 | } |
675 | if ( yearNumber == d.year() ) { | 675 | if ( yearNumber == d.year() ) { |
676 | int j = d.dayOfYear() + (7 - dayOfWeek % 7) + ( jan1WeekDay - 1 ); | 676 | int j = d.dayOfYear() + (7 - dayOfWeek % 7) + ( jan1WeekDay - 1 ); |
677 | weekNumber = j / 7; | 677 | weekNumber = j / 7; |
678 | if ( jan1WeekDay > 4 ) { | 678 | if ( jan1WeekDay > 4 ) { |
679 | weekNumber--; | 679 | weekNumber--; |
680 | } | 680 | } |
681 | } | 681 | } |
682 | } | 682 | } |
683 | year = yearNumber; | 683 | year = yearNumber; |
684 | week = weekNumber; | 684 | week = weekNumber; |
685 | return true; | 685 | return true; |
686 | } | 686 | } |
687 | 687 | ||
diff --git a/core/pim/datebook/datebookweeklst.cpp b/core/pim/datebook/datebookweeklst.cpp index 7083bc5..85c745a 100644 --- a/core/pim/datebook/datebookweeklst.cpp +++ b/core/pim/datebook/datebookweeklst.cpp | |||
@@ -1,373 +1,373 @@ | |||
1 | #include "datebookweeklst.h" | 1 | #include "datebookweeklst.h" |
2 | 2 | ||
3 | #include "datebookweekheaderimpl.h" | 3 | #include "datebookweekheaderimpl.h" |
4 | 4 | ||
5 | #include <qpe/calendar.h> | 5 | #include <qpe/calendar.h> |
6 | #include <qpe/datebookdb.h> | 6 | #include <qpe/datebookdb.h> |
7 | #include <qpe/event.h> | 7 | #include <qpe/event.h> |
8 | #include <qpe/qpeapplication.h> | 8 | #include <qpe/qpeapplication.h> |
9 | #include <qpe/timestring.h> | 9 | #include <qpe/timestring.h> |
10 | #include <qpe/datebookmonth.h> | 10 | #include <qpe/datebookmonth.h> |
11 | #include <qpe/config.h> | 11 | #include <qpe/config.h> |
12 | 12 | ||
13 | #include <qdatetime.h> | 13 | #include <qdatetime.h> |
14 | #include <qheader.h> | 14 | #include <qheader.h> |
15 | #include <qlabel.h> | 15 | #include <qlabel.h> |
16 | #include <qlayout.h> | 16 | #include <qlayout.h> |
17 | #include <qpainter.h> | 17 | #include <qpainter.h> |
18 | #include <qpopupmenu.h> | 18 | #include <qpopupmenu.h> |
19 | #include <qtimer.h> | 19 | #include <qtimer.h> |
20 | #include <qstyle.h> | 20 | #include <qstyle.h> |
21 | #include <qtoolbutton.h> | 21 | #include <qtoolbutton.h> |
22 | #include <qvbox.h> | 22 | #include <qvbox.h> |
23 | #include <qsizepolicy.h> | 23 | #include <qsizepolicy.h> |
24 | #include <qabstractlayout.h> | 24 | #include <qabstractlayout.h> |
25 | #include <qtl.h> | 25 | #include <qtl.h> |
26 | 26 | ||
27 | bool calcWeek(const QDate &d, int &week, int &year, | 27 | bool calcWeek(const QDate &d, int &week, int &year, |
28 | bool startOnMonday = false); | 28 | bool startOnMonday = false); |
29 | 29 | ||
30 | DateBookWeekLstHeader::DateBookWeekLstHeader(bool onM, QWidget* parent, | 30 | DateBookWeekLstHeader::DateBookWeekLstHeader(bool onM, QWidget* parent, |
31 | const char* name, WFlags fl) | 31 | const char* name, WFlags fl) |
32 | : DateBookWeekLstHeaderBase(parent, name, fl) | 32 | : DateBookWeekLstHeaderBase(parent, name, fl) |
33 | { | 33 | { |
34 | setBackgroundMode( PaletteButton ); | 34 | setBackgroundMode( PaletteButton ); |
35 | labelDate->setBackgroundMode( PaletteButton ); | 35 | labelDate->setBackgroundMode( PaletteButton ); |
36 | labelWeek->setBackgroundMode( PaletteButton ); | 36 | labelWeek->setBackgroundMode( PaletteButton ); |
37 | forward->setBackgroundMode( PaletteButton ); | 37 | forward->setBackgroundMode( PaletteButton ); |
38 | back->setBackgroundMode( PaletteButton ); | 38 | back->setBackgroundMode( PaletteButton ); |
39 | DateBookWeekLstHeaderBaseLayout->setSpacing(0); | 39 | DateBookWeekLstHeaderBaseLayout->setSpacing(0); |
40 | DateBookWeekLstHeaderBaseLayout->setMargin(0); | 40 | DateBookWeekLstHeaderBaseLayout->setMargin(0); |
41 | //setSizePolicy(QSizePolicy(QSizePolicy::Fixed,QSizePolicy::Expanding)); | 41 | //setSizePolicy(QSizePolicy(QSizePolicy::Fixed,QSizePolicy::Expanding)); |
42 | setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed)); | 42 | setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed)); |
43 | 43 | ||
44 | connect(back, SIGNAL(clicked()), this, SLOT(prevWeek())); | 44 | connect(back, SIGNAL(clicked()), this, SLOT(prevWeek())); |
45 | connect(forward, SIGNAL(clicked()), this, SLOT(nextWeek())); | 45 | connect(forward, SIGNAL(clicked()), this, SLOT(nextWeek())); |
46 | connect(labelWeek, SIGNAL(clicked()), this, SLOT(pickDate())); | 46 | connect(labelWeek, SIGNAL(clicked()), this, SLOT(pickDate())); |
47 | connect(dbl, SIGNAL(toggled(bool)), this, SIGNAL(setDbl(bool))); | 47 | connect(dbl, SIGNAL(toggled(bool)), this, SIGNAL(setDbl(bool))); |
48 | onMonday=onM; | 48 | onMonday=onM; |
49 | } | 49 | } |
50 | DateBookWeekLstHeader::~DateBookWeekLstHeader(){} | 50 | DateBookWeekLstHeader::~DateBookWeekLstHeader(){} |
51 | void DateBookWeekLstHeader::setDate(const QDate &d) { | 51 | void DateBookWeekLstHeader::setDate(const QDate &d) { |
52 | date=d; | 52 | date=d; |
53 | 53 | ||
54 | int year,week; | 54 | int year,week; |
55 | calcWeek(d,week,year,onMonday); | 55 | calcWeek(d,week,year,onMonday); |
56 | labelWeek->setText("W: " + QString::number(week)); | 56 | labelWeek->setText("W: " + QString::number(week)); |
57 | 57 | ||
58 | QDate start=date; | 58 | QDate start=date; |
59 | QDate stop=start.addDays(6); | 59 | QDate stop=start.addDays(6); |
60 | labelDate->setText( QString::number(start.day()) + " " + | 60 | labelDate->setText( QString::number(start.day()) + " " + |
61 | start.monthName(start.month()) + " - " + | 61 | start.monthName(start.month()) + " - " + |
62 | QString::number(stop.day()) + " " + | 62 | QString::number(stop.day()) + " " + |
63 | start.monthName(stop.month()) ); | 63 | start.monthName(stop.month()) ); |
64 | emit dateChanged(year,week); | 64 | emit dateChanged(year,week); |
65 | } | 65 | } |
66 | void DateBookWeekLstHeader::pickDate() { | 66 | void DateBookWeekLstHeader::pickDate() { |
67 | static QPopupMenu *m1 = 0; | 67 | static QPopupMenu *m1 = 0; |
68 | static DateBookMonth *picker = 0; | 68 | static DateBookMonth *picker = 0; |
69 | if ( !m1 ) { | 69 | if ( !m1 ) { |
70 | m1 = new QPopupMenu( this ); | 70 | m1 = new QPopupMenu( this ); |
71 | picker = new DateBookMonth( m1, 0, TRUE ); | 71 | picker = new DateBookMonth( m1, 0, TRUE ); |
72 | m1->insertItem( picker ); | 72 | m1->insertItem( picker ); |
73 | connect( picker, SIGNAL( dateClicked( int, int, int ) ), | 73 | connect( picker, SIGNAL( dateClicked( int, int, int ) ), |
74 | this, SLOT( setDate( int, int, int ) ) ); | 74 | this, SLOT( setDate( int, int, int ) ) ); |
75 | //connect( m1, SIGNAL( aboutToHide() ), | 75 | //connect( m1, SIGNAL( aboutToHide() ), |
76 | //this, SLOT( gotHide() ) ); | 76 | //this, SLOT( gotHide() ) ); |
77 | } | 77 | } |
78 | picker->setDate( date.year(), date.month(), date.day() ); | 78 | picker->setDate( date.year(), date.month(), date.day() ); |
79 | m1->popup(mapToGlobal(labelWeek->pos()+QPoint(0,labelWeek->height()))); | 79 | m1->popup(mapToGlobal(labelWeek->pos()+QPoint(0,labelWeek->height()))); |
80 | picker->setFocus(); | 80 | picker->setFocus(); |
81 | } | 81 | } |
82 | void DateBookWeekLstHeader::setDate(int y, int m, int d) { | 82 | void DateBookWeekLstHeader::setDate(int y, int m, int d) { |
83 | QDate new_date(y,m,d); | 83 | QDate new_date(y,m,d); |
84 | setDate(new_date); | 84 | setDate(new_date); |
85 | } | 85 | } |
86 | 86 | ||
87 | void DateBookWeekLstHeader::nextWeek() { | 87 | void DateBookWeekLstHeader::nextWeek() { |
88 | setDate(date.addDays(7)); | 88 | setDate(date.addDays(7)); |
89 | } | 89 | } |
90 | void DateBookWeekLstHeader::prevWeek() { | 90 | void DateBookWeekLstHeader::prevWeek() { |
91 | setDate(date.addDays(-7)); | 91 | setDate(date.addDays(-7)); |
92 | } | 92 | } |
93 | 93 | ||
94 | DateBookWeekLstDayHdr::DateBookWeekLstDayHdr(const QDate &d, bool onM, | 94 | DateBookWeekLstDayHdr::DateBookWeekLstDayHdr(const QDate &d, bool onM, |
95 | QWidget* parent = 0, | 95 | QWidget* parent, |
96 | const char* name = 0, | 96 | const char* name, |
97 | WFlags fl = 0 ) | 97 | WFlags fl ) |
98 | : DateBookWeekLstDayHdrBase(parent, name, fl) { | 98 | : DateBookWeekLstDayHdrBase(parent, name, fl) { |
99 | 99 | ||
100 | date=d; | 100 | date=d; |
101 | 101 | ||
102 | static const char *wdays="MTWTFSS"; | 102 | static const char *wdays="MTWTFSS"; |
103 | char day=wdays[d.dayOfWeek()-1]; | 103 | char day=wdays[d.dayOfWeek()-1]; |
104 | 104 | ||
105 | label->setText( QString(QChar(day)) + " " + | 105 | label->setText( QString(QChar(day)) + " " + |
106 | QString::number(d.day()) ); | 106 | QString::number(d.day()) ); |
107 | add->setText("+"); | 107 | add->setText("+"); |
108 | 108 | ||
109 | if (d == QDate::currentDate()) { | 109 | if (d == QDate::currentDate()) { |
110 | QPalette pal=label->palette(); | 110 | QPalette pal=label->palette(); |
111 | pal.setColor(QColorGroup::Foreground, QColor(0,0,255)); | 111 | pal.setColor(QColorGroup::Foreground, QColor(0,0,255)); |
112 | label->setPalette(pal); | 112 | label->setPalette(pal); |
113 | 113 | ||
114 | /* | 114 | /* |
115 | QFont f=label->font(); | 115 | QFont f=label->font(); |
116 | f.setItalic(true); | 116 | f.setItalic(true); |
117 | label->setFont(f); | 117 | label->setFont(f); |
118 | label->setPalette(QPalette(QColor(0,0,255),label->backgroundColor())); | 118 | label->setPalette(QPalette(QColor(0,0,255),label->backgroundColor())); |
119 | */ | 119 | */ |
120 | } else if (d.dayOfWeek() == 7) { // FIXME: Match any holiday | 120 | } else if (d.dayOfWeek() == 7) { // FIXME: Match any holiday |
121 | QPalette pal=label->palette(); | 121 | QPalette pal=label->palette(); |
122 | pal.setColor(QColorGroup::Foreground, QColor(255,0,0)); | 122 | pal.setColor(QColorGroup::Foreground, QColor(255,0,0)); |
123 | label->setPalette(pal); | 123 | label->setPalette(pal); |
124 | } | 124 | } |
125 | 125 | ||
126 | 126 | ||
127 | connect (label, SIGNAL(clicked()), this, SLOT(showDay())); | 127 | connect (label, SIGNAL(clicked()), this, SLOT(showDay())); |
128 | connect (add, SIGNAL(clicked()), this, SLOT(newEvent())); | 128 | connect (add, SIGNAL(clicked()), this, SLOT(newEvent())); |
129 | } | 129 | } |
130 | 130 | ||
131 | void DateBookWeekLstDayHdr::showDay() { | 131 | void DateBookWeekLstDayHdr::showDay() { |
132 | emit showDate(date.year(), date.month(), date.day()); | 132 | emit showDate(date.year(), date.month(), date.day()); |
133 | } | 133 | } |
134 | void DateBookWeekLstDayHdr::newEvent() { | 134 | void DateBookWeekLstDayHdr::newEvent() { |
135 | QDateTime start, stop; | 135 | QDateTime start, stop; |
136 | start=stop=date; | 136 | start=stop=date; |
137 | start.setTime(QTime(10,0)); | 137 | start.setTime(QTime(10,0)); |
138 | stop.setTime(QTime(12,0)); | 138 | stop.setTime(QTime(12,0)); |
139 | 139 | ||
140 | emit addEvent(start,stop,""); | 140 | emit addEvent(start,stop,""); |
141 | } | 141 | } |
142 | DateBookWeekLstEvent::DateBookWeekLstEvent(const EffectiveEvent &ev, | 142 | DateBookWeekLstEvent::DateBookWeekLstEvent(const EffectiveEvent &ev, |
143 | QWidget* parent = 0, | 143 | QWidget* parent, |
144 | const char* name = 0, | 144 | const char* name, |
145 | WFlags fl = 0) : | 145 | WFlags fl) : |
146 | ClickableLabel(parent,name,fl), | 146 | ClickableLabel(parent,name,fl), |
147 | event(ev) | 147 | event(ev) |
148 | { | 148 | { |
149 | char s[10]; | 149 | char s[10]; |
150 | if ( ev.startDate() != ev.date() ) { // multiday event (not first day) | 150 | if ( ev.startDate() != ev.date() ) { // multiday event (not first day) |
151 | if ( ev.endDate() == ev.date() ) { // last day | 151 | if ( ev.endDate() == ev.date() ) { // last day |
152 | strcpy(s, "__|__"); | 152 | strcpy(s, "__|__"); |
153 | } else { | 153 | } else { |
154 | strcpy(s, " |---"); | 154 | strcpy(s, " |---"); |
155 | } | 155 | } |
156 | } else { | 156 | } else { |
157 | sprintf(s,"%.2d:%.2d",ev.start().hour(),ev.start().minute()); | 157 | sprintf(s,"%.2d:%.2d",ev.start().hour(),ev.start().minute()); |
158 | } | 158 | } |
159 | setText(QString(s) + " " + ev.description()); | 159 | setText(QString(s) + " " + ev.description()); |
160 | connect(this, SIGNAL(clicked()), this, SLOT(editMe())); | 160 | connect(this, SIGNAL(clicked()), this, SLOT(editMe())); |
161 | setAlignment( int( QLabel::WordBreak | QLabel::AlignLeft ) ); | 161 | setAlignment( int( QLabel::WordBreak | QLabel::AlignLeft ) ); |
162 | } | 162 | } |
163 | void DateBookWeekLstEvent::editMe() { | 163 | void DateBookWeekLstEvent::editMe() { |
164 | emit editEvent(event.event()); | 164 | emit editEvent(event.event()); |
165 | } | 165 | } |
166 | 166 | ||
167 | 167 | ||
168 | DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev, | 168 | DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev, |
169 | const QDate &d, bool onM, | 169 | const QDate &d, bool onM, |
170 | QWidget* parent, | 170 | QWidget* parent, |
171 | const char* name, WFlags fl) | 171 | const char* name, WFlags fl) |
172 | : QWidget( parent, name, fl ) | 172 | : QWidget( parent, name, fl ) |
173 | { | 173 | { |
174 | onMonday=onM; | 174 | onMonday=onM; |
175 | setPalette(white); | 175 | setPalette(white); |
176 | setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding)); | 176 | setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding)); |
177 | 177 | ||
178 | QVBoxLayout *layout = new QVBoxLayout( this ); | 178 | QVBoxLayout *layout = new QVBoxLayout( this ); |
179 | 179 | ||
180 | qBubbleSort(ev); | 180 | qBubbleSort(ev); |
181 | QValueListIterator<EffectiveEvent> it; | 181 | QValueListIterator<EffectiveEvent> it; |
182 | it=ev.begin(); | 182 | it=ev.begin(); |
183 | 183 | ||
184 | int dayOrder[7]; | 184 | int dayOrder[7]; |
185 | if (onMonday) | 185 | if (onMonday) |
186 | for (int d=0; d<7; d++) dayOrder[d]=d+1; | 186 | for (int d=0; d<7; d++) dayOrder[d]=d+1; |
187 | else { | 187 | else { |
188 | for (int d=0; d<7; d++) dayOrder[d]=d; | 188 | for (int d=0; d<7; d++) dayOrder[d]=d; |
189 | dayOrder[0]=7; | 189 | dayOrder[0]=7; |
190 | } | 190 | } |
191 | 191 | ||
192 | for (int i=0; i<7; i++) { | 192 | for (int i=0; i<7; i++) { |
193 | // Header | 193 | // Header |
194 | DateBookWeekLstDayHdr *hdr=new DateBookWeekLstDayHdr(d.addDays(i), | 194 | DateBookWeekLstDayHdr *hdr=new DateBookWeekLstDayHdr(d.addDays(i), |
195 | onMonday,this); | 195 | onMonday,this); |
196 | connect(hdr, SIGNAL(showDate(int,int,int)), | 196 | connect(hdr, SIGNAL(showDate(int,int,int)), |
197 | this, SIGNAL(showDate(int,int,int))); | 197 | this, SIGNAL(showDate(int,int,int))); |
198 | connect(hdr, SIGNAL(addEvent(const QDateTime &, | 198 | connect(hdr, SIGNAL(addEvent(const QDateTime &, |
199 | const QDateTime &, | 199 | const QDateTime &, |
200 | const QString &)), | 200 | const QString &)), |
201 | this, SIGNAL(addEvent(const QDateTime &, | 201 | this, SIGNAL(addEvent(const QDateTime &, |
202 | const QDateTime &, | 202 | const QDateTime &, |
203 | const QString &))); | 203 | const QString &))); |
204 | layout->addWidget(hdr); | 204 | layout->addWidget(hdr); |
205 | 205 | ||
206 | // Events | 206 | // Events |
207 | while ( (*it).date().dayOfWeek() == dayOrder[i] && it!=ev.end() ) { | 207 | while ( (*it).date().dayOfWeek() == dayOrder[i] && it!=ev.end() ) { |
208 | DateBookWeekLstEvent *l=new DateBookWeekLstEvent(*it,this); | 208 | DateBookWeekLstEvent *l=new DateBookWeekLstEvent(*it,this); |
209 | layout->addWidget(l); | 209 | layout->addWidget(l); |
210 | connect (l, SIGNAL(editEvent(const Event &)), | 210 | connect (l, SIGNAL(editEvent(const Event &)), |
211 | this, SIGNAL(editEvent(const Event &))); | 211 | this, SIGNAL(editEvent(const Event &))); |
212 | it++; | 212 | it++; |
213 | } | 213 | } |
214 | 214 | ||
215 | layout->addItem(new QSpacerItem(1,1, QSizePolicy::Minimum, QSizePolicy::Expanding)); | 215 | layout->addItem(new QSpacerItem(1,1, QSizePolicy::Minimum, QSizePolicy::Expanding)); |
216 | } | 216 | } |
217 | } | 217 | } |
218 | DateBookWeekLstView::~DateBookWeekLstView(){} | 218 | DateBookWeekLstView::~DateBookWeekLstView(){} |
219 | void DateBookWeekLstView::keyPressEvent(QKeyEvent *e) {e->ignore();} | 219 | void DateBookWeekLstView::keyPressEvent(QKeyEvent *e) {e->ignore();} |
220 | 220 | ||
221 | DateBookWeekLstDblView::DateBookWeekLstDblView(QValueList<EffectiveEvent> &ev1, | 221 | DateBookWeekLstDblView::DateBookWeekLstDblView(QValueList<EffectiveEvent> &ev1, |
222 | QValueList<EffectiveEvent> &ev2, | 222 | QValueList<EffectiveEvent> &ev2, |
223 | QDate &d, bool onM, | 223 | QDate &d, bool onM, |
224 | QWidget* parent, | 224 | QWidget* parent, |
225 | const char* name, WFlags fl) | 225 | const char* name, WFlags fl) |
226 | : QWidget( parent, name, fl ) | 226 | : QWidget( parent, name, fl ) |
227 | { | 227 | { |
228 | QHBoxLayout *layout = new QHBoxLayout( this ); | 228 | QHBoxLayout *layout = new QHBoxLayout( this ); |
229 | 229 | ||
230 | DateBookWeekLstView *w=new DateBookWeekLstView(ev1,d,onM,this); | 230 | DateBookWeekLstView *w=new DateBookWeekLstView(ev1,d,onM,this); |
231 | layout->addWidget(w); | 231 | layout->addWidget(w); |
232 | connect (w, SIGNAL(editEvent(const Event &)), | 232 | connect (w, SIGNAL(editEvent(const Event &)), |
233 | this, SIGNAL(editEvent(const Event &))); | 233 | this, SIGNAL(editEvent(const Event &))); |
234 | connect (w, SIGNAL(showDate(int,int,int)), | 234 | connect (w, SIGNAL(showDate(int,int,int)), |
235 | this, SIGNAL(showDate(int,int,int))); | 235 | this, SIGNAL(showDate(int,int,int))); |
236 | connect (w, SIGNAL(addEvent(const QDateTime &, const QDateTime &, | 236 | connect (w, SIGNAL(addEvent(const QDateTime &, const QDateTime &, |
237 | const QString &)), | 237 | const QString &)), |
238 | this, SIGNAL(addEvent(const QDateTime &, const QDateTime &, | 238 | this, SIGNAL(addEvent(const QDateTime &, const QDateTime &, |
239 | const QString &))); | 239 | const QString &))); |
240 | 240 | ||
241 | 241 | ||
242 | w=new DateBookWeekLstView(ev2,d.addDays(7),onM,this); | 242 | w=new DateBookWeekLstView(ev2,d.addDays(7),onM,this); |
243 | layout->addWidget(w); | 243 | layout->addWidget(w); |
244 | connect (w, SIGNAL(editEvent(const Event &)), | 244 | connect (w, SIGNAL(editEvent(const Event &)), |
245 | this, SIGNAL(editEvent(const Event &))); | 245 | this, SIGNAL(editEvent(const Event &))); |
246 | connect (w, SIGNAL(showDate(int,int,int)), | 246 | connect (w, SIGNAL(showDate(int,int,int)), |
247 | this, SIGNAL(showDate(int,int,int))); | 247 | this, SIGNAL(showDate(int,int,int))); |
248 | connect (w, SIGNAL(addEvent(const QDateTime &, const QDateTime &, | 248 | connect (w, SIGNAL(addEvent(const QDateTime &, const QDateTime &, |
249 | const QString &)), | 249 | const QString &)), |
250 | this, SIGNAL(addEvent(const QDateTime &, const QDateTime &, | 250 | this, SIGNAL(addEvent(const QDateTime &, const QDateTime &, |
251 | const QString &))); | 251 | const QString &))); |
252 | } | 252 | } |
253 | 253 | ||
254 | DateBookWeekLst::DateBookWeekLst( bool ap, bool onM, DateBookDB *newDB, | 254 | DateBookWeekLst::DateBookWeekLst( bool ap, bool onM, DateBookDB *newDB, |
255 | QWidget *parent, | 255 | QWidget *parent, |
256 | const char *name ) | 256 | const char *name ) |
257 | : QWidget( parent, name ), | 257 | : QWidget( parent, name ), |
258 | db( newDB ), | 258 | db( newDB ), |
259 | startTime( 0 ), | 259 | startTime( 0 ), |
260 | ampm( ap ), | 260 | ampm( ap ), |
261 | onMonday(onM) | 261 | onMonday(onM) |
262 | { | 262 | { |
263 | setFocusPolicy(StrongFocus); | 263 | setFocusPolicy(StrongFocus); |
264 | layout = new QVBoxLayout( this ); | 264 | layout = new QVBoxLayout( this ); |
265 | layout->setMargin(0); | 265 | layout->setMargin(0); |
266 | 266 | ||
267 | header=new DateBookWeekLstHeader(onM, this); | 267 | header=new DateBookWeekLstHeader(onM, this); |
268 | layout->addWidget( header ); | 268 | layout->addWidget( header ); |
269 | connect(header, SIGNAL(dateChanged(int,int)), | 269 | connect(header, SIGNAL(dateChanged(int,int)), |
270 | this, SLOT(dateChanged(int,int))); | 270 | this, SLOT(dateChanged(int,int))); |
271 | connect(header, SIGNAL(setDbl(bool)), | 271 | connect(header, SIGNAL(setDbl(bool)), |
272 | this, SLOT(setDbl(bool))); | 272 | this, SLOT(setDbl(bool))); |
273 | 273 | ||
274 | scroll=new QScrollView(this); | 274 | scroll=new QScrollView(this); |
275 | //scroll->setVScrollBarMode(QScrollView::AlwaysOn); | 275 | //scroll->setVScrollBarMode(QScrollView::AlwaysOn); |
276 | //scroll->setHScrollBarMode(QScrollView::AlwaysOff); | 276 | //scroll->setHScrollBarMode(QScrollView::AlwaysOff); |
277 | scroll->setResizePolicy(QScrollView::AutoOneFit); | 277 | scroll->setResizePolicy(QScrollView::AutoOneFit); |
278 | layout->addWidget(scroll); | 278 | layout->addWidget(scroll); |
279 | 279 | ||
280 | view=NULL; | 280 | view=NULL; |
281 | Config config("DateBook"); | 281 | Config config("DateBook"); |
282 | config.setGroup("Main"); | 282 | config.setGroup("Main"); |
283 | dbl=config.readBoolEntry("weeklst_dbl", false); | 283 | dbl=config.readBoolEntry("weeklst_dbl", false); |
284 | header->dbl->setOn(dbl); | 284 | header->dbl->setOn(dbl); |
285 | } | 285 | } |
286 | DateBookWeekLst::~DateBookWeekLst(){ | 286 | DateBookWeekLst::~DateBookWeekLst(){ |
287 | Config config("DateBook"); | 287 | Config config("DateBook"); |
288 | config.setGroup("Main"); | 288 | config.setGroup("Main"); |
289 | config.writeEntry("weeklst_dbl", dbl); | 289 | config.writeEntry("weeklst_dbl", dbl); |
290 | } | 290 | } |
291 | 291 | ||
292 | void DateBookWeekLst::setDate(const QDate &d) { | 292 | void DateBookWeekLst::setDate(const QDate &d) { |
293 | int w,y; | 293 | int w,y; |
294 | calcWeek(d,w,y,onMonday); | 294 | calcWeek(d,w,y,onMonday); |
295 | year=y; | 295 | year=y; |
296 | _week=w; | 296 | _week=w; |
297 | header->setDate(date()); | 297 | header->setDate(date()); |
298 | } | 298 | } |
299 | void DateBookWeekLst::setDbl(bool on) { | 299 | void DateBookWeekLst::setDbl(bool on) { |
300 | dbl=on; | 300 | dbl=on; |
301 | redraw(); | 301 | redraw(); |
302 | } | 302 | } |
303 | void DateBookWeekLst::redraw() {getEvents();} | 303 | void DateBookWeekLst::redraw() {getEvents();} |
304 | 304 | ||
305 | QDate DateBookWeekLst::date() const { | 305 | QDate DateBookWeekLst::date() const { |
306 | QDate d; | 306 | QDate d; |
307 | d.setYMD(year,1,1); | 307 | d.setYMD(year,1,1); |
308 | 308 | ||
309 | int dow= d.dayOfWeek(); | 309 | int dow= d.dayOfWeek(); |
310 | if (!onMonday) | 310 | if (!onMonday) |
311 | if (dow==7) dow=1; | 311 | if (dow==7) dow=1; |
312 | else dow++; | 312 | else dow++; |
313 | 313 | ||
314 | d=d.addDays( (_week-1)*7 - dow + 1 ); | 314 | d=d.addDays( (_week-1)*7 - dow + 1 ); |
315 | return d; | 315 | return d; |
316 | } | 316 | } |
317 | 317 | ||
318 | void DateBookWeekLst::getEvents() { | 318 | void DateBookWeekLst::getEvents() { |
319 | QDate start = date(); | 319 | QDate start = date(); |
320 | QDate stop = start.addDays(6); | 320 | QDate stop = start.addDays(6); |
321 | QValueList<EffectiveEvent> el = db->getEffectiveEvents(start, stop); | 321 | QValueList<EffectiveEvent> el = db->getEffectiveEvents(start, stop); |
322 | 322 | ||
323 | if (view) delete view; | 323 | if (view) delete view; |
324 | if (dbl) { | 324 | if (dbl) { |
325 | QDate start2=start.addDays(7); | 325 | QDate start2=start.addDays(7); |
326 | stop=start2.addDays(6); | 326 | stop=start2.addDays(6); |
327 | QValueList<EffectiveEvent> el2 = db->getEffectiveEvents(start2, stop); | 327 | QValueList<EffectiveEvent> el2 = db->getEffectiveEvents(start2, stop); |
328 | 328 | ||
329 | view=new DateBookWeekLstDblView(el,el2,start,onMonday,scroll); | 329 | view=new DateBookWeekLstDblView(el,el2,start,onMonday,scroll); |
330 | } else { | 330 | } else { |
331 | view=new DateBookWeekLstView(el,start,onMonday,scroll); | 331 | view=new DateBookWeekLstView(el,start,onMonday,scroll); |
332 | } | 332 | } |
333 | 333 | ||
334 | connect (view, SIGNAL(editEvent(const Event &)), | 334 | connect (view, SIGNAL(editEvent(const Event &)), |
335 | this, SIGNAL(editEvent(const Event &))); | 335 | this, SIGNAL(editEvent(const Event &))); |
336 | connect (view, SIGNAL(showDate(int,int,int)), | 336 | connect (view, SIGNAL(showDate(int,int,int)), |
337 | this, SIGNAL(showDate(int,int,int))); | 337 | this, SIGNAL(showDate(int,int,int))); |
338 | connect (view, SIGNAL(addEvent(const QDateTime &, const QDateTime &, | 338 | connect (view, SIGNAL(addEvent(const QDateTime &, const QDateTime &, |
339 | const QString &)), | 339 | const QString &)), |
340 | this, SIGNAL(addEvent(const QDateTime &, const QDateTime &, | 340 | this, SIGNAL(addEvent(const QDateTime &, const QDateTime &, |
341 | const QString &))); | 341 | const QString &))); |
342 | 342 | ||
343 | scroll->addChild(view); | 343 | scroll->addChild(view); |
344 | view->show(); | 344 | view->show(); |
345 | scroll->updateScrollBars(); | 345 | scroll->updateScrollBars(); |
346 | } | 346 | } |
347 | 347 | ||
348 | void DateBookWeekLst::dateChanged(int y, int w) { | 348 | void DateBookWeekLst::dateChanged(int y, int w) { |
349 | year=y; | 349 | year=y; |
350 | _week=w; | 350 | _week=w; |
351 | getEvents(); | 351 | getEvents(); |
352 | } | 352 | } |
353 | 353 | ||
354 | void DateBookWeekLst::keyPressEvent(QKeyEvent *e) | 354 | void DateBookWeekLst::keyPressEvent(QKeyEvent *e) |
355 | { | 355 | { |
356 | switch(e->key()) { | 356 | switch(e->key()) { |
357 | case Key_Up: | 357 | case Key_Up: |
358 | scroll->scrollBy(0, -20); | 358 | scroll->scrollBy(0, -20); |
359 | break; | 359 | break; |
360 | case Key_Down: | 360 | case Key_Down: |
361 | scroll->scrollBy(0, 20); | 361 | scroll->scrollBy(0, 20); |
362 | break; | 362 | break; |
363 | case Key_Left: | 363 | case Key_Left: |
364 | header->prevWeek(); | 364 | header->prevWeek(); |
365 | break; | 365 | break; |
366 | case Key_Right: | 366 | case Key_Right: |
367 | header->nextWeek(); | 367 | header->nextWeek(); |
368 | break; | 368 | break; |
369 | default: | 369 | default: |
370 | e->ignore(); | 370 | e->ignore(); |
371 | } | 371 | } |
372 | } | 372 | } |
373 | 373 | ||
diff --git a/core/pim/datebook/timepicker.cpp b/core/pim/datebook/timepicker.cpp index 9097e1b..43e05ad 100644 --- a/core/pim/datebook/timepicker.cpp +++ b/core/pim/datebook/timepicker.cpp | |||
@@ -1,120 +1,120 @@ | |||
1 | #include "timepicker.h" | 1 | #include "timepicker.h" |
2 | 2 | ||
3 | #include <qbuttongroup.h> | 3 | #include <qbuttongroup.h> |
4 | #include <qtoolbutton.h> | 4 | #include <qtoolbutton.h> |
5 | #include <qlayout.h> | 5 | #include <qlayout.h> |
6 | #include "clickablelabel.h" | 6 | #include "clickablelabel.h" |
7 | #include <qstring.h> | 7 | #include <qstring.h> |
8 | #include <stdio.h> | 8 | #include <stdio.h> |
9 | 9 | ||
10 | TimePicker::TimePicker(QWidget* parent = 0, const char* name = 0, | 10 | TimePicker::TimePicker(QWidget* parent, const char* name, |
11 | WFlags fl = 0) : | 11 | WFlags fl) : |
12 | QWidget(parent,name,fl) | 12 | QWidget(parent,name,fl) |
13 | { | 13 | { |
14 | QVBoxLayout *vbox=new QVBoxLayout(this); | 14 | QVBoxLayout *vbox=new QVBoxLayout(this); |
15 | 15 | ||
16 | ClickableLabel *r; | 16 | ClickableLabel *r; |
17 | QString s; | 17 | QString s; |
18 | 18 | ||
19 | // Hour Row | 19 | // Hour Row |
20 | QWidget *row=new QWidget(this); | 20 | QWidget *row=new QWidget(this); |
21 | QHBoxLayout *l=new QHBoxLayout(row); | 21 | QHBoxLayout *l=new QHBoxLayout(row); |
22 | vbox->addWidget(row); | 22 | vbox->addWidget(row); |
23 | 23 | ||
24 | 24 | ||
25 | for (int i=0; i<24; i++) { | 25 | for (int i=0; i<24; i++) { |
26 | r=new ClickableLabel(row); | 26 | r=new ClickableLabel(row); |
27 | hourLst.append(r); | 27 | hourLst.append(r); |
28 | s.sprintf("%.2d",i); | 28 | s.sprintf("%.2d",i); |
29 | r->setText(s); | 29 | r->setText(s); |
30 | r->setToggleButton(true); | 30 | r->setToggleButton(true); |
31 | r->setAlignment(AlignHCenter | AlignVCenter); | 31 | r->setAlignment(AlignHCenter | AlignVCenter); |
32 | l->addWidget(r); | 32 | l->addWidget(r); |
33 | connect(r, SIGNAL(toggled(bool)), | 33 | connect(r, SIGNAL(toggled(bool)), |
34 | this, SLOT(slotHour(bool))); | 34 | this, SLOT(slotHour(bool))); |
35 | 35 | ||
36 | if (i==11) { // Second row | 36 | if (i==11) { // Second row |
37 | row=new QWidget(this); | 37 | row=new QWidget(this); |
38 | l=new QHBoxLayout(row); | 38 | l=new QHBoxLayout(row); |
39 | vbox->addWidget(row); | 39 | vbox->addWidget(row); |
40 | } | 40 | } |
41 | } | 41 | } |
42 | 42 | ||
43 | // Minute Row | 43 | // Minute Row |
44 | row=new QWidget(this); | 44 | row=new QWidget(this); |
45 | l=new QHBoxLayout(row); | 45 | l=new QHBoxLayout(row); |
46 | vbox->addWidget(row); | 46 | vbox->addWidget(row); |
47 | 47 | ||
48 | for (int i=0; i<60; i+=5) { | 48 | for (int i=0; i<60; i+=5) { |
49 | r=new ClickableLabel(row); | 49 | r=new ClickableLabel(row); |
50 | minuteLst.append(r); | 50 | minuteLst.append(r); |
51 | s.sprintf("%.2d",i); | 51 | s.sprintf("%.2d",i); |
52 | r->setText(s); | 52 | r->setText(s); |
53 | r->setToggleButton(true); | 53 | r->setToggleButton(true); |
54 | r->setAlignment(AlignHCenter | AlignVCenter); | 54 | r->setAlignment(AlignHCenter | AlignVCenter); |
55 | l->addWidget(r); | 55 | l->addWidget(r); |
56 | connect(r, SIGNAL(toggled(bool)), | 56 | connect(r, SIGNAL(toggled(bool)), |
57 | this, SLOT(slotMinute(bool))); | 57 | this, SLOT(slotMinute(bool))); |
58 | } | 58 | } |
59 | } | 59 | } |
60 | 60 | ||
61 | void TimePicker::slotHour(bool b) { | 61 | void TimePicker::slotHour(bool b) { |
62 | 62 | ||
63 | ClickableLabel *r = (ClickableLabel *) sender(); | 63 | ClickableLabel *r = (ClickableLabel *) sender(); |
64 | 64 | ||
65 | if (b) { | 65 | if (b) { |
66 | QValueListIterator<ClickableLabel *> it; | 66 | QValueListIterator<ClickableLabel *> it; |
67 | for (it=hourLst.begin(); it!=hourLst.end(); it++) { | 67 | for (it=hourLst.begin(); it!=hourLst.end(); it++) { |
68 | if (*it != r) (*it)->setOn(false); | 68 | if (*it != r) (*it)->setOn(false); |
69 | else tm.setHMS((*it)->text().toInt(), tm.minute(), 0); | 69 | else tm.setHMS((*it)->text().toInt(), tm.minute(), 0); |
70 | } | 70 | } |
71 | emit timeChanged(tm); | 71 | emit timeChanged(tm); |
72 | } else { | 72 | } else { |
73 | r->setOn(true); | 73 | r->setOn(true); |
74 | } | 74 | } |
75 | 75 | ||
76 | } | 76 | } |
77 | 77 | ||
78 | void TimePicker::slotMinute(bool b) { | 78 | void TimePicker::slotMinute(bool b) { |
79 | 79 | ||
80 | ClickableLabel *r = (ClickableLabel *) sender(); | 80 | ClickableLabel *r = (ClickableLabel *) sender(); |
81 | 81 | ||
82 | if (b) { | 82 | if (b) { |
83 | QValueListIterator<ClickableLabel *> it; | 83 | QValueListIterator<ClickableLabel *> it; |
84 | for (it=minuteLst.begin(); it!=minuteLst.end(); it++) { | 84 | for (it=minuteLst.begin(); it!=minuteLst.end(); it++) { |
85 | if (*it != r) (*it)->setOn(false); | 85 | if (*it != r) (*it)->setOn(false); |
86 | else tm.setHMS(tm.hour(),(*it)->text().toInt(), 0); | 86 | else tm.setHMS(tm.hour(),(*it)->text().toInt(), 0); |
87 | } | 87 | } |
88 | emit timeChanged(tm); | 88 | emit timeChanged(tm); |
89 | } else { | 89 | } else { |
90 | r->setOn(true); | 90 | r->setOn(true); |
91 | } | 91 | } |
92 | 92 | ||
93 | } | 93 | } |
94 | 94 | ||
95 | void TimePicker::setMinute(int m) { | 95 | void TimePicker::setMinute(int m) { |
96 | 96 | ||
97 | QString minute; | 97 | QString minute; |
98 | minute.sprintf("%.2d",m); | 98 | minute.sprintf("%.2d",m); |
99 | 99 | ||
100 | QValueListIterator<ClickableLabel *> it; | 100 | QValueListIterator<ClickableLabel *> it; |
101 | for (it=minuteLst.begin(); it!=minuteLst.end(); it++) { | 101 | for (it=minuteLst.begin(); it!=minuteLst.end(); it++) { |
102 | if ((*it)->text() == minute) (*it)->setOn(true); | 102 | if ((*it)->text() == minute) (*it)->setOn(true); |
103 | else (*it)->setOn(false); | 103 | else (*it)->setOn(false); |
104 | } | 104 | } |
105 | 105 | ||
106 | tm.setHMS(tm.hour(),m,0); | 106 | tm.setHMS(tm.hour(),m,0); |
107 | } | 107 | } |
108 | 108 | ||
109 | void TimePicker::setHour(int h) { | 109 | void TimePicker::setHour(int h) { |
110 | 110 | ||
111 | QString hour; | 111 | QString hour; |
112 | hour.sprintf("%.2d",h); | 112 | hour.sprintf("%.2d",h); |
113 | 113 | ||
114 | QValueListIterator<ClickableLabel *> it; | 114 | QValueListIterator<ClickableLabel *> it; |
115 | for (it=hourLst.begin(); it!=hourLst.end(); it++) { | 115 | for (it=hourLst.begin(); it!=hourLst.end(); it++) { |
116 | if ((*it)->text() == hour) (*it)->setOn(true); | 116 | if ((*it)->text() == hour) (*it)->setOn(true); |
117 | else (*it)->setOn(false); | 117 | else (*it)->setOn(false); |
118 | } | 118 | } |
119 | tm.setHMS(h,tm.minute(),0); | 119 | tm.setHMS(h,tm.minute(),0); |
120 | } | 120 | } |