author | zautrix <zautrix> | 2005-03-08 09:24:53 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-03-08 09:24:53 (UTC) |
commit | 91e7aeec0b15d28eb263c0699fdce4a00a3669c6 (patch) (side-by-side diff) | |
tree | 10bf2d72c94ab030c7a08b22d0880997c99dcfff /korganizer/calprintbase.cpp | |
parent | a50b432c475d2a0b97b3f8707666f7d2990cd8db (diff) | |
download | kdepimpi-91e7aeec0b15d28eb263c0699fdce4a00a3669c6.zip kdepimpi-91e7aeec0b15d28eb263c0699fdce4a00a3669c6.tar.gz kdepimpi-91e7aeec0b15d28eb263c0699fdce4a00a3669c6.tar.bz2 |
todo printing fixes
-rw-r--r-- | korganizer/calprintbase.cpp | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/korganizer/calprintbase.cpp b/korganizer/calprintbase.cpp index 6bb407d..f66fddc 100644 --- a/korganizer/calprintbase.cpp +++ b/korganizer/calprintbase.cpp @@ -872,181 +872,189 @@ void CalPrintBase::drawMonth(QPainter &p, const QDate &qd, bool weeknumbers, if ( (monthDate < monthFirst) || (monthDate > monthLast) ) { p.setBackgroundColor( QColor( 240, 240, 240) ); darkbg = true; } drawDayBox(p, monthDate, x+xoffset+col*cellWidth, y+yoffset+row*cellHeight, cellWidth, cellHeight); if ( darkbg ) { p.setBackgroundColor( back ); darkbg = false; } monthDate = monthDate.addDays(1); } } } /////////////////////////////////////////////////////////////////////////////// void CalPrintBase::drawTodo( bool completed, int &count, Todo * item, QPainter &p, bool connectSubTodos, bool desc, int pospriority, int possummary, int posDueDt, int level, int x, int &y, int width, int &height, int pageHeight, TodoParentStart *r ) { if ( !completed && item->isCompleted() ) return; QString outStr; // int fontHeight = 10; const KLocale *local = KGlobal::locale(); int priority=item->priority(); int posdue=posDueDt; if (posdue<0) posdue=x+width; QRect rect; TodoParentStart startpt; // This list keeps all starting points of the parent todos so the connection // lines of the tree can easily be drawn (needed if a new page is started) static QPtrList<TodoParentStart> startPoints; if (level<1) { startPoints.clear(); } // size of item outStr=item->summary(); if ( ! item->location().isEmpty() ) outStr += " ("+item->location()+")"; if ( item->hasDueDate() && posDueDt>=0 ) { outStr += " [" +local->formatDate(item->dtDue().date(),true)+"]"; } int left = possummary+(level*10); rect = p.boundingRect(left, y, (posdue-left-5),-1, WordBreak, outStr); + //qDebug("bottom1 %d ", rect.bottom() ); if ( !item->description().isEmpty() && desc ) { outStr = item->description(); rect = p.boundingRect( left+20, rect.bottom()+5, width-(left+10-x), -1, WordBreak, outStr ); } + //qDebug("bottom2 %d y+h %d y %d ph %d", rect.bottom(), y+height, y , pageHeight ); // if too big make new page if ( rect.bottom() > y+height) { // first draw the connection lines from parent todos: if (level > 0 && connectSubTodos) { TodoParentStart *rct; for ( rct = startPoints.first(); rct; rct = startPoints.next() ) { int start; int center = rct->mRect.left() + (rct->mRect.width()/2); int to = p.viewport().bottom(); // draw either from start point of parent or from top of the page if (rct->mSamePage) start = rct->mRect.bottom() + 1; else start = p.viewport().top(); p.moveTo( center, start ); p.lineTo( center, to ); rct->mSamePage=false; } } y=0; height=pageHeight-y; mPrinter->newPage(); } // If this is a sub-item, r will not be 0, and we want the LH side of the priority line up //to the RH side of the parent item's priority if (r && pospriority >= 0 ) { pospriority = r->mRect.right() + 1; } // Priority outStr.setNum(priority); rect = p.boundingRect(pospriority, y + 10, 5, -1, AlignCenter, outStr); // Make it a more reasonable size rect.setWidth(19); rect.setHeight(19); if ( priority > 0 && pospriority>=0 ) { p.drawText(rect, AlignCenter, outStr); p.drawRect(rect); // cross out the rectangle for completed items if ( item->isCompleted() ) { - p.drawLine( rect.topLeft(), rect.bottomRight() ); - p.drawLine( rect.topRight(), rect.bottomLeft() ); + p.drawLine( rect.topLeft(), rect.bottomRight() ); + p.drawLine( rect.topRight(), rect.bottomLeft() ); + } else if (item->cancelled() ) { + QPen pen = p.pen(); + p.setPen ( QPen ( black, 2) ); + p.drawLine( rect.left()+2,rect.top()+rect.height()/2, rect.right()-2, +rect.top()+rect.height()/2 ); + p.setPen( pen ); } - } + } startpt.mRect = rect; //save for later // Connect the dots if (level > 0 && connectSubTodos) { int bottom; int center( r->mRect.left() + (r->mRect.width()/2)+1 ); if (r->mSamePage ) bottom = r->mRect.bottom();//lutz + 1; else bottom = 0; int to( rect.top() + (rect.height()/2)+1 ); int endx( rect.left() ); p.moveTo(center, bottom); p.lineTo(center, to); p.lineTo(endx, to); } // if completed, use strike out font - QFont ft=p.font(); - ft.setStrikeOut( item->isCompleted() ); - p.setFont( ft ); + // LR does not work - font is underlined, not striked out + //QFont ft=p.font(); + //ft.setStrikeOut( item->isCompleted() ); + //p.setFont( ft ); // summary outStr=item->summary(); if ( ! item->location().isEmpty() ) outStr += " ("+item->location()+")"; if ( item->hasDueDate() && posDueDt>=0 ) { - outStr += " [" +local->formatDate(item->dtDue().date(),true)+"]"; + outStr += " [" +item->dtDueStr(true)+"]"; } rect = p.boundingRect( left, rect.top(), (posdue-(left + rect.width() + 5)), -1, WordBreak, outStr); QRect newrect; p.drawText( rect, WordBreak, outStr, -1, &newrect ); - ft.setStrikeOut(false); - p.setFont(ft); + //ft.setStrikeOut(false); + // p.setFont(ft); // due // if ( item->hasDueDate() && posDueDt>=0 ) { // outStr = local->formatDate(item->dtDue().date(),true); // rect = p.boundingRect(posdue, y, x+width, -1, AlignTop|AlignLeft, outStr); // p.drawText(rect, AlignTop|AlignLeft, outStr); // } if ( !item->description().isEmpty() && desc ) { y=newrect.bottom() + 5; outStr = item->description(); rect = p.boundingRect( left+20, y, x+width-(left+10), -1, WordBreak, outStr ); p.drawText( rect, WordBreak, outStr, -1, &newrect ); } // Set the new line position y=newrect.bottom() + 10; //set the line position // If the item has subitems, we need to call ourselves recursively Incidence::List l;l.fill( item->relations()); Incidence::List::ConstIterator it; startPoints.append( &startpt ); for( it = l.begin(); it != l.end(); ++it ) { count++; drawTodo( completed, count, static_cast<Todo *>( *it ), p, connectSubTodos, desc, pospriority, possummary, posDueDt, level+1, x, y, width, height, pageHeight, &startpt); } startPoints.remove(&startpt); } int CalPrintBase::weekdayColumn( int weekday ) { return ( weekday + 7 - KGlobal::locale()->weekStartDay() ) % 7; } void CalPrintBase::drawSplitWeek( QPainter &p, const QDate &fd, const QDate &td ) { QDate curDay, fromDay, toDay, curWeek, fromWeek, toWeek; mPrinter->setOrientation(KPrinter::Portrait); int minus = 0; if (KGlobal::locale()->weekStartsMonday()) { // correct to monday fromWeek = fd.addDays(-(fd.dayOfWeek()-1)); |