22
22
without including the source code for Qt in the source distribution.
25
#ifndef KORG_NOPRINTER
27
25
#include "journalprint.h"
28
26
#include "calprintpluginbase.h"
28
#include <calendarsupport/utils.h>
30
30
#include <libkdepim/kdateedit.h>
32
#include <kcal/journal.h>
33
#include <kcal/calendar.h>
32
#include <kcalcore/journal.h>
34
#include <Akonadi/Item>
35
36
#include <kconfig.h>
36
37
#include <kdebug.h>
117
118
void CalPrintJournal::print( QPainter &p, int width, int height )
120
Journal::List journals( mCalendar->journals() );
121
Akonadi::Item::List journals( mCalendar->journals() );
121
122
if ( mUseDateRange ) {
122
Journal::List allJournals = journals;
123
Akonadi::Item::List allJournals = journals;
123
124
journals.clear();
124
Journal::List::Iterator it = allJournals.begin();
125
Akonadi::Item::List::Iterator it = allJournals.begin();
125
126
for ( ; it != allJournals.end(); ++it ) {
126
QDate dt = (*it)->dtStart().date();
127
KCalCore::Journal::Ptr j = CalendarSupport::journal( *it );
128
const QDate dt = j->dtStart().date();
127
129
if ( mFromDate <= dt && dt <= mToDate ) {
128
130
journals.append( *it );
133
drawHeader( p, i18n( "Journal entries" ), QDate(), QDate(),
134
QRect( 0, 0, width, headerHeight() ) );
135
QRect headerBox( 0, 0, width, headerHeight() );
136
QRect footerBox( 0, height - footerHeight(), width, footerHeight() );
137
height -= footerHeight();
139
drawHeader( p, i18n( "Journal entries" ), QDate(), QDate(), headerBox );
135
140
y = headerHeight() + 15;
137
Journal::List::Iterator it = journals.begin();
142
Akonadi::Item::List::Iterator it = journals.begin();
138
143
for ( ; it != journals.end(); ++it ) {
139
drawJournal( *it, p, x, y, width, height );
144
drawJournal( CalendarSupport::journal( *it ), p, x, y, width, height );
147
drawFooter( p, footerBox );