Incompatible calendar classes?

Daniel Vrátil dvratil at kde.org
Sun Apr 2 10:52:40 BST 2017


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, so you should be able to cast between them. You probably need to use 
QSharedPointer casts though because of the ::Ptr.

> Is there any solution, or are we doomed to load the calendar twice?
> 
> (or did I completely misunderstand what's going on?)


-- 
Daniel Vrátil
www.dvratil.cz | dvratil at kde.org
IRC: dvratil on Freenode (#kde, #kontact, #akonadi, #fedora-kde)

GPG Key: 0x4D69557AECB13683
Fingerprint: 0ABD FA55 A4E6 BEA9 9A83 EA97 4D69 557A ECB1 3683
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20170402/4166de67/attachment.sig>


More information about the kde-pim mailing list