KAlarmCal

akonadi.cpp
1 /*
2  * akonadi.cpp - Akonadi object functions
3  * This file is part of kalarmcal library, which provides access to KAlarm
4  * calendar data.
5  * SPDX-FileCopyrightText: 2011, 2019 David Jarvie <[email protected]>
6  *
7  * SPDX-License-Identifier: LGPL-2.0-or-later
8  */
9 
10 #include "akonadi.h"
11 #include "kaevent.h"
12 
13 #include <Akonadi/Item>
14 
15 namespace KAlarmCal
16 {
17 
18 /******************************************************************************
19 * Initialise an Item with the event.
20 * Note that the event is not updated with the Item ID.
21 * Reply = true if successful,
22 * false if event's category does not match collection's mime types.
23 */
24 bool setItemPayload(Akonadi::Item &item, const KAEvent &event, const QStringList &collectionMimeTypes)
25 {
27  switch (event.category()) {
28  case CalEvent::ACTIVE: mimetype = MIME_ACTIVE; break;
29  case CalEvent::ARCHIVED: mimetype = MIME_ARCHIVED; break;
30  case CalEvent::TEMPLATE: mimetype = MIME_TEMPLATE; break;
31  default: Q_ASSERT(0); return false;
32  }
33  if (!collectionMimeTypes.contains(mimetype)) {
34  return false;
35  }
36  item.setMimeType(mimetype);
37  item.setPayload<KAEvent>(event);
38  return true;
39 }
40 
41 }
the event is an alarm template
Definition: kacalendar.h:116
bool contains(const QString &str, Qt::CaseSensitivity cs) const const
void setPayload(const T &p)
void setMimeType(const QString &mimeType)
the event is currently active
Definition: kacalendar.h:114
KIOCORE_EXPORT MimetypeJob * mimetype(const QUrl &url, JobFlags flags=DefaultFlags)
the event is archived
Definition: kacalendar.h:115
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Mon Jan 24 2022 23:02:53 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.