File indexing completed on 2024-11-10 04:50:05

0001 /*
0002  * SPDX-FileCopyrightText: 1996-1998 Stefan Taferner <taferner@kde.org>
0003  *
0004  * SPDX-License-Identifier: GPL-2.0-or-later
0005  *
0006  */
0007 
0008 #include "filteractionwithaddress.h"
0009 
0010 #include <Akonadi/EmailAddressRequester>
0011 
0012 using namespace MailCommon;
0013 
0014 FilterActionWithAddress::FilterActionWithAddress(const QString &name, const QString &label, QObject *parent)
0015     : FilterActionWithString(name, label, parent)
0016 {
0017 }
0018 
0019 QWidget *FilterActionWithAddress::createParamWidget(QWidget *parent) const
0020 {
0021     auto requester = new Akonadi::EmailAddressRequester(parent);
0022     requester->setText(mParameter);
0023     requester->setObjectName(QLatin1StringView("emailaddressrequester"));
0024     requester->setText(mParameter);
0025 
0026     connect(requester, &Akonadi::EmailAddressRequester::textChanged, this, &FilterActionWithAddress::filterActionModified);
0027 
0028     return requester;
0029 }
0030 
0031 void FilterActionWithAddress::applyParamWidgetValue(QWidget *paramWidget)
0032 {
0033     mParameter = qobject_cast<Akonadi::EmailAddressRequester *>(paramWidget)->text();
0034 }
0035 
0036 void FilterActionWithAddress::setParamWidgetValue(QWidget *paramWidget) const
0037 {
0038     qobject_cast<Akonadi::EmailAddressRequester *>(paramWidget)->setText(mParameter);
0039 }
0040 
0041 void FilterActionWithAddress::clearParamWidget(QWidget *paramWidget) const
0042 {
0043     qobject_cast<Akonadi::EmailAddressRequester *>(paramWidget)->clear();
0044 }
0045 
0046 #include "moc_filteractionwithaddress.cpp"