Akonadi Contacts

contactmetadataakonadi.cpp
1/*
2 This file is part of Akonadi Contact.
3
4 SPDX-FileCopyrightText: 2009 Tobias Koenig <tokoe@kde.org>
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 <Akonadi/Item>
14
15using namespace Akonadi;
16
17ContactMetaDataAkonadi::ContactMetaDataAkonadi() = default;
18
19ContactMetaDataAkonadi::~ContactMetaDataAkonadi() = default;
20
21void ContactMetaDataAkonadi::load(const Akonadi::Item &contact)
22{
23 if (!contact.hasAttribute("contactmetadata")) {
24 return;
25 }
26 const auto attribute = contact.attribute<Akonadi::ContactMetaDataAttribute>();
27 const QVariantMap metaData = attribute->metaData();
28 loadMetaData(metaData);
29}
30
31void ContactMetaDataAkonadi::store(Akonadi::Item &contact)
32{
33 auto attribute = contact.attribute<Akonadi::ContactMetaDataAttribute>(Akonadi::Item::AddIfMissing);
34
35 attribute->setMetaData(storeMetaData());
36}
bool hasAttribute() const
const T * attribute() const
A widget for editing the display name of a contact.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:36:45 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.