Messagelib

filternamedialog.cpp
1/*
2 SPDX-FileCopyrightText: 2021-2024 Laurent Montel <montel@kde.org>
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
14using namespace MessageList::Core;
15FilterNameDialog::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(QLatin1StringView("mainLayout"));
22
23 mFilterNameWidget->setObjectName(QLatin1StringView("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
35FilterNameDialog::~FilterNameDialog() = default;
36
37void FilterNameDialog::setFilterName(const QString &str)
38{
39 mFilterNameWidget->setFilterName(str);
40}
41
42QString FilterNameDialog::filterName() const
43{
44 return mFilterNameWidget->filterName();
45}
46
47QString FilterNameDialog::iconName() const
48{
49 return mFilterNameWidget->iconName();
50}
51
52void FilterNameDialog::setExistingFilterNames(const QStringList &lst)
53{
54 mFilterNameWidget->setExistingFilterNames(lst);
55}
56
57void FilterNameDialog::setIconName(const QString &icon)
58{
59 mFilterNameWidget->setIconName(icon);
60}
61
62#include "moc_filternamedialog.cpp"
QString i18nc(const char *context, const char *text, const TYPE &arg...)
The implementation independent part of the MessageList library.
Definition aggregation.h:22
QFuture< ArgsType< Signal > > connect(Sender *sender, Signal signal)
void setEnabled(bool)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 16:59:12 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.