-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 | |||
@@ -1,64 +1,66 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | 3 | ||
4 | Copyright (c) 1998 Preston Brown | 4 | Copyright (c) 1998 Preston Brown |
5 | Copyright (c) 2003 Reinhold Kainhofer <reinhold@kainhofer.com> | 5 | Copyright (c) 2003 Reinhold Kainhofer <reinhold@kainhofer.com> |
6 | 6 | ||
7 | This program is free software; you can redistribute it and/or modify | 7 | This program is free software; you can redistribute it and/or modify |
8 | it under the terms of the GNU General Public License as published by | 8 | it under the terms of the GNU General Public License as published by |
9 | the Free Software Foundation; either version 2 of the License, or | 9 | the Free Software Foundation; either version 2 of the License, or |
10 | (at your option) any later version. | 10 | (at your option) any later version. |
11 | 11 | ||
12 | This program is distributed in the hope that it will be useful, | 12 | This program is distributed in the hope that it will be useful, |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | GNU General Public License for more details. | 15 | GNU General Public License for more details. |
16 | 16 | ||
17 | You should have received a copy of the GNU General Public License | 17 | You should have received a copy of the GNU General Public License |
18 | along with this program; if not, write to the Free Software | 18 | along with this program; if not, write to the Free Software |
19 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 19 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
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 | ||
41 | #include <libkcal/todo.h> | 43 | #include <libkcal/todo.h> |
42 | #include <libkcal/event.h> | 44 | #include <libkcal/event.h> |
43 | #include <libkcal/calendar.h> | 45 | #include <libkcal/calendar.h> |
44 | 46 | ||
45 | #include "koprefs.h" | 47 | #include "koprefs.h" |
46 | #include "koglobals.h" | 48 | #include "koglobals.h" |
47 | #ifndef KORG_NOPLUGINS | 49 | #ifndef KORG_NOPLUGINS |
48 | #include "kocore.h" | 50 | #include "kocore.h" |
49 | #endif | 51 | #endif |
50 | #include "cellitem.h" | 52 | #include "cellitem.h" |
51 | 53 | ||
52 | #include "calprintbase.h" | 54 | #include "calprintbase.h" |
53 | 55 | ||
54 | #ifndef KORG_NOPRINTER | 56 | #ifndef KORG_NOPRINTER |
55 | //#include "calprintbase.moc" | 57 | //#include "calprintbase.moc" |
56 | 58 | ||
57 | int CalPrintBase::mHeaderHeight=90; | 59 | int CalPrintBase::mHeaderHeight=90; |
58 | int CalPrintBase::mSubHeaderHeight=20; | 60 | int CalPrintBase::mSubHeaderHeight=20; |
59 | int CalPrintBase::mMargin=36; | 61 | int CalPrintBase::mMargin=36; |
60 | 62 | ||
61 | 63 | ||
62 | 64 | ||
63 | class CalPrintBase::TodoParentStart | 65 | class CalPrintBase::TodoParentStart |
64 | { | 66 | { |
@@ -116,66 +118,66 @@ class PrintCellItem : public KOrg::CellItem | |||
116 | QDate mDay; | 118 | QDate mDay; |
117 | }; | 119 | }; |
118 | 120 | ||
119 | void setCategoryColors( QPainter &p, Incidence *incidence) | 121 | void setCategoryColors( QPainter &p, Incidence *incidence) |
120 | { | 122 | { |
121 | QColor bgColor; | 123 | QColor bgColor; |
122 | QStringList categories = incidence->categories(); | 124 | QStringList categories = incidence->categories(); |
123 | QString cat = categories.first(); | 125 | QString cat = categories.first(); |
124 | if (cat.isEmpty()) | 126 | if (cat.isEmpty()) |
125 | bgColor = KOPrefs::instance()->mEventColor; | 127 | bgColor = KOPrefs::instance()->mEventColor; |
126 | else | 128 | else |
127 | bgColor = *(KOPrefs::instance()->categoryColor(cat)); | 129 | bgColor = *(KOPrefs::instance()->categoryColor(cat)); |
128 | QColor textColor = Qt::black;//getTextColor(bgColor); | 130 | QColor textColor = Qt::black;//getTextColor(bgColor); |
129 | p.setPen( textColor ); | 131 | p.setPen( textColor ); |
130 | p.setBrush( bgColor ); | 132 | p.setBrush( bgColor ); |
131 | } | 133 | } |
132 | 134 | ||
133 | 135 | ||
134 | 136 | ||
135 | CalPrintBase::CalPrintBase( KPrinter *printer, Calendar *cal, KConfig *cfg ) | 137 | CalPrintBase::CalPrintBase( KPrinter *printer, Calendar *cal, KConfig *cfg ) |
136 | : QObject(), mPrinter( printer ), mCalendar( cal ), mConfig( cfg ) | 138 | : QObject(), mPrinter( printer ), mCalendar( cal ), mConfig( cfg ) |
137 | { | 139 | { |
138 | } | 140 | } |
139 | 141 | ||
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 ); |
158 | layout->addWidget( new QLabel( longDescription(), wdg ) ); | 160 | layout->addWidget( new QLabel( longDescription(), wdg ) ); |
159 | layout->addSpacing( 20 ); | 161 | layout->addSpacing( 20 ); |
160 | layout->addWidget( new QLabel( i18n("This printing style does not " | 162 | layout->addWidget( new QLabel( i18n("This printing style does not " |
161 | "have any configuration options."), | 163 | "have any configuration options."), |
162 | wdg ) ); | 164 | wdg ) ); |
163 | layout->addStretch(); | 165 | layout->addStretch(); |
164 | return wdg; | 166 | return wdg; |
165 | } | 167 | } |
166 | #include <qapplication.h> | 168 | #include <qapplication.h> |
167 | void CalPrintBase::doPrint() | 169 | void CalPrintBase::doPrint() |
168 | { | 170 | { |
169 | QPainter p; | 171 | QPainter p; |
170 | 172 | ||
171 | mPrinter->setColorMode( (mUseColors)?(KPrinter::Color):(KPrinter::GrayScale)); | 173 | mPrinter->setColorMode( (mUseColors)?(KPrinter::Color):(KPrinter::GrayScale)); |
172 | //#define DUMMY_PRINTER | 174 | //#define DUMMY_PRINTER |
173 | #ifdef DUMMY_PRINTER | 175 | #ifdef DUMMY_PRINTER |
174 | 176 | ||
175 | static QWidget* dummy = 0; | 177 | static QWidget* dummy = 0; |
176 | if ( ! dummy ) | 178 | if ( ! dummy ) |
177 | dummy = new QWidget( ); | 179 | dummy = new QWidget( ); |
178 | else { | 180 | else { |
179 | delete dummy; | 181 | delete dummy; |
180 | dummy = new QWidget( ); | 182 | dummy = new QWidget( ); |
181 | 183 | ||
@@ -256,273 +258,273 @@ void CalPrintBase::drawHeader( QPainter &p, QString title, | |||
256 | right -= (10+smallMonthWidth); | 258 | right -= (10+smallMonthWidth); |
257 | drawSmallMonth(p, QDate(month2.year(), month2.month(), 1), | 259 | drawSmallMonth(p, QDate(month2.year(), month2.month(), 1), |
258 | right, y+2, smallMonthWidth, height-4); | 260 | right, y+2, smallMonthWidth, height-4); |
259 | right-=10; | 261 | right-=10; |
260 | } | 262 | } |
261 | if (month1.isValid()) { | 263 | if (month1.isValid()) { |
262 | right -= (10+smallMonthWidth); | 264 | right -= (10+smallMonthWidth); |
263 | drawSmallMonth(p, QDate(month1.year(), month1.month(), 1), | 265 | drawSmallMonth(p, QDate(month1.year(), month1.month(), 1), |
264 | right, y+2, smallMonthWidth, height-4); | 266 | right, y+2, smallMonthWidth, height-4); |
265 | right-=10; | 267 | right-=10; |
266 | } | 268 | } |
267 | 269 | ||
268 | // Print the titles... | 270 | // Print the titles... |
269 | QFont font("helvetica", 18, QFont::Bold); | 271 | QFont font("helvetica", 18, QFont::Bold); |
270 | p.setFont(font); | 272 | p.setFont(font); |
271 | QRect textRect( x+5, y+5, right-10-x, height-10 ); | 273 | QRect textRect( x+5, y+5, right-10-x, height-10 ); |
272 | p.drawText( textRect, Qt::AlignLeft | Qt::AlignTop | Qt::WordBreak, title ); | 274 | p.drawText( textRect, Qt::AlignLeft | Qt::AlignTop | Qt::WordBreak, title ); |
273 | } | 275 | } |
274 | 276 | ||
275 | 277 | ||
276 | void CalPrintBase::drawSmallMonth(QPainter &p, const QDate &qd, | 278 | void CalPrintBase::drawSmallMonth(QPainter &p, const QDate &qd, |
277 | int x, int y, int width, int height) | 279 | int x, int y, int width, int height) |
278 | { | 280 | { |
279 | bool firstCol = true; | 281 | bool firstCol = true; |
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 | /////////////////////////////////////////////////////////////////////////////// |
330 | 332 | ||
331 | /* | 333 | /* |
332 | * This routine draws a header box over the main part of the calendar | 334 | * This routine draws a header box over the main part of the calendar |
333 | * containing the days of the week. | 335 | * containing the days of the week. |
334 | */ | 336 | */ |
335 | void CalPrintBase::drawDaysOfWeek(QPainter &p, | 337 | void CalPrintBase::drawDaysOfWeek(QPainter &p, |
336 | const QDate &fromDate, const QDate &toDate, | 338 | const QDate &fromDate, const QDate &toDate, |
337 | int x, int y, int width, int height) | 339 | int x, int y, int width, int height) |
338 | { | 340 | { |
339 | int cellWidth = width/(fromDate.daysTo( toDate )+1); | 341 | int cellWidth = width/(fromDate.daysTo( toDate )+1); |
340 | int currx=x; | 342 | int currx=x; |
341 | QDate cellDate(fromDate); | 343 | QDate cellDate(fromDate); |
342 | 344 | ||
343 | while (cellDate<=toDate) { | 345 | while (cellDate<=toDate) { |
344 | drawDaysOfWeekBox(p, cellDate, currx, y, cellWidth, height); | 346 | drawDaysOfWeekBox(p, cellDate, currx, y, cellWidth, height); |
345 | currx+=cellWidth; | 347 | currx+=cellWidth; |
346 | cellDate = cellDate.addDays(1); | 348 | cellDate = cellDate.addDays(1); |
347 | } | 349 | } |
348 | } | 350 | } |
349 | 351 | ||
350 | 352 | ||
351 | void CalPrintBase::drawDaysOfWeekBox(QPainter &p, const QDate &qd, | 353 | void CalPrintBase::drawDaysOfWeekBox(QPainter &p, const QDate &qd, |
352 | int x, int y, int width, int height) | 354 | int x, int y, int width, int height) |
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 | { |
370 | p.drawRect(x, y, width, height); | 372 | p.drawRect(x, y, width, height); |
371 | 373 | ||
372 | int totalsecs=fromTime.secsTo(toTime); | 374 | int totalsecs=fromTime.secsTo(toTime); |
373 | float minlen=(float)height*60./(float)totalsecs; | 375 | float minlen=(float)height*60./(float)totalsecs; |
374 | float cellHeight=(60.*(float)minlen); | 376 | float cellHeight=(60.*(float)minlen); |
375 | float currY=y; | 377 | float currY=y; |
376 | 378 | ||
377 | QTime curTime( fromTime ); | 379 | QTime curTime( fromTime ); |
378 | QTime endTime( toTime ); | 380 | QTime endTime( toTime ); |
379 | if ( fromTime.minute() > 30 ) | 381 | if ( fromTime.minute() > 30 ) |
380 | curTime = QTime( fromTime.hour()+1, 0, 0 ); | 382 | curTime = QTime( fromTime.hour()+1, 0, 0 ); |
381 | else if ( fromTime.minute() > 0 ) { | 383 | else if ( fromTime.minute() > 0 ) { |
382 | curTime = QTime( fromTime.hour(), 30, 0 ); | 384 | curTime = QTime( fromTime.hour(), 30, 0 ); |
383 | float yy = currY + minlen*(float)fromTime.secsTo( curTime )/60.; | 385 | float yy = currY + minlen*(float)fromTime.secsTo( curTime )/60.; |
384 | p.drawLine( x+width/2, (int)yy, x+width, (int)yy ); | 386 | p.drawLine( x+width/2, (int)yy, x+width, (int)yy ); |
385 | curTime = QTime( fromTime.hour()+1, 0, 0 ); | 387 | curTime = QTime( fromTime.hour()+1, 0, 0 ); |
386 | } | 388 | } |
387 | currY += ( fromTime.secsTo(curTime)*minlen/60 ); | 389 | currY += ( fromTime.secsTo(curTime)*minlen/60 ); |
388 | 390 | ||
389 | while ( curTime < endTime ) { | 391 | while ( curTime < endTime ) { |
390 | p.drawLine( x, (int)currY, x+width, (int)currY ); | 392 | p.drawLine( x, (int)currY, x+width, (int)currY ); |
391 | int newY=(int)(currY+cellHeight/2.); | 393 | int newY=(int)(currY+cellHeight/2.); |
392 | QString numStr; | 394 | QString numStr; |
393 | if (newY < y+height) { | 395 | if (newY < y+height) { |
394 | p.drawLine(x+width/2, (int)newY, x+width, (int)newY); | 396 | p.drawLine(x+width/2, (int)newY, x+width, (int)newY); |
395 | // draw the time: | 397 | // draw the time: |
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 | } |
422 | 424 | ||
423 | 425 | ||
424 | /////////////////////////////////////////////////////////////////////////////// | 426 | /////////////////////////////////////////////////////////////////////////////// |
425 | 427 | ||
426 | /** prints the all-day box for the agenda print view. if expandable is set, | 428 | /** prints the all-day box for the agenda print view. if expandable is set, |
427 | height is the cell height of a single cell, and the returned height will | 429 | height is the cell height of a single cell, and the returned height will |
428 | be the total height used for the all-day events. If !expandable, only one | 430 | be the total height used for the all-day events. If !expandable, only one |
429 | cell will be used, and multiple events are concatenated using ", ". | 431 | cell will be used, and multiple events are concatenated using ", ". |
430 | */ | 432 | */ |
431 | void CalPrintBase::drawAllDayBox(QPainter &p, Event::List &eventList, | 433 | void CalPrintBase::drawAllDayBox(QPainter &p, Event::List &eventList, |
432 | const QDate &qd, bool expandable, | 434 | const QDate &qd, bool expandable, |
433 | int x, int y, int width, int &height) | 435 | int x, int y, int width, int &height) |
434 | { | 436 | { |
435 | Event::List::Iterator it, itold; | 437 | Event::List::Iterator it, itold; |
436 | 438 | ||
437 | int offset=y; | 439 | int offset=y; |
438 | 440 | ||
439 | //p.setBrush(QBrush(Dense7Pattern)); | 441 | //p.setBrush(QBrush(Dense7Pattern)); |
440 | QPen oldPen(p.pen()); | 442 | QPen oldPen(p.pen()); |
441 | QColor oldBgColor(p.backgroundColor()); | 443 | QColor oldBgColor(p.backgroundColor()); |
442 | QBrush oldBrush(p.brush()); | 444 | QBrush oldBrush(p.brush()); |
443 | QString multiDayStr; | 445 | QString multiDayStr; |
444 | 446 | ||
445 | it = eventList.begin(); | 447 | it = eventList.begin(); |
446 | #ifndef KORG_NOPLUGINS | 448 | #ifndef KORG_NOPLUGINS |
447 | QString hstring(KOCore::self()->holiday(qd)); | 449 | QString hstring(KOCore::self()->holiday(qd)); |
448 | if (!hstring.isEmpty()) { | 450 | if (!hstring.isEmpty()) { |
449 | Event*holiday=new Event(); | 451 | Event*holiday=new Event(); |
450 | holiday->setDtStart(qd); | 452 | holiday->setDtStart(qd); |
451 | holiday->setDtEnd(qd); | 453 | holiday->setDtEnd(qd); |
452 | holiday->setFloats(true); | 454 | holiday->setFloats(true); |
453 | holiday->setCategories(i18n("Holiday")); | 455 | holiday->setCategories(i18n("Holiday")); |
454 | eventList.prepend(holiday); | 456 | eventList.prepend(holiday); |
455 | } | 457 | } |
456 | #endif | 458 | #endif |
457 | Event *currEvent = 0; | 459 | Event *currEvent = 0; |
458 | // First, print all floating events | 460 | // First, print all floating events |
459 | while( it!=eventList.end() ) { | 461 | while( it!=eventList.end() ) { |
460 | currEvent=*it; | 462 | currEvent=*it; |
461 | itold=it; | 463 | itold=it; |
462 | ++it; | 464 | ++it; |
463 | if ( currEvent->doesFloat() ) { | 465 | if ( currEvent->doesFloat() ) { |
464 | // set the colors according to the categories | 466 | // set the colors according to the categories |
465 | QString text = currEvent->summary() ; | 467 | QString text = currEvent->summary() ; |
466 | if ( ! currEvent->location().isEmpty() ) | 468 | if ( ! currEvent->location().isEmpty() ) |
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 { |
484 | //if (!multiDayStr.isEmpty()) multiDayStr+=", "; | 486 | //if (!multiDayStr.isEmpty()) multiDayStr+=", "; |
485 | multiDayStr += text+"\n"; | 487 | multiDayStr += text+"\n"; |
486 | } | 488 | } |
487 | eventList.remove( itold ); | 489 | eventList.remove( itold ); |
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 | ||
505 | void CalPrintBase::drawAgendaDayBox( QPainter &p, Event::List &events, | 507 | void CalPrintBase::drawAgendaDayBox( QPainter &p, Event::List &events, |
506 | const QDate &qd, bool expandable, | 508 | const QDate &qd, bool expandable, |
507 | QTime &fromTime, QTime &toTime, | 509 | QTime &fromTime, QTime &toTime, |
508 | int x, int y, int width, int height ) | 510 | int x, int y, int width, int height ) |
509 | { | 511 | { |
510 | p.drawRect( x, y, width, height ); | 512 | p.drawRect( x, y, width, height ); |
511 | 513 | ||
512 | Event *event; | 514 | Event *event; |
513 | 515 | ||
514 | if ( expandable ) { | 516 | if ( expandable ) { |
515 | // Adapt start/end times to include complete events | 517 | // Adapt start/end times to include complete events |
516 | Event::List::ConstIterator it; | 518 | Event::List::ConstIterator it; |
517 | for ( it = events.begin(); it != events.end(); ++it ) { | 519 | for ( it = events.begin(); it != events.end(); ++it ) { |
518 | event = *it; | 520 | event = *it; |
519 | if ( event->dtStart().time() < fromTime ) | 521 | if ( event->dtStart().time() < fromTime ) |
520 | fromTime = event->dtStart().time(); | 522 | fromTime = event->dtStart().time(); |
521 | if ( event->dtEnd().time() > toTime ) | 523 | if ( event->dtEnd().time() > toTime ) |
522 | toTime = event->dtEnd().time(); | 524 | toTime = event->dtEnd().time(); |
523 | } | 525 | } |
524 | } | 526 | } |
525 | 527 | ||
526 | // Show at least one hour | 528 | // Show at least one hour |
527 | if ( fromTime.secsTo( toTime ) < 3600 ) { | 529 | if ( fromTime.secsTo( toTime ) < 3600 ) { |
528 | fromTime = QTime( fromTime.hour(), 0, 0 ); | 530 | fromTime = QTime( fromTime.hour(), 0, 0 ); |
@@ -531,248 +533,248 @@ void CalPrintBase::drawAgendaDayBox( QPainter &p, Event::List &events, | |||
531 | 533 | ||
532 | // calculate the height of a cell and of a minute | 534 | // calculate the height of a cell and of a minute |
533 | int totalsecs = fromTime.secsTo( toTime ); | 535 | int totalsecs = fromTime.secsTo( toTime ); |
534 | float minlen = height * 60. / totalsecs; | 536 | float minlen = height * 60. / totalsecs; |
535 | float cellHeight = 60. * minlen; | 537 | float cellHeight = 60. * minlen; |
536 | float currY = y; | 538 | float currY = y; |
537 | 539 | ||
538 | // print grid: | 540 | // print grid: |
539 | QTime curTime( QTime( fromTime.hour(), 0, 0 ) ); | 541 | QTime curTime( QTime( fromTime.hour(), 0, 0 ) ); |
540 | currY += fromTime.secsTo( curTime ) * minlen / 60; | 542 | currY += fromTime.secsTo( curTime ) * minlen / 60; |
541 | 543 | ||
542 | while ( curTime < toTime && curTime.isValid() ) { | 544 | while ( curTime < toTime && curTime.isValid() ) { |
543 | if ( currY > y ) p.drawLine( x, int( currY ), x + width, int( currY ) ); | 545 | if ( currY > y ) p.drawLine( x, int( currY ), x + width, int( currY ) ); |
544 | currY += cellHeight / 2; | 546 | currY += cellHeight / 2; |
545 | if ( ( currY > y ) && ( currY < y + height ) ) { | 547 | if ( ( currY > y ) && ( currY < y + height ) ) { |
546 | QPen oldPen( p.pen() ); | 548 | QPen oldPen( p.pen() ); |
547 | p.setPen( QColor( 192, 192, 192 ) ); | 549 | p.setPen( QColor( 192, 192, 192 ) ); |
548 | p.drawLine( x, int( currY ), x + width, int( currY ) ); | 550 | p.drawLine( x, int( currY ), x + width, int( currY ) ); |
549 | p.setPen( oldPen ); | 551 | p.setPen( oldPen ); |
550 | } // enough space for half-hour line | 552 | } // enough space for half-hour line |
551 | if ( curTime.secsTo( toTime ) > 3600 ) | 553 | if ( curTime.secsTo( toTime ) > 3600 ) |
552 | curTime = curTime.addSecs( 3600 ); | 554 | curTime = curTime.addSecs( 3600 ); |
553 | else curTime = toTime; | 555 | else curTime = toTime; |
554 | currY += cellHeight / 2; | 556 | currY += cellHeight / 2; |
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(); |
580 | QBrush oldBrush = p.brush(); | 582 | QBrush oldBrush = p.brush(); |
581 | 583 | ||
582 | p.setFont( QFont( "helvetica", 10 ) ); | 584 | p.setFont( QFont( "helvetica", 10 ) ); |
583 | //p.setBrush( QBrush( Dense7Pattern ) ); | 585 | //p.setBrush( QBrush( Dense7Pattern ) ); |
584 | 586 | ||
585 | for( it1.toFirst(); it1.current(); ++it1 ) { | 587 | for( it1.toFirst(); it1.current(); ++it1 ) { |
586 | PrintCellItem *placeItem = static_cast<PrintCellItem *>( it1.current() ); | 588 | PrintCellItem *placeItem = static_cast<PrintCellItem *>( it1.current() ); |
587 | 589 | ||
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 ) |
605 | { | 607 | { |
606 | Event *event = item->event(); | 608 | Event *event = item->event(); |
607 | 609 | ||
608 | // set the colors according to the categories | 610 | // set the colors according to the categories |
609 | if ( mUseColors ) setCategoryColors( p, event ); | 611 | if ( mUseColors ) setCategoryColors( p, event ); |
610 | else p.setBrush( Qt::white ); | 612 | else p.setBrush( Qt::white ); |
611 | // start/end of print area for event | 613 | // start/end of print area for event |
612 | QDateTime startTime = event->dtStart(); | 614 | QDateTime startTime = event->dtStart(); |
613 | QDateTime endTime = event->dtEnd(); | 615 | QDateTime endTime = event->dtEnd(); |
614 | if ( event->doesRecur() ) { | 616 | if ( event->doesRecur() ) { |
615 | startTime.setDate( qd ); | 617 | startTime.setDate( qd ); |
616 | endTime.setDate( qd ); | 618 | endTime.setDate( qd ); |
617 | } | 619 | } |
618 | if ( ( startTime < endPrintDate && endTime > startPrintDate ) || | 620 | if ( ( startTime < endPrintDate && endTime > startPrintDate ) || |
619 | ( endTime > startPrintDate && startTime < endPrintDate ) ) { | 621 | ( endTime > startPrintDate && startTime < endPrintDate ) ) { |
620 | if ( startTime < startPrintDate ) startTime = startPrintDate; | 622 | if ( startTime < startPrintDate ) startTime = startPrintDate; |
621 | if ( endTime > endPrintDate ) endTime = endPrintDate; | 623 | if ( endTime > endPrintDate ) endTime = endPrintDate; |
622 | int eventLength = int( startTime.secsTo( endTime ) / 60. * minlen ); | 624 | int eventLength = int( startTime.secsTo( endTime ) / 60. * minlen ); |
623 | int currentyPos = int( y + startPrintDate.secsTo( startTime ) * | 625 | int currentyPos = int( y + startPrintDate.secsTo( startTime ) * |
624 | minlen / 60. ); | 626 | minlen / 60. ); |
625 | int currentWidth = width / item->subCells(); | 627 | int currentWidth = width / item->subCells(); |
626 | int currentX = x + item->subCell() * currentWidth; | 628 | int currentX = x + item->subCell() * currentWidth; |
627 | QString text = KGlobal::locale()->formatTime(event->dtStart().time())+ | 629 | QString text = KGlobal::locale()->formatTime(event->dtStart().time())+ |
628 | "-"+KGlobal::locale()->formatTime(event->dtEnd().time())+ | 630 | "-"+KGlobal::locale()->formatTime(event->dtEnd().time())+ |
629 | " "+event->summary(); | 631 | " "+event->summary(); |
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) |
647 | { | 649 | { |
648 | QString dayNumStr; | 650 | QString dayNumStr; |
649 | QString ampm; | 651 | QString ampm; |
650 | const KLocale*local = KGlobal::locale(); | 652 | const KLocale*local = KGlobal::locale(); |
651 | 653 | ||
652 | 654 | ||
653 | // This has to be localized | 655 | // This has to be localized |
654 | if (fullDate) { | 656 | if (fullDate) { |
655 | dayNumStr = local->formatDate(qd); | 657 | dayNumStr = local->formatDate(qd); |
656 | } else { | 658 | } else { |
657 | dayNumStr = QString::number( qd.day() ); | 659 | dayNumStr = QString::number( qd.day() ); |
658 | } | 660 | } |
659 | 661 | ||
660 | p.eraseRect( x, y, width, height ); | 662 | p.eraseRect( x, y, width, height ); |
661 | p.drawRect( x, y, width, height ); | 663 | p.drawRect( x, y, width, height ); |
662 | // p.fillRect( x+1, y+1, width-2,height, QBrush(Dense7Pattern) ); | 664 | // p.fillRect( x+1, y+1, width-2,height, QBrush(Dense7Pattern) ); |
663 | p.drawRect( x, y, width, mSubHeaderHeight ); | 665 | p.drawRect( x, y, width, mSubHeaderHeight ); |
664 | //p.fillRect( x+1, y+1, width-2, mSubHeaderHeight-2, QBrush(Dense7Pattern) ); | 666 | //p.fillRect( x+1, y+1, width-2, mSubHeaderHeight-2, QBrush(Dense7Pattern) ); |
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(); |
692 | 694 | ||
693 | int textY=mSubHeaderHeight+3; // gives the relative y-coord of the next printed entry | 695 | int textY=mSubHeaderHeight+3; // gives the relative y-coord of the next printed entry |
694 | Event::List::ConstIterator it; | 696 | Event::List::ConstIterator it; |
695 | int entryCount = eventList.count() +todos.count(); | 697 | int entryCount = eventList.count() +todos.count(); |
696 | if ( p.fontMetrics().lineSpacing()* entryCount > height-textY ) { | 698 | if ( p.fontMetrics().lineSpacing()* entryCount > height-textY ) { |
697 | if ( (p.fontMetrics().lineSpacing()-1) * entryCount > height-textY ) { | 699 | if ( (p.fontMetrics().lineSpacing()-1) * entryCount > height-textY ) { |
698 | p.setFont( QFont( "helvetica", 7 ) ); | 700 | p.setFont( QFont( "helvetica", 7 ) ); |
699 | if ( (p.fontMetrics().lineSpacing()-1) * entryCount > height-textY ) | 701 | if ( (p.fontMetrics().lineSpacing()-1) * entryCount > height-textY ) |
700 | p.setFont( QFont( "helvetica", 6 ) ); | 702 | p.setFont( QFont( "helvetica", 6 ) ); |
701 | } | 703 | } |
702 | lineSpacing = p.fontMetrics().lineSpacing()-1; | 704 | lineSpacing = p.fontMetrics().lineSpacing()-1; |
703 | } | 705 | } |
704 | // qDebug("fm %d %d %d ",p.fontMetrics().height(), eventList.count() , height-textY ); | 706 | // qDebug("fm %d %d %d ",p.fontMetrics().height(), eventList.count() , height-textY ); |
705 | for( it = eventList.begin(); it != eventList.end() && textY<height; ++it ) { | 707 | for( it = eventList.begin(); it != eventList.end() && textY<height; ++it ) { |
706 | Event *currEvent = *it; | 708 | Event *currEvent = *it; |
707 | if (currEvent->doesFloat() || currEvent->isMultiDay()) | 709 | if (currEvent->doesFloat() || currEvent->isMultiDay()) |
708 | outStr = currEvent->summary(); | 710 | outStr = currEvent->summary(); |
709 | 711 | ||
710 | else { | 712 | else { |
711 | if ( fullDate ) { | 713 | if ( fullDate ) { |
712 | outStr = KGlobal::locale()->formatTime( currEvent->dtStart().time())+ | 714 | outStr = KGlobal::locale()->formatTime( currEvent->dtStart().time())+ |
713 | "-"+KGlobal::locale()->formatTime( currEvent->dtEnd().time())+ | 715 | "-"+KGlobal::locale()->formatTime( currEvent->dtEnd().time())+ |
714 | " "+ currEvent->summary(); | 716 | " "+ currEvent->summary(); |
715 | if ( ! currEvent->location().isEmpty() ) | 717 | if ( ! currEvent->location().isEmpty() ) |
716 | outStr += " (" + currEvent->location()+")"; | 718 | outStr += " (" + currEvent->location()+")"; |
717 | } else { | 719 | } else { |
718 | QTime t1 = currEvent->dtStart().time(); | 720 | QTime t1 = currEvent->dtStart().time(); |
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; |
736 | QString text; | 738 | QString text; |
737 | if (todo->hasDueDate()) { | 739 | if (todo->hasDueDate()) { |
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 | ||
755 | void CalPrintBase::drawWeek(QPainter &p, const QDate &qd, | 757 | void CalPrintBase::drawWeek(QPainter &p, const QDate &qd, |
756 | int x, int y, int width, int height) | 758 | int x, int y, int width, int height) |
757 | { | 759 | { |
758 | QDate weekDate = qd; | 760 | QDate weekDate = qd; |
759 | bool portrait = ( mPrinter->orientation() == KPrinter::Portrait ); | 761 | bool portrait = ( mPrinter->orientation() == KPrinter::Portrait ); |
760 | int cellWidth, cellHeight; | 762 | int cellWidth, cellHeight; |
761 | int vcells; | 763 | int vcells; |
762 | if (portrait) { | 764 | if (portrait) { |
763 | cellWidth = width/2; | 765 | cellWidth = width/2; |
764 | vcells=3; | 766 | vcells=3; |
765 | } else { | 767 | } else { |
766 | cellWidth = width/6; | 768 | cellWidth = width/6; |
767 | vcells=1; | 769 | vcells=1; |
768 | } | 770 | } |
769 | cellHeight = height/vcells; | 771 | cellHeight = height/vcells; |
770 | 772 | ||
771 | // correct begin of week | 773 | // correct begin of week |
772 | int weekdayCol = weekdayColumn( qd.dayOfWeek() ); | 774 | int weekdayCol = weekdayColumn( qd.dayOfWeek() ); |
773 | weekDate = qd.addDays( -weekdayCol ); | 775 | weekDate = qd.addDays( -weekdayCol ); |
774 | 776 | ||
775 | for (int i = 0; i < 7; i++, weekDate = weekDate.addDays(1)) { | 777 | for (int i = 0; i < 7; i++, weekDate = weekDate.addDays(1)) { |
776 | if (i<5) { | 778 | if (i<5) { |
777 | drawDayBox(p, weekDate, x+cellWidth*(int)(i/vcells), y+cellHeight*(i%vcells), | 779 | drawDayBox(p, weekDate, x+cellWidth*(int)(i/vcells), y+cellHeight*(i%vcells), |
778 | cellWidth, cellHeight, true); | 780 | cellWidth, cellHeight, true); |
@@ -820,233 +822,231 @@ void CalPrintBase::drawTimeTable(QPainter &p, | |||
820 | 822 | ||
821 | 823 | ||
822 | /////////////////////////////////////////////////////////////////////////////// | 824 | /////////////////////////////////////////////////////////////////////////////// |
823 | 825 | ||
824 | void CalPrintBase::drawMonth(QPainter &p, const QDate &qd, bool weeknumbers, | 826 | void CalPrintBase::drawMonth(QPainter &p, const QDate &qd, bool weeknumbers, |
825 | int x, int y, int width, int height) | 827 | int x, int y, int width, int height) |
826 | { | 828 | { |
827 | 829 | ||
828 | int yoffset = mSubHeaderHeight; | 830 | int yoffset = mSubHeaderHeight; |
829 | int xoffset = 0; | 831 | int xoffset = 0; |
830 | 832 | ||
831 | QDate monthDate(QDate(qd.year(), qd.month(), 1)); | 833 | QDate monthDate(QDate(qd.year(), qd.month(), 1)); |
832 | QDate monthFirst(monthDate); | 834 | QDate monthFirst(monthDate); |
833 | QDate monthLast(monthDate.addMonths(1).addDays(-1)); | 835 | QDate monthLast(monthDate.addMonths(1).addDays(-1)); |
834 | 836 | ||
835 | 837 | ||
836 | int weekdayCol = weekdayColumn( monthDate.dayOfWeek() ); | 838 | int weekdayCol = weekdayColumn( monthDate.dayOfWeek() ); |
837 | monthDate = monthDate.addDays(-weekdayCol); | 839 | monthDate = monthDate.addDays(-weekdayCol); |
838 | 840 | ||
839 | int rows=(weekdayCol + qd.daysInMonth() - 1)/7 +1; | 841 | int rows=(weekdayCol + qd.daysInMonth() - 1)/7 +1; |
840 | int cellHeight = (height-yoffset) / rows; | 842 | int cellHeight = (height-yoffset) / rows; |
841 | 843 | ||
842 | if (weeknumbers) { | 844 | if (weeknumbers) { |
843 | QFont oldFont(p.font()); | 845 | QFont oldFont(p.font()); |
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 | ||
861 | QColor back = p.backgroundColor(); | 863 | QColor back = p.backgroundColor(); |
862 | bool darkbg = false; | 864 | bool darkbg = false; |
863 | for (int row = 0; row < rows; row++) { | 865 | for (int row = 0; row < rows; row++) { |
864 | for (int col = 0; col < 7; col++) { | 866 | for (int col = 0; col < 7; col++) { |
865 | // show days from previous/next month with a grayed background | 867 | // show days from previous/next month with a grayed background |
866 | if ( (monthDate < monthFirst) || (monthDate > monthLast) ) { | 868 | if ( (monthDate < monthFirst) || (monthDate > monthLast) ) { |
867 | p.setBackgroundColor( QColor( 240, 240, 240) ); | 869 | p.setBackgroundColor( QColor( 240, 240, 240) ); |
868 | darkbg = true; | 870 | darkbg = true; |
869 | } | 871 | } |
870 | drawDayBox(p, monthDate, x+xoffset+col*cellWidth, y+yoffset+row*cellHeight, cellWidth, cellHeight); | 872 | drawDayBox(p, monthDate, x+xoffset+col*cellWidth, y+yoffset+row*cellHeight, cellWidth, cellHeight); |
871 | if ( darkbg ) { | 873 | if ( darkbg ) { |
872 | p.setBackgroundColor( back ); | 874 | p.setBackgroundColor( back ); |
873 | darkbg = false; | 875 | darkbg = false; |
874 | } | 876 | } |
875 | monthDate = monthDate.addDays(1); | 877 | monthDate = monthDate.addDays(1); |
876 | } | 878 | } |
877 | } | 879 | } |
878 | } | 880 | } |
879 | 881 | ||
880 | 882 | ||
881 | /////////////////////////////////////////////////////////////////////////////// | 883 | /////////////////////////////////////////////////////////////////////////////// |
882 | 884 | ||
883 | void CalPrintBase::drawTodo( bool completed, int &count, Todo * item, QPainter &p, bool connectSubTodos, | 885 | void CalPrintBase::drawTodo( bool completed, int &count, Todo * item, QPainter &p, bool connectSubTodos, |
884 | bool desc, int pospriority, int possummary, int posDueDt, int level, | 886 | bool desc, int pospriority, int possummary, int posDueDt, int level, |
885 | int x, int &y, int width, int &height, int pageHeight, | 887 | int x, int &y, int width, int &height, int pageHeight, |
886 | TodoParentStart *r ) | 888 | TodoParentStart *r ) |
887 | { | 889 | { |
888 | if ( !completed && item->isCompleted() ) | 890 | if ( !completed && item->isCompleted() ) |
889 | return; | 891 | return; |
890 | QString outStr; | 892 | QString outStr; |
891 | // int fontHeight = 10; | 893 | // int fontHeight = 10; |
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() ) { |
927 | int start; | 929 | int start; |
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; |
1029 | startPoints.append( &startpt ); | 1029 | startPoints.append( &startpt ); |
1030 | for( it = l.begin(); it != l.end(); ++it ) { | 1030 | for( it = l.begin(); it != l.end(); ++it ) { |
1031 | count++; | 1031 | count++; |
1032 | drawTodo( completed, count, static_cast<Todo *>( *it ), p, connectSubTodos, | 1032 | drawTodo( completed, count, static_cast<Todo *>( *it ), p, connectSubTodos, |
1033 | desc, pospriority, possummary, posDueDt, level+1, | 1033 | desc, pospriority, possummary, posDueDt, level+1, |
1034 | x, y, width, height, pageHeight, &startpt); | 1034 | x, y, width, height, pageHeight, &startpt); |
1035 | } | 1035 | } |
1036 | startPoints.remove(&startpt); | 1036 | startPoints.remove(&startpt); |
1037 | } | 1037 | } |
1038 | 1038 | ||
1039 | int CalPrintBase::weekdayColumn( int weekday ) | 1039 | int CalPrintBase::weekdayColumn( int weekday ) |
1040 | { | 1040 | { |
1041 | return ( weekday + 7 - KGlobal::locale()->weekStartDay() ) % 7; | 1041 | return ( weekday + 7 - KGlobal::locale()->weekStartDay() ) % 7; |
1042 | } | 1042 | } |
1043 | 1043 | ||
1044 | void CalPrintBase::drawSplitWeek( QPainter &p, const QDate &fd, | 1044 | void CalPrintBase::drawSplitWeek( QPainter &p, const QDate &fd, |
1045 | const QDate &td ) | 1045 | const QDate &td ) |
1046 | { | 1046 | { |
1047 | QDate curDay, fromDay, toDay, curWeek, fromWeek, toWeek; | 1047 | QDate curDay, fromDay, toDay, curWeek, fromWeek, toWeek; |
1048 | 1048 | ||
1049 | mPrinter->setOrientation(KPrinter::Portrait); | 1049 | mPrinter->setOrientation(KPrinter::Portrait); |
1050 | 1050 | ||
1051 | int minus = 0; | 1051 | int minus = 0; |
1052 | if (KGlobal::locale()->weekStartsMonday()) { | 1052 | if (KGlobal::locale()->weekStartsMonday()) { |
@@ -1109,198 +1109,198 @@ void CalPrintBase::drawSplitWeek( QPainter &p, const QDate &fd, | |||
1109 | drawSplitDay( p, curDay, columnWidth, pageHeight, | 1109 | drawSplitDay( p, curDay, columnWidth, pageHeight, |
1110 | int( columnWidth * 0.5 ) ); | 1110 | int( columnWidth * 0.5 ) ); |
1111 | drawSplitHeaderRight( p, curWeek.addDays( -6 ), curWeek, | 1111 | drawSplitHeaderRight( p, curWeek.addDays( -6 ), curWeek, |
1112 | curWeek, pageWidth, mHeaderHeight ); | 1112 | curWeek, pageWidth, mHeaderHeight ); |
1113 | break; | 1113 | break; |
1114 | case 5: | 1114 | case 5: |
1115 | drawSplitDay( p, curDay, columnWidth, pageHeight, | 1115 | drawSplitDay( p, curDay, columnWidth, pageHeight, |
1116 | int( columnWidth * 1.5 ) ); | 1116 | int( columnWidth * 1.5 ) ); |
1117 | break; | 1117 | break; |
1118 | case 6: | 1118 | case 6: |
1119 | drawSplitDay( p, curDay, columnWidth, pageHeight, | 1119 | drawSplitDay( p, curDay, columnWidth, pageHeight, |
1120 | int( columnWidth * 2.5 ) ); | 1120 | int( columnWidth * 2.5 ) ); |
1121 | if ( curDay < toDay ) | 1121 | if ( curDay < toDay ) |
1122 | mPrinter->newPage(); | 1122 | mPrinter->newPage(); |
1123 | curWeek = curWeek.addDays( 7 ); | 1123 | curWeek = curWeek.addDays( 7 ); |
1124 | break; | 1124 | break; |
1125 | } | 1125 | } |
1126 | curDay = curDay.addDays(1); | 1126 | curDay = curDay.addDays(1); |
1127 | 1127 | ||
1128 | } while (curDay <= toDay); | 1128 | } while (curDay <= toDay); |
1129 | 1129 | ||
1130 | } | 1130 | } |
1131 | 1131 | ||
1132 | void CalPrintBase::drawSplitHeaderRight( QPainter &p, const QDate &fd, | 1132 | 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 { |
1151 | title = local->monthName(fd.month(), false) + ' ' + QString::number(fd.day()) + ' ' | 1151 | title = local->monthName(fd.month(), false) + ' ' + QString::number(fd.day()) + ' ' |
1152 | + '-' + ' ' + local->monthName(td.month(), false) + ' ' + QString::number(td.day()); | 1152 | + '-' + ' ' + local->monthName(td.month(), false) + ' ' + QString::number(td.day()); |
1153 | } | 1153 | } |
1154 | 1154 | ||
1155 | // Grrrrrrr! why can't I set the font to a serif font?!?!? | 1155 | // Grrrrrrr! why can't I set the font to a serif font?!?!? |
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; |
1183 | int startHour = KOPrefs::instance()->mDayBegins; | 1183 | int startHour = KOPrefs::instance()->mDayBegins; |
1184 | int endHour = 20; | 1184 | int endHour = 20; |
1185 | int offset = mHeaderHeight + mSubHeaderHeight + 10; | 1185 | int offset = mHeaderHeight + mSubHeaderHeight + 10; |
1186 | Event::List eventList; eventList.fill( mCalendar->events( qd, true )); | 1186 | Event::List eventList; eventList.fill( mCalendar->events( qd, true )); |
1187 | Event::List::Iterator it; | 1187 | Event::List::Iterator it; |
1188 | Event *currEvent; | 1188 | Event *currEvent; |
1189 | KLocale *local = KGlobal::locale(); | 1189 | KLocale *local = KGlobal::locale(); |
1190 | QString dayName; | 1190 | QString dayName; |
1191 | 1191 | ||
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 | /* |
1209 | while( it != eventList.end() ) { | 1209 | while( it != eventList.end() ) { |
1210 | Event *currEvent = *it; | 1210 | Event *currEvent = *it; |
1211 | if ( currEvent->doesFloat() ) { | 1211 | if ( currEvent->doesFloat() ) { |
1212 | p.drawRect( offsetLeft, offset, width, 35 ); | 1212 | p.drawRect( offsetLeft, offset, width, 35 ); |
1213 | p.drawText( offsetLeft + 5, offset + 10, width - 10, 30, | 1213 | p.drawText( offsetLeft + 5, offset + 10, width - 10, 30, |
1214 | AlignLeft | AlignTop, currEvent->summary() ); | 1214 | AlignLeft | AlignTop, currEvent->summary() ); |
1215 | offset += 40; | 1215 | offset += 40; |
1216 | allDays++; | 1216 | allDays++; |
1217 | it = eventList.remove( it ); | 1217 | it = eventList.remove( it ); |
1218 | } else { | 1218 | } else { |
1219 | ++it; | 1219 | ++it; |
1220 | } | 1220 | } |
1221 | } | 1221 | } |
1222 | */ | 1222 | */ |
1223 | //p.setBrush(QBrush()); | 1223 | //p.setBrush(QBrush()); |
1224 | int tmpEnd; | 1224 | int tmpEnd; |
1225 | for ( it = eventList.begin(); it != eventList.end(); ++it ) { | 1225 | for ( it = eventList.begin(); it != eventList.end(); ++it ) { |
1226 | Event *currEvent = *it; | 1226 | Event *currEvent = *it; |
1227 | tmpEnd = currEvent->dtEnd().time().hour(); | 1227 | tmpEnd = currEvent->dtEnd().time().hour(); |
1228 | if (currEvent->dtEnd().time().minute() > 0) | 1228 | if (currEvent->dtEnd().time().minute() > 0) |
1229 | tmpEnd++; | 1229 | tmpEnd++; |
1230 | if (tmpEnd > endHour) | 1230 | if (tmpEnd > endHour) |
1231 | endHour = tmpEnd; | 1231 | endHour = tmpEnd; |
1232 | } | 1232 | } |
1233 | int hours = endHour - startHour; | 1233 | int hours = endHour - startHour; |
1234 | int cellHeight = (height-offset) / hours; // hour increments. | 1234 | int cellHeight = (height-offset) / hours; // hour increments. |
1235 | 1235 | ||
1236 | p.setFont(QFont("helvetica", 12)); | 1236 | p.setFont(QFont("helvetica", 12)); |
1237 | //p.setBrush(QBrush(Dense7Pattern)); | 1237 | //p.setBrush(QBrush(Dense7Pattern)); |
1238 | p.setBrush(Qt::white); | 1238 | p.setBrush(Qt::white); |
1239 | for ( it = eventList.begin(); it != eventList.end(); ++it ) { | 1239 | for ( it = eventList.begin(); it != eventList.end(); ++it ) { |
1240 | Event *currEvent = *it; | 1240 | Event *currEvent = *it; |
1241 | int startTime = currEvent->dtStart().time().hour(); | 1241 | int startTime = currEvent->dtStart().time().hour(); |
1242 | int endTime = currEvent->dtEnd().time().hour(); | 1242 | int endTime = currEvent->dtEnd().time().hour(); |
1243 | float minuteInc = cellHeight / 60.0; | 1243 | float minuteInc = cellHeight / 60.0; |
1244 | if ((startTime >= startHour) && (endTime <= (startHour + hours))) { | 1244 | if ((startTime >= startHour) && (endTime <= (startHour + hours))) { |
1245 | startTime -= startHour; | 1245 | startTime -= startHour; |
1246 | int startMinuteOff = (int) (minuteInc * | 1246 | int startMinuteOff = (int) (minuteInc * |
1247 | currEvent->dtStart().time().minute()); | 1247 | currEvent->dtStart().time().minute()); |
1248 | QString text = currEvent->summary() ; | 1248 | QString text = currEvent->summary() ; |
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 |