Akonadi Contacts

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