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 #include <QStringList>
16 
17 namespace KAlarmCal
18 {
19 
20 /******************************************************************************
21 * Initialise an Item with the event.
22 * Note that the event is not updated with the Item ID.
23 * Reply = true if successful,
24 * false if event's category does not match collection's mime types.
25 */
26 bool setItemPayload(Akonadi::Item &item, const KAEvent &event, const QStringList &collectionMimeTypes)
27 {
29  switch (event.category()) {
30  case CalEvent::ACTIVE: mimetype = MIME_ACTIVE; break;
31  case CalEvent::ARCHIVED: mimetype = MIME_ARCHIVED; break;
32  case CalEvent::TEMPLATE: mimetype = MIME_TEMPLATE; break;
33  default: Q_ASSERT(0); return false;
34  }
35  if (!collectionMimeTypes.contains(mimetype)) {
36  return false;
37  }
38  item.setMimeType(mimetype);
39  item.setPayload<KAEvent>(event);
40  return true;
41 }
42 
43 }
the event is an alarm template
Definition: kacalendar.h:117
bool contains(const QString &str, Qt::CaseSensitivity cs) const const
the event is currently active
Definition: kacalendar.h:115
KIOCORE_EXPORT MimetypeJob * mimetype(const QUrl &url, JobFlags flags=DefaultFlags)
the event is archived
Definition: kacalendar.h:116
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Wed Aug 12 2020 23:09:29 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.