+ mControls[FavouriteControlOff]->paint(painter, option.rect);
+#ifdef MAEMO
+ if(event->hasAlarm())
+ mControls[AlarmControlOn]->paint(painter, option.rect);
+ else
+ mControls[AlarmControlOff]->paint(painter, option.rect);
+#endif
+ if(event->hasTimeConflict())
+ mControls[WarningControl]->paint(painter, option.rect);
+
+ // draw texts
+ // it starts just below the image
+ // ("position of text" is lower-left angle of the first letter,
+ // so the first line is actually at the same height as the image)
+ QPointF titlePointF(option.rect.x() + SPACER,
+ option.rect.y() + SPACER + mControls[FavouriteControlOn]->image()->height());
+ QTime start = event->start().time();
+ painter->setFont(fontBig);
+ painter->drawText(titlePointF,start.toString("hh:mm") + "-" + start.addSecs(event->duration()).toString("hh:mm") + ", " + event->roomName());
+ // title
+ titlePointF.setY(titlePointF.y()+fmBig.height()-fmBig.descent());
+ painter->setFont(fontBigB);
+ QString title = event->title();
+ if(fmBigB.boundingRect(title).width() > (option.rect.width()-2*SPACER)) // the title won't fit the screen
+ {
+ // chop words from the end
+ while( (fmBigB.boundingRect(title + "...").width() > (option.rect.width()-2*SPACER)) && !title.isEmpty())
+ {
+ title.chop(1);
+ // chop characters one-by-one from the end
+ while( (!title.at(title.length()-1).isSpace()) && !title.isEmpty())
+ {
+ title.chop(1);
+ }
+ }
+ title += "...";
+ }
+ painter->drawText(titlePointF,title);
+ // persons
+ titlePointF.setY(titlePointF.y()+fmSmall.height()-fmSmall.descent());
+ painter->setFont(fontSmall);
+ painter->drawText(titlePointF,"Presenter(s): " + event->persons().join(" and "));
+ // track
+ titlePointF.setY(titlePointF.y()+fmSmall.height()-fmSmall.descent());
+ painter->drawText(titlePointF,"Track: " + Track::retrieveTrackName(event->trackId()));