summaryrefslogtreecommitdiffabout
path: root/korganizer
Unidiff
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calprintbase.cpp26
-rw-r--r--korganizer/calprinter.cpp2
2 files changed, 18 insertions, 10 deletions
diff --git a/korganizer/calprintbase.cpp b/korganizer/calprintbase.cpp
index 6bb407d..f66fddc 100644
--- a/korganizer/calprintbase.cpp
+++ b/korganizer/calprintbase.cpp
@@ -896,133 +896,141 @@ void CalPrintBase::drawTodo( bool completed, int &count, Todo * item, QPainter &
896 QString outStr; 896 QString outStr;
897// int fontHeight = 10; 897// int fontHeight = 10;
898 const KLocale *local = KGlobal::locale(); 898 const KLocale *local = KGlobal::locale();
899 int priority=item->priority(); 899 int priority=item->priority();
900 int posdue=posDueDt; 900 int posdue=posDueDt;
901 if (posdue<0) posdue=x+width; 901 if (posdue<0) posdue=x+width;
902 QRect rect; 902 QRect rect;
903 TodoParentStart startpt; 903 TodoParentStart startpt;
904 // This list keeps all starting points of the parent todos so the connection 904 // This list keeps all starting points of the parent todos so the connection
905 // lines of the tree can easily be drawn (needed if a new page is started) 905 // lines of the tree can easily be drawn (needed if a new page is started)
906 static QPtrList<TodoParentStart> startPoints; 906 static QPtrList<TodoParentStart> startPoints;
907 if (level<1) { 907 if (level<1) {
908 startPoints.clear(); 908 startPoints.clear();
909 } 909 }
910 910
911 // size of item 911 // size of item
912 outStr=item->summary(); 912 outStr=item->summary();
913 if ( ! item->location().isEmpty() ) 913 if ( ! item->location().isEmpty() )
914 outStr += " ("+item->location()+")"; 914 outStr += " ("+item->location()+")";
915 if ( item->hasDueDate() && posDueDt>=0 ) { 915 if ( item->hasDueDate() && posDueDt>=0 ) {
916 outStr += " [" +local->formatDate(item->dtDue().date(),true)+"]"; 916 outStr += " [" +local->formatDate(item->dtDue().date(),true)+"]";
917 } 917 }
918 int left = possummary+(level*10); 918 int left = possummary+(level*10);
919 rect = p.boundingRect(left, y, (posdue-left-5),-1, WordBreak, outStr); 919 rect = p.boundingRect(left, y, (posdue-left-5),-1, WordBreak, outStr);
920 //qDebug("bottom1 %d ", rect.bottom() );
920 if ( !item->description().isEmpty() && desc ) { 921 if ( !item->description().isEmpty() && desc ) {
921 outStr = item->description(); 922 outStr = item->description();
922 rect = p.boundingRect( left+20, rect.bottom()+5, width-(left+10-x), -1, 923 rect = p.boundingRect( left+20, rect.bottom()+5, width-(left+10-x), -1,
923 WordBreak, outStr ); 924 WordBreak, outStr );
924 } 925 }
926 //qDebug("bottom2 %d y+h %d y %d ph %d", rect.bottom(), y+height, y , pageHeight );
925 // if too big make new page 927 // if too big make new page
926 if ( rect.bottom() > y+height) { 928 if ( rect.bottom() > y+height) {
927 // first draw the connection lines from parent todos: 929 // first draw the connection lines from parent todos:
928 if (level > 0 && connectSubTodos) { 930 if (level > 0 && connectSubTodos) {
929 TodoParentStart *rct; 931 TodoParentStart *rct;
930 for ( rct = startPoints.first(); rct; rct = startPoints.next() ) { 932 for ( rct = startPoints.first(); rct; rct = startPoints.next() ) {
931 int start; 933 int start;
932 int center = rct->mRect.left() + (rct->mRect.width()/2); 934 int center = rct->mRect.left() + (rct->mRect.width()/2);
933 int to = p.viewport().bottom(); 935 int to = p.viewport().bottom();
934 936
935 // draw either from start point of parent or from top of the page 937 // draw either from start point of parent or from top of the page
936 if (rct->mSamePage) 938 if (rct->mSamePage)
937 start = rct->mRect.bottom() + 1; 939 start = rct->mRect.bottom() + 1;
938 else 940 else
939 start = p.viewport().top(); 941 start = p.viewport().top();
940 p.moveTo( center, start ); 942 p.moveTo( center, start );
941 p.lineTo( center, to ); 943 p.lineTo( center, to );
942 rct->mSamePage=false; 944 rct->mSamePage=false;
943 } 945 }
944 } 946 }
945 y=0; 947 y=0;
946 height=pageHeight-y; 948 height=pageHeight-y;
947 mPrinter->newPage(); 949 mPrinter->newPage();
948 } 950 }
949 951
950 // If this is a sub-item, r will not be 0, and we want the LH side of the priority line up 952 // If this is a sub-item, r will not be 0, and we want the LH side of the priority line up
951 //to the RH side of the parent item's priority 953 //to the RH side of the parent item's priority
952 if (r && pospriority >= 0 ) { 954 if (r && pospriority >= 0 ) {
953 pospriority = r->mRect.right() + 1; 955 pospriority = r->mRect.right() + 1;
954 } 956 }
955 957
956 // Priority 958 // Priority
957 outStr.setNum(priority); 959 outStr.setNum(priority);
958 rect = p.boundingRect(pospriority, y + 10, 5, -1, AlignCenter, outStr); 960 rect = p.boundingRect(pospriority, y + 10, 5, -1, AlignCenter, outStr);
959 // Make it a more reasonable size 961 // Make it a more reasonable size
960 rect.setWidth(19); 962 rect.setWidth(19);
961 rect.setHeight(19); 963 rect.setHeight(19);
962 if ( priority > 0 && pospriority>=0 ) { 964 if ( priority > 0 && pospriority>=0 ) {
963 p.drawText(rect, AlignCenter, outStr); 965 p.drawText(rect, AlignCenter, outStr);
964 p.drawRect(rect); 966 p.drawRect(rect);
965 // cross out the rectangle for completed items 967 // cross out the rectangle for completed items
966 if ( item->isCompleted() ) { 968 if ( item->isCompleted() ) {
967 p.drawLine( rect.topLeft(), rect.bottomRight() ); 969 p.drawLine( rect.topLeft(), rect.bottomRight() );
968 p.drawLine( rect.topRight(), rect.bottomLeft() ); 970 p.drawLine( rect.topRight(), rect.bottomLeft() );
971 } else if (item->cancelled() ) {
972 QPen pen = p.pen();
973 p.setPen ( QPen ( black, 2) );
974 p.drawLine( rect.left()+2,rect.top()+rect.height()/2, rect.right()-2, +rect.top()+rect.height()/2 );
975 p.setPen( pen );
969 } 976 }
970 } 977 }
971 startpt.mRect = rect; //save for later 978 startpt.mRect = rect; //save for later
972 979
973 // Connect the dots 980 // Connect the dots
974 if (level > 0 && connectSubTodos) { 981 if (level > 0 && connectSubTodos) {
975 int bottom; 982 int bottom;
976 int center( r->mRect.left() + (r->mRect.width()/2)+1 ); 983 int center( r->mRect.left() + (r->mRect.width()/2)+1 );
977 if (r->mSamePage ) 984 if (r->mSamePage )
978 bottom = r->mRect.bottom();//lutz + 1; 985 bottom = r->mRect.bottom();//lutz + 1;
979 else 986 else
980 bottom = 0; 987 bottom = 0;
981 int to( rect.top() + (rect.height()/2)+1 ); 988 int to( rect.top() + (rect.height()/2)+1 );
982 int endx( rect.left() ); 989 int endx( rect.left() );
983 p.moveTo(center, bottom); 990 p.moveTo(center, bottom);
984 p.lineTo(center, to); 991 p.lineTo(center, to);
985 p.lineTo(endx, to); 992 p.lineTo(endx, to);
986 } 993 }
987 994
988 // if completed, use strike out font 995 // if completed, use strike out font
989 QFont ft=p.font(); 996 // LR does not work - font is underlined, not striked out
990 ft.setStrikeOut( item->isCompleted() ); 997 //QFont ft=p.font();
991 p.setFont( ft ); 998 //ft.setStrikeOut( item->isCompleted() );
999 //p.setFont( ft );
992 // summary 1000 // summary
993 outStr=item->summary(); 1001 outStr=item->summary();
994 if ( ! item->location().isEmpty() ) 1002 if ( ! item->location().isEmpty() )
995 outStr += " ("+item->location()+")"; 1003 outStr += " ("+item->location()+")";
996 if ( item->hasDueDate() && posDueDt>=0 ) { 1004 if ( item->hasDueDate() && posDueDt>=0 ) {
997 outStr += " [" +local->formatDate(item->dtDue().date(),true)+"]"; 1005 outStr += " [" +item->dtDueStr(true)+"]";
998 } 1006 }
999 rect = p.boundingRect( left, rect.top(), (posdue-(left + rect.width() + 5)), 1007 rect = p.boundingRect( left, rect.top(), (posdue-(left + rect.width() + 5)),
1000 -1, WordBreak, outStr); 1008 -1, WordBreak, outStr);
1001 QRect newrect; 1009 QRect newrect;
1002 p.drawText( rect, WordBreak, outStr, -1, &newrect ); 1010 p.drawText( rect, WordBreak, outStr, -1, &newrect );
1003 ft.setStrikeOut(false); 1011 //ft.setStrikeOut(false);
1004 p.setFont(ft); 1012 // p.setFont(ft);
1005 1013
1006 // due 1014 // due
1007 // if ( item->hasDueDate() && posDueDt>=0 ) { 1015 // if ( item->hasDueDate() && posDueDt>=0 ) {
1008// outStr = local->formatDate(item->dtDue().date(),true); 1016// outStr = local->formatDate(item->dtDue().date(),true);
1009// rect = p.boundingRect(posdue, y, x+width, -1, AlignTop|AlignLeft, outStr); 1017// rect = p.boundingRect(posdue, y, x+width, -1, AlignTop|AlignLeft, outStr);
1010// p.drawText(rect, AlignTop|AlignLeft, outStr); 1018// p.drawText(rect, AlignTop|AlignLeft, outStr);
1011// } 1019// }
1012 1020
1013 if ( !item->description().isEmpty() && desc ) { 1021 if ( !item->description().isEmpty() && desc ) {
1014 y=newrect.bottom() + 5; 1022 y=newrect.bottom() + 5;
1015 outStr = item->description(); 1023 outStr = item->description();
1016 rect = p.boundingRect( left+20, y, x+width-(left+10), -1, 1024 rect = p.boundingRect( left+20, y, x+width-(left+10), -1,
1017 WordBreak, outStr ); 1025 WordBreak, outStr );
1018 p.drawText( rect, WordBreak, outStr, -1, &newrect ); 1026 p.drawText( rect, WordBreak, outStr, -1, &newrect );
1019 } 1027 }
1020 1028
1021 // Set the new line position 1029 // Set the new line position
1022 y=newrect.bottom() + 10; //set the line position 1030 y=newrect.bottom() + 10; //set the line position
1023 1031
1024 // If the item has subitems, we need to call ourselves recursively 1032 // If the item has subitems, we need to call ourselves recursively
1025 Incidence::List l;l.fill( item->relations()); 1033 Incidence::List l;l.fill( item->relations());
1026 Incidence::List::ConstIterator it; 1034 Incidence::List::ConstIterator it;
1027 startPoints.append( &startpt ); 1035 startPoints.append( &startpt );
1028 for( it = l.begin(); it != l.end(); ++it ) { 1036 for( it = l.begin(); it != l.end(); ++it ) {
diff --git a/korganizer/calprinter.cpp b/korganizer/calprinter.cpp
index 6b5b0fe..0cdf28e 100644
--- a/korganizer/calprinter.cpp
+++ b/korganizer/calprinter.cpp
@@ -110,49 +110,49 @@ void CalPrinter::setupPrinter()
110} 110}
111 111
112void CalPrinter::setDateRange( const QDate &fd, const QDate &td ) 112void CalPrinter::setDateRange( const QDate &fd, const QDate &td )
113{ 113{
114 CalPrintBase *plug = mPrintPlugins.first(); 114 CalPrintBase *plug = mPrintPlugins.first();
115 while ( plug ) { 115 while ( plug ) {
116 plug->setDateRange( fd, td ); 116 plug->setDateRange( fd, td );
117 plug = mPrintPlugins.next(); 117 plug = mPrintPlugins.next();
118 } 118 }
119} 119}
120 120
121void CalPrinter::preview( PrintType type, const QDate &fd, const QDate &td ) 121void CalPrinter::preview( PrintType type, const QDate &fd, const QDate &td )
122{ 122{
123 mPrintDialog->setPreview( true ); 123 mPrintDialog->setPreview( true );
124 mPrintDialog->setPrintType( int( type ) ); 124 mPrintDialog->setPrintType( int( type ) );
125 setDateRange( fd, td ); 125 setDateRange( fd, td );
126 126
127 if ( mPrintDialog->exec() == QDialog::Accepted ) { 127 if ( mPrintDialog->exec() == QDialog::Accepted ) {
128 doPrint( mPrintDialog->selectedPlugin(), true ); 128 doPrint( mPrintDialog->selectedPlugin(), true );
129 } 129 }
130} 130}
131 131
132void CalPrinter::print( PrintType type, const QDate &fd, const QDate &td ) 132void CalPrinter::print( PrintType type, const QDate &fd, const QDate &td )
133{ 133{
134 mPrintDialog->resize( 640, 380 ); 134 mPrintDialog->resize( 640, 440 );
135 mPrintDialog->setPreview( false ); 135 mPrintDialog->setPreview( false );
136 mPrintDialog->setPrintType( int( type ) ); 136 mPrintDialog->setPrintType( int( type ) );
137 setDateRange( fd, td ); 137 setDateRange( fd, td );
138 138
139 if ( mPrintDialog->exec() == QDialog::Accepted ) { 139 if ( mPrintDialog->exec() == QDialog::Accepted ) {
140 doPrint( mPrintDialog->selectedPlugin(), false ); 140 doPrint( mPrintDialog->selectedPlugin(), false );
141 } 141 }
142} 142}
143 143
144void CalPrinter::doPrint( CalPrintBase *selectedStyle, bool preview ) 144void CalPrinter::doPrint( CalPrintBase *selectedStyle, bool preview )
145{ 145{
146 // FIXME: add a better caption to the Printingdialog 146 // FIXME: add a better caption to the Printingdialog
147 //mPrinter->setPreviewOnly( preview ); 147 //mPrinter->setPreviewOnly( preview );
148 if ( preview || mPrinter->setup( mParent ) ) { 148 if ( preview || mPrinter->setup( mParent ) ) {
149 switch ( mPrintDialog->orientation() ) { 149 switch ( mPrintDialog->orientation() ) {
150 case eOrientPlugin: 150 case eOrientPlugin:
151 mPrinter->setOrientation( selectedStyle->orientation()); 151 mPrinter->setOrientation( selectedStyle->orientation());
152 break; 152 break;
153 case eOrientPortrait: 153 case eOrientPortrait:
154 mPrinter->setOrientation( KPrinter::Portrait ); 154 mPrinter->setOrientation( KPrinter::Portrait );
155 break; 155 break;
156 case eOrientLandscape: 156 case eOrientLandscape:
157 mPrinter->setOrientation( KPrinter::Landscape ); 157 mPrinter->setOrientation( KPrinter::Landscape );
158 break; 158 break;