Messagelib

templateparseremailaddressrequesterinterfacewidget.cpp
1 /*
2  SPDX-FileCopyrightText: 2017-2021 Laurent Montel <[email protected]>
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 
13 using namespace TemplateParser;
14 
15 TemplateParserEmailAddressRequesterInterfaceWidget::TemplateParserEmailAddressRequesterInterfaceWidget(QWidget *parent)
16  : QWidget(parent)
17 {
18  auto mainLayout = new QHBoxLayout(this);
19  mainLayout->setObjectName(QStringLiteral("mainlayout"));
20  mainLayout->setContentsMargins({});
21  initializeEmailWidget();
22  mainLayout->addWidget(mTemplateParserEmailBase);
23 }
24 
25 void TemplateParserEmailAddressRequesterInterfaceWidget::initializeEmailWidget()
26 {
27  const KPluginMetaData editWidgetPlugin(QStringLiteral("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(QStringLiteral("templateparseremailbase"));
36  connect(mTemplateParserEmailBase,
37  &TemplateParserEmailAddressRequesterBase::textChanged,
38  this,
39  &TemplateParserEmailAddressRequesterInterfaceWidget::textChanged);
40 }
41 
42 QString TemplateParserEmailAddressRequesterInterfaceWidget::text() const
43 {
44  return mTemplateParserEmailBase->text();
45 }
46 
47 void TemplateParserEmailAddressRequesterInterfaceWidget::setText(const QString &str)
48 {
49  mTemplateParserEmailBase->setText(str);
50 }
51 
52 void TemplateParserEmailAddressRequesterInterfaceWidget::clear()
53 {
54  mTemplateParserEmailBase->clear();
55 }
void clear()
QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Thu Dec 2 2021 23:06:09 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.