Messagelib

templateparseremailaddressrequesterinterfacewidget.cpp
1/*
2 SPDX-FileCopyrightText: 2017-2024 Laurent Montel <montel@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#include "templateparseremailaddressrequesterinterfacewidget.h"
8#include "templateparseremailaddressrequesterlineedit.h"
9#include <KPluginFactory>
10#include <QHBoxLayout>
11#include <TemplateParser/TemplateParserEmailAddressRequesterBase>
12
13using namespace TemplateParser;
14
15TemplateParserEmailAddressRequesterInterfaceWidget::TemplateParserEmailAddressRequesterInterfaceWidget(QWidget *parent)
16 : QWidget(parent)
17{
18 auto mainLayout = new QHBoxLayout(this);
19 mainLayout->setObjectName(QLatin1StringView("mainlayout"));
20 mainLayout->setContentsMargins({});
21 initializeEmailWidget();
22 mainLayout->addWidget(mTemplateParserEmailBase);
23}
24
25void TemplateParserEmailAddressRequesterInterfaceWidget::initializeEmailWidget()
26{
27 const KPluginMetaData editWidgetPlugin(QStringLiteral("pim6/templateparser/templateparseraddressrequesterplugin"));
28
29 const auto result = KPluginFactory::instantiatePlugin<TemplateParser::TemplateParserEmailAddressRequesterBase>(editWidgetPlugin, this);
30 if (result) {
31 mTemplateParserEmailBase = result.plugin;
32 } else {
33 mTemplateParserEmailBase = new TemplateParser::TemplateParserEmailAddressRequesterLineEdit(this);
34 }
35 mTemplateParserEmailBase->setObjectName(QLatin1StringView("templateparseremailbase"));
36 connect(mTemplateParserEmailBase,
37 &TemplateParserEmailAddressRequesterBase::textChanged,
38 this,
39 &TemplateParserEmailAddressRequesterInterfaceWidget::textChanged);
40}
41
42QString TemplateParserEmailAddressRequesterInterfaceWidget::text() const
43{
44 return mTemplateParserEmailBase->text();
45}
46
47void TemplateParserEmailAddressRequesterInterfaceWidget::setText(const QString &str)
48{
49 mTemplateParserEmailBase->setText(str);
50}
51
52void TemplateParserEmailAddressRequesterInterfaceWidget::clear()
53{
54 mTemplateParserEmailBase->clear();
55}
56
57#include "moc_templateparseremailaddressrequesterinterfacewidget.cpp"
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
void setObjectName(QAnyStringView name)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:33:26 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.