Incompatible calendar classes?
David Faure
faure at kde.org
Sun Apr 2 17:08:36 BST 2017
On dimanche 2 avril 2017 11:52:40 CEST Daniel Vrátil wrote:
> On Saturday, April 1, 2017 11:21:06 PM CEST David Faure wrote:
> > I've been trying to fix the fact that when receiving an invitation in
> > standalone kmail, the full calendar is loaded once to display the
> > invitation (because it lists events happening at the same time)
> >
> > and then the full calendar is loaded again when accepting the invitation,
> > to insert the event (and whatever else ITIPHandler does).
> >
> > I noticed that BodyPartFormatter knows about a calendar and
> > ITIPHandler has a setCalendar(), so it seemed to me that it was just about
> > passing the info via the right classes...
> >
> > I passed the BodyPart around in the text/calendar formatter, to then do
> > + MemoryCalendarMemento *memento =
> > dynamic_cast<MemoryCalendarMemento
> > *>(bodyPart->memento()); - SyncItipHandler *itipHandler = new
> > SyncItipHandler(receiver, iCal, type); + SyncItipHandler
> > *itipHandler = new SyncItipHandler(receiver, iCal, type,
> > memento->calendar());
> >
> > But... surprise, those are different types of calendar.
> >
> > This is a KCalCore::MemoryCalendar (either from
> > CalendarSupport::calendarSingleton or FetchJobCalendar) while ITIPHandler
> > wants a Akonadi::CalendarBase::Ptr, looks like a completely different
> > class
> > hierarchy.
>
> Are you sure? :-) Akonadi::CalendarBase is a KCalCore::MemoryCalendar
> subclass
Haha, nice, I didn't see that because it's called "Base" so I didn't think it
might itself have a base class.
Thanks for your help!
> so you should be able to cast between them. You probably need to
> use QSharedPointer casts though because of the ::Ptr.
Actually, I avoided having to do any down-casting by changing
the type of the calendar member variable in the memento.
https://phabricator.kde.org/D5280 is up for review.
--
David Faure, faure at kde.org, http://www.davidfaure.fr
Working on KDE Frameworks 5
More information about the kde-pim
mailing list