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

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 "maillistwidget.h"
0011 #include "mailwidgetlister.h"
0012 #include <KContacts/Addressee>
0013 #include <KLocalizedString>
0014 #include <QLabel>
0015 #include <QVBoxLayout>
0016 using namespace Akonadi;
0017 
0018 MailListWidget::MailListWidget(QWidget *parent)
0019     : QWidget(parent)
0020     , mMailWidgetLister(new Akonadi::MailWidgetLister(this))
0021 {
0022     auto topLayout = new QVBoxLayout(this);
0023     topLayout->setContentsMargins({});
0024     topLayout->setSpacing(0);
0025 
0026     auto label = new QLabel(i18n("Email"), this);
0027     label->setObjectName(QLatin1StringView("emaillistlabel"));
0028     topLayout->addWidget(label);
0029 
0030     mMailWidgetLister->setObjectName(QLatin1StringView("emailwidgetlister"));
0031     topLayout->addWidget(mMailWidgetLister);
0032 }
0033 
0034 MailListWidget::~MailListWidget() = default;
0035 
0036 void MailListWidget::loadContact(const KContacts::Addressee &contact)
0037 {
0038     mMailWidgetLister->loadContact(contact);
0039 }
0040 
0041 void MailListWidget::storeContact(KContacts::Addressee &contact) const
0042 {
0043     mMailWidgetLister->storeContact(contact);
0044 }
0045 
0046 void MailListWidget::setReadOnly(bool readOnly)
0047 {
0048     mMailWidgetLister->setReadOnly(readOnly);
0049 }
0050 
0051 #include "moc_maillistwidget.cpp"