Commit 7e681c1d authored by Allen Winter's avatar Allen Winter

forward port SVN commit 1155133 by winterz:

for Day prints, put the allday events in their own box at the top of
the agenda print, sorta like how agenda view looks.
kolab/issue4261

svn path=/trunk/KDE/kdepim/; revision=1158329
parent 8751fb20
......@@ -32,23 +32,25 @@
#include <akonadi/kcal/utils.h>
#include <kcalprefs.h>
#include <kcalcore/visitor.h>
#include <kcalcore/todo.h>
#include <kcalutils/incidenceformatter.h>
#include <kcalutils/stringify.h>
#include <KCal/Todo>
#include <KCal/IncidenceFormatter>
#include <KCalendarSystem>
#include <KDateTime>
#include <KConfigGroup>
#include <ksystemtimezone.h>
#include <KSystemTimeZones>
#include <QDateTime>
#include <QPainter>
#include <QPrinter>
using namespace Akonadi;
using namespace KCalUtils;
static QString cleanStr( const QString &instr )
{
QString ret = instr;
return ret.replace( '\n', ' ' );
}
/**************************************************************
* Print Incidence
......@@ -121,21 +123,21 @@ void CalPrintIncidence::saveConfig()
}
}
class TimePrintStringsVisitor : public Visitor
class TimePrintStringsVisitor : public IncidenceBase::Visitor
{
public:
TimePrintStringsVisitor() {}
bool act( IncidenceBase::Ptr incidence )
bool act( IncidenceBase *incidence )
{
return incidence->accept( *this, incidence );
return incidence->accept( *this );
}
QString mStartCaption, mStartString;
QString mEndCaption, mEndString;
QString mDurationCaption, mDurationString;
protected:
bool visit( Event::Ptr event ) {
bool visit( Event *event ) {
if ( event->dtStart().isValid() ) {
mStartCaption = i18n( "Start date: " );
mStartString = IncidenceFormatter::dateTimeToString(
......@@ -164,7 +166,7 @@ class TimePrintStringsVisitor : public Visitor
}
return true;
}
bool visit( Todo::Ptr todo ) {
bool visit( Todo *todo ) {
if ( todo->hasStartDate() ) {
mStartCaption = i18n( "Start date: " );
mStartString = IncidenceFormatter::dateTimeToString(
......@@ -184,7 +186,7 @@ class TimePrintStringsVisitor : public Visitor
}
return true;
}
bool visit( Journal::Ptr journal ) {
bool visit( Journal *journal ) {
mStartCaption = i18n( "Start date: " );
mStartString = IncidenceFormatter::dateTimeToString(
journal->dtStart(), journal->allDay(), false );
......@@ -192,7 +194,7 @@ class TimePrintStringsVisitor : public Visitor
mEndString.clear();
return true;
}
bool visit( FreeBusy::Ptr fb ) {
bool visit( FreeBusy *fb ) {
Q_UNUSED( fb );
return true;
}
......@@ -239,7 +241,7 @@ void CalPrintIncidence::print( QPainter &p, int width, int height )
mPrinter->newPage();
}
const bool isJournal = ( (*it)->type() == Incidence::TypeJournal );
const bool isJournal = ( (*it)->type() == "Journal" );
// PAGE Layout (same for landscape and portrait! astonishingly, it looks good with both!):
// +-----------------------------------+
......@@ -286,7 +288,7 @@ void CalPrintIncidence::print( QPainter &p, int width, int height )
TimePrintStringsVisitor stringVis;
int h = timesBox.top();
if ( stringVis.act( *it ) ) {
if ( stringVis.act(*it) ) {
QRect textRect( timesBox.left() + padding(),
timesBox.top() + padding(), 0, lineHeight );
textRect.setRight( timesBox.center().x() );
......@@ -303,7 +305,7 @@ void CalPrintIncidence::print( QPainter &p, int width, int height )
if ( (*it)->recurs() ) {
QRect recurBox( timesBox.left() + padding(), h + padding(),
timesBox.right() - padding(), lineHeight );
KCalCore::Recurrence *recurs = (*it)->recurrence();
KCal::Recurrence *recurs = (*it)->recurrence();
QString displayString = IncidenceFormatter::recurrenceString((*it));
// exception dates
QString exceptString;
......@@ -332,9 +334,9 @@ void CalPrintIncidence::print( QPainter &p, int width, int height )
cap = i18np( "Reminder: ", "%1 reminders: ", alarms.count() );
QStringList alarmStrings;
KCalCore::Alarm::List::ConstIterator it;
KCal::Alarm::List::ConstIterator it;
for ( it = alarms.constBegin(); it != alarms.constEnd(); ++it ) {
Alarm::Ptr alarm = *it;
Alarm *alarm = *it;
// Alarm offset, copied from koeditoralarms.cpp:
KLocalizedString offsetstr;
......@@ -384,7 +386,7 @@ void CalPrintIncidence::print( QPainter &p, int width, int height )
QRect organizerBox( timesBox.left() + padding(), h + padding(),
timesBox.right() - padding(), lineHeight );
h = qMax( printCaptionAndText( p, organizerBox, i18n( "Organizer: " ),
(*it)->organizer()->fullName(), captionFont, textFont ), h );
(*it)->organizer().fullName(), captionFont, textFont ), h );
// Finally, draw the frame around the time information...
timesBox.setBottom( qMax( timesBox.bottom(), h + padding() ) );
......@@ -413,10 +415,13 @@ void CalPrintIncidence::print( QPainter &p, int width, int height )
box.width(), box.height() / 9 );
QRect attachmentsBox( box.left(), attendeesBox.top() - padding() - box.height() / 9,
box.width() * 3 / 4 - padding(), box.height() / 9 );
QRect optionsBox( isJournal ? box.left() : attachmentsBox.right() + padding(), attachmentsBox.top(), 0, 0 );
QRect optionsBox( isJournal ? box.left() : attachmentsBox.right() + padding(),
attachmentsBox.top(), 0, 0 );
optionsBox.setRight( box.right() );
optionsBox.setBottom( attachmentsBox.bottom() );
QRect notesBox( optionsBox.left(), isJournal ? ( timesBox.bottom() + padding() ) : ( locationBox.bottom() + padding() ),
QRect notesBox( optionsBox.left(),
isJournal ? ( timesBox.bottom() + padding() ) :
( locationBox.bottom() + padding() ),
optionsBox.width(), 0 );
notesBox.setBottom( optionsBox.top() - padding() );
QRect descriptionBox( notesBox );
......@@ -462,18 +467,14 @@ void CalPrintIncidence::print( QPainter &p, int width, int height )
if ( mShowNoteLines ) {
drawNoteLines( p, descriptionBox, newBottom );
}
Akonadi::Item item = mCalendar->itemForIncidenceUid( (*it)->uid() );
Akonadi::Item::List relations = mCalendar->findChildren( item );
if ( mShowSubitemsNotes && !isJournal ) {
if ( relations.isEmpty() || (*it)->type() != Incidence::TypeTodo ) {
if ( (*it)->relations().isEmpty() || (*it)->type() != "Todo" ) {
int notesPosition = drawBoxWithCaption( p, notesBox, i18n( "Notes:" ),
QString(), /*sameLine=*/false,
/*expand=*/false, captionFont, textFont );
drawNoteLines( p, notesBox, notesPosition );
} else {
Incidence::List relations = (*it)->relations();
QString subitemCaption;
if ( relations.count() == 0 ) {
subitemCaption = i18n( "No Subitems" );
......@@ -483,21 +484,20 @@ void CalPrintIncidence::print( QPainter &p, int width, int height )
"%1 Subitems:",
relations.count() );
}
Incidence::List::ConstIterator rit;
QString subitemString;
QString statusString;
QString datesString;
int count = 0;
foreach( const Akonadi::Item &item, relations ) {
Todo::Ptr todo = Akonadi::todo( item );
for ( rit = relations.constBegin(); rit != relations.constEnd(); ++rit ) {
++count;
if ( !todo ) { // defensive, skip any zero pointers
if ( !(*rit) ) { // defensive, skip any zero pointers
continue;
}
// format the status
statusString = Stringify::incidenceStatus( todo->status() );
statusString = (*rit)->statusStr();
if ( statusString.isEmpty() ) {
if ( todo->status() == Incidence::StatusNone ) {
if ( (*rit)->status() == Incidence::StatusNone ) {
statusString = i18nc( "no status", "none" );
} else {
statusString = i18nc( "unknown status", "unknown" );
......@@ -506,32 +506,32 @@ void CalPrintIncidence::print( QPainter &p, int width, int height )
// format the dates if provided
datesString.clear();
KDateTime::Spec spec = KCalPrefs::instance()->timeSpec();
if ( todo->dtStart().isValid() ) {
if ( (*rit)->dtStart().isValid() ) {
datesString += i18nc(
"subitem start date", "Start Date: %1\n",
KGlobal::locale()->formatDate( todo->dtStart().toTimeSpec( spec ).date(),
KGlobal::locale()->formatDate( (*rit)->dtStart().toTimeSpec( spec ).date(),
KLocale::ShortDate ) );
if ( !todo->allDay() ) {
if ( !(*rit)->allDay() ) {
datesString += i18nc(
"subitem start time", "Start Time: %1\n",
KGlobal::locale()->formatTime( todo->dtStart().toTimeSpec( spec ).time(),
KGlobal::locale()->formatTime( (*rit)->dtStart().toTimeSpec( spec ).time(),
false, false ) );
}
}
if ( todo->dateTime( Incidence::RoleEnd ).isValid() ) {
if ( (*rit)->dtEnd().isValid() ) {
subitemString += i18nc(
"subitem due date", "Due Date: %1\n",
KGlobal::locale()->formatDate( todo->dateTime( Incidence::RoleEnd ).toTimeSpec( spec ).date(),
KGlobal::locale()->formatDate( (*rit)->dtEnd().toTimeSpec( spec ).date(),
KLocale::ShortDate ) );
if ( !todo->allDay() ) {
if ( !(*rit)->allDay() ) {
subitemString += i18nc(
"subitem due time", "Due Time: %1\n",
KGlobal::locale()->formatTime( todo->dateTime( Incidence::RoleEnd ).toTimeSpec( spec ).time(),
KGlobal::locale()->formatTime( (*rit)->dtEnd().toTimeSpec( spec ).time(),
false, false ) );
}
}
subitemString += i18nc( "subitem counter", "%1: ", count );
subitemString += todo->summary();
subitemString += (*rit)->summary();
subitemString += '\n';
if ( !datesString.isEmpty() ) {
subitemString += datesString;
......@@ -540,13 +540,13 @@ void CalPrintIncidence::print( QPainter &p, int width, int height )
subitemString += i18nc( "subitem Status: statusString",
"Status: %1\n",
statusString );
subitemString += IncidenceFormatter::recurrenceString( todo ) + '\n';
subitemString += IncidenceFormatter::recurrenceString((*rit)) + '\n';
subitemString += i18nc( "subitem Priority: N",
"Priority: <numid>%1</numid>\n",
todo->priority() );
(*rit)->priority() );
subitemString += i18nc( "subitem Secrecy: secrecyString",
"Secrecy: %1\n",
Stringify::incidenceSecrecy( todo->secrecy() ) );
(*rit)->secrecyStr() );
subitemString += '\n';
}
drawBoxWithCaption( p, notesBox, subitemCaption,
......@@ -600,7 +600,7 @@ void CalPrintIncidence::print( QPainter &p, int width, int height )
"'Name (Role): Status', e.g. 'Reinhold Kainhofer "
"<reinhold@kainhofer.com> (Participant): Awaiting Response'",
"%1 (%2): %3",
(*ait)->fullName(), Stringify::attendeeRole( (*ait)->role() ), Stringify::attendeeStatus( ( *ait )->status() ) );
(*ait)->fullName(), (*ait)->roleStr(), (*ait)->statusStr() );
}
drawBoxWithCaption( p, attendeesBox, attendeeCaption, attendeeString,
/*sameLine=*/false, /*expand=*/false,
......@@ -609,29 +609,29 @@ void CalPrintIncidence::print( QPainter &p, int width, int height )
if ( mShowOptions ) {
QString optionsString;
if ( !Stringify::incidenceStatus( (*it)->status() ).isEmpty() ) {
optionsString += i18n( "Status: %1", Stringify::incidenceStatus( (*it)->status() ) );
if ( !(*it)->statusStr().isEmpty() ) {
optionsString += i18n( "Status: %1", (*it)->statusStr() );
optionsString += '\n';
}
if ( !Stringify::incidenceSecrecy( (*it)->secrecy() ).isEmpty() ) {
optionsString += i18n( "Secrecy: %1", Stringify::incidenceSecrecy( (*it)->secrecy() ) );
if ( !(*it)->secrecyStr().isEmpty() ) {
optionsString += i18n( "Secrecy: %1", (*it)->secrecyStr() );
optionsString += '\n';
}
if ( (*it)->type() == Incidence::TypeEvent ) {
Event::Ptr e = (*it).staticCast<Event>();
if ( (*it)->type() == "Event" ) {
Event *e = static_cast<Event*>(*it);
if ( e->transparency() == Event::Opaque ) {
optionsString += i18n( "Show as: Busy" );
} else {
optionsString += i18n( "Show as: Free" );
}
optionsString += '\n';
} else if ( (*it)->type() == Incidence::TypeTodo ) {
Todo::Ptr t = (*it).staticCast<Todo>();
} else if ( (*it)->type() == "Todo" ) {
Todo *t = static_cast<Todo*>(*it);
if ( t->isOverdue() ) {
optionsString += i18n( "This task is overdue!" );
optionsString += '\n';
}
} else if ( (*it)->type() == Incidence::TypeJournal ) {
} else if ( (*it)->type() == "Journal" ) {
//TODO: Anything Journal-specific?
}
drawBoxWithCaption( p, optionsBox, i18n( "Settings: " ),
......@@ -833,18 +833,70 @@ void CalPrintDay::print( QPainter &p, int width, int height )
Akonadi::EventSortStartDate,
Akonadi::SortDirectionAscending );
p.setFont( QFont( "sans-serif", 12 ) );
// split out the all day events as they will be printed in a separate box
Item::List alldayEvents, timedEvents;
Item::List::ConstIterator it;
for ( it = eventList.begin(); it != eventList.end(); ++it ) {
Event::Ptr event = Akonadi::event( *it );
if ( event->allDay() ) {
alldayEvents.append( *it );
} else {
timedEvents.append( *it );
}
}
int fontSize = 11;
QFont textFont( "sans-serif", fontSize, QFont::Normal );
p.setFont( textFont );
int lineSpacing = p.fontMetrics().lineSpacing();
// TODO: Find a good way to determine the height of the all-day box
int maxAllDayEvents = 8; // the max we allow to be printed, sorry.
int allDayHeight = qMin( alldayEvents.count(), maxAllDayEvents ) * lineSpacing;
allDayHeight = qMax( allDayHeight, ( 5 * lineSpacing ) ) + ( 2 * padding() );
QRect allDayBox( TIMELINE_WIDTH + padding(), headerBox.bottom() + padding(),
0, height - headerBox.bottom() - padding() );
allDayBox.setRight( width );
width - TIMELINE_WIDTH - padding(), allDayHeight );
if ( alldayEvents.count() > 0 ) {
drawVerticalBox( p,
QRect( 0, headerBox.bottom() + padding(), TIMELINE_WIDTH, allDayHeight ),
i18n( "Today's Events" ),
Qt::AlignHCenter | Qt::AlignVCenter | Qt::SingleLine );
drawBox( p, BOX_BORDER_WIDTH, allDayBox );
Item::List::ConstIterator it;
QRect eventBox( allDayBox );
eventBox.setLeft( TIMELINE_WIDTH + ( 2 * padding() ) );
eventBox.setTop( eventBox.top() + padding() );
eventBox.setBottom( eventBox.top() + lineSpacing );
int count = 0;
for ( it = alldayEvents.begin(); it != alldayEvents.end(); ++it ) {
Event::Ptr event = Akonadi::event( *it );
if ( count == maxAllDayEvents ) {
break;
}
count++;
QString str;
if ( event->location().isEmpty() ) {
str = cleanStr( event->summary() );
} else {
str = i18nc( "summary, location", "%1, %2",
cleanStr( event->summary() ), cleanStr( event->location() ) );
}
printEventString( p, eventBox, str );
eventBox.setTop( eventBox.bottom() );
eventBox.setBottom( eventBox.top() + lineSpacing );
}
} else {
allDayBox.setBottom( headerBox.bottom() );
}
QRect dayBox( allDayBox );
drawAgendaDayBox( p, eventList, curDay, mIncludeAllEvents,
curStartTime, curEndTime, dayBox,
mIncludeDescription, mExcludeTime,
mExcludeConfidential, mExcludePrivate );
dayBox.setTop( allDayBox.bottom() + padding() );
dayBox.setBottom( height );
drawAgendaDayBox( p, timedEvents, curDay, mIncludeAllEvents,
curStartTime, curEndTime, dayBox,
mIncludeDescription, mExcludeTime,
mExcludeConfidential, mExcludePrivate );
QRect tlBox( dayBox );
tlBox.setLeft( 0 );
......@@ -1340,11 +1392,11 @@ void CalPrintTodos::setSettingsWidget()
if ( mTodoSortField != TodoFieldUnset ) {
// do not insert if already done so.
cfg->mSortField->addItem( i18n( "Title" ) );
cfg->mSortField->addItem( i18n( "Start Date" ) );
cfg->mSortField->addItem( i18n( "Due Date" ) );
cfg->mSortField->addItem( i18n( "Priority" ) );
cfg->mSortField->addItem( i18n( "Percent Complete" ) );
cfg->mSortField->addItem( i18nc( "@option sort by title", "Title" ) );
cfg->mSortField->addItem( i18nc( "@option sort by start date/time", "Start Date" ) );
cfg->mSortField->addItem( i18nc( "@option sort by due date/time", "Due Date" ) );
cfg->mSortField->addItem( i18nc( "@option sort by priority", "Priority" ) );
cfg->mSortField->addItem( i18nc( "@option sort by percent completed", "Percent Complete" ) );
cfg->mSortField->setCurrentIndex( mTodoSortField );
}
......@@ -1428,7 +1480,7 @@ void CalPrintTodos::print( QPainter &p, int width, int height )
}
outStr.truncate( 0 );
outStr += i18n( "Title" );
outStr += i18nc( "@label to-do summary", "Title" );
p.drawText( possummary, mCurrentLinePos - 2, outStr );
if ( mIncludePercentComplete ) {
......@@ -1458,22 +1510,22 @@ void CalPrintTodos::print( QPainter &p, int width, int height )
Item::List::ConstIterator it;
// Convert sort options to the corresponding enums
Akonadi::TodoSortField sortField = Akonadi::TodoSortSummary;
TodoSortField sortField = TodoSortSummary;
switch( mTodoSortField ) {
case TodoFieldSummary:
sortField = Akonadi::TodoSortSummary;
sortField = TodoSortSummary;
break;
case TodoFieldStartDate:
sortField = Akonadi::TodoSortStartDate;
sortField = TodoSortStartDate;
break;
case TodoFieldDueDate:
sortField = Akonadi::TodoSortDueDate;
sortField = TodoSortDueDate;
break;
case TodoFieldPriority:
sortField = Akonadi::TodoSortPriority;
sortField = TodoSortPriority;
break;
case TodoFieldPercentComplete:
sortField = Akonadi::TodoSortPercentComplete;
sortField = TodoSortPercentComplete;
break;
case TodoFieldUnset:
break;
......@@ -1531,7 +1583,7 @@ void CalPrintTodos::print( QPainter &p, int width, int height )
continue;
}
// Skip sub-to-dos. They will be printed recursively in drawTodo()
if ( todo->relatedTo().isEmpty() ) { //review(AKONADI_PORT)
if ( !todo->relatedTo() ) { //review(AKONADI_PORT)
count++;
drawTodo( count, *it, p,
sortField, sortDirection,
......
......@@ -32,12 +32,11 @@
#include <akonadi/kcal/calendar.h>
#include <akonadi/kcal/utils.h>
#include <kdebug.h>
#include <kconfig.h>
#include <kcalendarsystem.h>
#include <kwordwrap.h>
#include <kconfiggroup.h>
#include <ksystemtimezone.h>
#include <KDebug>
#include <KCalendarSystem>
#include <KConfigGroup>
#include <KSystemTimeZones>
#include <KWordWrap>
#include <QPainter>
#include <QLayout>
......@@ -50,7 +49,7 @@
#include <QAbstractTextDocumentLayout>
#include <qmath.h> // qCeil
using namespace KCalCore;
using namespace KCal;
using namespace Akonadi;
static QString cleanStr( const QString &instr )
......@@ -241,7 +240,7 @@ QTime CalPrintPluginBase::dayStart()
return start;
}
void CalPrintPluginBase::setCategoryColors( QPainter &p, const Incidence::Ptr &incidence )
void CalPrintPluginBase::setCategoryColors( QPainter &p, Incidence *incidence )
{
QColor bgColor = categoryBgColor( incidence );
if ( bgColor.isValid() ) {
......@@ -253,12 +252,12 @@ void CalPrintPluginBase::setCategoryColors( QPainter &p, const Incidence::Ptr &i
}
}
QColor CalPrintPluginBase::categoryBgColor( const Incidence::Ptr &incidence )
QColor CalPrintPluginBase::categoryBgColor( Incidence *incidence )
{
if ( mCoreHelper && incidence ) {
QColor backColor = mCoreHelper->categoryColor( incidence->categories() );
if ( incidence->type() == Incidence::TypeTodo ) {
if ( ( incidence.staticCast<Todo>() )->isOverdue() ) {
if ( incidence->type() == "Todo" ) {
if ( static_cast<Todo*>( incidence )->isOverdue() ) {
backColor = KOPrefs::instance()->todoOverdueColor();
}
}
......@@ -417,7 +416,7 @@ void CalPrintPluginBase::showEventBox( QPainter &p, const QRect &box,
{
QPen oldpen( p.pen() );
QBrush oldbrush( p.brush() );
QColor bgColor( categoryBgColor( incidence ) );
QColor bgColor( categoryBgColor( incidence.get() ) );
if ( mUseColors & bgColor.isValid() ) {
p.setBrush( bgColor );
} else {
......@@ -442,13 +441,14 @@ void CalPrintPluginBase::drawSubHeaderBox( QPainter &p, const QString &str, cons
p.setFont( oldfont );
}
void CalPrintPluginBase::drawVerticalBox( QPainter &p, const QRect &box, const QString &str )
void CalPrintPluginBase::drawVerticalBox( QPainter &p, const QRect &box, const QString &str,
int flags )
{
p.save();
p.rotate( -90 );
QRect rotatedBox( -box.top() - box.height(), box.left(), box.height(), box.width() );
showEventBox( p, rotatedBox, Incidence::Ptr(), str,
Qt::AlignLeft | Qt::AlignVCenter | Qt::SingleLine );
( flags == -1 ) ? Qt::AlignLeft | Qt::AlignVCenter | Qt::SingleLine : flags );
p.restore();
}
......@@ -1077,7 +1077,7 @@ void CalPrintPluginBase::drawDayBox( QPainter &p, const QDate &qd,
timeText = local->formatTime( currEvent->dtStart().toLocalZone().time() ) + ' ';
}
p.save();
setCategoryColors( p, currEvent );
setCategoryColors( p, currEvent.get() );
QString str;
if ( !currEvent->location().isEmpty() ) {
str = i18nc( "summary, location", "%1, %2",
......@@ -1111,7 +1111,7 @@ void CalPrintPluginBase::drawDayBox( QPainter &p, const QDate &qd,
timeText.clear();
}
p.save();
setCategoryColors( p, todo );
setCategoryColors( p, todo.get() );
QString summaryStr;
if ( !todo->location().isEmpty() ) {
summaryStr = i18nc( "summary, location", "%1, %2",
......@@ -1867,23 +1867,21 @@ void CalPrintPluginBase::drawTodo( int &count, const Item &todoItem, QPainter &p
// Make a list of all the sub-to-dos related to this to-do.
Todo::List t;
Akonadi::Item item = mCalendar->itemForIncidenceUid( todo->uid() );
Akonadi::Item::List relations = mCalendar->findChildren( item );
foreach( const Akonadi::Item &childItem, relations ) {
Incidence::List l = todo->relations();
Incidence::List::ConstIterator it;
for ( it = l.constBegin(); it != l.constEnd(); ++it ) {
// In the future, to-dos might also be related to events
// Manually check if the sub-to-do is in the list of to-dos to print
// The problem is that relations() does not apply filters, so
// we need to compare manually with the complete filtered list!
Todo::Ptr subtodo = Akonadi::todo( childItem );
Todo* subtodo = dynamic_cast<Todo *>( *it );
#ifdef AKONADI_PORT_DISABLED
if ( subtodo && todoList.contains( subtodo ) ) {
#else
bool subtodoOk = false;
if ( subtodo ) {
foreach ( const Akonadi::Item &item, todoList ) {
if ( item.payload<Todo::Ptr>() == subtodo ) {
if ( item.payload<Todo::Ptr>().get() == subtodo ) {
subtodoOk = true;
break;
}
......@@ -1902,7 +1900,7 @@ void CalPrintPluginBase::drawTodo( int &count, const Item &todoItem, QPainter &p
}
// has sub-todos?
startpt.mHasLine = ( relations.size() > 0 );
startpt.mHasLine = ( l.size() > 0 );
startPoints.append( &startpt );
// description
......@@ -1921,7 +1919,7 @@ void CalPrintPluginBase::drawTodo( int &count, const Item &todoItem, QPainter &p
Item::List sl = mCalendar->sortTodos( &t, sortField, sortDir );
#else
Akonadi::Item::List tl;
foreach ( const Todo::Ptr &todo, t ) {
foreach ( Todo *todo, t ) {
Akonadi::Item todoitem;
todoitem.setPayload( Todo::Ptr( todo->clone() ) );
tl.append( todoitem );
......@@ -2009,8 +2007,8 @@ void CalPrintPluginBase::drawJournal( const Journal::Ptr &journal, QPainter &p,
p.drawLine( x + 3, y, x + width - 6, y );
y += 5;
if ( !( journal->organizer()->fullName().isEmpty() ) ) {
drawTextLines( p, i18n( "Person: %1", journal->organizer()->fullName() ),
if ( !( journal->organizer().fullName().isEmpty() ) ) {
drawTextLines( p, i18n( "Person: %1", journal->organizer().fullName() ),