Akonadi Contacts

contactmetadataakonadi.cpp
1 /*
2  This file is part of Akonadi Contact.
3 
4  SPDX-FileCopyrightText: 2009 Tobias Koenig <[email protected]>
5 
6  SPDX-License-Identifier: LGPL-2.0-or-later
7 */
8 
9 #include "contactmetadataakonadi_p.h"
10 
11 #include "attributes/contactmetadataattribute_p.h"
12 
13 #include <item.h>
14 
15 using namespace Akonadi;
16 
17 ContactMetaDataAkonadi::ContactMetaDataAkonadi()
18 {
19 }
20 
21 ContactMetaDataAkonadi::~ContactMetaDataAkonadi()
22 {
23 }
24 
25 void ContactMetaDataAkonadi::load(const Akonadi::Item &contact)
26 {
27  if (!contact.hasAttribute("contactmetadata")) {
28  return;
29  }
30  const auto attribute = contact.attribute<ContactMetaDataAttribute>();
31  const QVariantMap metaData = attribute->metaData();
32  loadMetaData(metaData);
33 }
34 
35 void ContactMetaDataAkonadi::store(Akonadi::Item &contact)
36 {
37  auto attribute = contact.attribute<ContactMetaDataAttribute>(Item::AddIfMissing);
38 
39  attribute->setMetaData(storeMetaData());
40 }
Attribute * attribute(const QByteArray &name)
bool hasAttribute(const QByteArray &name) const
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Wed Jun 23 2021 23:09:24 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.