File indexing completed on 2024-11-24 04:39:31

0001 /*
0002     This file is part of Contact Editor.
0003 
0004     SPDX-FileCopyrightText: 2016 eyeOS S.L.U., a Telefonica company, sales@eyeos.com
0005     SPDX-FileCopyrightText: 2016-2020 Laurent Montel <montel.org>
0006 
0007     SPDX-License-Identifier: LGPL-2.0-or-later
0008 */
0009 
0010 #include "phonelistwidget.h"
0011 #include "phonewidgetlister.h"
0012 #include <KContacts/Addressee>
0013 #include <KLocalizedString>
0014 #include <QLabel>
0015 #include <QVBoxLayout>
0016 using namespace Akonadi;
0017 
0018 PhoneListWidget::PhoneListWidget(QWidget *parent)
0019     : QWidget(parent)
0020     , mPhoneWidgetLister(new Akonadi::PhoneWidgetLister(this))
0021 {
0022     auto topLayout = new QVBoxLayout(this);
0023     topLayout->setContentsMargins({});
0024     topLayout->setSpacing(0);
0025 
0026     auto label = new QLabel(i18n("Phone"), this);
0027     label->setObjectName(QLatin1StringView("phonelistlabel"));
0028     topLayout->addWidget(label);
0029 
0030     mPhoneWidgetLister->setObjectName(QLatin1StringView("phonewidgetlister"));
0031     topLayout->addWidget(mPhoneWidgetLister);
0032 }
0033 
0034 PhoneListWidget::~PhoneListWidget() = default;
0035 
0036 void PhoneListWidget::loadContact(const KContacts::Addressee &contact)
0037 {
0038     mPhoneWidgetLister->loadContact(contact);
0039 }
0040 
0041 void PhoneListWidget::storeContact(KContacts::Addressee &contact) const
0042 {
0043     mPhoneWidgetLister->storeContact(contact);
0044 }
0045 
0046 void PhoneListWidget::setReadOnly(bool readOnly)
0047 {
0048     mPhoneWidgetLister->setReadOnly(readOnly);
0049 }
0050 
0051 #include "moc_phonelistwidget.cpp"