Commit 3ba1f109 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Enabled/disabled ok button

parent c0a49cab
......@@ -8,6 +8,7 @@
#include "filternamewidget.h"
#include <KLocalizedString>
#include <QDialogButtonBox>
#include <QPushButton>
#include <QVBoxLayout>
using namespace MessageList::Core;
......@@ -25,6 +26,9 @@ FilterNameDialog::FilterNameDialog(QWidget *parent)
mainLayout->addWidget(button);
connect(button, &QDialogButtonBox::accepted, this, &FilterNameDialog::accept);
connect(button, &QDialogButtonBox::rejected, this, &FilterNameDialog::reject);
auto okButton = button->button(QDialogButtonBox::Ok);
okButton->setEnabled(false);
connect(mFilterNameWidget, &FilterNameWidget::updateOkButton, okButton, &QPushButton::setEnabled);
}
FilterNameDialog::~FilterNameDialog()
......
......@@ -6,17 +6,26 @@
#include "filternamewidget.h"
#include <KLocalizedString>
#include <QHBoxLayout>
#include <QLabel>
#include <QLineEdit>
#include <QVBoxLayout>
using namespace MessageList::Core;
FilterNameWidget::FilterNameWidget(QWidget *parent)
: QWidget(parent)
, mName(new QLineEdit(this))
{
auto mainLayout = new QVBoxLayout(this);
auto mainLayout = new QHBoxLayout(this);
mainLayout->setObjectName(QStringLiteral("mainLayout"));
mainLayout->setContentsMargins({});
mName->setObjectName(QStringLiteral("mName"));
auto label = new QLabel(i18n("Name:"), this);
label->setObjectName(QStringLiteral("label"));
mainLayout->addWidget(label);
mainLayout->addWidget(mName);
}
FilterNameWidget::~FilterNameWidget()
......
......@@ -8,6 +8,7 @@
#include "messagelist_private_export.h"
#include <QWidget>
class QLineEdit;
namespace MessageList
{
namespace Core
......@@ -20,6 +21,9 @@ public:
~FilterNameWidget() override;
Q_SIGNALS:
void updateOkButton(bool enabled);
private:
QLineEdit *const mName;
};
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment