Akonadi Contacts

customfieldswidget.cpp
1 /*
2  This file is part of Contact Editor.
3 
4  SPDX-FileCopyrightText: 2016 eyeOS S.L.U., a Telefonica company, [email protected]
5  SPDX-FileCopyrightText: 2016-2020 Laurent Montel <montel.org>
6 
7  SPDX-License-Identifier: LGPL-2.0-or-later
8 */
9 
10 #include "customfieldswidget.h"
11 #include "customfieldeditorwidget.h"
12 #include "customfieldslistwidget.h"
13 
14 #include <QVBoxLayout>
15 
16 using namespace ContactEditor;
17 
18 CustomFieldsWidget::CustomFieldsWidget(QWidget *parent)
19  : QWidget(parent)
20 {
21  auto topLayout = new QVBoxLayout(this);
22  topLayout->setContentsMargins(0, 0, 0, 0);
23  mCustomFieldEditorWidget = new ContactEditor::CustomFieldEditorWidget(this);
24  mCustomFieldEditorWidget->setObjectName(QStringLiteral("customfieldeditorwidget"));
25  topLayout->addWidget(mCustomFieldEditorWidget);
26 
27  mCustomFieldsListWidget = new ContactEditor::CustomFieldsListWidget(this);
28  mCustomFieldsListWidget->setObjectName(QStringLiteral("customfieldslistwidget"));
29  topLayout->addWidget(mCustomFieldsListWidget);
30 
31  connect(mCustomFieldEditorWidget, &CustomFieldEditorWidget::addNewField, mCustomFieldsListWidget, &CustomFieldsListWidget::slotAddNewField);
32 }
33 
34 CustomFieldsWidget::~CustomFieldsWidget()
35 {
36 }
37 
38 void CustomFieldsWidget::loadContact(const KContacts::Addressee &contact)
39 {
40  mCustomFieldsListWidget->loadContact(contact);
41 }
42 
43 void CustomFieldsWidget::storeContact(KContacts::Addressee &contact) const
44 {
45  mCustomFieldsListWidget->storeContact(contact);
46 }
47 
48 void CustomFieldsWidget::setReadOnly(bool readOnly)
49 {
50  mCustomFieldEditorWidget->setReadOnly(readOnly);
51  mCustomFieldsListWidget->setReadOnly(readOnly);
52 }
53 
54 void CustomFieldsWidget::setLocalCustomFieldDescriptions(const QVariantList &descriptions)
55 {
56  mCustomFieldsListWidget->setLocalCustomFieldDescriptions(descriptions);
57 }
58 
59 QVariantList CustomFieldsWidget::localCustomFieldDescriptions() const
60 {
61  return mCustomFieldsListWidget->localCustomFieldDescriptions();
62 }
Akonadi::Item contact() const
Returns the contact that is currently displayed.
QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Fri Jun 18 2021 23:08:56 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.