author | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
commit | a08aff328d4393031d5ba7d622c2b05705a89d73 (patch) (unidiff) | |
tree | 8ee90d686081c52e7c69b5ce946e9b1a7d690001 /korganizer/calprintbase.cpp | |
parent | 11edc920afe4f274c0964436633aa632c8288a40 (diff) | |
download | kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.zip kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.gz kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.bz2 |
initial public commit of qt4 portp1
-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 | |||
@@ -24,13 +24,15 @@ | |||
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> |
@@ -144,10 +146,10 @@ CalPrintBase::~CalPrintBase() | |||
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 ); |
@@ -284,9 +286,9 @@ void CalPrintBase::drawSmallMonth(QPainter &p, const QDate &qd, | |||
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; |
@@ -300,9 +302,9 @@ void CalPrintBase::drawSmallMonth(QPainter &p, const QDate &qd, | |||
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 |
@@ -317,9 +319,9 @@ void CalPrintBase::drawSmallMonth(QPainter &p, const QDate &qd, | |||
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 | } |
@@ -357,9 +359,9 @@ void CalPrintBase::drawDaysOfWeekBox(QPainter &p, const QDate &qd, | |||
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 | ||
@@ -400,18 +402,18 @@ void CalPrintBase::drawTimeLine(QPainter &p, | |||
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) |
@@ -471,9 +473,9 @@ void CalPrintBase::drawAllDayBox(QPainter &p, Event::List &eventList, | |||
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 ); |
@@ -492,9 +494,9 @@ void CalPrintBase::drawAllDayBox(QPainter &p, Event::List &eventList, | |||
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; |
@@ -559,17 +561,17 @@ void CalPrintBase::drawAgendaDayBox( QPainter &p, Event::List &events, | |||
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 ); |
@@ -592,9 +594,9 @@ void CalPrintBase::drawAgendaDayBox( QPainter &p, Event::List &events, | |||
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, |
@@ -634,9 +636,9 @@ void CalPrintBase::drawAgendaItem( PrintCellItem *item, QPainter &p, | |||
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 | } |
@@ -669,9 +671,9 @@ void CalPrintBase::drawDayBox(QPainter &p, const QDate &qd, | |||
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) { |
@@ -679,9 +681,9 @@ void CalPrintBase::drawDayBox(QPainter &p, const QDate &qd, | |||
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; |
@@ -723,9 +725,9 @@ void CalPrintBase::drawDayBox(QPainter &p, const QDate &qd, | |||
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 ) { |
@@ -742,9 +744,9 @@ void CalPrintBase::drawDayBox(QPainter &p, const QDate &qd, | |||
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 | } |
@@ -848,9 +850,9 @@ void CalPrintBase::drawMonth(QPainter &p, const QDate &qd, bool weeknumbers, | |||
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 | } |
@@ -896,9 +898,9 @@ void CalPrintBase::drawTodo( bool completed, int &count, Todo * item, QPainter & | |||
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 | ||
@@ -909,14 +911,14 @@ void CalPrintBase::drawTodo( bool completed, int &count, Todo * item, QPainter & | |||
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) { |
@@ -932,10 +934,9 @@ void CalPrintBase::drawTodo( bool completed, int &count, Todo * item, QPainter & | |||
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; |
@@ -950,22 +951,22 @@ void CalPrintBase::drawTodo( bool completed, int &count, Todo * item, QPainter & | |||
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 | } |
@@ -980,11 +981,10 @@ void CalPrintBase::drawTodo( bool completed, int &count, Todo * item, QPainter & | |||
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 |
@@ -998,11 +998,11 @@ void CalPrintBase::drawTodo( bool completed, int &count, Todo * item, QPainter & | |||
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 |
@@ -1015,10 +1015,10 @@ void CalPrintBase::drawTodo( bool completed, int &count, Todo * item, QPainter & | |||
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 |
@@ -1137,10 +1137,10 @@ void CalPrintBase::drawSplitHeaderRight( QPainter &p, const QDate &fd, | |||
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()); |
@@ -1160,9 +1160,9 @@ void CalPrintBase::drawSplitHeaderRight( QPainter &p, const QDate &fd, | |||
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 ); |
@@ -1170,9 +1170,9 @@ void CalPrintBase::drawSplitHeaderRight( QPainter &p, const QDate &fd, | |||
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, |
@@ -1196,9 +1196,9 @@ void CalPrintBase::drawSplitDay( QPainter &p, const QDate &qd, int width, | |||
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)); |
@@ -1253,12 +1253,12 @@ void CalPrintBase::drawSplitDay( QPainter &p, const QDate &qd, int width, | |||
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, |
@@ -1273,14 +1273,14 @@ void CalPrintBase::drawSplitTimes( QPainter &p, int width, int timeWidth, | |||
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) { |
@@ -1288,18 +1288,18 @@ void CalPrintBase::drawSplitTimes( QPainter &p, int width, int timeWidth, | |||
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 | ||