• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepim API Reference
  • KDE Home
  • Contact Us
 

calendarsupport

  • sources
  • kde-4.14
  • kdepim
  • calendarsupport
  • printing
calprintdefaultplugins.cpp
Go to the documentation of this file.
1 /*
2  Copyright (c) 1998 Preston Brown <pbrown@kde.org>
3  Copyright (C) 2003 Reinhold Kainhofer <reinhold@kainhofer.com>
4  Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org>
5  Copyright (c) 2008 Ron Goodheart <rong.dev@gmail.com>
6  Copyright (c) 2010-2015 Laurent Montel <montel@kde.org>
7  Copyright (c) 2012-2013 Allen Winter <winter@kde.org>
8 
9  This program is free software; you can redistribute it and/or modify
10  it under the terms of the GNU General Public License as published by
11  the Free Software Foundation; either version 2 of the License, or
12  (at your option) any later version.
13 
14  This program is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License for more details.
18 
19  You should have received a copy of the GNU General Public License along
20  with this program; if not, write to the Free Software Foundation, Inc.,
21  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 
23  As a special exception, permission is given to link this program
24  with any edition of Qt, and distribute the resulting executable,
25  without including the source code for Qt in the source distribution.
26 */
27 
28 #include "calprintdefaultplugins.h"
29 #include "kcalprefs.h"
30 #include "utils.h"
31 
32 #include <Akonadi/Item>
33 
34 #include <KCalCore/Visitor>
35 
36 #include <KCalUtils/IncidenceFormatter>
37 #include <KCalUtils/Stringify>
38 
39 #include <KCalendarSystem>
40 #include <KDateTime>
41 #include <KConfigGroup>
42 #include <KSystemTimeZones>
43 
44 #include <QDateTime>
45 #include <QPainter>
46 #include <QPrinter>
47 
48 using namespace CalendarSupport;
49 
50 static QString cleanStr( const QString &instr )
51 {
52  QString ret = instr;
53  return ret.replace( QLatin1Char('\n'), QLatin1Char(' ') );
54 }
55 
56 /**************************************************************
57  * Print Incidence
58  **************************************************************/
59 
60 CalPrintIncidence::CalPrintIncidence() : CalPrintPluginBase()
61 {
62 }
63 
64 CalPrintIncidence::~CalPrintIncidence()
65 {
66 }
67 
68 QWidget *CalPrintIncidence::createConfigWidget( QWidget *w )
69 {
70  return new CalPrintIncidenceConfig( w );
71 }
72 
73 void CalPrintIncidence::readSettingsWidget()
74 {
75  CalPrintIncidenceConfig *cfg =
76  dynamic_cast<CalPrintIncidenceConfig *>( ( QWidget* )mConfigWidget );
77  if ( cfg ) {
78  mUseColors = cfg->mColors->isChecked();
79  mPrintFooter = cfg->mPrintFooter->isChecked();
80  mShowOptions = cfg->mShowDetails->isChecked();
81  mShowSubitemsNotes = cfg->mShowSubitemsNotes->isChecked();
82  mShowAttendees = cfg->mShowAttendees->isChecked();
83  mShowAttachments = cfg->mShowAttachments->isChecked();
84  mShowNoteLines = cfg->mShowNoteLines->isChecked();
85  }
86 }
87 
88 void CalPrintIncidence::setSettingsWidget()
89 {
90  CalPrintIncidenceConfig *cfg =
91  dynamic_cast<CalPrintIncidenceConfig *>( ( QWidget* )mConfigWidget );
92  if ( cfg ) {
93  cfg->mColors->setChecked( mUseColors );
94  cfg->mPrintFooter->setChecked( mPrintFooter );
95  cfg->mShowDetails->setChecked( mShowOptions );
96  cfg->mShowSubitemsNotes->setChecked( mShowSubitemsNotes );
97  cfg->mShowAttendees->setChecked( mShowAttendees );
98  cfg->mShowAttachments->setChecked( mShowAttachments );
99  cfg->mShowNoteLines->setChecked( mShowNoteLines );
100  }
101 }
102 
103 void CalPrintIncidence::loadConfig()
104 {
105  if ( mConfig ) {
106  KConfigGroup grp( mConfig, groupName() );
107  mShowOptions = grp.readEntry( "Show Options", false );
108  mShowSubitemsNotes = grp.readEntry( "Show Subitems and Notes", false );
109  mShowAttendees = grp.readEntry( "Use Attendees", false );
110  mShowAttachments = grp.readEntry( "Use Attachments", false );
111  mShowNoteLines = grp.readEntry( "Note Lines", false );
112  }
113  setSettingsWidget();
114 }
115 
116 void CalPrintIncidence::saveConfig()
117 {
118  readSettingsWidget();
119  if ( mConfig ) {
120  KConfigGroup grp( mConfig, groupName() );
121  grp.writeEntry( "Show Options", mShowOptions );
122  grp.writeEntry( "Show Subitems and Notes", mShowSubitemsNotes );
123  grp.writeEntry( "Use Attendees", mShowAttendees );
124  grp.writeEntry( "Use Attachments", mShowAttachments );
125  grp.writeEntry( "Note Lines", mShowNoteLines );
126  }
127 }
128 
129 class TimePrintStringsVisitor : public KCalCore::Visitor
130 {
131  public:
132  TimePrintStringsVisitor() {}
133 
134  bool act( KCalCore::IncidenceBase::Ptr incidence )
135  {
136  return incidence->accept( *this, incidence );
137  }
138  QString mStartCaption, mStartString;
139  QString mEndCaption, mEndString;
140  QString mDurationCaption, mDurationString;
141 
142  protected:
143  bool visit( KCalCore::Event::Ptr event ) {
144  if ( event->dtStart().isValid() ) {
145  mStartCaption = i18n( "Start date: " );
146  mStartString = KCalUtils::IncidenceFormatter::dateTimeToString(
147  event->dtStart(), event->allDay(), false );
148  } else {
149  mStartCaption = i18n( "No start date" );
150  mStartString.clear();
151  }
152 
153  if ( event->hasEndDate() ) {
154  mEndCaption = i18n( "End date: " );
155  mEndString = KCalUtils::IncidenceFormatter::dateTimeToString(
156  event->dtEnd(), event->allDay(), false );
157  } else if ( event->hasDuration() ) {
158  mEndCaption = i18n( "Duration: " );
159  int mins = event->duration().asSeconds() / 60;
160  if ( mins >= 60 ) {
161  mEndString += i18np( "1 hour ", "%1 hours ", mins / 60 );
162  }
163  if ( mins % 60 > 0 ) {
164  mEndString += i18np( "1 minute ", "%1 minutes ", mins % 60 );
165  }
166  } else {
167  mEndCaption = i18n( "No end date" );
168  mEndString.clear();
169  }
170  return true;
171  }
172  bool visit( KCalCore::Todo::Ptr todo ) {
173  if ( todo->hasStartDate() ) {
174  mStartCaption = i18n( "Start date: " );
175  mStartString = KCalUtils::IncidenceFormatter::dateTimeToString(
176  todo->dtStart(), todo->allDay(), false );
177  } else {
178  mStartCaption = i18n( "No start date" );
179  mStartString.clear();
180  }
181 
182  if ( todo->hasDueDate() ) {
183  mEndCaption = i18n( "Due date: " );
184  mEndString = KCalUtils::IncidenceFormatter::dateTimeToString(
185  todo->dtDue(), todo->allDay(), false );
186  } else {
187  mEndCaption = i18n( "No due date" );
188  mEndString.clear();
189  }
190  return true;
191  }
192  bool visit( KCalCore::Journal::Ptr journal ) {
193  mStartCaption = i18n( "Start date: " );
194  mStartString = KCalUtils::IncidenceFormatter::dateTimeToString(
195  journal->dtStart(), journal->allDay(), false );
196  mEndCaption.clear();
197  mEndString.clear();
198  return true;
199  }
200  bool visit( KCalCore::FreeBusy::Ptr fb ) {
201  Q_UNUSED( fb );
202  return true;
203  }
204 };
205 
206 int CalPrintIncidence::printCaptionAndText( QPainter &p, const QRect &box,
207  const QString &caption,
208  const QString &text,
209  QFont captionFont, QFont textFont )
210 {
211  QFontMetrics captionFM( captionFont );
212  int textWd = captionFM.width( caption );
213  QRect textRect( box );
214 
215  QFont oldFont( p.font() );
216  p.setFont( captionFont );
217  p.drawText( box, Qt::AlignLeft|Qt::AlignTop|Qt::TextSingleLine, caption );
218 
219  if ( !text.isEmpty() ) {
220  textRect.setLeft( textRect.left() + textWd );
221  p.setFont( textFont );
222  p.drawText( textRect, Qt::AlignLeft|Qt::AlignTop|Qt::TextSingleLine, text );
223  }
224  p.setFont( oldFont );
225  return textRect.bottom();
226 }
227 
228 void CalPrintIncidence::print( QPainter &p, int width, int height )
229 {
230  QFont oldFont( p.font() );
231  QFont textFont( QLatin1String("sans-serif"), 11, QFont::Normal );
232  QFont captionFont( QLatin1String("sans-serif"), 11, QFont::Bold );
233  p.setFont( textFont );
234  int lineHeight = p.fontMetrics().lineSpacing();
235  QString cap, txt;
236 
237  KCalCore::Incidence::List::ConstIterator it;
238  for ( it = mSelectedIncidences.constBegin(); it != mSelectedIncidences.constEnd(); ++it ) {
239  // don't do anything on a 0-pointer!
240  if ( !(*it) ) {
241  continue;
242  }
243  if ( it != mSelectedIncidences.constBegin() ) {
244  mPrinter->newPage();
245  }
246 
247  const bool isJournal = ( (*it)->type() == KCalCore::Incidence::TypeJournal );
248 
249  // PAGE Layout (same for landscape and portrait! astonishingly, it looks good with both!):
250  // +-----------------------------------+
251  // | Header: Summary |
252  // +===================================+
253  // | start: ______ end: _________ |
254  // | repeats: ___________________ |
255  // | reminder: __________________ |
256  // +-----------------------------------+
257  // | Location: ______________________ |
258  // +------------------------+----------+
259  // | Description: | Notes or |
260  // | | Subitems |
261  // | | |
262  // | | |
263  // | | |
264  // | | |
265  // | | |
266  // | | |
267  // | | |
268  // | | |
269  // +------------------------+----------+
270  // | Attachments: | Settings |
271  // | | |
272  // +------------------------+----------+
273  // | Attendees: |
274  // | |
275  // +-----------------------------------+
276  // | Categories: _____________________ |
277  // +-----------------------------------+
278 
279  QRect box( 0, 0, width, height );
280  QRect titleBox( box );
281  titleBox.setHeight( headerHeight() );
282  QColor headerColor = categoryBgColor( *it );
283  // Draw summary as header, no small calendars in title bar, expand height if needed
284  int titleBottom = drawHeader( p, (*it)->summary(), QDate(), QDate(),
285  titleBox, true, headerColor );
286  titleBox.setBottom( titleBottom );
287 
288  QRect timesBox( titleBox );
289  timesBox.setTop( titleBox.bottom() + padding() );
290  timesBox.setHeight( height / 8 );
291 
292  TimePrintStringsVisitor stringVis;
293  int h = timesBox.top();
294  if ( stringVis.act( *it ) ) {
295  QRect textRect( timesBox.left() + padding(),
296  timesBox.top() + padding(), 0, lineHeight );
297  textRect.setRight( timesBox.center().x() );
298  h = printCaptionAndText( p, textRect, stringVis.mStartCaption,
299  stringVis.mStartString, captionFont, textFont );
300 
301  textRect.setLeft( textRect.right() );
302  textRect.setRight( timesBox.right() - padding() );
303  h = qMax( printCaptionAndText( p, textRect, stringVis.mEndCaption,
304  stringVis.mEndString, captionFont, textFont ), h );
305  }
306 
307  // Recurrence Printing
308  if ( (*it)->recurs() ) {
309  QRect recurBox( timesBox.left() + padding(), h + padding(),
310  timesBox.right() - padding(), lineHeight );
311  KCalCore::Recurrence *recurs = (*it)->recurrence();
312  QString displayString = KCalUtils::IncidenceFormatter::recurrenceString((*it));
313  // exception dates
314  QString exceptString;
315  if ( !recurs->exDates().isEmpty() ) {
316  exceptString = i18nc( "except for listed dates", " except" );
317  for ( int i = 0; i < recurs->exDates().size(); ++i ) {
318  exceptString.append( QLatin1String(" ") );
319  exceptString.append( KGlobal::locale()->formatDate( recurs->exDates()[i],
320  KLocale::ShortDate ) );
321  }
322  }
323  displayString.append( exceptString );
324  h = qMax( printCaptionAndText( p, recurBox, i18n( "Repeats: " ),
325  displayString, captionFont, textFont ), h );
326  }
327 
328  if ( !isJournal ) {
329  // Alarms Printing
330  QRect alarmBox( timesBox.left() + padding(), h + padding(),
331  timesBox.right() - padding(), lineHeight );
332  KCalCore::Alarm::List alarms = (*it)->alarms();
333  if ( alarms.count() == 0 ) {
334  cap = i18n( "No reminders" );
335  txt.clear();
336  } else {
337  cap = i18np( "Reminder: ", "%1 reminders: ", alarms.count() );
338 
339  QStringList alarmStrings;
340  KCalCore::Alarm::List::ConstIterator it;
341  for ( it = alarms.constBegin(); it != alarms.constEnd(); ++it ) {
342  KCalCore::Alarm::Ptr alarm = *it;
343 
344  // Alarm offset, copied from koeditoralarms.cpp:
345  KLocalizedString offsetstr;
346  int offset = 0;
347  if ( alarm->hasStartOffset() ) {
348  offset = alarm->startOffset().asSeconds();
349  if ( offset < 0 ) {
350  offsetstr = ki18nc( "N days/hours/minutes before/after the start/end",
351  "%1 before the start" );
352  offset = -offset;
353  } else {
354  offsetstr = ki18nc( "N days/hours/minutes before/after the start/end",
355  "%1 after the start" );
356  }
357  } else if ( alarm->hasEndOffset() ) {
358  offset = alarm->endOffset().asSeconds();
359  if ( offset < 0 ) {
360  offsetstr = ki18nc( "N days/hours/minutes before/after the start/end",
361  "%1 before the end" );
362  offset = -offset;
363  } else {
364  offsetstr = ki18nc( "N days/hours/minutes before/after the start/end",
365  "%1 after the end" );
366  }
367  }
368 
369  offset = offset / 60; // make minutes
370  int useoffset = offset;
371 
372  if ( offset % ( 24 * 60 ) == 0 && offset > 0 ) { // divides evenly into days?
373  useoffset = offset / ( 24 * 60 );
374  offsetstr = offsetstr.subs( i18np( "1 day", "%1 days", useoffset ) );
375  } else if ( offset % 60 == 0 && offset > 0 ) { // divides evenly into hours?
376  useoffset = offset / 60;
377  offsetstr = offsetstr.subs( i18np( "1 hour", "%1 hours", useoffset ) );
378  } else {
379  useoffset = offset;
380  offsetstr = offsetstr.subs( i18np( "1 minute", "%1 minutes", useoffset ) );
381  }
382  alarmStrings << offsetstr.toString();
383  }
384  txt = alarmStrings.join( i18nc( "Spacer for the joined list of categories", ", " ) );
385 
386  }
387  h = qMax( printCaptionAndText( p, alarmBox, cap, txt, captionFont, textFont ), h );
388  }
389  QRect organizerBox( timesBox.left() + padding(), h + padding(),
390  timesBox.right() - padding(), lineHeight );
391  h = qMax( printCaptionAndText( p, organizerBox, i18n( "Organizer: " ),
392  (*it)->organizer()->fullName(), captionFont, textFont ), h );
393 
394  // Finally, draw the frame around the time information...
395  timesBox.setBottom( qMax( timesBox.bottom(), h + padding() ) );
396  drawBox( p, BOX_BORDER_WIDTH, timesBox );
397 
398  QRect locationBox( timesBox );
399  locationBox.setTop( timesBox.bottom() + padding() );
400  locationBox.setHeight( 0 );
401  int locationBottom = 0;
402  if ( !isJournal ) {
403  locationBottom = drawBoxWithCaption( p, locationBox, i18n( "Location: " ),
404  (*it)->location(), /*sameLine=*/true,
405  /*expand=*/true, captionFont, textFont );
406  }
407  locationBox.setBottom( locationBottom );
408 
409  // Now start constructing the boxes from the bottom:
410  QRect footerBox( locationBox );
411  footerBox.setBottom( box.bottom() );
412  footerBox.setTop( footerBox.bottom() - lineHeight - 2 * padding() );
413 
414  QRect categoriesBox( footerBox );
415  categoriesBox.setBottom( footerBox.top() );
416  categoriesBox.setTop( categoriesBox.bottom() - lineHeight - 2 * padding() );
417  QRect attendeesBox( box.left(), categoriesBox.top() - padding() - box.height() / 9,
418  box.width(), box.height() / 9 );
419  QRect attachmentsBox( box.left(), attendeesBox.top() - padding() - box.height() / 9,
420  box.width() * 3 / 4 - padding(), box.height() / 9 );
421  QRect optionsBox( isJournal ? box.left() : attachmentsBox.right() + padding(),
422  attachmentsBox.top(), 0, 0 );
423  optionsBox.setRight( box.right() );
424  optionsBox.setBottom( attachmentsBox.bottom() );
425  QRect notesBox( optionsBox.left(),
426  isJournal ? ( timesBox.bottom() + padding() ) :
427  ( locationBox.bottom() + padding() ),
428  optionsBox.width(), 0 );
429  notesBox.setBottom( optionsBox.top() - padding() );
430  QRect descriptionBox( notesBox );
431  descriptionBox.setLeft( box.left() );
432  descriptionBox.setRight( attachmentsBox.right() );
433 
434  // Adjust boxes depending on the show options...
435  if ( !mShowSubitemsNotes || isJournal ) {
436  descriptionBox.setRight( box.right() );
437  }
438  if ( !mShowAttachments || !mShowAttendees ) {
439  descriptionBox.setBottom( attachmentsBox.bottom() );
440  optionsBox.setTop( attendeesBox.top() );
441  optionsBox.setBottom( attendeesBox.bottom() );
442  notesBox.setBottom( attachmentsBox.bottom() );
443  if ( mShowOptions ) {
444  attendeesBox.setRight( attachmentsBox.right() );
445  }
446  if ( !mShowAttachments && !mShowAttendees ) {
447  if ( mShowSubitemsNotes ) {
448  descriptionBox.setBottom( attendeesBox.bottom() );
449  }
450  if ( !mShowOptions ) {
451  descriptionBox.setBottom( attendeesBox.bottom() );
452  notesBox.setBottom( attendeesBox.bottom() );
453  }
454  }
455  }
456  if ( mShowAttachments && !isJournal ) {
457  if ( !mShowOptions ) {
458  attachmentsBox.setRight( box.right() );
459  attachmentsBox.setRight( box.right() );
460  }
461  if ( !mShowAttendees ) {
462  attachmentsBox.setTop( attendeesBox.top() );
463  attachmentsBox.setBottom( attendeesBox.bottom() );
464  }
465  }
466  int newBottom = drawBoxWithCaption( p, descriptionBox, i18n( "Description:" ),
467  (*it)->description(), /*sameLine=*/false,
468  /*expand=*/false, captionFont, textFont,
469  (*it)->descriptionIsRich() );
470  if ( mShowNoteLines ) {
471  drawNoteLines( p, descriptionBox, newBottom );
472  }
473 
474  Akonadi::Item item = mCalendar->item( (*it)->uid() );
475  Akonadi::Item::List relations = mCalendar->childItems( item.id() );
476 
477  if ( mShowSubitemsNotes && !isJournal ) {
478  if ( relations.isEmpty() || (*it)->type() != KCalCore::Incidence::TypeTodo ) {
479  int notesPosition = drawBoxWithCaption( p, notesBox, i18n( "Notes:" ),
480  QString(), /*sameLine=*/false,
481  /*expand=*/false, captionFont, textFont );
482  drawNoteLines( p, notesBox, notesPosition );
483  } else {
484 
485  QString subitemCaption;
486  if ( relations.count() == 0 ) {
487  subitemCaption = i18n( "No Subitems" );
488  txt.clear();
489  } else {
490  subitemCaption = i18np( "1 Subitem:",
491  "%1 Subitems:",
492  relations.count() );
493  }
494 
495  QString subitemString;
496  QString statusString;
497  QString datesString;
498  int count = 0;
499  foreach ( const Akonadi::Item &item, relations ) {
500  KCalCore::Todo::Ptr todo = CalendarSupport::todo( item );
501  ++count;
502  if ( !todo ) { // defensive, skip any zero pointers
503  continue;
504  }
505  // format the status
506  statusString = KCalUtils::Stringify::incidenceStatus( todo->status() );
507  if ( statusString.isEmpty() ) {
508  if ( todo->status() == KCalCore::Incidence::StatusNone ) {
509  statusString = i18nc( "no status", "none" );
510  } else {
511  statusString = i18nc( "unknown status", "unknown" );
512  }
513  }
514  // format the dates if provided
515  datesString.clear();
516  KDateTime::Spec spec = KCalPrefs::instance()->timeSpec();
517  if ( todo->dtStart().isValid() ) {
518  datesString += i18nc(
519  "subitem start date", "Start Date: %1\n",
520  KGlobal::locale()->formatDate( todo->dtStart().toTimeSpec( spec ).date(),
521  KLocale::ShortDate ) );
522  if ( !todo->allDay() ) {
523  datesString += i18nc(
524  "subitem start time", "Start Time: %1\n",
525  KGlobal::locale()->formatTime( todo->dtStart().toTimeSpec( spec ).time(),
526  false, false ) );
527  }
528  }
529  if ( todo->dateTime( KCalCore::Incidence::RoleEnd ).isValid() ) {
530  subitemString +=
531  i18nc( "subitem due date", "Due Date: %1\n",
532  KGlobal::locale()->formatDate(
533  todo->dateTime( KCalCore::Incidence::RoleEnd ).toTimeSpec( spec ).date(),
534  KLocale::ShortDate ) );
535 
536  if ( !todo->allDay() ) {
537  subitemString += i18nc(
538  "subitem due time", "Due Time: %1\n",
539  KGlobal::locale()->formatTime(
540  todo->dateTime( KCalCore::Incidence::RoleEnd ).toTimeSpec( spec ).time(),
541  false, false ) );
542  }
543  }
544  subitemString += i18nc( "subitem counter", "%1: ", count );
545  subitemString += todo->summary();
546  subitemString += QLatin1Char('\n');
547  if ( !datesString.isEmpty() ) {
548  subitemString += datesString;
549  subitemString += QLatin1Char('\n');
550  }
551  subitemString += i18nc( "subitem Status: statusString",
552  "Status: %1\n",
553  statusString );
554  subitemString += KCalUtils::IncidenceFormatter::recurrenceString( todo ) + QLatin1Char('\n');
555  subitemString += i18nc( "subitem Priority: N",
556  "Priority: <numid>%1</numid>\n",
557  todo->priority() );
558  subitemString += i18nc( "subitem Secrecy: secrecyString",
559  "Secrecy: %1\n",
560  KCalUtils::Stringify::incidenceSecrecy( todo->secrecy() ) );
561  subitemString += QLatin1Char('\n');
562  }
563  drawBoxWithCaption( p, notesBox, subitemCaption,
564  subitemString, /*sameLine=*/false,
565  /*expand=*/false, captionFont, textFont );
566  }
567  }
568 
569  if ( mShowAttachments && !isJournal ) {
570  KCalCore::Attachment::List attachments = (*it)->attachments();
571  QString attachmentCaption;
572  if ( attachments.count() == 0 ) {
573  attachmentCaption = i18n( "No Attachments" );
574  txt.clear();
575  } else {
576  attachmentCaption = i18np( "1 Attachment:",
577  "%1 Attachments:",
578  attachments.count() );
579  }
580  QString attachmentString;
581  KCalCore::Attachment::List::ConstIterator ait = attachments.constBegin();
582  for ( ; ait != attachments.constEnd(); ++ait ) {
583  if ( !attachmentString.isEmpty() ) {
584  attachmentString += i18nc( "Spacer for list of attachments", " " );
585  }
586  attachmentString.append( (*ait)->label() );
587  }
588  drawBoxWithCaption( p, attachmentsBox,
589  attachmentCaption, attachmentString,
590  /*sameLine=*/false, /*expand=*/false,
591  captionFont, textFont );
592  }
593  if ( mShowAttendees ) {
594  KCalCore::Attendee::List attendees = (*it)->attendees();
595  QString attendeeCaption;
596  if ( attendees.count() == 0 ) {
597  attendeeCaption = i18n( "No Attendees" );
598  } else {
599  attendeeCaption = i18np( "1 Attendee:",
600  "%1 Attendees:",
601  attendees.count() );
602  }
603  QString attendeeString;
604  KCalCore::Attendee::List::ConstIterator ait = attendees.constBegin();
605  for ( ; ait != attendees.constEnd(); ++ait ) {
606  if ( !attendeeString.isEmpty() ) {
607  attendeeString += QLatin1Char('\n');
608  }
609  attendeeString += i18nc(
610  "Formatting of an attendee: "
611  "'Name (Role): Status', e.g. 'Reinhold Kainhofer "
612  "<reinhold@kainhofer.com> (Participant): Awaiting Response'",
613  "%1 (%2): %3",
614  (*ait)->fullName(),
615  KCalUtils::Stringify::attendeeRole( (*ait)->role() ),
616  KCalUtils::Stringify::attendeeStatus( ( *ait )->status() ) );
617  }
618  drawBoxWithCaption( p, attendeesBox, attendeeCaption, attendeeString,
619  /*sameLine=*/false, /*expand=*/false,
620  captionFont, textFont );
621  }
622 
623  if ( mShowOptions ) {
624  QString optionsString;
625  if ( !KCalUtils::Stringify::incidenceStatus( (*it)->status() ).isEmpty() ) {
626  optionsString += i18n( "Status: %1", KCalUtils::Stringify::incidenceStatus( (*it)->status() ) );
627  optionsString += QLatin1Char('\n');
628  }
629  if ( !KCalUtils::Stringify::incidenceSecrecy( (*it)->secrecy() ).isEmpty() ) {
630  optionsString += i18n( "Secrecy: %1", KCalUtils::Stringify::incidenceSecrecy( (*it)->secrecy() ) );
631  optionsString += QLatin1Char('\n');
632  }
633  if ( (*it)->type() == KCalCore::Incidence::TypeEvent ) {
634  KCalCore::Event::Ptr e = (*it).staticCast<KCalCore::Event>();
635  if ( e->transparency() == KCalCore::Event::Opaque ) {
636  optionsString += i18n( "Show as: Busy" );
637  } else {
638  optionsString += i18n( "Show as: Free" );
639  }
640  optionsString += QLatin1Char('\n');
641  } else if ( (*it)->type() == KCalCore::Incidence::TypeTodo ) {
642  KCalCore::Todo::Ptr t = (*it).staticCast<KCalCore::Todo>();
643  if ( t->isOverdue() ) {
644  optionsString += i18n( "This task is overdue!" );
645  optionsString += QLatin1Char('\n');
646  }
647  } else if ( (*it)->type() == KCalCore::Incidence::TypeJournal ) {
648  //TODO: Anything Journal-specific?
649  }
650  drawBoxWithCaption( p, optionsBox, i18n( "Settings: " ),
651  optionsString, /*sameLine=*/false, /*expand=*/false,
652  captionFont, textFont );
653  }
654 
655  drawBoxWithCaption( p, categoriesBox, i18n( "Categories: " ),
656  (*it)->categories().join( i18nc( "Spacer for the joined list of categories", ", " ) ),
657  /*sameLine=*/true, /*expand=*/false, captionFont, textFont );
658 
659  if ( mPrintFooter ) {
660  drawFooter( p, footerBox );
661  }
662  }
663  p.setFont( oldFont );
664 }
665 
666 /**************************************************************
667  * Print Day
668  **************************************************************/
669 
670 CalPrintDay::CalPrintDay() : CalPrintPluginBase()
671 {
672 }
673 
674 CalPrintDay::~CalPrintDay()
675 {
676 }
677 
678 QWidget *CalPrintDay::createConfigWidget( QWidget *w )
679 {
680  return new CalPrintDayConfig( w );
681 }
682 
683 void CalPrintDay::readSettingsWidget()
684 {
685  CalPrintDayConfig *cfg =
686  dynamic_cast<CalPrintDayConfig *>( ( QWidget* )mConfigWidget );
687  if ( cfg ) {
688  mFromDate = cfg->mFromDate->date();
689  mToDate = cfg->mToDate->date();
690 
691  if ( cfg->mPrintTypeFilofax->isChecked() ) {
692  mDayPrintType = Filofax;
693  } else if ( cfg->mPrintTypeTimetable->isChecked() ) {
694  mDayPrintType = Timetable;
695  } else {
696  mDayPrintType = SingleTimetable;
697  }
698 
699  mStartTime = cfg->mFromTime->time();
700  mEndTime = cfg->mToTime->time();
701  mIncludeAllEvents = cfg->mIncludeAllEvents->isChecked();
702 
703  mIncludeDescription = cfg->mIncludeDescription->isChecked();
704  mSingleLineLimit = cfg->mSingleLineLimit->isChecked();
705  mIncludeTodos = cfg->mIncludeTodos->isChecked();
706  mUseColors = cfg->mColors->isChecked();
707  mPrintFooter = cfg->mPrintFooter->isChecked();
708  mShowNoteLines = cfg->mShowNoteLines->isChecked();
709  mExcludeTime = cfg->mExcludeTime->isChecked();
710  mExcludeConfidential = cfg->mExcludeConfidential->isChecked();
711  mExcludePrivate = cfg->mExcludePrivate->isChecked();
712  }
713 }
714 
715 void CalPrintDay::setSettingsWidget()
716 {
717  CalPrintDayConfig *cfg = dynamic_cast<CalPrintDayConfig *>( ( QWidget* )mConfigWidget );
718  if ( cfg ) {
719  cfg->mFromDate->setDate( mFromDate );
720  cfg->mToDate->setDate( mToDate );
721 
722  cfg->mPrintTypeFilofax->setChecked( mDayPrintType == Filofax );
723  cfg->mPrintTypeTimetable->setChecked( mDayPrintType == Timetable );
724  cfg->mPrintTypeSingleTimetable->setChecked( mDayPrintType == SingleTimetable );
725 
726  cfg->mFromTime->setTime( mStartTime );
727  cfg->mToTime->setTime( mEndTime );
728  cfg->mIncludeAllEvents->setChecked( mIncludeAllEvents );
729 
730  cfg->mIncludeDescription->setChecked( mIncludeDescription );
731  cfg->mSingleLineLimit->setChecked( mSingleLineLimit );
732  cfg->mIncludeTodos->setChecked( mIncludeTodos );
733  cfg->mColors->setChecked( mUseColors );
734  cfg->mPrintFooter->setChecked( mPrintFooter );
735  cfg->mShowNoteLines->setChecked( mShowNoteLines );
736  cfg->mExcludeTime->setChecked( mExcludeTime );
737  cfg->mExcludeConfidential->setChecked( mExcludeConfidential );
738  cfg->mExcludePrivate->setChecked( mExcludePrivate );
739  }
740 }
741 
742 void CalPrintDay::loadConfig()
743 {
744  if ( mConfig ) {
745  KConfigGroup grp( mConfig, groupName() );
746  QDate dt = QDate::currentDate(); // any valid QDate will do
747  QTime tm1( dayStart() );
748  QDateTime startTm( dt, tm1 );
749  QDateTime endTm( dt, tm1.addSecs( 12 * 60 * 60 ) );
750  mStartTime = grp.readEntry( "Start time", startTm ).time();
751  mEndTime = grp.readEntry( "End time", endTm ).time();
752  mIncludeDescription = grp.readEntry( "Include description", false );
753  mIncludeTodos = grp.readEntry( "Include todos", false );
754  mIncludeAllEvents = grp.readEntry( "Include all events", false );
755  mDayPrintType = (eDayPrintType)( grp.readEntry( "Print type", (int)Timetable ) );
756  mSingleLineLimit = grp.readEntry( "Single line limit", false );
757  mShowNoteLines = grp.readEntry( "Note Lines", false );
758  mExcludeTime = grp.readEntry( "Exclude time", false );
759  mExcludeConfidential = grp.readEntry( "Exclude confidential", true );
760  mExcludePrivate = grp.readEntry( "Exclude private", true );
761  }
762  setSettingsWidget();
763 }
764 
765 void CalPrintDay::saveConfig()
766 {
767  readSettingsWidget();
768  if ( mConfig ) {
769  KConfigGroup grp( mConfig, groupName() );
770  QDateTime dt = QDateTime::currentDateTime(); // any valid QDateTime will do
771  dt.setTime( mStartTime );
772  grp.writeEntry( "Start time", dt );
773  dt.setTime( mEndTime );
774  grp.writeEntry( "End time", dt );
775  grp.writeEntry( "Include description", mIncludeDescription );
776  grp.writeEntry( "Include todos", mIncludeTodos );
777  grp.writeEntry( "Include all events", mIncludeAllEvents );
778  grp.writeEntry( "Print type", int( mDayPrintType ) );
779  grp.writeEntry( "Single line limit", mSingleLineLimit );
780  grp.writeEntry( "Note Lines", mShowNoteLines );
781  grp.writeEntry( "Exclude time", mExcludeTime );
782  grp.writeEntry( "Exclude confidential", mExcludeConfidential );
783  grp.writeEntry( "Exclude private", mExcludePrivate );
784  }
785 }
786 
787 void CalPrintDay::setDateRange( const QDate &from, const QDate &to )
788 {
789  CalPrintPluginBase::setDateRange( from, to );
790  CalPrintDayConfig *cfg =
791  dynamic_cast<CalPrintDayConfig *>( ( QWidget* )mConfigWidget );
792  if ( cfg ) {
793  cfg->mFromDate->setDate( from );
794  cfg->mToDate->setDate( to );
795  }
796 }
797 
798 void CalPrintDay::print( QPainter &p, int width, int height )
799 {
800  QDate curDay( mFromDate );
801 
802  KDateTime::Spec timeSpec = KSystemTimeZones::local();
803 
804  QRect headerBox( 0, 0, width, headerHeight() );
805  QRect footerBox( 0, height - footerHeight(), width, footerHeight() );
806  height -= footerHeight();
807 
808  KLocale *local = KGlobal::locale();
809 
810  switch ( mDayPrintType ) {
811  case Filofax:
812  case SingleTimetable:
813  {
814  QRect daysBox( headerBox );
815  daysBox.setTop( headerBox.bottom() + padding() );
816  daysBox.setBottom( height );
817  QString line1 = local->formatDate( mFromDate );
818  QString line2 = local->formatDate( mToDate );
819  QString title;
820  if ( orientation() == QPrinter::Landscape ) {
821  title = i18nc( "date from-to", "%1 - %2", line1, line2 );
822  } else {
823  title = i18nc( "date from-\nto", "%1 -\n%2", line1, line2 );
824  }
825  drawHeader( p, title, mFromDate, QDate(), headerBox );
826  if ( mDayPrintType == Filofax ) {
827  drawDays( p, mFromDate, mToDate, mStartTime, mEndTime, daysBox,
828  mSingleLineLimit, mShowNoteLines,
829  mIncludeDescription, mExcludeConfidential, mExcludePrivate );
830  } else if ( mDayPrintType == SingleTimetable ) {
831  drawTimeTable( p, mFromDate, mToDate,
832  mIncludeAllEvents, mStartTime, mEndTime, daysBox,
833  mIncludeDescription, mExcludeTime, mExcludeConfidential,
834  mExcludePrivate );
835  }
836  if ( mPrintFooter ) {
837  drawFooter( p, footerBox );
838  }
839  }
840  break;
841 
842  case Timetable:
843  default:
844  do {
845  QTime curStartTime( mStartTime );
846  QTime curEndTime( mEndTime );
847 
848  // For an invalid time range, simply show one hour, starting at the hour
849  // before the given start time
850  if ( curEndTime <= curStartTime ) {
851  curStartTime = QTime( curStartTime.hour(), 0, 0 );
852  curEndTime = curStartTime.addSecs( 3600 );
853  }
854 
855  drawHeader( p, local->formatDate( curDay ), curDay, QDate(), headerBox );
856  KCalCore::Event::List eventList = mCalendar->events( curDay, timeSpec,
857  KCalCore::EventSortStartDate,
858  KCalCore::SortDirectionAscending );
859 
860  // split out the all day events as they will be printed in a separate box
861  KCalCore::Event::List alldayEvents, timedEvents;
862  foreach( const KCalCore::Event::Ptr &event, eventList ) {
863  if ( event->allDay() ) {
864  alldayEvents.append( event );
865  } else {
866  timedEvents.append( event );
867  }
868  }
869 
870  int fontSize = 11;
871  QFont textFont( QLatin1String("sans-serif"), fontSize, QFont::Normal );
872  p.setFont( textFont );
873  int lineSpacing = p.fontMetrics().lineSpacing();
874 
875  int maxAllDayEvents = 8; // the max we allow to be printed, sorry.
876  int allDayHeight = qMin( alldayEvents.count(), maxAllDayEvents ) * lineSpacing;
877  allDayHeight = qMax( allDayHeight, ( 5 * lineSpacing ) ) + ( 2 * padding() );
878  QRect allDayBox( TIMELINE_WIDTH + padding(), headerBox.bottom() + padding(),
879  width - TIMELINE_WIDTH - padding(), allDayHeight );
880  if ( alldayEvents.count() > 0 ) {
881  // draw the side bar for all-day events
882  QFont oldFont( p.font() );
883  p.setFont( QFont( QLatin1String("sans-serif"), 9, QFont::Normal ) );
884  drawVerticalBox( p,
885  BOX_BORDER_WIDTH,
886  QRect( 0, headerBox.bottom() + padding(), TIMELINE_WIDTH, allDayHeight ),
887  i18n( "Today's Events" ),
888  Qt::AlignHCenter | Qt::AlignVCenter | Qt::TextWordWrap );
889  p.setFont( oldFont );
890 
891  // now draw at most maxAllDayEvents in the all-day box
892  drawBox( p, BOX_BORDER_WIDTH, allDayBox );
893 
894  QRect eventBox( allDayBox );
895  eventBox.setLeft( TIMELINE_WIDTH + ( 2 * padding() ) );
896  eventBox.setTop( eventBox.top() + padding() );
897  eventBox.setBottom( eventBox.top() + lineSpacing );
898  int count = 0;
899  foreach ( const KCalCore::Event::Ptr &event, alldayEvents ) {
900  if ( count == maxAllDayEvents ) {
901  break;
902  }
903  count++;
904  QString str;
905  if ( event->location().isEmpty() ) {
906  str = cleanStr( event->summary() );
907  } else {
908  str = i18nc( "summary, location", "%1, %2",
909  cleanStr( event->summary() ), cleanStr( event->location() ) );
910  }
911  printEventString( p, eventBox, str );
912  eventBox.setTop( eventBox.bottom() );
913  eventBox.setBottom( eventBox.top() + lineSpacing );
914  }
915  } else {
916  allDayBox.setBottom( headerBox.bottom() );
917  }
918 
919  QRect dayBox( allDayBox );
920  dayBox.setTop( allDayBox.bottom() + padding() );
921  dayBox.setBottom( height );
922  QList<QDate> workDays = CalendarSupport::workDays( curDay, curDay );
923  drawAgendaDayBox( p, timedEvents, curDay, mIncludeAllEvents,
924  curStartTime, curEndTime, dayBox,
925  mIncludeDescription, mExcludeTime,
926  mExcludeConfidential, mExcludePrivate,
927  workDays );
928 
929  QRect tlBox( dayBox );
930  tlBox.setLeft( 0 );
931  tlBox.setWidth( TIMELINE_WIDTH );
932  drawTimeLine( p, curStartTime, curEndTime, tlBox );
933 
934  if ( mPrintFooter ) {
935  drawFooter( p, footerBox );
936  }
937 
938  curDay = curDay.addDays( 1 );
939  if ( curDay <= mToDate ) {
940  mPrinter->newPage();
941  }
942  } while ( curDay <= mToDate );
943  } //switch
944 }
945 
946 /**************************************************************
947  * Print Week
948  **************************************************************/
949 
950 CalPrintWeek::CalPrintWeek() : CalPrintPluginBase()
951 {
952 }
953 
954 CalPrintWeek::~CalPrintWeek()
955 {
956 }
957 
958 QWidget *CalPrintWeek::createConfigWidget( QWidget *w )
959 {
960  return new CalPrintWeekConfig( w );
961 }
962 
963 void CalPrintWeek::readSettingsWidget()
964 {
965  CalPrintWeekConfig *cfg = dynamic_cast<CalPrintWeekConfig *>( ( QWidget* )mConfigWidget );
966  if ( cfg ) {
967  mFromDate = cfg->mFromDate->date();
968  mToDate = cfg->mToDate->date();
969 
970  if ( cfg->mPrintTypeFilofax->isChecked() ) {
971  mWeekPrintType = Filofax;
972  } else if ( cfg->mPrintTypeTimetable->isChecked() ) {
973  mWeekPrintType = Timetable;
974  } else if ( cfg->mPrintTypeSplitWeek->isChecked() ) {
975  mWeekPrintType = SplitWeek;
976  } else {
977  mWeekPrintType = Timetable;
978  }
979 
980  mStartTime = cfg->mFromTime->time();
981  mEndTime = cfg->mToTime->time();
982 
983  mShowNoteLines = cfg->mShowNoteLines->isChecked();
984  mSingleLineLimit = cfg->mSingleLineLimit->isChecked();
985  mIncludeTodos = cfg->mIncludeTodos->isChecked();
986  mUseColors = cfg->mColors->isChecked();
987  mPrintFooter = cfg->mPrintFooter->isChecked();
988  mIncludeDescription = cfg->mIncludeDescription->isChecked();
989  mExcludeTime = cfg->mExcludeTime->isChecked();
990  mExcludeConfidential = cfg->mExcludeConfidential->isChecked();
991  mExcludePrivate = cfg->mExcludePrivate->isChecked();
992  }
993 }
994 
995 void CalPrintWeek::setSettingsWidget()
996 {
997  CalPrintWeekConfig *cfg = dynamic_cast<CalPrintWeekConfig *>( ( QWidget* )mConfigWidget );
998  if ( cfg ) {
999  cfg->mFromDate->setDate( mFromDate );
1000  cfg->mToDate->setDate( mToDate );
1001 
1002  cfg->mPrintTypeFilofax->setChecked( mWeekPrintType == Filofax );
1003  cfg->mPrintTypeTimetable->setChecked( mWeekPrintType == Timetable );
1004  cfg->mPrintTypeSplitWeek->setChecked( mWeekPrintType == SplitWeek );
1005 
1006  cfg->mFromTime->setTime( mStartTime );
1007  cfg->mToTime->setTime( mEndTime );
1008 
1009  cfg->mShowNoteLines->setChecked( mShowNoteLines );
1010  cfg->mSingleLineLimit->setChecked( mSingleLineLimit );
1011  cfg->mIncludeTodos->setChecked( mIncludeTodos );
1012  cfg->mColors->setChecked( mUseColors );
1013  cfg->mPrintFooter->setChecked( mPrintFooter );
1014  cfg->mIncludeDescription->setChecked( mIncludeDescription );
1015  cfg->mExcludeTime->setChecked( mExcludeTime );
1016  cfg->mExcludeConfidential->setChecked( mExcludeConfidential );
1017  cfg->mExcludePrivate->setChecked( mExcludePrivate );
1018  }
1019 }
1020 
1021 void CalPrintWeek::loadConfig()
1022 {
1023  if ( mConfig ) {
1024  KConfigGroup grp( mConfig, groupName() );
1025  QDate dt = QDate::currentDate(); // any valid QDate will do
1026  QTime tm1( dayStart() );
1027  QDateTime startTm( dt, tm1 );
1028  QDateTime endTm( dt, tm1.addSecs( 43200 ) );
1029  mStartTime = grp.readEntry( "Start time", startTm ).time();
1030  mEndTime = grp.readEntry( "End time", endTm ).time();
1031  mShowNoteLines = grp.readEntry( "Note Lines", false );
1032  mSingleLineLimit = grp.readEntry( "Single line limit", false );
1033  mIncludeTodos = grp.readEntry( "Include todos", false );
1034  mWeekPrintType = (eWeekPrintType)( grp.readEntry( "Print type", (int)Filofax ) );
1035  mIncludeDescription = grp.readEntry( "Include Description", false );
1036  mExcludeTime = grp.readEntry( "Exclude Time", false );
1037  mExcludeConfidential = grp.readEntry( "Exclude confidential", true );
1038  mExcludePrivate = grp.readEntry( "Exclude private", true );
1039  }
1040  setSettingsWidget();
1041 }
1042 
1043 void CalPrintWeek::saveConfig()
1044 {
1045  readSettingsWidget();
1046  if ( mConfig ) {
1047  KConfigGroup grp( mConfig, groupName() );
1048  QDateTime dt = QDateTime::currentDateTime(); // any valid QDateTime will do
1049  dt.setTime( mStartTime );
1050  grp.writeEntry( "Start time", dt );
1051  dt.setTime( mEndTime );
1052  grp.writeEntry( "End time", dt );
1053  grp.writeEntry( "Note Lines", mShowNoteLines );
1054  grp.writeEntry( "Single line limit", mSingleLineLimit );
1055  grp.writeEntry( "Include todos", mIncludeTodos );
1056  grp.writeEntry( "Print type", int( mWeekPrintType ) );
1057  grp.writeEntry( "Include Description", mIncludeDescription );
1058  grp.writeEntry( "Exclude Time", mExcludeTime );
1059  grp.writeEntry( "Exclude confidential", mExcludeConfidential );
1060  grp.writeEntry( "Exclude private", mExcludePrivate );
1061  }
1062 }
1063 
1064 QPrinter::Orientation CalPrintWeek::defaultOrientation()
1065 {
1066  if ( mWeekPrintType == Filofax ) {
1067  return QPrinter::Portrait;
1068  } else if ( mWeekPrintType == SplitWeek ) {
1069  return QPrinter::Portrait;
1070  } else {
1071  return QPrinter::Landscape;
1072  }
1073 }
1074 
1075 void CalPrintWeek::setDateRange( const QDate &from, const QDate &to )
1076 {
1077  CalPrintPluginBase::setDateRange( from, to );
1078  CalPrintWeekConfig *cfg =
1079  dynamic_cast<CalPrintWeekConfig *>( ( QWidget* )mConfigWidget );
1080  if ( cfg ) {
1081  cfg->mFromDate->setDate( from );
1082  cfg->mToDate->setDate( to );
1083  }
1084 }
1085 
1086 void CalPrintWeek::print( QPainter &p, int width, int height )
1087 {
1088  QDate curWeek, fromWeek, toWeek;
1089 
1090  // correct begin and end to first and last day of week
1091  int weekdayCol = weekdayColumn( mFromDate.dayOfWeek() );
1092  fromWeek = mFromDate.addDays( -weekdayCol );
1093  weekdayCol = weekdayColumn( mToDate.dayOfWeek() );
1094  toWeek = mToDate.addDays( 6 - weekdayCol );
1095 
1096  curWeek = fromWeek.addDays( 6 );
1097  KLocale *local = KGlobal::locale();
1098 
1099  QString line1, line2, title;
1100  QRect headerBox( 0, 0, width, headerHeight() );
1101  QRect footerBox( 0, height - footerHeight(), width, footerHeight() );
1102  height -= footerHeight();
1103 
1104  QRect weekBox( headerBox );
1105  weekBox.setTop( headerBox.bottom() + padding() );
1106  weekBox.setBottom( height );
1107 
1108  switch ( mWeekPrintType ) {
1109  case Filofax:
1110  do {
1111  line1 = local->formatDate( curWeek.addDays( -6 ) );
1112  line2 = local->formatDate( curWeek );
1113  if ( orientation() == QPrinter::Landscape ) {
1114  title = i18nc( "date from-to", "%1 - %2", line1, line2 );
1115  } else {
1116  title = i18nc( "date from-\nto", "%1 -\n%2", line1, line2 );
1117  }
1118  drawHeader( p, title, curWeek.addDays( -6 ), QDate(), headerBox );
1119 
1120  drawWeek( p, curWeek, mStartTime, mEndTime, weekBox, mSingleLineLimit,
1121  mShowNoteLines, mIncludeDescription,
1122  mExcludeConfidential, mExcludePrivate );
1123 
1124  if ( mPrintFooter ) {
1125  drawFooter( p, footerBox );
1126  }
1127 
1128  curWeek = curWeek.addDays( 7 );
1129  if ( curWeek <= toWeek ) {
1130  mPrinter->newPage();
1131  }
1132  } while ( curWeek <= toWeek );
1133  break;
1134 
1135  case Timetable:
1136  default:
1137  do {
1138  line1 = local->formatDate( curWeek.addDays( -6 ) );
1139  line2 = local->formatDate( curWeek );
1140  if ( orientation() == QPrinter::Landscape ) {
1141  title = i18nc( "date from - to (week number)", "%1 - %2 (Week %3)",
1142  line1, line2, curWeek.weekNumber() );
1143  } else {
1144  title = i18nc( "date from -\nto (week number)", "%1 -\n%2 (Week %3)",
1145  line1, line2, curWeek.weekNumber() );
1146  }
1147  drawHeader( p, title, curWeek, QDate(), headerBox );
1148 
1149  drawTimeTable( p, fromWeek, curWeek,
1150  false, mStartTime, mEndTime, weekBox,
1151  mIncludeDescription, mExcludeTime, mExcludeConfidential,
1152  mExcludePrivate );
1153 
1154  if ( mPrintFooter ) {
1155  drawFooter( p, footerBox );
1156  }
1157 
1158  fromWeek = fromWeek.addDays( 7 );
1159  curWeek = fromWeek.addDays( 6 );
1160  if ( curWeek <= toWeek ) {
1161  mPrinter->newPage();
1162  }
1163  } while ( curWeek <= toWeek );
1164  break;
1165 
1166  case SplitWeek:
1167  {
1168  QRect weekBox1( weekBox );
1169  // On the left side there are four days (mo-th) plus the timeline,
1170  // on the right there are only three days (fr-su) plus the timeline. Don't
1171  // use the whole width, but rather give them the same width as on the left.
1172  weekBox1.setRight( int( ( width - TIMELINE_WIDTH ) * 3. / 4. + TIMELINE_WIDTH ) );
1173  do {
1174  QDate endLeft( fromWeek.addDays( 3 ) );
1175  int hh = headerHeight();
1176 
1177  drawSplitHeaderRight( p, fromWeek, curWeek, QDate(), width, hh );
1178  drawTimeTable( p, fromWeek, endLeft,
1179  false, mStartTime, mEndTime, weekBox,
1180  mIncludeDescription, mExcludeTime,
1181  mExcludeConfidential, mExcludePrivate );
1182  if ( mPrintFooter ) {
1183  drawFooter( p, weekBox1 );
1184  }
1185  mPrinter->newPage();
1186  drawSplitHeaderRight( p, fromWeek, curWeek, QDate(), width, hh );
1187  drawTimeTable( p, endLeft.addDays( 1 ), curWeek,
1188  false, mStartTime, mEndTime, weekBox1,
1189  mIncludeDescription, mExcludeTime,
1190  mExcludeConfidential, mExcludePrivate );
1191 
1192  if ( mPrintFooter ) {
1193  drawFooter( p, footerBox );
1194  }
1195 
1196  fromWeek = fromWeek.addDays( 7 );
1197  curWeek = fromWeek.addDays( 6 );
1198  if ( curWeek <= toWeek ) {
1199  mPrinter->newPage();
1200  }
1201  } while ( curWeek <= toWeek );
1202  }
1203  break;
1204  }
1205 }
1206 
1207 /**************************************************************
1208  * Print Month
1209  **************************************************************/
1210 
1211 CalPrintMonth::CalPrintMonth() : CalPrintPluginBase()
1212 {
1213 }
1214 
1215 CalPrintMonth::~CalPrintMonth()
1216 {
1217 }
1218 
1219 QWidget *CalPrintMonth::createConfigWidget( QWidget *w )
1220 {
1221  return new CalPrintMonthConfig( w );
1222 }
1223 
1224 void CalPrintMonth::readSettingsWidget()
1225 {
1226  CalPrintMonthConfig *cfg = dynamic_cast<CalPrintMonthConfig *>( ( QWidget* )mConfigWidget );
1227 
1228  if ( cfg ) {
1229  mFromDate = QDate( cfg->mFromYear->value(), cfg->mFromMonth->currentIndex()+1, 1 );
1230  mToDate = QDate( cfg->mToYear->value(), cfg->mToMonth->currentIndex()+1, 1 );
1231 
1232  mWeekNumbers = cfg->mWeekNumbers->isChecked();
1233  mRecurDaily = cfg->mRecurDaily->isChecked();
1234  mRecurWeekly = cfg->mRecurWeekly->isChecked();
1235  mIncludeTodos = cfg->mIncludeTodos->isChecked();
1236  mShowNoteLines = cfg->mShowNoteLines->isChecked();
1237  mSingleLineLimit = cfg->mSingleLineLimit->isChecked();
1238  mUseColors = cfg->mColors->isChecked();
1239  mPrintFooter = cfg->mPrintFooter->isChecked();
1240  mIncludeDescription = cfg->mIncludeDescription->isChecked();
1241  mExcludeConfidential = cfg->mExcludeConfidential->isChecked();
1242  mExcludePrivate = cfg->mExcludePrivate->isChecked();
1243  }
1244 }
1245 
1246 void CalPrintMonth::setSettingsWidget()
1247 {
1248  CalPrintMonthConfig *cfg = dynamic_cast<CalPrintMonthConfig *>( ( QWidget* )mConfigWidget );
1249 
1250  if ( cfg ) {
1251  setDateRange( mFromDate, mToDate );
1252 
1253  cfg->mWeekNumbers->setChecked( mWeekNumbers );
1254  cfg->mRecurDaily->setChecked( mRecurDaily );
1255  cfg->mRecurWeekly->setChecked( mRecurWeekly );
1256  cfg->mIncludeTodos->setChecked( mIncludeTodos );
1257  cfg->mShowNoteLines->setChecked( mShowNoteLines );
1258  cfg->mSingleLineLimit->setChecked( mSingleLineLimit );
1259  cfg->mColors->setChecked( mUseColors );
1260  cfg->mPrintFooter->setChecked( mPrintFooter );
1261  cfg->mIncludeDescription->setChecked( mIncludeDescription );
1262  cfg->mExcludeConfidential->setChecked( mExcludeConfidential );
1263  cfg->mExcludePrivate->setChecked( mExcludePrivate );
1264  }
1265 }
1266 
1267 void CalPrintMonth::loadConfig()
1268 {
1269  if ( mConfig ) {
1270  KConfigGroup grp( mConfig, groupName() );
1271  mWeekNumbers = grp.readEntry( "Print week numbers", true );
1272  mRecurDaily = grp.readEntry( "Print daily incidences", true );
1273  mRecurWeekly = grp.readEntry( "Print weekly incidences", true );
1274  mIncludeTodos = grp.readEntry( "Include todos", false );
1275  mSingleLineLimit = grp.readEntry( "Single line limit", false );
1276  mShowNoteLines = grp.readEntry( "Note Lines", false );
1277  mIncludeDescription = grp.readEntry( "Include description", false );
1278  mExcludeConfidential = grp.readEntry( "Exclude confidential", true );
1279  mExcludePrivate = grp.readEntry( "Exclude private", true );
1280  }
1281  setSettingsWidget();
1282 }
1283 
1284 void CalPrintMonth::saveConfig()
1285 {
1286  readSettingsWidget();
1287  if ( mConfig ) {
1288  KConfigGroup grp( mConfig, groupName() );
1289  grp.writeEntry( "Print week numbers", mWeekNumbers );
1290  grp.writeEntry( "Print daily incidences", mRecurDaily );
1291  grp.writeEntry( "Print weekly incidences", mRecurWeekly );
1292  grp.writeEntry( "Include todos", mIncludeTodos );
1293  grp.writeEntry( "Single line limit", mSingleLineLimit );
1294  grp.writeEntry( "Note Lines", mShowNoteLines );
1295  grp.writeEntry( "Include description", mIncludeDescription );
1296  grp.writeEntry( "Exclude confidential", mExcludeConfidential );
1297  grp.writeEntry( "Exclude private", mExcludePrivate );
1298  }
1299 }
1300 
1301 void CalPrintMonth::setDateRange( const QDate &from, const QDate &to )
1302 {
1303  CalPrintPluginBase::setDateRange( from, to );
1304  CalPrintMonthConfig *cfg =
1305  dynamic_cast<CalPrintMonthConfig *>( ( QWidget* )mConfigWidget );
1306  const KCalendarSystem *calSys = calendarSystem();
1307  if ( cfg && calSys ) {
1308  cfg->mFromMonth->clear();
1309  for ( int i=0; i<calSys->monthsInYear( mFromDate ); ++i ) {
1310  cfg->mFromMonth->addItem( calSys->monthName( i+1, mFromDate.year() ) );
1311  }
1312  cfg->mToMonth->clear();
1313  for ( int i=0; i<calSys->monthsInYear( mToDate ); ++i ) {
1314  cfg->mToMonth->addItem( calSys->monthName( i+1, mToDate.year() ) );
1315  }
1316  }
1317  if ( cfg ) {
1318  cfg->mFromMonth->setCurrentIndex( from.month()-1 );
1319  cfg->mFromYear->setValue( to.year() );
1320  cfg->mToMonth->setCurrentIndex( mToDate.month()-1 );
1321  cfg->mToYear->setValue( mToDate.year() );
1322  }
1323 }
1324 
1325 void CalPrintMonth::print( QPainter &p, int width, int height )
1326 {
1327  QDate curMonth, fromMonth, toMonth;
1328 
1329  fromMonth = mFromDate.addDays( -( mFromDate.day() - 1 ) );
1330  toMonth = mToDate.addDays( mToDate.daysInMonth() - mToDate.day() );
1331 
1332  curMonth = fromMonth;
1333  const KCalendarSystem *calSys = calendarSystem();
1334  if ( !calSys ) {
1335  return;
1336  }
1337 
1338  QRect headerBox( 0, 0, width, headerHeight() );
1339  QRect footerBox( 0, height - footerHeight(), width, footerHeight() );
1340  height -= footerHeight();
1341 
1342  QRect monthBox( 0, 0, width, height );
1343  monthBox.setTop( headerBox.bottom() + padding() );
1344 
1345  do {
1346  QString title( i18nc( "monthname year", "%1 <numid>%2</numid>",
1347  calSys->monthName( curMonth ),
1348  curMonth.year() ) );
1349  QDate tmp( fromMonth );
1350  int weekdayCol = weekdayColumn( tmp.dayOfWeek() );
1351  tmp = tmp.addDays( -weekdayCol );
1352 
1353  drawHeader( p, title, curMonth.addMonths( -1 ), curMonth.addMonths( 1 ),
1354  headerBox );
1355  drawMonthTable( p,
1356  curMonth, QTime(), QTime(),
1357  mWeekNumbers,
1358  mRecurDaily, mRecurWeekly,
1359  mSingleLineLimit, mShowNoteLines, mIncludeDescription,
1360  mExcludeConfidential, mExcludePrivate, monthBox );
1361 
1362  if ( mPrintFooter ) {
1363  drawFooter( p, footerBox );
1364  }
1365 
1366  curMonth = curMonth.addDays( curMonth.daysInMonth() );
1367  if ( curMonth <= toMonth ) {
1368  mPrinter->newPage();
1369  }
1370  } while ( curMonth <= toMonth );
1371 
1372 }
1373 
1374 /**************************************************************
1375  * Print Todos
1376  **************************************************************/
1377 
1378 CalPrintTodos::CalPrintTodos() : CalPrintPluginBase()
1379 {
1380  mTodoSortField = TodoFieldUnset;
1381  mTodoSortDirection = TodoDirectionUnset;
1382 }
1383 
1384 CalPrintTodos::~CalPrintTodos()
1385 {
1386 }
1387 
1388 QWidget *CalPrintTodos::createConfigWidget( QWidget *w )
1389 {
1390  return new CalPrintTodoConfig( w );
1391 }
1392 
1393 void CalPrintTodos::readSettingsWidget()
1394 {
1395  CalPrintTodoConfig *cfg = dynamic_cast<CalPrintTodoConfig *>( ( QWidget* )mConfigWidget );
1396 
1397  if ( cfg ) {
1398  mPageTitle = cfg->mTitle->text();
1399 
1400  if ( cfg->mPrintAll->isChecked() ) {
1401  mTodoPrintType = TodosAll;
1402  } else if ( cfg->mPrintUnfinished->isChecked() ) {
1403  mTodoPrintType = TodosUnfinished;
1404  } else if ( cfg->mPrintDueRange->isChecked() ) {
1405  mTodoPrintType = TodosDueRange;
1406  } else {
1407  mTodoPrintType = TodosAll;
1408  }
1409 
1410  mFromDate = cfg->mFromDate->date();
1411  mToDate = cfg->mToDate->date();
1412 
1413  mIncludeDescription = cfg->mDescription->isChecked();
1414  mIncludePriority = cfg->mPriority->isChecked();
1415  mIncludeDueDate = cfg->mDueDate->isChecked();
1416  mIncludePercentComplete = cfg->mPercentComplete->isChecked();
1417  mConnectSubTodos = cfg->mConnectSubTodos->isChecked();
1418  mStrikeOutCompleted = cfg->mStrikeOutCompleted->isChecked();
1419  mExcludeConfidential = cfg->mExcludeConfidential->isChecked();
1420  mExcludePrivate = cfg->mExcludePrivate->isChecked();
1421 
1422  mTodoSortField = (eTodoSortField)cfg->mSortField->currentIndex();
1423  mTodoSortDirection = (eTodoSortDirection)cfg->mSortDirection->currentIndex();
1424 
1425  mPrintFooter = cfg->mPrintFooter->isChecked();
1426  }
1427 }
1428 
1429 void CalPrintTodos::setSettingsWidget()
1430 {
1431  CalPrintTodoConfig *cfg =
1432  dynamic_cast<CalPrintTodoConfig *>( ( QWidget* )mConfigWidget );
1433  if ( cfg ) {
1434  cfg->mTitle->setText( mPageTitle );
1435 
1436  cfg->mPrintAll->setChecked( mTodoPrintType == TodosAll );
1437  cfg->mPrintUnfinished->setChecked( mTodoPrintType == TodosUnfinished );
1438  cfg->mPrintDueRange->setChecked( mTodoPrintType == TodosDueRange );
1439 
1440  cfg->mFromDate->setDate( mFromDate );
1441  cfg->mToDate->setDate( mToDate );
1442 
1443  cfg->mDescription->setChecked( mIncludeDescription );
1444  cfg->mPriority->setChecked( mIncludePriority );
1445  cfg->mDueDate->setChecked( mIncludeDueDate );
1446  cfg->mPercentComplete->setChecked( mIncludePercentComplete );
1447  cfg->mConnectSubTodos->setChecked( mConnectSubTodos );
1448  cfg->mStrikeOutCompleted->setChecked( mStrikeOutCompleted );
1449  cfg->mExcludeConfidential->setChecked( mExcludeConfidential );
1450  cfg->mExcludePrivate->setChecked( mExcludePrivate );
1451 
1452  if ( mTodoSortField != TodoFieldUnset ) {
1453  // do not insert if already done so.
1454  cfg->mSortField->addItem( i18nc( "@option sort by title", "Title" ) );
1455  cfg->mSortField->addItem( i18nc( "@option sort by start date/time", "Start Date" ) );
1456  cfg->mSortField->addItem( i18nc( "@option sort by due date/time", "Due Date" ) );
1457  cfg->mSortField->addItem( i18nc( "@option sort by priority", "Priority" ) );
1458  cfg->mSortField->addItem( i18nc( "@option sort by percent completed", "Percent Complete" ) );
1459  cfg->mSortField->setCurrentIndex( mTodoSortField );
1460  }
1461 
1462  if ( mTodoSortDirection != TodoDirectionUnset ) {
1463  // do not insert if already done so.
1464  cfg->mSortDirection->addItem( i18nc( "@option sort in increasing order", "Ascending" ) );
1465  cfg->mSortDirection->addItem( i18nc( "@option sort in descreasing order", "Descending" ) );
1466  cfg->mSortDirection->setCurrentIndex( mTodoSortDirection );
1467  }
1468 
1469  cfg->mPrintFooter->setChecked( mPrintFooter );
1470  }
1471 }
1472 
1473 void CalPrintTodos::loadConfig()
1474 {
1475  if ( mConfig ) {
1476  KConfigGroup grp( mConfig, groupName() );
1477  mPageTitle = grp.readEntry( "Page title", i18n( "To-do list" ) );
1478  mTodoPrintType = (eTodoPrintType)grp.readEntry( "Print type", (int)TodosAll );
1479  mIncludeDescription = grp.readEntry( "Include description", true );
1480  mIncludePriority = grp.readEntry( "Include priority", true );
1481  mIncludeDueDate = grp.readEntry( "Include due date", true );
1482  mIncludePercentComplete = grp.readEntry( "Include percentage completed", true );
1483  mConnectSubTodos = grp.readEntry( "Connect subtodos", true );
1484  mStrikeOutCompleted = grp.readEntry( "Strike out completed summaries", true );
1485  mTodoSortField =
1486  (eTodoSortField)grp.readEntry( "Sort field", (int)TodoFieldSummary );
1487  mTodoSortDirection =
1488  (eTodoSortDirection)grp.readEntry( "Sort direction", (int)TodoDirectionAscending );
1489  mExcludeConfidential = grp.readEntry( "Exclude confidential", true );
1490  mExcludePrivate = grp.readEntry( "Exclude private", true );
1491  }
1492  setSettingsWidget();
1493 }
1494 
1495 void CalPrintTodos::saveConfig()
1496 {
1497  readSettingsWidget();
1498  if ( mConfig ) {
1499  KConfigGroup grp( mConfig, groupName());
1500  grp.writeEntry( "Page title", mPageTitle );
1501  grp.writeEntry( "Print type", int( mTodoPrintType ) );
1502  grp.writeEntry( "Include description", mIncludeDescription );
1503  grp.writeEntry( "Include priority", mIncludePriority );
1504  grp.writeEntry( "Include due date", mIncludeDueDate );
1505  grp.writeEntry( "Include percentage completed", mIncludePercentComplete );
1506  grp.writeEntry( "Connect subtodos", mConnectSubTodos );
1507  grp.writeEntry( "Strike out completed summaries", mStrikeOutCompleted );
1508  grp.writeEntry( "Sort field", (int)mTodoSortField );
1509  grp.writeEntry( "Sort direction", (int)mTodoSortDirection );
1510  grp.writeEntry( "Exclude confidential", mExcludeConfidential );
1511  grp.writeEntry( "Exclude private", mExcludePrivate );
1512  }
1513 }
1514 
1515 void CalPrintTodos::print( QPainter &p, int width, int height )
1516 {
1517  // TODO: Find a good way to guarantee a nicely designed output
1518  int pospriority = 0;
1519  int possummary = 100;
1520  int posdue = width - 65;
1521  int poscomplete = posdue - 70; //Complete column is to right of the Due column
1522  int lineSpacing = 15;
1523  //int fontHeight = 10;
1524 
1525  QRect headerBox( 0, 0, width, headerHeight() );
1526  QRect footerBox( 0, height - footerHeight(), width, footerHeight() );
1527  height -= footerHeight();
1528 
1529  // Draw the First Page Header
1530  drawHeader( p, mPageTitle, mFromDate, QDate(), headerBox );
1531 
1532  // Draw the Column Headers
1533  int mCurrentLinePos = headerHeight() + 5;
1534  QString outStr;
1535  QFont oldFont( p.font() );
1536 
1537  p.setFont( QFont( QLatin1String("sans-serif"), 9, QFont::Bold ) );
1538  lineSpacing = p.fontMetrics().lineSpacing();
1539  mCurrentLinePos += lineSpacing;
1540  if ( mIncludePriority ) {
1541  outStr += i18n( "Priority" );
1542  p.drawText( pospriority, mCurrentLinePos - 2, outStr );
1543  } else {
1544  pospriority = -1;
1545  }
1546 
1547  outStr.truncate( 0 );
1548  outStr += i18nc( "@label to-do summary", "Title" );
1549  p.drawText( possummary, mCurrentLinePos - 2, outStr );
1550 
1551  if ( mIncludePercentComplete ) {
1552  if ( !mIncludeDueDate ) { //move Complete column to the right
1553  poscomplete = posdue; //if not print the Due Date column
1554  }
1555  outStr.truncate( 0 );
1556  outStr += i18nc( "@label to-do percentage complete", "Complete" );
1557  p.drawText( poscomplete, mCurrentLinePos - 2, outStr );
1558  } else {
1559  poscomplete = -1;
1560  }
1561 
1562  if ( mIncludeDueDate ) {
1563  outStr.truncate( 0 );
1564  outStr += i18nc( "@label to-do due date", "Due" );
1565  p.drawText( posdue, mCurrentLinePos - 2, outStr );
1566  } else {
1567  posdue = -1;
1568  }
1569 
1570  p.setFont( QFont( QLatin1String("sans-serif"), 10 ) );
1571  //fontHeight = p.fontMetrics().height();
1572 
1573  KCalCore::Todo::List todoList;
1574  KCalCore::Todo::List tempList;
1575 
1576  KCalCore::SortDirection sortDirection = KCalCore::SortDirectionAscending;
1577  switch( mTodoSortDirection ) {
1578  case TodoDirectionAscending:
1579  sortDirection = KCalCore::SortDirectionAscending;
1580  break;
1581  case TodoDirectionDescending:
1582  sortDirection = KCalCore::SortDirectionDescending;
1583  break;
1584  case TodoDirectionUnset:
1585  break;
1586  }
1587 
1588  KCalCore::TodoSortField sortField = KCalCore::TodoSortSummary;
1589  switch( mTodoSortField ) {
1590  case TodoFieldSummary:
1591  sortField = KCalCore::TodoSortSummary;
1592  break;
1593  case TodoFieldStartDate:
1594  sortField = KCalCore::TodoSortStartDate;
1595  break;
1596  case TodoFieldDueDate:
1597  sortField = KCalCore::TodoSortDueDate;
1598  break;
1599  case TodoFieldPriority:
1600  sortField = KCalCore::TodoSortPriority;
1601  break;
1602  case TodoFieldPercentComplete:
1603  sortField = KCalCore::TodoSortPercentComplete;
1604  break;
1605  case TodoFieldUnset:
1606  break;
1607  }
1608 
1609  // Create list of to-dos which will be printed
1610  todoList = mCalendar->todos( sortField, sortDirection );
1611  switch( mTodoPrintType ) {
1612  case TodosAll:
1613  break;
1614  case TodosUnfinished:
1615  foreach( const KCalCore::Todo::Ptr& todo, todoList ) {
1616  Q_ASSERT( todo );
1617  if ( !todo->isCompleted() ) {
1618  tempList.append( todo );
1619  }
1620  }
1621  todoList = tempList;
1622  break;
1623  case TodosDueRange:
1624  foreach( const KCalCore::Todo::Ptr& todo, todoList ) {
1625  Q_ASSERT( todo );
1626  if ( todo->hasDueDate() ) {
1627  if ( todo->dtDue().date() >= mFromDate && todo->dtDue().date() <= mToDate ) {
1628  tempList.append( todo );
1629  }
1630  } else {
1631  tempList.append( todo );
1632  }
1633  }
1634  todoList = tempList;
1635  break;
1636  }
1637 
1638  // Print to-dos
1639  int count = 0;
1640  foreach( const KCalCore::Todo::Ptr& todo, todoList ) {
1641  if ( ( mExcludeConfidential && todo->secrecy() == KCalCore::Incidence::SecrecyConfidential ) ||
1642  ( mExcludePrivate && todo->secrecy() == KCalCore::Incidence::SecrecyPrivate ) ) {
1643  continue;
1644  }
1645  // Skip sub-to-dos. They will be printed recursively in drawTodo()
1646  if ( todo->relatedTo().isEmpty() ) { //review(AKONADI_PORT)
1647  count++;
1648  drawTodo( count, todo, p,
1649  sortField, sortDirection,
1650  mConnectSubTodos,
1651  mStrikeOutCompleted, mIncludeDescription,
1652  pospriority, possummary, posdue, poscomplete,
1653  0, 0, mCurrentLinePos, width, height, todoList, 0,
1654  mExcludeConfidential, mExcludePrivate );
1655  }
1656  }
1657 
1658  if ( mPrintFooter ) {
1659  drawFooter( p, footerBox );
1660  }
1661  p.setFont( oldFont );
1662 }
CalendarSupport::CalPrintMonth::CalPrintMonth
CalPrintMonth()
Definition: calprintdefaultplugins.cpp:1211
CalendarSupport::CalPrintWeek::mExcludeTime
bool mExcludeTime
Definition: calprintdefaultplugins.h:198
CalendarSupport::CalPrintWeekConfig
Definition: calprintdefaultplugins.h:342
QString::constBegin
const_iterator constBegin() const
CalendarSupport::CalPrintTodos::TodoFieldPercentComplete
Definition: calprintdefaultplugins.h:302
cleanStr
static QString cleanStr(const QString &instr)
Definition: calprintdefaultplugins.cpp:50
QRect::setBottom
void setBottom(int y)
QWidget
CalendarSupport::CalPrintMonth::mExcludeConfidential
bool mExcludeConfidential
Definition: calprintdefaultplugins.h:249
CalendarSupport::CalPrintWeek::~CalPrintWeek
virtual ~CalPrintWeek()
Definition: calprintdefaultplugins.cpp:954
QString::append
QString & append(QChar ch)
calprintdefaultplugins.h
CalendarSupport::CalPrintDay::createConfigWidget
virtual QWidget * createConfigWidget(QWidget *)
Returns widget for configuring the print format.
Definition: calprintdefaultplugins.cpp:678
CalendarSupport::CalPrintDayConfig
Definition: calprintdefaultplugins.h:333
QString::truncate
void truncate(int position)
CalendarSupport::CalPrintDay::mDayPrintType
enum CalendarSupport::CalPrintDay::eDayPrintType mDayPrintType
CalendarSupport::CalPrintDay::mIncludeTodos
bool mIncludeTodos
Definition: calprintdefaultplugins.h:140
CalendarSupport::CalPrintWeek::mIncludeDescription
bool mIncludeDescription
Definition: calprintdefaultplugins.h:197
CalendarSupport::CalPrintMonth::mIncludeDescription
bool mIncludeDescription
Definition: calprintdefaultplugins.h:248
CalendarSupport::CalPrintPluginBase::drawFooter
int drawFooter(QPainter &p, const QRect &box)
Draw a page footer containing the printing date and possibly other things, like a page number...
Definition: calprintpluginbase.cpp:640
CalendarSupport::CalPrintDay::mEndTime
QTime mEndTime
Definition: calprintdefaultplugins.h:137
CalendarSupport::CalPrintMonth::setDateRange
virtual void setDateRange(const QDate &from, const QDate &to)
Set date range which should be printed.
Definition: calprintdefaultplugins.cpp:1301
CalendarSupport::CalPrintIncidence::createConfigWidget
virtual QWidget * createConfigWidget(QWidget *)
Returns widget for configuring the print format.
Definition: calprintdefaultplugins.cpp:68
CalendarSupport::CalPrintPluginBase::drawWeek
void drawWeek(QPainter &p, const QDate &qd, const QTime &fromTime, const QTime &toTime, const QRect &box, bool singleLineLimit, bool showNoteLines, bool includeDescription, bool excludeConfidential, bool excludePrivate)
Draw the week (filofax) table of the week containing the date qd.
Definition: calprintpluginbase.cpp:1360
QRect::right
int right() const
QDate::daysInMonth
int daysInMonth() const
CalendarSupport::CalPrintWeek::print
void print(QPainter &p, int width, int height)
Actually do the printing.
Definition: calprintdefaultplugins.cpp:1086
CalendarSupport::CalPrintDay::Filofax
Definition: calprintdefaultplugins.h:133
CalendarSupport::CalPrintMonth::setSettingsWidget
virtual void setSettingsWidget()
Set configuration widget to reflect settings of current object.
Definition: calprintdefaultplugins.cpp:1246
CalendarSupport::CalPrintTodos::TodosUnfinished
Definition: calprintdefaultplugins.h:293
CalendarSupport::CalPrintTodos::mTodoPrintType
enum CalendarSupport::CalPrintTodos::eTodoPrintType mTodoPrintType
CalendarSupport::CalPrintTodos::mExcludeConfidential
bool mExcludeConfidential
Definition: calprintdefaultplugins.h:320
CalendarSupport::CalPrintTodos::createConfigWidget
virtual QWidget * createConfigWidget(QWidget *)
Returns widget for configuring the print format.
Definition: calprintdefaultplugins.cpp:1388
CalendarSupport::CalPrintDay::eDayPrintType
eDayPrintType
Definition: calprintdefaultplugins.h:132
QPainter::font
const QFont & font() const
QFont
CalendarSupport::CalPrintTodos::mPageTitle
QString mPageTitle
Definition: calprintdefaultplugins.h:289
CalendarSupport::CalPrintDay::mIncludeDescription
bool mIncludeDescription
Definition: calprintdefaultplugins.h:138
CalendarSupport::CalPrintDay::mExcludeTime
bool mExcludeTime
Definition: calprintdefaultplugins.h:142
QDateTime::setTime
void setTime(const QTime &time)
CalendarSupport::CalPrintWeek::eWeekPrintType
eWeekPrintType
Definition: calprintdefaultplugins.h:189
CalendarSupport::CalPrintTodos::mIncludePriority
bool mIncludePriority
Definition: calprintdefaultplugins.h:313
CalendarSupport::CalPrintMonth::~CalPrintMonth
virtual ~CalPrintMonth()
Definition: calprintdefaultplugins.cpp:1215
CalendarSupport::CalPrintMonth::loadConfig
virtual void loadConfig()
Load print format configuration from config file.
Definition: calprintdefaultplugins.cpp:1267
QRect::height
int height() const
CalendarSupport::PrintPlugin::setDateRange
virtual void setDateRange(const QDate &from, const QDate &to)
Set date range which should be printed.
Definition: printplugin.h:153
CalendarSupport::CalPrintDay::loadConfig
virtual void loadConfig()
Load print format configuration from config file.
Definition: calprintdefaultplugins.cpp:742
CalendarSupport::CalPrintPluginBase::headerHeight
int headerHeight() const
Returns the height of the page header.
Definition: calprintpluginbase.cpp:327
QFontMetrics
CalendarSupport::CalPrintDay::~CalPrintDay
virtual ~CalPrintDay()
Definition: calprintdefaultplugins.cpp:674
CalendarSupport::CalPrintDay::groupName
virtual QString groupName()
Returns KConfig group name where store settings.
Definition: calprintdefaultplugins.h:101
CalendarSupport::CalPrintPluginBase::mUseColors
bool mUseColors
Definition: calprintpluginbase.h:642
CalendarSupport::CalPrintIncidence::setSettingsWidget
virtual void setSettingsWidget()
Set configuration widget to reflect settings of current object.
Definition: calprintdefaultplugins.cpp:88
CalendarSupport::CalPrintDay::mSingleLineLimit
bool mSingleLineLimit
Definition: calprintdefaultplugins.h:139
CalendarSupport::CalPrintWeek::CalPrintWeek
CalPrintWeek()
Definition: calprintdefaultplugins.cpp:950
CalendarSupport::CalPrintTodos::TodoFieldPriority
Definition: calprintdefaultplugins.h:301
QDate::month
int month() const
CalendarSupport::CalPrintDay::setSettingsWidget
virtual void setSettingsWidget()
Set configuration widget to reflect settings of current object.
Definition: calprintdefaultplugins.cpp:715
QTime
CalendarSupport::CalPrintMonthConfig
Definition: calprintdefaultplugins.h:351
CalendarSupport::incidence
CALENDARSUPPORT_EXPORT KCalCore::Incidence::Ptr incidence(const Akonadi::Item &item)
returns the incidence from an akonadi item, or a null pointer if the item has no such payload ...
Definition: utils.cpp:78
QDate::weekNumber
int weekNumber(int *yearNumber) const
CalendarSupport::PrintPlugin::mFromDate
QDate mFromDate
Definition: printplugin.h:160
CalendarSupport::CalPrintPluginBase::weekdayColumn
static int weekdayColumn(int weekday)
Determines the column of the given weekday ( 1=Monday, 7=Sunday ), taking the start of the week setti...
Definition: calprintpluginbase.cpp:2085
CalendarSupport::CalPrintPluginBase::calendarSystem
const KCalendarSystem * calendarSystem()
Definition: calprintpluginbase.cpp:314
CalendarSupport::CalPrintTodos::mTodoSortDirection
enum CalendarSupport::CalPrintTodos::eTodoSortDirection mTodoSortDirection
CalendarSupport::CalPrintTodos::eTodoSortField
eTodoSortField
Definition: calprintdefaultplugins.h:297
CalendarSupport::CalPrintWeek::readSettingsWidget
virtual void readSettingsWidget()
Read settings from configuration widget and apply them to current object.
Definition: calprintdefaultplugins.cpp:963
CalendarSupport::CalPrintPluginBase::drawTimeTable
void drawTimeTable(QPainter &p, const QDate &fromDate, const QDate &toDate, bool expandable, const QTime &fromTime, const QTime &toTime, const QRect &box, bool includeDescription, bool excludeTime, bool excludeConfidential, bool excludePrivate)
Draw the timetable view of the given time range from fromDate to toDate.
Definition: calprintpluginbase.cpp:1440
CalendarSupport::CalPrintTodos::TodoFieldSummary
Definition: calprintdefaultplugins.h:298
CalendarSupport::CalPrintDay::mIncludeAllEvents
bool mIncludeAllEvents
Definition: calprintdefaultplugins.h:141
CalendarSupport::CalPrintWeek::SplitWeek
Definition: calprintdefaultplugins.h:192
QPoint::x
int x() const
CalendarSupport::CalPrintIncidence::mShowNoteLines
bool mShowNoteLines
Definition: calprintdefaultplugins.h:93
CalendarSupport::CalPrintPluginBase::drawNoteLines
void drawNoteLines(QPainter &p, const QRect &box, int startY)
Draws dotted lines for notes in a box.
Definition: calprintpluginbase.cpp:2216
CalendarSupport::CalPrintTodos::groupName
virtual QString groupName()
Returns KConfig group name where store settings.
Definition: calprintdefaultplugins.h:259
kcalprefs.h
CalendarSupport::CalPrintPluginBase::padding
int padding() const
Definition: calprintpluginbase.cpp:383
CalendarSupport::CalPrintTodos::mConnectSubTodos
bool mConnectSubTodos
Definition: calprintdefaultplugins.h:316
CalendarSupport::CalPrintTodos::TodosDueRange
Definition: calprintdefaultplugins.h:294
QString::clear
void clear()
CalendarSupport::todo
CALENDARSUPPORT_EXPORT KCalCore::Todo::Ptr todo(const Akonadi::Item &item)
returns the todo from an akonadi item, or a null pointer if the item has no such payload ...
Definition: utils.cpp:124
QDate::dayOfWeek
int dayOfWeek() const
utils.h
CalendarSupport::CalPrintTodos::loadConfig
virtual void loadConfig()
Load print format configuration from config file.
Definition: calprintdefaultplugins.cpp:1473
CalendarSupport::CalPrintWeek::Timetable
Definition: calprintdefaultplugins.h:191
CalendarSupport::CalPrintMonth::createConfigWidget
virtual QWidget * createConfigWidget(QWidget *)
Returns widget for configuring the print format.
Definition: calprintdefaultplugins.cpp:1219
QRect
CalendarSupport::CalPrintMonth::saveConfig
virtual void saveConfig()
Write print format configuration to config file.
Definition: calprintdefaultplugins.cpp:1284
QPainter::setFont
void setFont(const QFont &font)
CalendarSupport::CalPrintTodos::mIncludeDescription
bool mIncludeDescription
Definition: calprintdefaultplugins.h:312
CalendarSupport::CalPrintWeek::createConfigWidget
virtual QWidget * createConfigWidget(QWidget *)
Returns widget for configuring the print format.
Definition: calprintdefaultplugins.cpp:958
CalendarSupport::CalPrintTodos::TodoFieldDueDate
Definition: calprintdefaultplugins.h:300
CalendarSupport::CalPrintWeek::mSingleLineLimit
bool mSingleLineLimit
Definition: calprintdefaultplugins.h:195
CalendarSupport::CalPrintWeek::Filofax
Definition: calprintdefaultplugins.h:190
CalendarSupport::CalPrintDay::mStartTime
QTime mStartTime
Definition: calprintdefaultplugins.h:137
QDate::addMonths
QDate addMonths(int nmonths) const
QRect::top
int top() const
CalendarSupport::CalPrintWeek::mIncludeTodos
bool mIncludeTodos
Definition: calprintdefaultplugins.h:196
CalendarSupport::CalPrintMonth::mWeekNumbers
bool mWeekNumbers
Definition: calprintdefaultplugins.h:243
CalendarSupport::CalPrintPluginBase::drawBoxWithCaption
int drawBoxWithCaption(QPainter &p, const QRect &box, const QString &caption, const QString &contents, bool sameLine, bool expand, const QFont &captionFont, const QFont &textFont, bool richContents=false)
Draw a component box with a heading (printed in bold).
Definition: calprintpluginbase.cpp:482
CalendarSupport::CalPrintDay::Timetable
Definition: calprintdefaultplugins.h:134
CalendarSupport::CalPrintWeek::setDateRange
virtual void setDateRange(const QDate &from, const QDate &to)
Set date range which should be printed.
Definition: calprintdefaultplugins.cpp:1075
CalendarSupport::CalPrintWeek::setSettingsWidget
virtual void setSettingsWidget()
Set configuration widget to reflect settings of current object.
Definition: calprintdefaultplugins.cpp:995
QRect::setTop
void setTop(int y)
CalendarSupport::CalPrintWeek::mStartTime
QTime mStartTime
Definition: calprintdefaultplugins.h:194
QRect::left
int left() const
CalendarSupport::CalPrintDay::CalPrintDay
CalPrintDay()
Definition: calprintdefaultplugins.cpp:670
CalendarSupport::CalPrintTodos::mExcludePrivate
bool mExcludePrivate
Definition: calprintdefaultplugins.h:321
CalendarSupport::PrintPlugin::mSelectedIncidences
KCalCore::Incidence::List mSelectedIncidences
Definition: printplugin.h:169
QPainter
QRect::setWidth
void setWidth(int width)
QString::isEmpty
bool isEmpty() const
CalendarSupport::CalPrintDay::mExcludePrivate
bool mExcludePrivate
Definition: calprintdefaultplugins.h:144
CalendarSupport::CalPrintIncidence::groupName
virtual QString groupName()
Returns KConfig group name where store settings.
Definition: calprintdefaultplugins.h:46
QDate::day
int day() const
CalendarSupport::PrintPlugin::mCalendar
Akonadi::ETMCalendar::Ptr mCalendar
Definition: printplugin.h:168
CalendarSupport::CalPrintPluginBase::orientation
QPrinter::Orientation orientation() const
Definition: calprintpluginbase.cpp:225
CalendarSupport::CalPrintTodos::TodoDirectionUnset
Definition: calprintdefaultplugins.h:309
CalendarSupport::CalPrintIncidence::printCaptionAndText
int printCaptionAndText(QPainter &p, const QRect &box, const QString &caption, const QString &text, QFont captionFont, QFont textFont)
Definition: calprintdefaultplugins.cpp:206
QTime::addSecs
QTime addSecs(int s) const
QPainter::drawText
void drawText(const QPointF &position, const QString &text)
QRect::center
QPoint center() const
QDate
CalendarSupport::CalPrintPluginBase::drawSplitHeaderRight
void drawSplitHeaderRight(QPainter &p, const QDate &fd, const QDate &td, const QDate &cd, int width, int height)
Definition: calprintpluginbase.cpp:2162
CalendarSupport::CalPrintTodos::mTodoSortField
enum CalendarSupport::CalPrintTodos::eTodoSortField mTodoSortField
CalendarSupport::CalPrintIncidence::mShowAttachments
bool mShowAttachments
Definition: calprintdefaultplugins.h:92
QDate::year
int year() const
CalendarSupport::CalPrintTodos::saveConfig
virtual void saveConfig()
Write print format configuration to config file.
Definition: calprintdefaultplugins.cpp:1495
QString
CalendarSupport::CalPrintIncidence::~CalPrintIncidence
virtual ~CalPrintIncidence()
Definition: calprintdefaultplugins.cpp:64
QList
CalendarSupport::CalPrintPluginBase::drawBox
static void drawBox(QPainter &p, int linewidth, const QRect &rect)
Draw a box with given width at the given coordinates.
Definition: calprintpluginbase.cpp:403
QColor
CalendarSupport::CalPrintTodos::readSettingsWidget
virtual void readSettingsWidget()
Read settings from configuration widget and apply them to current object.
Definition: calprintdefaultplugins.cpp:1393
CalendarSupport::KCalPrefs::instance
static KCalPrefs * instance()
Get instance of KCalPrefs.
Definition: kcalprefs.cpp:77
CalendarSupport::CalPrintIncidence::loadConfig
virtual void loadConfig()
Load print format configuration from config file.
Definition: calprintdefaultplugins.cpp:103
CalendarSupport::CalPrintTodos::~CalPrintTodos
virtual ~CalPrintTodos()
Definition: calprintdefaultplugins.cpp:1384
CalendarSupport::CalPrintDay::mExcludeConfidential
bool mExcludeConfidential
Definition: calprintdefaultplugins.h:143
QStringList
CalendarSupport::CalPrintIncidence::mShowAttendees
bool mShowAttendees
Definition: calprintdefaultplugins.h:91
CalendarSupport::CalPrintPluginBase
Base class for Calendar printing classes.
Definition: calprintpluginbase.h:62
CalendarSupport::CalPrintIncidence::CalPrintIncidence
CalPrintIncidence()
Definition: calprintdefaultplugins.cpp:60
QTime::hour
int hour() const
CalendarSupport::CalPrintMonth::groupName
virtual QString groupName()
Returns KConfig group name where store settings.
Definition: calprintdefaultplugins.h:208
CalendarSupport::CalPrintMonth::mRecurWeekly
bool mRecurWeekly
Definition: calprintdefaultplugins.h:245
CalendarSupport::CalPrintWeek::defaultOrientation
virtual QPrinter::Orientation defaultOrientation()
Returns the default orientation for the eWeekPrintType.
Definition: calprintdefaultplugins.cpp:1064
CalendarSupport::CalPrintDay::SingleTimetable
Definition: calprintdefaultplugins.h:135
CalendarSupport::CalPrintMonth::mExcludePrivate
bool mExcludePrivate
Definition: calprintdefaultplugins.h:250
QLatin1Char
CalendarSupport::CalPrintTodos::print
void print(QPainter &p, int width, int height)
Actually do the printing.
Definition: calprintdefaultplugins.cpp:1515
CalendarSupport::CalPrintIncidence::print
void print(QPainter &p, int width, int height)
Actually do the printing.
Definition: calprintdefaultplugins.cpp:228
QFontMetrics::width
int width(const QString &text, int len) const
CalendarSupport::CalPrintTodos::TodoDirectionAscending
Definition: calprintdefaultplugins.h:307
CalendarSupport::CalPrintPluginBase::drawVerticalBox
void drawVerticalBox(QPainter &p, int linewidth, const QRect &box, const QString &str, int flags=-1)
Draw an event box with vertical text.
Definition: calprintpluginbase.cpp:466
CalendarSupport::PrintPlugin::mConfigWidget
QPointer< QWidget > mConfigWidget
Definition: printplugin.h:164
QPrinter::newPage
bool newPage()
CalendarSupport::CalPrintTodos::mIncludeDueDate
bool mIncludeDueDate
Definition: calprintdefaultplugins.h:314
CalendarSupport::CalPrintPluginBase::drawHeader
int drawHeader(QPainter &p, const QString &title, const QDate &month1, const QDate &month2, const QRect &box, bool expand=false, QColor backColor=QColor())
Draw the gray header bar of the printout to the QPainter.
Definition: calprintpluginbase.cpp:565
CalendarSupport::CalPrintMonth::mRecurDaily
bool mRecurDaily
Definition: calprintdefaultplugins.h:244
CalendarSupport::CalPrintIncidence::mShowSubitemsNotes
bool mShowSubitemsNotes
Definition: calprintdefaultplugins.h:90
QString::replace
QString & replace(int position, int n, QChar after)
CalendarSupport::CalPrintPluginBase::drawMonthTable
void drawMonthTable(QPainter &p, const QDate &qd, const QTime &fromTime, const QTime &toTime, bool weeknumbers, bool recurDaily, bool recurWeekly, bool singleLineLimit, bool showNoteLines, bool includeDescription, bool excludeConfidential, bool excludePrivate, const QRect &box)
Draw the month table of the month containing the date qd.
Definition: calprintpluginbase.cpp:1756
QRect::setRight
void setRight(int x)
CalendarSupport::CalPrintIncidence::saveConfig
virtual void saveConfig()
Write print format configuration to config file.
Definition: calprintdefaultplugins.cpp:116
CalendarSupport::CalPrintTodos::eTodoPrintType
eTodoPrintType
Definition: calprintdefaultplugins.h:291
CalendarSupport::CalPrintTodos::mIncludePercentComplete
bool mIncludePercentComplete
Definition: calprintdefaultplugins.h:315
QDateTime::currentDateTime
QDateTime currentDateTime()
QRect::width
int width() const
CalendarSupport::CalPrintMonth::print
void print(QPainter &p, int width, int height)
Actually do the printing.
Definition: calprintdefaultplugins.cpp:1325
CalendarSupport::CalPrintWeek::mEndTime
QTime mEndTime
Definition: calprintdefaultplugins.h:194
QLatin1String
CalendarSupport::CalPrintWeek::mWeekPrintType
enum CalendarSupport::CalPrintWeek::eWeekPrintType mWeekPrintType
CalendarSupport::PrintPlugin::mToDate
QDate mToDate
Definition: printplugin.h:161
CalendarSupport::CalPrintPluginBase::printEventString
void printEventString(QPainter &p, const QRect &box, const QString &str, int flags=-1)
Print the given string (event summary) in the given rectangle.
Definition: calprintpluginbase.cpp:427
CalendarSupport::CalPrintPluginBase::drawAgendaDayBox
void drawAgendaDayBox(QPainter &p, const KCalCore::Event::List &eventList, const QDate &qd, bool expandable, const QTime &fromTime, const QTime &toTime, const QRect &box, bool includeDescription, bool excludeTime, bool excludeConfidential, bool excludePrivate, const QList< QDate > &workDays)
Draw the agenda box for the day print style (the box showing all events of that day).
Definition: calprintpluginbase.cpp:870
QPainter::fontMetrics
QFontMetrics fontMetrics() const
QRect::setHeight
void setHeight(int height)
CalendarSupport::CalPrintIncidenceConfig
Definition: calprintdefaultplugins.h:324
CalendarSupport::CalPrintPluginBase::categoryBgColor
QColor categoryBgColor(const KCalCore::Incidence::Ptr &incidence) const
Definition: calprintpluginbase.cpp:274
BOX_BORDER_WIDTH
#define BOX_BORDER_WIDTH
Definition: calprintpluginbase.h:51
CalendarSupport::CalPrintPluginBase::footerHeight
int footerHeight() const
Returns the height of the page footer.
Definition: calprintpluginbase.cpp:353
QDate::currentDate
QDate currentDate()
CalendarSupport::CalPrintTodoConfig
Definition: calprintdefaultplugins.h:360
CalendarSupport::CalPrintWeek::saveConfig
virtual void saveConfig()
Write print format configuration to config file.
Definition: calprintdefaultplugins.cpp:1043
QRect::bottom
int bottom() const
CalendarSupport::CalPrintPluginBase::drawTimeLine
void drawTimeLine(QPainter &p, const QTime &fromTime, const QTime &toTime, const QRect &box)
Draw a (vertical) time scale from time fromTime to toTime inside the given area of the painter...
Definition: calprintpluginbase.cpp:738
CalendarSupport::CalPrintTodos::TodoFieldUnset
Definition: calprintdefaultplugins.h:303
TIMELINE_WIDTH
#define TIMELINE_WIDTH
Definition: calprintpluginbase.h:54
CalendarSupport::CalPrintMonth::mSingleLineLimit
bool mSingleLineLimit
Definition: calprintdefaultplugins.h:247
CalendarSupport::CalPrintPluginBase::mPrintFooter
bool mPrintFooter
Definition: calprintpluginbase.h:643
CalendarSupport::CalPrintIncidence::readSettingsWidget
virtual void readSettingsWidget()
Read settings from configuration widget and apply them to current object.
Definition: calprintdefaultplugins.cpp:73
CalendarSupport::CalPrintPluginBase::drawDays
void drawDays(QPainter &p, const QDate &start, const QDate &end, const QTime &fromTime, const QTime &toTime, const QRect &box, bool singleLineLimit, bool showNoteLines, bool includeDescription, bool excludeConfidential, bool excludePrivate)
Draw the (filofax) table for a bunch of days, using drawDayBox.
Definition: calprintpluginbase.cpp:1399
CalendarSupport::CalPrintTodos::setSettingsWidget
virtual void setSettingsWidget()
Set configuration widget to reflect settings of current object.
Definition: calprintdefaultplugins.cpp:1429
CalendarSupport::CalPrintIncidence::mShowOptions
bool mShowOptions
Definition: calprintdefaultplugins.h:89
CalendarSupport::CalPrintWeek::mExcludeConfidential
bool mExcludeConfidential
Definition: calprintdefaultplugins.h:199
CalendarSupport::workDays
CALENDARSUPPORT_EXPORT QList< QDate > workDays(const QDate &start, const QDate &end)
Returns a list containing work days between start and .
Definition: utils.cpp:642
CalendarSupport::CalPrintMonth::readSettingsWidget
virtual void readSettingsWidget()
Read settings from configuration widget and apply them to current object.
Definition: calprintdefaultplugins.cpp:1224
CalendarSupport::CalPrintDay::setDateRange
virtual void setDateRange(const QDate &from, const QDate &to)
Set date range which should be printed.
Definition: calprintdefaultplugins.cpp:787
QDate::addDays
QDate addDays(int ndays) const
CalendarSupport::CalPrintDay::print
void print(QPainter &p, int width, int height)
Actually do the printing.
Definition: calprintdefaultplugins.cpp:798
CalendarSupport::journal
CALENDARSUPPORT_EXPORT KCalCore::Journal::Ptr journal(const Akonadi::Item &item)
returns the journal from an akonadi item, or a null pointer if the item has no such payload ...
Definition: utils.cpp:137
CalendarSupport::event
CALENDARSUPPORT_EXPORT KCalCore::Event::Ptr event(const Akonadi::Item &item)
returns the event from an akonadi item, or a null pointer if the item has no such payload ...
Definition: utils.cpp:88
CalendarSupport::PrintPlugin::mConfig
KConfig * mConfig
Definition: printplugin.h:170
CalendarSupport::CalPrintDay::saveConfig
virtual void saveConfig()
Write print format configuration to config file.
Definition: calprintdefaultplugins.cpp:765
CalendarSupport::CalPrintDay::readSettingsWidget
virtual void readSettingsWidget()
Read settings from configuration widget and apply them to current object.
Definition: calprintdefaultplugins.cpp:683
CalendarSupport::CalPrintWeek::mExcludePrivate
bool mExcludePrivate
Definition: calprintdefaultplugins.h:200
CalendarSupport::CalPrintPluginBase::mShowNoteLines
bool mShowNoteLines
Definition: calprintpluginbase.h:644
CalendarSupport::CalPrintTodos::TodoDirectionDescending
Definition: calprintdefaultplugins.h:308
CalendarSupport::CalPrintTodos::TodosAll
Definition: calprintdefaultplugins.h:292
CalendarSupport::CalPrintTodos::TodoFieldStartDate
Definition: calprintdefaultplugins.h:299
CalendarSupport::PrintPlugin::mPrinter
QPrinter * mPrinter
The printer object.
Definition: printplugin.h:167
QRect::setLeft
void setLeft(int x)
CalendarSupport::CalPrintMonth::mIncludeTodos
bool mIncludeTodos
Definition: calprintdefaultplugins.h:246
CalendarSupport::CalPrintWeek::loadConfig
virtual void loadConfig()
Load print format configuration from config file.
Definition: calprintdefaultplugins.cpp:1021
CalendarSupport::CalPrintWeek::groupName
virtual QString groupName()
Returns KConfig group name where store settings.
Definition: calprintdefaultplugins.h:153
QFontMetrics::lineSpacing
int lineSpacing() const
CalendarSupport::CalPrintPluginBase::dayStart
QTime dayStart() const
Definition: calprintpluginbase.cpp:236
CalendarSupport::CalPrintPluginBase::drawTodo
void drawTodo(int &count, const KCalCore::Todo::Ptr &todo, QPainter &p, KCalCore::TodoSortField sortField, KCalCore::SortDirection sortDir, bool connectSubTodos, bool strikeoutCompleted, bool desc, int posPriority, int posSummary, int posDueDt, int posPercentComplete, int level, int x, int &y, int width, int pageHeight, const KCalCore::Todo::List &todoList, TodoParentStart *r, bool excludeConfidential, bool excludePrivate)
Draws single to-do and its (intented) sub-to-dos, optionally connects them by a tree-like line...
Definition: calprintpluginbase.cpp:1883
QDateTime
CalendarSupport::KCalPrefs::timeSpec
KDateTime::Spec timeSpec()
Definition: kcalprefs.cpp:110
CalendarSupport::CalPrintTodos::CalPrintTodos
CalPrintTodos()
Definition: calprintdefaultplugins.cpp:1378
CalendarSupport::CalPrintTodos::mStrikeOutCompleted
bool mStrikeOutCompleted
Definition: calprintdefaultplugins.h:317
CalendarSupport::CalPrintTodos::eTodoSortDirection
eTodoSortDirection
Definition: calprintdefaultplugins.h:306
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:31:15 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

calendarsupport

Skip menu "calendarsupport"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdepim API Reference

Skip menu "kdepim API Reference"
  • akonadi_next
  • akregator
  • blogilo
  • calendarsupport
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt2
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korgac
  • korganizer
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • mailcommon
  • messagelist
  • messageviewer
  • pimprint

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal