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 <AkonadiCore/Item>
14 
15 
16 namespace KAlarmCal
17 {
18 
19 /******************************************************************************
20 * Initialise an Item with the event.
21 * Note that the event is not updated with the Item ID.
22 * Reply = true if successful,
23 * false if event's category does not match collection's mime types.
24 */
25 bool setItemPayload(Akonadi::Item &item, const KAEvent &event, const QStringList &collectionMimeTypes)
26 {
28  switch (event.category()) {
29  case CalEvent::ACTIVE: mimetype = MIME_ACTIVE; break;
30  case CalEvent::ARCHIVED: mimetype = MIME_ARCHIVED; break;
31  case CalEvent::TEMPLATE: mimetype = MIME_TEMPLATE; break;
32  default: Q_ASSERT(0); return false;
33  }
34  if (!collectionMimeTypes.contains(mimetype)) {
35  return false;
36  }
37  item.setMimeType(mimetype);
38  item.setPayload<KAEvent>(event);
39  return true;
40 }
41 
42 }
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-2021 The KDE developers.
Generated on Thu Jul 29 2021 23:11:14 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.