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, sales@eyeos.com
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
16using namespace Akonadi;
17
18CustomFieldsWidget::CustomFieldsWidget(QWidget *parent)
19 : QWidget(parent)
20 , mCustomFieldEditorWidget(new Akonadi::CustomFieldEditorWidget(this))
21 , mCustomFieldsListWidget(new Akonadi::CustomFieldsListWidget(this))
22{
23 auto topLayout = new QVBoxLayout(this);
24 topLayout->setContentsMargins({});
25 mCustomFieldEditorWidget->setObjectName(QLatin1StringView("customfieldeditorwidget"));
26 topLayout->addWidget(mCustomFieldEditorWidget);
27
28 mCustomFieldsListWidget->setObjectName(QLatin1StringView("customfieldslistwidget"));
29 topLayout->addWidget(mCustomFieldsListWidget);
30
31 connect(mCustomFieldEditorWidget, &CustomFieldEditorWidget::addNewField, mCustomFieldsListWidget, &CustomFieldsListWidget::slotAddNewField);
32}
33
34CustomFieldsWidget::~CustomFieldsWidget() = default;
35
36void CustomFieldsWidget::loadContact(const KContacts::Addressee &contact)
37{
38 mCustomFieldsListWidget->loadContact(contact);
39}
40
41void CustomFieldsWidget::storeContact(KContacts::Addressee &contact) const
42{
43 mCustomFieldsListWidget->storeContact(contact);
44}
45
46void CustomFieldsWidget::setReadOnly(bool readOnly)
47{
48 mCustomFieldEditorWidget->setReadOnly(readOnly);
49 mCustomFieldsListWidget->setReadOnly(readOnly);
50}
51
52void CustomFieldsWidget::setLocalCustomFieldDescriptions(const QVariantList &descriptions)
53{
54 mCustomFieldsListWidget->setLocalCustomFieldDescriptions(descriptions);
55}
56
57QVariantList CustomFieldsWidget::localCustomFieldDescriptions() const
58{
59 return mCustomFieldsListWidget->localCustomFieldDescriptions();
60}
61
62#include "moc_customfieldswidget.cpp"
A widget for editing the display name of a contact.
QFuture< ArgsType< Signal > > connect(Sender *sender, Signal signal)
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.