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