Messagelib

filternamedialog.cpp
1 /*
2  SPDX-FileCopyrightText: 2021 Laurent Montel <[email protected]>
3 
4  SPDX-License-Identifier: GPL-2.0-or-later
5 */
6 
7 #include "filternamedialog.h"
8 #include "filternamewidget.h"
9 #include <KLocalizedString>
10 #include <QDialogButtonBox>
11 #include <QPushButton>
12 #include <QVBoxLayout>
13 
14 using namespace MessageList::Core;
15 FilterNameDialog::FilterNameDialog(QWidget *parent)
16  : QDialog(parent)
17  , mFilterNameWidget(new FilterNameWidget(this))
18 {
19  setWindowTitle(i18nc("@title:window", "Edit Filter"));
20  auto mainLayout = new QVBoxLayout(this);
21  mainLayout->setObjectName(QStringLiteral("mainLayout"));
22 
23  mFilterNameWidget->setObjectName(QStringLiteral("mFilterNameWidget"));
24  mainLayout->addWidget(mFilterNameWidget);
25 
27  mainLayout->addWidget(button);
28  connect(button, &QDialogButtonBox::accepted, this, &FilterNameDialog::accept);
29  connect(button, &QDialogButtonBox::rejected, this, &FilterNameDialog::reject);
30  auto okButton = button->button(QDialogButtonBox::Ok);
31  okButton->setEnabled(false);
32  connect(mFilterNameWidget, &FilterNameWidget::updateOkButton, okButton, &QPushButton::setEnabled);
33 }
34 
35 FilterNameDialog::~FilterNameDialog() = default;
36 
37 void FilterNameDialog::setFilterName(const QString &str)
38 {
39  mFilterNameWidget->setFilterName(str);
40 }
41 
42 QString FilterNameDialog::filterName() const
43 {
44  return mFilterNameWidget->filterName();
45 }
46 
47 QString FilterNameDialog::iconName() const
48 {
49  return mFilterNameWidget->iconName();
50 }
51 
52 void FilterNameDialog::setExistingFilterNames(const QStringList &lst)
53 {
54  mFilterNameWidget->setExistingFilterNames(lst);
55 }
56 
57 void FilterNameDialog::setIconName(const QString &icon)
58 {
59  mFilterNameWidget->setIconName(icon);
60 }
The implementation independent part of the MessageList library.
Definition: aggregation.h:21
void setEnabled(bool)
QString i18nc(const char *context, const char *text, const TYPE &arg...)
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 Tue Nov 30 2021 23:05:46 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.