-rw-r--r-- | korganizer/calprintbase.cpp | 102 |
1 files changed, 51 insertions, 51 deletions
diff --git a/korganizer/calprintbase.cpp b/korganizer/calprintbase.cpp index 7b7d54c..ecb9e03 100644 --- a/korganizer/calprintbase.cpp +++ b/korganizer/calprintbase.cpp | |||
@@ -20,21 +20,23 @@ | |||
20 | 20 | ||
21 | As a special exception, permission is given to link this program | 21 | As a special exception, permission is given to link this program |
22 | with any edition of Qt, and distribute the resulting executable, | 22 | with any edition of Qt, and distribute the resulting executable, |
23 | without including the source code for Qt in the source distribution. | 23 | without including the source code for Qt in the source distribution. |
24 | */ | 24 | */ |
25 | 25 | ||
26 | #include <qpainter.h> | 26 | #include <qpainter.h> |
27 | #include <qlayout.h> | 27 | #include <qlayout.h> |
28 | #include <qframe.h> | 28 | #include <q3frame.h> |
29 | #include <qlabel.h> | 29 | #include <qlabel.h> |
30 | #include <qptrlist.h> | 30 | #include <q3ptrlist.h> |
31 | #include <qintdict.h> | 31 | #include <q3intdict.h> |
32 | #include <qfontmetrics.h> | 32 | #include <qfontmetrics.h> |
33 | //Added by qt3to4: | ||
34 | #include <Q3VBoxLayout> | ||
33 | 35 | ||
34 | #include <kglobal.h> | 36 | #include <kglobal.h> |
35 | #include <klocale.h> | 37 | #include <klocale.h> |
36 | #include <kdebug.h> | 38 | #include <kdebug.h> |
37 | #include <kconfig.h> | 39 | #include <kconfig.h> |
38 | #include <kcalendarsystem.h> | 40 | #include <kcalendarsystem.h> |
39 | #include <kprinter.h> | 41 | #include <kprinter.h> |
40 | 42 | ||
@@ -140,18 +142,18 @@ CalPrintBase::CalPrintBase( KPrinter *printer, Calendar *cal, KConfig *cfg ) | |||
140 | CalPrintBase::~CalPrintBase() | 142 | CalPrintBase::~CalPrintBase() |
141 | { | 143 | { |
142 | } | 144 | } |
143 | 145 | ||
144 | 146 | ||
145 | 147 | ||
146 | QWidget *CalPrintBase::configWidget( QWidget *w ) | 148 | QWidget *CalPrintBase::configWidget( QWidget *w ) |
147 | { | 149 | { |
148 | QFrame *wdg = new QFrame( w ); | 150 | Q3Frame *wdg = new Q3Frame( w ); |
149 | QVBoxLayout *layout = new QVBoxLayout( wdg ); | 151 | Q3VBoxLayout *layout = new Q3VBoxLayout( wdg ); |
150 | 152 | ||
151 | QLabel *title = new QLabel( description(), wdg ); | 153 | QLabel *title = new QLabel( description(), wdg ); |
152 | QFont titleFont( title->font() ); | 154 | QFont titleFont( title->font() ); |
153 | titleFont.setPointSize( 20 ); | 155 | titleFont.setPointSize( 20 ); |
154 | titleFont.setBold( true ); | 156 | titleFont.setBold( true ); |
155 | title->setFont( titleFont ); | 157 | title->setFont( titleFont ); |
156 | 158 | ||
157 | layout->addWidget( title ); | 159 | layout->addWidget( title ); |
@@ -280,50 +282,50 @@ void CalPrintBase::drawSmallMonth(QPainter &p, const QDate &qd, | |||
280 | QDate monthDate(QDate(qd.year(), qd.month(), 1)); | 282 | QDate monthDate(QDate(qd.year(), qd.month(), 1)); |
281 | QDate monthDate2; | 283 | QDate monthDate2; |
282 | int month = monthDate.month(); | 284 | int month = monthDate.month(); |
283 | 285 | ||
284 | // draw the title | 286 | // draw the title |
285 | p.setFont(QFont("helvetica", 7, QFont::Bold)); | 287 | p.setFont(QFont("helvetica", 7, QFont::Bold)); |
286 | // int lineSpacing = p.fontMetrics().lineSpacing(); | 288 | // int lineSpacing = p.fontMetrics().lineSpacing(); |
287 | const KCalendarSystem *calSys = KOGlobals::self()->calendarSystem(); | 289 | const KCalendarSystem *calSys = KOGlobals::self()->calendarSystem(); |
288 | p.drawText(x, y, width, height/4, AlignCenter, calSys->monthName( qd ) ); | 290 | p.drawText(x, y, width, height/4, Qt::AlignCenter, calSys->monthName( qd ) ); |
289 | 291 | ||
290 | int cellWidth = width/7; | 292 | int cellWidth = width/7; |
291 | int cellHeight = height/8; | 293 | int cellHeight = height/8; |
292 | QString tmpStr; | 294 | QString tmpStr; |
293 | 295 | ||
294 | // correct begin of week | 296 | // correct begin of week |
295 | int weekdayCol = weekdayColumn( qd.dayOfWeek() ); | 297 | int weekdayCol = weekdayColumn( qd.dayOfWeek() ); |
296 | monthDate2 = monthDate.addDays(-weekdayCol); | 298 | monthDate2 = monthDate.addDays(-weekdayCol); |
297 | 299 | ||
298 | // draw days of week | 300 | // draw days of week |
299 | p.setFont(QFont("helvetica", 7, QFont::Bold)); | 301 | p.setFont(QFont("helvetica", 7, QFont::Bold)); |
300 | for (int col = 0; col < 7; col++) { | 302 | for (int col = 0; col < 7; col++) { |
301 | // tmpStr.sprintf("%c",(const char*)monthDate2.dayName(monthDate2.dayOfWeek())); | 303 | // tmpStr.sprintf("%c",(const char*)monthDate2.dayName(monthDate2.dayOfWeek())); |
302 | tmpStr=calSys->weekDayName( monthDate2 )[0].upper(); | 304 | tmpStr=calSys->weekDayName( monthDate2 )[0].upper(); |
303 | p.drawText(x+col*cellWidth, y+height/4, cellWidth, cellHeight, | 305 | p.drawText(x+col*cellWidth, y+height/4, cellWidth, cellHeight, |
304 | AlignCenter, tmpStr); | 306 | Qt::AlignCenter, tmpStr); |
305 | monthDate2 = monthDate2.addDays(1); | 307 | monthDate2 = monthDate2.addDays(1); |
306 | } | 308 | } |
307 | 309 | ||
308 | // draw separator line | 310 | // draw separator line |
309 | p.drawLine(x, y+height/4+cellHeight, x+width, y+height/4+cellHeight); | 311 | p.drawLine(x, y+height/4+cellHeight, x+width, y+height/4+cellHeight); |
310 | 312 | ||
311 | for (int row = 0; row < 5; row++) { | 313 | for (int row = 0; row < 5; row++) { |
312 | for (int col = 0; col < 7; col++) { | 314 | for (int col = 0; col < 7; col++) { |
313 | if (monthDate.month() != month) | 315 | if (monthDate.month() != month) |
314 | break; | 316 | break; |
315 | if (firstCol) { | 317 | if (firstCol) { |
316 | firstCol = true; | 318 | firstCol = true; |
317 | col = weekdayColumn( monthDate.dayOfWeek() ); | 319 | col = weekdayColumn( monthDate.dayOfWeek() ); |
318 | } | 320 | } |
319 | p.drawText( x+col*cellWidth, | 321 | p.drawText( x+col*cellWidth, |
320 | y+height/4+cellHeight+(row*cellHeight), | 322 | y+height/4+cellHeight+(row*cellHeight), |
321 | cellWidth, cellHeight, AlignCenter, | 323 | cellWidth, cellHeight, Qt::AlignCenter, |
322 | tmpStr.setNum(monthDate.day()) ); | 324 | tmpStr.setNum(monthDate.day()) ); |
323 | monthDate = monthDate.addDays(1); | 325 | monthDate = monthDate.addDays(1); |
324 | } | 326 | } |
325 | } | 327 | } |
326 | } | 328 | } |
327 | 329 | ||
328 | 330 | ||
329 | /////////////////////////////////////////////////////////////////////////////// | 331 | /////////////////////////////////////////////////////////////////////////////// |
@@ -353,17 +355,17 @@ void CalPrintBase::drawDaysOfWeekBox(QPainter &p, const QDate &qd, | |||
353 | { | 355 | { |
354 | const KCalendarSystem *calSys = KOGlobals::self()->calendarSystem(); | 356 | const KCalendarSystem *calSys = KOGlobals::self()->calendarSystem(); |
355 | 357 | ||
356 | p.setFont( QFont( "helvetica", 10, QFont::Bold ) ); | 358 | p.setFont( QFont( "helvetica", 10, QFont::Bold ) ); |
357 | p.drawRect( x, y, width, height ); | 359 | p.drawRect( x, y, width, height ); |
358 | // p.fillRect( x+1, y+1, | 360 | // p.fillRect( x+1, y+1, |
359 | // width-2, height-2, | 361 | // width-2, height-2, |
360 | // QBrush( Dense7Pattern ) ); | 362 | // QBrush( Dense7Pattern ) ); |
361 | p.drawText( x+5, y, width-10, height, AlignCenter | AlignVCenter, | 363 | p.drawText( x+5, y, width-10, height, Qt::AlignCenter | Qt::AlignVCenter, |
362 | calSys->weekDayName( qd ) ); | 364 | calSys->weekDayName( qd ) ); |
363 | } | 365 | } |
364 | 366 | ||
365 | 367 | ||
366 | void CalPrintBase::drawTimeLine(QPainter &p, | 368 | void CalPrintBase::drawTimeLine(QPainter &p, |
367 | const QTime &fromTime, const QTime &toTime, | 369 | const QTime &fromTime, const QTime &toTime, |
368 | int x, int y, int width, int height) | 370 | int x, int y, int width, int height) |
369 | { | 371 | { |
@@ -396,26 +398,26 @@ void CalPrintBase::drawTimeLine(QPainter &p, | |||
396 | if ( !KGlobal::locale()->use12Clock() ) { | 398 | if ( !KGlobal::locale()->use12Clock() ) { |
397 | numStr.setNum(curTime.hour()); | 399 | numStr.setNum(curTime.hour()); |
398 | if (cellHeight > 30) { | 400 | if (cellHeight > 30) { |
399 | p.setFont(QFont("helvetica", 16, QFont::Bold)); | 401 | p.setFont(QFont("helvetica", 16, QFont::Bold)); |
400 | } else { | 402 | } else { |
401 | p.setFont(QFont("helvetica", 12, QFont::Bold)); | 403 | p.setFont(QFont("helvetica", 12, QFont::Bold)); |
402 | } | 404 | } |
403 | p.drawText(x+2, (int)currY+2, width/2-2, (int)cellHeight, | 405 | p.drawText(x+2, (int)currY+2, width/2-2, (int)cellHeight, |
404 | AlignTop|AlignRight, numStr); | 406 | Qt::AlignTop|Qt::AlignRight, numStr); |
405 | p.setFont(QFont("helvetica", 10, QFont::Normal)); | 407 | p.setFont(QFont("helvetica", 10, QFont::Normal)); |
406 | p.drawText(x+width/2, (int)currY+2, width/2+2, (int)(cellHeight/2)-3, | 408 | p.drawText(x+width/2, (int)currY+2, width/2+2, (int)(cellHeight/2)-3, |
407 | AlignTop | AlignLeft, "00"); | 409 | Qt::AlignTop | Qt::AlignLeft, "00"); |
408 | } else { | 410 | } else { |
409 | QTime time( curTime.hour(), 0 ); | 411 | QTime time( curTime.hour(), 0 ); |
410 | numStr = KGlobal::locale()->formatTime( time ); | 412 | numStr = KGlobal::locale()->formatTime( time ); |
411 | p.setFont(QFont("helvetica", 14, QFont::Bold)); | 413 | p.setFont(QFont("helvetica", 14, QFont::Bold)); |
412 | p.drawText(x+2, (int)currY+2, width-4, (int)cellHeight/2-3, | 414 | p.drawText(x+2, (int)currY+2, width-4, (int)cellHeight/2-3, |
413 | AlignTop|AlignLeft, numStr); | 415 | Qt::AlignTop|Qt::AlignLeft, numStr); |
414 | } | 416 | } |
415 | currY+=cellHeight; | 417 | currY+=cellHeight; |
416 | } // enough space for half-hour line and time | 418 | } // enough space for half-hour line and time |
417 | if (curTime.secsTo(endTime)>3600) | 419 | if (curTime.secsTo(endTime)>3600) |
418 | curTime=curTime.addSecs(3600); | 420 | curTime=curTime.addSecs(3600); |
419 | else curTime=endTime; | 421 | else curTime=endTime; |
420 | } // currTime<endTime | 422 | } // currTime<endTime |
421 | } | 423 | } |
@@ -467,17 +469,17 @@ void CalPrintBase::drawAllDayBox(QPainter &p, Event::List &eventList, | |||
467 | text += " ("+currEvent->location()+")"; | 469 | text += " ("+currEvent->location()+")"; |
468 | if (expandable) { | 470 | if (expandable) { |
469 | if (mUseColors) | 471 | if (mUseColors) |
470 | setCategoryColors(p, currEvent); | 472 | setCategoryColors(p, currEvent); |
471 | 473 | ||
472 | p.drawRect( x, offset, width, height ); | 474 | p.drawRect( x, offset, width, height ); |
473 | 475 | ||
474 | p.drawText( x+5, offset+5, width-10, height-10, | 476 | p.drawText( x+5, offset+5, width-10, height-10, |
475 | AlignCenter | AlignVCenter | AlignJustify | WordBreak, | 477 | Qt::AlignCenter | Qt::AlignVCenter | Qt::AlignJustify | Qt::WordBreak, |
476 | text ); | 478 | text ); |
477 | // reset the colors | 479 | // reset the colors |
478 | p.setBrush( oldBrush ); | 480 | p.setBrush( oldBrush ); |
479 | p.setPen( oldPen ); | 481 | p.setPen( oldPen ); |
480 | p.setBackgroundColor(oldBgColor); | 482 | p.setBackgroundColor(oldBgColor); |
481 | 483 | ||
482 | offset += height; | 484 | offset += height; |
483 | } else { | 485 | } else { |
@@ -488,17 +490,17 @@ void CalPrintBase::drawAllDayBox(QPainter &p, Event::List &eventList, | |||
488 | } | 490 | } |
489 | } | 491 | } |
490 | 492 | ||
491 | if (!expandable) { | 493 | if (!expandable) { |
492 | p.drawRect(x, offset, width, height); | 494 | p.drawRect(x, offset, width, height); |
493 | if (!multiDayStr.isEmpty()) { | 495 | if (!multiDayStr.isEmpty()) { |
494 | // p.fillRect(x+1, offset+1, width-2, height-2, QBrush(Dense5Pattern) ); | 496 | // p.fillRect(x+1, offset+1, width-2, height-2, QBrush(Dense5Pattern) ); |
495 | p.drawText( x+5, offset+5, width-10, height-10, | 497 | p.drawText( x+5, offset+5, width-10, height-10, |
496 | AlignLeft | AlignTop | AlignJustify , | 498 | Qt::AlignLeft | Qt::AlignTop | Qt::AlignJustify , |
497 | multiDayStr); | 499 | multiDayStr); |
498 | } | 500 | } |
499 | } else { | 501 | } else { |
500 | height=offset-y; | 502 | height=offset-y; |
501 | } | 503 | } |
502 | } | 504 | } |
503 | 505 | ||
504 | 506 | ||
@@ -555,25 +557,25 @@ void CalPrintBase::drawAgendaDayBox( QPainter &p, Event::List &events, | |||
555 | } | 557 | } |
556 | 558 | ||
557 | QDateTime startPrintDate = QDateTime( qd, fromTime ); | 559 | QDateTime startPrintDate = QDateTime( qd, fromTime ); |
558 | QDateTime endPrintDate = QDateTime( qd, toTime ); | 560 | QDateTime endPrintDate = QDateTime( qd, toTime ); |
559 | 561 | ||
560 | // Calculate horizontal positions and widths of events taking into account | 562 | // Calculate horizontal positions and widths of events taking into account |
561 | // overlapping events | 563 | // overlapping events |
562 | 564 | ||
563 | QPtrList<KOrg::CellItem> cells; | 565 | Q3PtrList<KOrg::CellItem> cells; |
564 | cells.setAutoDelete( true ); | 566 | cells.setAutoDelete( true ); |
565 | 567 | ||
566 | Event::List::ConstIterator itEvents; | 568 | Event::List::ConstIterator itEvents; |
567 | for( itEvents = events.begin(); itEvents != events.end(); ++itEvents ) { | 569 | for( itEvents = events.begin(); itEvents != events.end(); ++itEvents ) { |
568 | cells.append( new PrintCellItem( *itEvents, qd ) ); | 570 | cells.append( new PrintCellItem( *itEvents, qd ) ); |
569 | } | 571 | } |
570 | 572 | ||
571 | QPtrListIterator<KOrg::CellItem> it1( cells ); | 573 | Q3PtrListIterator<KOrg::CellItem> it1( cells ); |
572 | for( it1.toFirst(); it1.current(); ++it1 ) { | 574 | for( it1.toFirst(); it1.current(); ++it1 ) { |
573 | KOrg::CellItem *placeItem = it1.current(); | 575 | KOrg::CellItem *placeItem = it1.current(); |
574 | 576 | ||
575 | KOrg::CellItem::placeItem( cells, placeItem ); | 577 | KOrg::CellItem::placeItem( cells, placeItem ); |
576 | } | 578 | } |
577 | 579 | ||
578 | QPen oldPen = p.pen(); | 580 | QPen oldPen = p.pen(); |
579 | QColor oldBgColor = p.backgroundColor(); | 581 | QColor oldBgColor = p.backgroundColor(); |
@@ -588,17 +590,17 @@ void CalPrintBase::drawAgendaDayBox( QPainter &p, Event::List &events, | |||
588 | drawAgendaItem( placeItem, p, qd, startPrintDate, endPrintDate, minlen, x, | 590 | drawAgendaItem( placeItem, p, qd, startPrintDate, endPrintDate, minlen, x, |
589 | y, width ); | 591 | y, width ); |
590 | 592 | ||
591 | p.setBrush( oldBrush ); | 593 | p.setBrush( oldBrush ); |
592 | p.setPen( oldPen ); | 594 | p.setPen( oldPen ); |
593 | p.setBackgroundColor( oldBgColor ); | 595 | p.setBackgroundColor( oldBgColor ); |
594 | } | 596 | } |
595 | 597 | ||
596 | p.setBrush( QBrush( NoBrush ) ); | 598 | p.setBrush( QBrush( Qt::NoBrush ) ); |
597 | } | 599 | } |
598 | 600 | ||
599 | 601 | ||
600 | void CalPrintBase::drawAgendaItem( PrintCellItem *item, QPainter &p, | 602 | void CalPrintBase::drawAgendaItem( PrintCellItem *item, QPainter &p, |
601 | const QDate &qd, | 603 | const QDate &qd, |
602 | const QDateTime &startPrintDate, | 604 | const QDateTime &startPrintDate, |
603 | const QDateTime &endPrintDate, | 605 | const QDateTime &endPrintDate, |
604 | float minlen, int x, int y, int width ) | 606 | float minlen, int x, int y, int width ) |
@@ -630,17 +632,17 @@ void CalPrintBase::drawAgendaItem( PrintCellItem *item, QPainter &p, | |||
630 | if ( !event->location().isEmpty() ) | 632 | if ( !event->location().isEmpty() ) |
631 | text += " (" +event->location()+")"; | 633 | text += " (" +event->location()+")"; |
632 | // p.save(); | 634 | // p.save(); |
633 | QPen pe = p.pen(); | 635 | QPen pe = p.pen(); |
634 | pe.setWidth( 2 ); | 636 | pe.setWidth( 2 ); |
635 | p.setPen( pe ); | 637 | p.setPen( pe ); |
636 | p.drawRect( currentX, currentyPos+1, currentWidth+1, eventLength+1 ); | 638 | p.drawRect( currentX, currentyPos+1, currentWidth+1, eventLength+1 ); |
637 | p.drawText( currentX+3, currentyPos+2, currentWidth-5, eventLength-3, | 639 | p.drawText( currentX+3, currentyPos+2, currentWidth-5, eventLength-3, |
638 | AlignLeft | AlignTop | AlignJustify | WordBreak, | 640 | Qt::AlignLeft | Qt::AlignTop | Qt::AlignJustify | Qt::TextWordWrap, |
639 | text); | 641 | text); |
640 | // p.restore(); | 642 | // p.restore(); |
641 | } | 643 | } |
642 | } | 644 | } |
643 | 645 | ||
644 | void CalPrintBase::drawDayBox(QPainter &p, const QDate &qd, | 646 | void CalPrintBase::drawDayBox(QPainter &p, const QDate &qd, |
645 | int x, int y, int width, int height, | 647 | int x, int y, int width, int height, |
646 | bool fullDate) | 648 | bool fullDate) |
@@ -665,27 +667,27 @@ void CalPrintBase::drawDayBox(QPainter &p, const QDate &qd, | |||
665 | QString hstring; | 667 | QString hstring; |
666 | #ifndef KORG_NOPLUGINS | 668 | #ifndef KORG_NOPLUGINS |
667 | hstring=KOCore::self()->holiday(qd); | 669 | hstring=KOCore::self()->holiday(qd); |
668 | #endif | 670 | #endif |
669 | 671 | ||
670 | if (!hstring.isEmpty()) { | 672 | if (!hstring.isEmpty()) { |
671 | p.setFont( QFont( "helvetica", 8, QFont::Bold, true ) ); | 673 | p.setFont( QFont( "helvetica", 8, QFont::Bold, true ) ); |
672 | 674 | ||
673 | p.drawText( x+5, y, width-25, mSubHeaderHeight, AlignLeft | AlignVCenter, | 675 | p.drawText( x+5, y, width-25, mSubHeaderHeight, Qt::AlignLeft | Qt::AlignVCenter, |
674 | hstring ); | 676 | hstring ); |
675 | } | 677 | } |
676 | p.setFont(QFont("helvetica", 10, QFont::Bold)); | 678 | p.setFont(QFont("helvetica", 10, QFont::Bold)); |
677 | if ( fullDate) { | 679 | if ( fullDate) { |
678 | // use short date format, if long date is too long | 680 | // use short date format, if long date is too long |
679 | QFontMetrics fm ( p.font() ); | 681 | QFontMetrics fm ( p.font() ); |
680 | if ( fm.width( dayNumStr ) > width -10 ) | 682 | if ( fm.width( dayNumStr ) > width -10 ) |
681 | dayNumStr = local->formatDate(qd, true); | 683 | dayNumStr = local->formatDate(qd, true); |
682 | } | 684 | } |
683 | p.drawText(x+5, y, width-10, mSubHeaderHeight, AlignRight | AlignVCenter, | 685 | p.drawText(x+5, y, width-10, mSubHeaderHeight, Qt::AlignRight | Qt::AlignVCenter, |
684 | dayNumStr); | 686 | dayNumStr); |
685 | Event::List eventList; | 687 | Event::List eventList; |
686 | eventList.fill( mCalendar->events( qd, true )); | 688 | eventList.fill( mCalendar->events( qd, true )); |
687 | Todo::List todos; | 689 | Todo::List todos; |
688 | todos.fill( mCalendar->todos( qd )); | 690 | todos.fill( mCalendar->todos( qd )); |
689 | QString outStr; | 691 | QString outStr; |
690 | p.setFont( QFont( "helvetica", 8 ) ); | 692 | p.setFont( QFont( "helvetica", 8 ) ); |
691 | int lineSpacing = p.fontMetrics().lineSpacing(); | 693 | int lineSpacing = p.fontMetrics().lineSpacing(); |
@@ -719,17 +721,17 @@ void CalPrintBase::drawDayBox(QPainter &p, const QDate &qd, | |||
719 | 721 | ||
720 | outStr = local->formatTime(t1); | 722 | outStr = local->formatTime(t1); |
721 | outStr += " " + currEvent->summary(); | 723 | outStr += " " + currEvent->summary(); |
722 | } | 724 | } |
723 | 725 | ||
724 | } // doesFloat | 726 | } // doesFloat |
725 | 727 | ||
726 | p.drawText(x+5, y+textY, width-10, lineSpacing, | 728 | p.drawText(x+5, y+textY, width-10, lineSpacing, |
727 | AlignLeft|AlignBottom, outStr); | 729 | Qt::AlignLeft|Qt::AlignBottom, outStr); |
728 | textY+=lineSpacing; | 730 | textY+=lineSpacing; |
729 | } | 731 | } |
730 | 732 | ||
731 | if ( textY<height ) { | 733 | if ( textY<height ) { |
732 | 734 | ||
733 | Todo::List::ConstIterator it2; | 735 | Todo::List::ConstIterator it2; |
734 | for( it2 = todos.begin(); it2 != todos.end() && textY<height; ++it2 ) { | 736 | for( it2 = todos.begin(); it2 != todos.end() && textY<height; ++it2 ) { |
735 | Todo *todo = *it2; | 737 | Todo *todo = *it2; |
@@ -738,17 +740,17 @@ void CalPrintBase::drawDayBox(QPainter &p, const QDate &qd, | |||
738 | if (!todo->doesFloat()) { | 740 | if (!todo->doesFloat()) { |
739 | text += KGlobal::locale()->formatTime(todo->dtDue().time()); | 741 | text += KGlobal::locale()->formatTime(todo->dtDue().time()); |
740 | text += " "; | 742 | text += " "; |
741 | } | 743 | } |
742 | } | 744 | } |
743 | text += i18n("To-Do: %1").arg(todo->summary()); | 745 | text += i18n("To-Do: %1").arg(todo->summary()); |
744 | 746 | ||
745 | p.drawText(x+5, y+textY, width-10, lineSpacing, | 747 | p.drawText(x+5, y+textY, width-10, lineSpacing, |
746 | AlignLeft|AlignBottom, text); | 748 | Qt::AlignLeft|Qt::AlignBottom, text); |
747 | textY+=lineSpacing; | 749 | textY+=lineSpacing; |
748 | } | 750 | } |
749 | } | 751 | } |
750 | } | 752 | } |
751 | 753 | ||
752 | 754 | ||
753 | /////////////////////////////////////////////////////////////////////////////// | 755 | /////////////////////////////////////////////////////////////////////////////// |
754 | 756 | ||
@@ -844,17 +846,17 @@ void CalPrintBase::drawMonth(QPainter &p, const QDate &qd, bool weeknumbers, | |||
844 | QFont newFont(p.font()); | 846 | QFont newFont(p.font()); |
845 | newFont.setPointSize(7); | 847 | newFont.setPointSize(7); |
846 | p.setFont(newFont); | 848 | p.setFont(newFont); |
847 | xoffset += 18; | 849 | xoffset += 18; |
848 | QDate weekDate(monthDate); | 850 | QDate weekDate(monthDate); |
849 | for (int row = 0; row<rows; row++) { | 851 | for (int row = 0; row<rows; row++) { |
850 | int calWeek = weekDate.weekNumber(); | 852 | int calWeek = weekDate.weekNumber(); |
851 | QRect rc(x, y+yoffset+cellHeight*row, xoffset-1, cellHeight); | 853 | QRect rc(x, y+yoffset+cellHeight*row, xoffset-1, cellHeight); |
852 | p.drawText( rc, AlignRight|AlignVCenter, QString::number(calWeek) ); | 854 | p.drawText( rc, Qt::AlignRight|Qt::AlignVCenter, QString::number(calWeek) ); |
853 | weekDate = weekDate.addDays(7); | 855 | weekDate = weekDate.addDays(7); |
854 | } | 856 | } |
855 | p.setFont(oldFont); | 857 | p.setFont(oldFont); |
856 | } | 858 | } |
857 | 859 | ||
858 | drawDaysOfWeek( p, monthDate, monthDate.addDays(6), x+xoffset, y, width-xoffset, mSubHeaderHeight ); | 860 | drawDaysOfWeek( p, monthDate, monthDate.addDays(6), x+xoffset, y, width-xoffset, mSubHeaderHeight ); |
859 | int cellWidth = (width-xoffset) / 7; | 861 | int cellWidth = (width-xoffset) / 7; |
860 | 862 | ||
@@ -892,35 +894,35 @@ void CalPrintBase::drawTodo( bool completed, int &count, Todo * item, QPainter & | |||
892 | const KLocale *local = KGlobal::locale(); | 894 | const KLocale *local = KGlobal::locale(); |
893 | int priority=item->priority(); | 895 | int priority=item->priority(); |
894 | int posdue=posDueDt; | 896 | int posdue=posDueDt; |
895 | if (posdue<0) posdue=x+width; | 897 | if (posdue<0) posdue=x+width; |
896 | QRect rect; | 898 | QRect rect; |
897 | TodoParentStart startpt; | 899 | TodoParentStart startpt; |
898 | // This list keeps all starting points of the parent todos so the connection | 900 | // This list keeps all starting points of the parent todos so the connection |
899 | // lines of the tree can easily be drawn (needed if a new page is started) | 901 | // lines of the tree can easily be drawn (needed if a new page is started) |
900 | static QPtrList<TodoParentStart> startPoints; | 902 | static Q3PtrList<TodoParentStart> startPoints; |
901 | if (level<1) { | 903 | if (level<1) { |
902 | startPoints.clear(); | 904 | startPoints.clear(); |
903 | } | 905 | } |
904 | 906 | ||
905 | // size of item | 907 | // size of item |
906 | outStr=item->summary(); | 908 | outStr=item->summary(); |
907 | if ( ! item->location().isEmpty() ) | 909 | if ( ! item->location().isEmpty() ) |
908 | outStr += " ("+item->location()+")"; | 910 | outStr += " ("+item->location()+")"; |
909 | if ( item->hasDueDate() && posDueDt>=0 ) { | 911 | if ( item->hasDueDate() && posDueDt>=0 ) { |
910 | outStr += " [" +local->formatDate(item->dtDue().date(),true)+"]"; | 912 | outStr += " [" +local->formatDate(item->dtDue().date(),true)+"]"; |
911 | } | 913 | } |
912 | int left = possummary+(level*10); | 914 | int left = possummary+(level*10); |
913 | rect = p.boundingRect(left, y, (posdue-left-5),-1, WordBreak, outStr); | 915 | rect = p.boundingRect(left, y, (posdue-left-5),-1, Qt::WordBreak, outStr); |
914 | //qDebug("bottom1 %d ", rect.bottom() ); | 916 | //qDebug("bottom1 %d ", rect.bottom() ); |
915 | if ( !item->description().isEmpty() && desc ) { | 917 | if ( !item->description().isEmpty() && desc ) { |
916 | outStr = item->description(); | 918 | outStr = item->description(); |
917 | rect = p.boundingRect( left+20, rect.bottom()+5, width-(left+10-x), -1, | 919 | rect = p.boundingRect( left+20, rect.bottom()+5, width-(left+10-x), -1, |
918 | WordBreak, outStr ); | 920 | Qt::WordBreak, outStr ); |
919 | } | 921 | } |
920 | //qDebug("bottom2 %d y+h %d y %d ph %d", rect.bottom(), y+height, y , pageHeight ); | 922 | //qDebug("bottom2 %d y+h %d y %d ph %d", rect.bottom(), y+height, y , pageHeight ); |
921 | // if too big make new page | 923 | // if too big make new page |
922 | if ( rect.bottom() > y+height) { | 924 | if ( rect.bottom() > y+height) { |
923 | // first draw the connection lines from parent todos: | 925 | // first draw the connection lines from parent todos: |
924 | if (level > 0 && connectSubTodos) { | 926 | if (level > 0 && connectSubTodos) { |
925 | TodoParentStart *rct; | 927 | TodoParentStart *rct; |
926 | for ( rct = startPoints.first(); rct; rct = startPoints.next() ) { | 928 | for ( rct = startPoints.first(); rct; rct = startPoints.next() ) { |
@@ -928,101 +930,99 @@ void CalPrintBase::drawTodo( bool completed, int &count, Todo * item, QPainter & | |||
928 | int center = rct->mRect.left() + (rct->mRect.width()/2); | 930 | int center = rct->mRect.left() + (rct->mRect.width()/2); |
929 | int to = p.viewport().bottom(); | 931 | int to = p.viewport().bottom(); |
930 | 932 | ||
931 | // draw either from start point of parent or from top of the page | 933 | // draw either from start point of parent or from top of the page |
932 | if (rct->mSamePage) | 934 | if (rct->mSamePage) |
933 | start = rct->mRect.bottom() + 1; | 935 | start = rct->mRect.bottom() + 1; |
934 | else | 936 | else |
935 | start = p.viewport().top(); | 937 | start = p.viewport().top(); |
936 | p.moveTo( center, start ); | 938 | p.drawLine( center, start, center, to ); |
937 | p.lineTo( center, to ); | ||
938 | rct->mSamePage=false; | 939 | rct->mSamePage=false; |
939 | } | 940 | } |
940 | } | 941 | } |
941 | y=0; | 942 | y=0; |
942 | height=pageHeight-y; | 943 | height=pageHeight-y; |
943 | mPrinter->newPage(); | 944 | mPrinter->newPage(); |
944 | } | 945 | } |
945 | 946 | ||
946 | // If this is a sub-item, r will not be 0, and we want the LH side of the priority line up | 947 | // If this is a sub-item, r will not be 0, and we want the LH side of the priority line up |
947 | //to the RH side of the parent item's priority | 948 | //to the RH side of the parent item's priority |
948 | if (r && pospriority >= 0 ) { | 949 | if (r && pospriority >= 0 ) { |
949 | pospriority = r->mRect.right() + 1; | 950 | pospriority = r->mRect.right() + 1; |
950 | } | 951 | } |
951 | 952 | ||
952 | // Priority | 953 | // Priority |
953 | outStr.setNum(priority); | 954 | outStr.setNum(priority); |
954 | rect = p.boundingRect(pospriority, y + 10, 5, -1, AlignCenter, outStr); | 955 | rect = p.boundingRect(pospriority, y + 10, 5, -1, Qt::AlignCenter, outStr); |
955 | // Make it a more reasonable size | 956 | // Make it a more reasonable size |
956 | rect.setWidth(19); | 957 | rect.setWidth(19); |
957 | rect.setHeight(19); | 958 | rect.setHeight(19); |
958 | if ( priority > 0 && pospriority>=0 ) { | 959 | if ( priority > 0 && pospriority>=0 ) { |
959 | p.drawText(rect, AlignCenter, outStr); | 960 | p.drawText(rect, Qt::AlignCenter, outStr); |
960 | p.drawRect(rect); | 961 | p.drawRect(rect); |
961 | // cross out the rectangle for completed items | 962 | // cross out the rectangle for completed items |
962 | if ( item->isCompleted() ) { | 963 | if ( item->isCompleted() ) { |
963 | p.drawLine( rect.topLeft(), rect.bottomRight() ); | 964 | p.drawLine( rect.topLeft(), rect.bottomRight() ); |
964 | p.drawLine( rect.topRight(), rect.bottomLeft() ); | 965 | p.drawLine( rect.topRight(), rect.bottomLeft() ); |
965 | } else if (item->cancelled() ) { | 966 | } else if (item->cancelled() ) { |
966 | QPen pen = p.pen(); | 967 | QPen pen = p.pen(); |
967 | p.setPen ( QPen ( black, 2) ); | 968 | p.setPen ( QPen ( Qt::black, 2) ); |
968 | p.drawLine( rect.left()+2,rect.top()+rect.height()/2, rect.right()-2, +rect.top()+rect.height()/2 ); | 969 | p.drawLine( rect.left()+2,rect.top()+rect.height()/2, rect.right()-2, +rect.top()+rect.height()/2 ); |
969 | p.setPen( pen ); | 970 | p.setPen( pen ); |
970 | } | 971 | } |
971 | } | 972 | } |
972 | startpt.mRect = rect; //save for later | 973 | startpt.mRect = rect; //save for later |
973 | 974 | ||
974 | // Connect the dots | 975 | // Connect the dots |
975 | if (level > 0 && connectSubTodos) { | 976 | if (level > 0 && connectSubTodos) { |
976 | int bottom; | 977 | int bottom; |
977 | int center( r->mRect.left() + (r->mRect.width()/2)+1 ); | 978 | int center( r->mRect.left() + (r->mRect.width()/2)+1 ); |
978 | if (r->mSamePage ) | 979 | if (r->mSamePage ) |
979 | bottom = r->mRect.bottom();//lutz + 1; | 980 | bottom = r->mRect.bottom();//lutz + 1; |
980 | else | 981 | else |
981 | bottom = 0; | 982 | bottom = 0; |
982 | int to( rect.top() + (rect.height()/2)+1 ); | 983 | int to( rect.top() + (rect.height()/2)+1 ); |
983 | int endx( rect.left() ); | 984 | int endx( rect.left() ); |
984 | p.moveTo(center, bottom); | 985 | p.drawLine(center,bottom, center,to); |
985 | p.lineTo(center, to); | 986 | p.drawLine(center,to, endx,to); |
986 | p.lineTo(endx, to); | ||
987 | } | 987 | } |
988 | 988 | ||
989 | // if completed, use strike out font | 989 | // if completed, use strike out font |
990 | // LR does not work - font is underlined, not striked out | 990 | // LR does not work - font is underlined, not striked out |
991 | //QFont ft=p.font(); | 991 | //QFont ft=p.font(); |
992 | //ft.setStrikeOut( item->isCompleted() ); | 992 | //ft.setStrikeOut( item->isCompleted() ); |
993 | //p.setFont( ft ); | 993 | //p.setFont( ft ); |
994 | // summary | 994 | // summary |
995 | outStr=item->summary(); | 995 | outStr=item->summary(); |
996 | if ( ! item->location().isEmpty() ) | 996 | if ( ! item->location().isEmpty() ) |
997 | outStr += " ("+item->location()+")"; | 997 | outStr += " ("+item->location()+")"; |
998 | if ( item->hasDueDate() && posDueDt>=0 ) { | 998 | if ( item->hasDueDate() && posDueDt>=0 ) { |
999 | outStr += " [" +item->dtDueStr(true)+"]"; | 999 | outStr += " [" +item->dtDueStr(true)+"]"; |
1000 | } | 1000 | } |
1001 | rect = p.boundingRect( left, rect.top(), (posdue-(left + rect.width() + 5)), | 1001 | rect = p.boundingRect( left, rect.top(), (posdue-(left + rect.width() + 5)), |
1002 | -1, WordBreak, outStr); | 1002 | -1, Qt::WordBreak, outStr); |
1003 | QRect newrect; | 1003 | QRect newrect; |
1004 | p.drawText( rect, WordBreak, outStr, -1, &newrect ); | 1004 | p.drawText( rect, Qt::WordBreak, outStr, -1, &newrect ); |
1005 | //ft.setStrikeOut(false); | 1005 | //ft.setStrikeOut(false); |
1006 | // p.setFont(ft); | 1006 | // p.setFont(ft); |
1007 | 1007 | ||
1008 | // due | 1008 | // due |
1009 | // if ( item->hasDueDate() && posDueDt>=0 ) { | 1009 | // if ( item->hasDueDate() && posDueDt>=0 ) { |
1010 | // outStr = local->formatDate(item->dtDue().date(),true); | 1010 | // outStr = local->formatDate(item->dtDue().date(),true); |
1011 | // rect = p.boundingRect(posdue, y, x+width, -1, AlignTop|AlignLeft, outStr); | 1011 | // rect = p.boundingRect(posdue, y, x+width, -1, AlignTop|AlignLeft, outStr); |
1012 | // p.drawText(rect, AlignTop|AlignLeft, outStr); | 1012 | // p.drawText(rect, AlignTop|AlignLeft, outStr); |
1013 | // } | 1013 | // } |
1014 | 1014 | ||
1015 | if ( !item->description().isEmpty() && desc ) { | 1015 | if ( !item->description().isEmpty() && desc ) { |
1016 | y=newrect.bottom() + 5; | 1016 | y=newrect.bottom() + 5; |
1017 | outStr = item->description(); | 1017 | outStr = item->description(); |
1018 | rect = p.boundingRect( left+20, y, x+width-(left+10), -1, | 1018 | rect = p.boundingRect( left+20, y, x+width-(left+10), -1, |
1019 | WordBreak, outStr ); | 1019 | Qt::WordBreak, outStr ); |
1020 | p.drawText( rect, WordBreak, outStr, -1, &newrect ); | 1020 | p.drawText( rect, Qt::WordBreak, outStr, -1, &newrect ); |
1021 | } | 1021 | } |
1022 | 1022 | ||
1023 | // Set the new line position | 1023 | // Set the new line position |
1024 | y=newrect.bottom() + 10; //set the line position | 1024 | y=newrect.bottom() + 10; //set the line position |
1025 | 1025 | ||
1026 | // If the item has subitems, we need to call ourselves recursively | 1026 | // If the item has subitems, we need to call ourselves recursively |
1027 | Incidence::List l;l.fill( item->relations()); | 1027 | Incidence::List l;l.fill( item->relations()); |
1028 | Incidence::List::ConstIterator it; | 1028 | Incidence::List::ConstIterator it; |
@@ -1133,18 +1133,18 @@ void CalPrintBase::drawSplitHeaderRight( QPainter &p, const QDate &fd, | |||
1133 | const QDate &td, | 1133 | const QDate &td, |
1134 | const QDate &, | 1134 | const QDate &, |
1135 | int width, int ) | 1135 | int width, int ) |
1136 | { | 1136 | { |
1137 | int tempStore = mSubHeaderHeight; | 1137 | int tempStore = mSubHeaderHeight; |
1138 | mSubHeaderHeight+= mSubHeaderHeight; | 1138 | mSubHeaderHeight+= mSubHeaderHeight; |
1139 | KLocale *local = KGlobal::locale(); | 1139 | KLocale *local = KGlobal::locale(); |
1140 | QFont font("helvetica", 18, QFont::Bold); | 1140 | QFont font("helvetica", 18, QFont::Bold); |
1141 | QPen penA( black,0); | 1141 | QPen penA( Qt::black,0); |
1142 | QPen penB( black,3); | 1142 | QPen penB( Qt::black,3); |
1143 | p.setFont(font); | 1143 | p.setFont(font); |
1144 | int lineSpacing = p.fontMetrics().lineSpacing(); | 1144 | int lineSpacing = p.fontMetrics().lineSpacing(); |
1145 | QString title; | 1145 | QString title; |
1146 | QString myOwner(mCalendar->getOwner()); | 1146 | QString myOwner(mCalendar->getOwner()); |
1147 | if ( fd.month() == td.month() ) { | 1147 | if ( fd.month() == td.month() ) { |
1148 | title = local->monthName(fd.month(), false) + ' ' + QString::number(fd.day()) + ' ' | 1148 | title = local->monthName(fd.month(), false) + ' ' + QString::number(fd.day()) + ' ' |
1149 | + '-' + ' ' + QString::number(td.day()); | 1149 | + '-' + ' ' + QString::number(td.day()); |
1150 | } else { | 1150 | } else { |
@@ -1156,27 +1156,27 @@ void CalPrintBase::drawSplitHeaderRight( QPainter &p, const QDate &fd, | |||
1156 | QFont serifFont("Helvetica", 30); | 1156 | QFont serifFont("Helvetica", 30); |
1157 | // serifFont.setFamily("Serif"); | 1157 | // serifFont.setFamily("Serif"); |
1158 | // serifFont.setWeight(87); | 1158 | // serifFont.setWeight(87); |
1159 | // serifFont.setItalic(true); | 1159 | // serifFont.setItalic(true); |
1160 | p.setFont(serifFont); | 1160 | p.setFont(serifFont); |
1161 | QFontInfo info(p.font()); | 1161 | QFontInfo info(p.font()); |
1162 | 1162 | ||
1163 | lineSpacing = p.fontMetrics().lineSpacing(); | 1163 | lineSpacing = p.fontMetrics().lineSpacing(); |
1164 | p.drawText(0, lineSpacing * 0, width, lineSpacing, AlignRight |AlignTop, title ); | 1164 | p.drawText(0, lineSpacing * 0, width, lineSpacing, Qt::AlignRight |Qt::AlignTop, title ); |
1165 | 1165 | ||
1166 | title.truncate(0); | 1166 | title.truncate(0); |
1167 | 1167 | ||
1168 | p.setPen(penB ); | 1168 | p.setPen(penB ); |
1169 | p.drawLine(200, lineSpacing * 1, width, lineSpacing * 1); | 1169 | p.drawLine(200, lineSpacing * 1, width, lineSpacing * 1); |
1170 | p.setPen(penA ); | 1170 | p.setPen(penA ); |
1171 | 1171 | ||
1172 | p.setFont(QFont("Helvetica", 20, QFont::Bold, TRUE)); | 1172 | p.setFont(QFont("Helvetica", 20, QFont::Bold, TRUE)); |
1173 | title += QString::number(fd.year()); | 1173 | title += QString::number(fd.year()); |
1174 | p.drawText(0, lineSpacing * 1, width, lineSpacing, AlignRight |AlignTop, title ); | 1174 | p.drawText(0, lineSpacing * 1, width, lineSpacing, Qt::AlignRight |Qt::AlignTop, title ); |
1175 | mSubHeaderHeight = tempStore ; | 1175 | mSubHeaderHeight = tempStore ; |
1176 | } | 1176 | } |
1177 | 1177 | ||
1178 | void CalPrintBase::drawSplitDay( QPainter &p, const QDate &qd, int width, | 1178 | void CalPrintBase::drawSplitDay( QPainter &p, const QDate &qd, int width, |
1179 | int height, int offsetLeft ) | 1179 | int height, int offsetLeft ) |
1180 | { | 1180 | { |
1181 | int tempStore = mSubHeaderHeight; | 1181 | int tempStore = mSubHeaderHeight; |
1182 | mSubHeaderHeight+= mSubHeaderHeight; | 1182 | mSubHeaderHeight+= mSubHeaderHeight; |
@@ -1192,17 +1192,17 @@ void CalPrintBase::drawSplitDay( QPainter &p, const QDate &qd, int width, | |||
1192 | dayName = local->weekDayName(qd.dayOfWeek()) + ' ' + ' ' + QString::number(qd.day()); | 1192 | dayName = local->weekDayName(qd.dayOfWeek()) + ' ' + ' ' + QString::number(qd.day()); |
1193 | //p.setBrush(QBrush(black)); | 1193 | //p.setBrush(QBrush(black)); |
1194 | // width+1 to make sure there's a continuous, black bar across the top. | 1194 | // width+1 to make sure there's a continuous, black bar across the top. |
1195 | p.setPen( QPen(Qt::black,2)); | 1195 | p.setPen( QPen(Qt::black,2)); |
1196 | p.drawRect(offsetLeft, mHeaderHeight + 5, width +1, mSubHeaderHeight); | 1196 | p.drawRect(offsetLeft, mHeaderHeight + 5, width +1, mSubHeaderHeight); |
1197 | p.setPen( Qt::black); | 1197 | p.setPen( Qt::black); |
1198 | p.setFont(QFont("helvetica", 12, QFont::Bold, true)); | 1198 | p.setFont(QFont("helvetica", 12, QFont::Bold, true)); |
1199 | p.drawText(offsetLeft, mHeaderHeight + 5, | 1199 | p.drawText(offsetLeft, mHeaderHeight + 5, |
1200 | width, mSubHeaderHeight, AlignHCenter | AlignVCenter, | 1200 | width, mSubHeaderHeight, Qt::AlignHCenter | Qt::AlignVCenter, |
1201 | dayName); | 1201 | dayName); |
1202 | 1202 | ||
1203 | p.setPen( QPen(Qt::black,2)); | 1203 | p.setPen( QPen(Qt::black,2)); |
1204 | p.setFont(QFont("helvetica", 12)); | 1204 | p.setFont(QFont("helvetica", 12)); |
1205 | p.setBrush(Qt::white); | 1205 | p.setBrush(Qt::white); |
1206 | it = eventList.begin(); | 1206 | it = eventList.begin(); |
1207 | int allDays = 0; | 1207 | int allDays = 0; |
1208 | /* | 1208 | /* |
@@ -1249,58 +1249,58 @@ void CalPrintBase::drawSplitDay( QPainter &p, const QDate &qd, int width, | |||
1249 | if ( ! currEvent->location().isEmpty() ) | 1249 | if ( ! currEvent->location().isEmpty() ) |
1250 | text += "\n("+currEvent->location()+")"; | 1250 | text += "\n("+currEvent->location()+")"; |
1251 | int endMinuteOff = (int) (minuteInc * currEvent->dtEnd().time().minute()); | 1251 | int endMinuteOff = (int) (minuteInc * currEvent->dtEnd().time().minute()); |
1252 | int cheight = (int) (minuteInc * | 1252 | int cheight = (int) (minuteInc * |
1253 | currEvent->dtStart().secsTo(currEvent->dtEnd()) / 60 ); | 1253 | currEvent->dtStart().secsTo(currEvent->dtEnd()) / 60 ); |
1254 | p.drawRect(offsetLeft+2, 1+offset+startMinuteOff+startTime*cellHeight, | 1254 | p.drawRect(offsetLeft+2, 1+offset+startMinuteOff+startTime*cellHeight, |
1255 | width-4, cheight); | 1255 | width-4, cheight); |
1256 | p.drawText(offsetLeft+12, offset+startMinuteOff+startTime*cellHeight+5, width-24, | 1256 | p.drawText(offsetLeft+12, offset+startMinuteOff+startTime*cellHeight+5, width-24, |
1257 | cheight-10, AlignHCenter | AlignTop, text); | 1257 | cheight-10, Qt::AlignHCenter | Qt::AlignTop, text); |
1258 | } | 1258 | } |
1259 | } | 1259 | } |
1260 | p.setBrush(QBrush(NoBrush)); | 1260 | p.setBrush(QBrush(Qt::NoBrush)); |
1261 | mSubHeaderHeight = tempStore ; | 1261 | mSubHeaderHeight = tempStore ; |
1262 | } | 1262 | } |
1263 | 1263 | ||
1264 | void CalPrintBase::drawSplitTimes( QPainter &p, int width, int timeWidth, | 1264 | void CalPrintBase::drawSplitTimes( QPainter &p, int width, int timeWidth, |
1265 | int height ) | 1265 | int height ) |
1266 | { | 1266 | { |
1267 | int tempStore = mSubHeaderHeight; | 1267 | int tempStore = mSubHeaderHeight; |
1268 | mSubHeaderHeight+= mSubHeaderHeight; | 1268 | mSubHeaderHeight+= mSubHeaderHeight; |
1269 | int startHour = KOPrefs::instance()->mDayBegins; | 1269 | int startHour = KOPrefs::instance()->mDayBegins; |
1270 | int endHour = 20; | 1270 | int endHour = 20; |
1271 | int offset = mHeaderHeight + mSubHeaderHeight + 10; | 1271 | int offset = mHeaderHeight + mSubHeaderHeight + 10; |
1272 | int hours = endHour - startHour; | 1272 | int hours = endHour - startHour; |
1273 | int cellHeight = (height-offset) / hours; // hour increments. | 1273 | int cellHeight = (height-offset) / hours; // hour increments. |
1274 | 1274 | ||
1275 | QString numStr; | 1275 | QString numStr; |
1276 | for (int i = 0; i < hours; i++) { | 1276 | for (int i = 0; i < hours; i++) { |
1277 | p.setPen(QPen(black,1)); | 1277 | p.setPen(QPen(Qt::black,1)); |
1278 | p.drawLine(0, offset+i*cellHeight, width, offset+i*cellHeight); | 1278 | p.drawLine(0, offset+i*cellHeight, width, offset+i*cellHeight); |
1279 | p.setPen(QPen(gray,0)); | 1279 | p.setPen(QPen(Qt::gray,0)); |
1280 | p.drawLine(37, offset+i*cellHeight+(cellHeight/2), | 1280 | p.drawLine(37, offset+i*cellHeight+(cellHeight/2), |
1281 | width, offset+i*cellHeight+(cellHeight/2)); | 1281 | width, offset+i*cellHeight+(cellHeight/2)); |
1282 | p.setPen(QPen(black,0)); | 1282 | p.setPen(QPen(Qt::black,0)); |
1283 | 1283 | ||
1284 | if ( !KGlobal::locale()->use12Clock() ) { | 1284 | if ( !KGlobal::locale()->use12Clock() ) { |
1285 | numStr.setNum(i+startHour); | 1285 | numStr.setNum(i+startHour); |
1286 | if (cellHeight > 40) { | 1286 | if (cellHeight > 40) { |
1287 | p.setFont(QFont("helvetica", 16, QFont::Bold)); | 1287 | p.setFont(QFont("helvetica", 16, QFont::Bold)); |
1288 | } else { | 1288 | } else { |
1289 | p.setFont(QFont("helvetica", 14, QFont::Bold)); | 1289 | p.setFont(QFont("helvetica", 14, QFont::Bold)); |
1290 | } | 1290 | } |
1291 | p.drawText(0, offset+i*cellHeight, 33, cellHeight/2, | 1291 | p.drawText(0, offset+i*cellHeight, 33, cellHeight/2, |
1292 | AlignTop|AlignRight, numStr); | 1292 | Qt::AlignTop|Qt::AlignRight, numStr); |
1293 | p.setFont(QFont("helvetica", 12, QFont::Bold)); | 1293 | p.setFont(QFont("helvetica", 12, QFont::Bold)); |
1294 | p.drawText(37, offset+i*cellHeight, 45, cellHeight/2, | 1294 | p.drawText(37, offset+i*cellHeight, 45, cellHeight/2, |
1295 | AlignTop | AlignLeft, "00"); | 1295 | Qt::AlignTop | Qt::AlignLeft, "00"); |
1296 | } else { | 1296 | } else { |
1297 | QTime time( i + startHour, 0 ); | 1297 | QTime time( i + startHour, 0 ); |
1298 | numStr = KGlobal::locale()->formatTime( time ); | 1298 | numStr = KGlobal::locale()->formatTime( time ); |
1299 | p.setFont(QFont("helvetica", 12, QFont::Bold)); | 1299 | p.setFont(QFont("helvetica", 12, QFont::Bold)); |
1300 | p.drawText(4, offset+i*cellHeight, 70, cellHeight/2, | 1300 | p.drawText(4, offset+i*cellHeight, 70, cellHeight/2, |
1301 | AlignTop|AlignLeft, numStr); | 1301 | Qt::AlignTop|Qt::AlignLeft, numStr); |
1302 | } | 1302 | } |
1303 | } mSubHeaderHeight = tempStore ; | 1303 | } mSubHeaderHeight = tempStore ; |
1304 | } | 1304 | } |
1305 | 1305 | ||
1306 | #endif | 1306 | #endif |