Commit 5d5b8e10 authored by David Jarvie's avatar David Jarvie
Browse files

Allow collection ID to be set without copying shared data

parent e4f748a4
......@@ -306,7 +306,7 @@ class KAEvent::Private : public QSharedData
#ifndef KALARMCAL_USE_KRESOURCES
QMap<QByteArray, QString> mCustomProperties; // KCal::Event's non-KAlarm custom properties
Akonadi::Item::Id mItemId; // Akonadi::Item ID for this event
Akonadi::Collection::Id mCollectionId; // ID of collection containing the event, or for a displaying event,
mutable Akonadi::Collection::Id mCollectionId; // ID of collection containing the event, or for a displaying event,
// saved collection ID (not the collection the event is in)
#else
QString mOriginalResourceId;// saved resource ID (not the resource the event is in)
......@@ -1888,6 +1888,11 @@ void KAEvent::setCollectionId(Akonadi::Collection::Id id)
d->mCollectionId = id;
}
void KAEvent::setCollectionId_const(Akonadi::Collection::Id id) const
{
d->mCollectionId = id;
}
Akonadi::Collection::Id KAEvent::collectionId() const
{
// A displaying alarm contains the event's original collection ID
......
......@@ -472,6 +472,14 @@ class KALARMCAL_EXPORT KAEvent
#ifndef KALARMCAL_USE_KRESOURCES
/** Set the ID of the Akonadi Collection which contains the event. */
void setCollectionId(Akonadi::Collection::Id id);
/** Set the ID of the Akonadi Collection which contains the event.
* \warning This is a const method, which means that any other instance
* which references the same shared data will also be
* updated. It is designed to be used when a KAEvent is
* being created from an Akonadi Item, to avoid unnecessary
* copying. Use with caution!
*/
void setCollectionId_const(Akonadi::Collection::Id id) const;
/** Return the ID of the Akonadi Collection which contains the event. */
Akonadi::Collection::Id collectionId() const;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment