Akonadi Contacts

contactmetadatabase.cpp
1/*
2 This file is part of Contact Editor.
3
4 SPDX-FileCopyrightText: 2017-2024 Laurent Montel <montel@kde.org>
5
6 SPDX-License-Identifier: LGPL-2.0-or-later
7*/
8
9#include "contactmetadatabase_p.h"
10
11using namespace Akonadi;
12
13class Akonadi::ContactMetaDataBasePrivate
14{
15public:
16 int mDisplayNameMode = -1;
17 QVariantList mCustomFieldDescriptions;
18};
19
20ContactMetaDataBase::ContactMetaDataBase()
21 : d(new ContactMetaDataBasePrivate)
22{
23}
24
25ContactMetaDataBase::~ContactMetaDataBase() = default;
26
27void ContactMetaDataBase::loadMetaData(const QVariantMap &metaData)
28{
29 d->mDisplayNameMode = metaData.value(QStringLiteral("DisplayNameMode"), -1).toInt();
30
31 d->mCustomFieldDescriptions = metaData.value(QStringLiteral("CustomFieldDescriptions")).toList();
32}
33
34QVariantMap ContactMetaDataBase::storeMetaData() const
35{
36 QVariantMap metaData;
37 if (d->mDisplayNameMode != -1) {
38 metaData.insert(QStringLiteral("DisplayNameMode"), QVariant(d->mDisplayNameMode));
39 }
40
41 if (!d->mCustomFieldDescriptions.isEmpty()) {
42 metaData.insert(QStringLiteral("CustomFieldDescriptions"), d->mCustomFieldDescriptions);
43 }
44 return metaData;
45}
46
47void ContactMetaDataBase::setDisplayNameMode(int mode)
48{
49 d->mDisplayNameMode = mode;
50}
51
52int ContactMetaDataBase::displayNameMode() const
53{
54 return d->mDisplayNameMode;
55}
56
57void ContactMetaDataBase::setCustomFieldDescriptions(const QVariantList &descriptions)
58{
59 d->mCustomFieldDescriptions = descriptions;
60}
61
62QVariantList ContactMetaDataBase::customFieldDescriptions() const
63{
64 return d->mCustomFieldDescriptions;
65}
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 Sun Feb 25 2024 18:38:21 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.