Commit 51e60a33 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Use directly filternamedialog

parent 3ba1f109
Pipeline #65716 passed with stage
in 40 minutes and 8 seconds
......@@ -34,3 +34,8 @@ FilterNameDialog::FilterNameDialog(QWidget *parent)
FilterNameDialog::~FilterNameDialog()
{
}
QString FilterNameDialog::filterName() const
{
return mFilterNameWidget->filterName();
}
......@@ -21,6 +21,8 @@ public:
explicit FilterNameDialog(QWidget *parent = nullptr);
~FilterNameDialog() override;
Q_REQUIRED_RESULT QString filterName() const;
private:
FilterNameWidget *const mFilterNameWidget;
};
......
......@@ -26,8 +26,16 @@ FilterNameWidget::FilterNameWidget(QWidget *parent)
mainLayout->addWidget(label);
mainLayout->addWidget(mName);
connect(mName, &QLineEdit::textChanged, this, [this](const QString &str) {
Q_EMIT updateOkButton(!str.trimmed().isEmpty());
});
}
FilterNameWidget::~FilterNameWidget()
{
}
QString FilterNameWidget::filterName() const
{
return mName->text();
}
......@@ -19,6 +19,9 @@ class MESSAGELIST_TESTS_EXPORT FilterNameWidget : public QWidget
public:
explicit FilterNameWidget(QWidget *parent = nullptr);
~FilterNameWidget() override;
Q_REQUIRED_RESULT QString filterName() const;
Q_SIGNALS:
void updateOkButton(bool enabled);
......
......@@ -7,6 +7,7 @@
#include "searchlinestatus.h"
#include "configurefiltersdialog.h"
#include "core/filtersavedmanager.h"
#include "filternamedialog.h"
#include "filtersavedmenu.h"
#include "messagelist_debug.h"
......@@ -18,7 +19,6 @@
#include <QAction>
#include <QCompleter>
#include <QContextMenuEvent>
#include <QInputDialog>
#include <QMenu>
#include <QPointer>
#include <QPushButton>
......@@ -141,11 +141,11 @@ void SearchLineStatus::slotConfigureFilters()
void SearchLineStatus::slotSaveFilter()
{
bool ok = false;
const QString str = QInputDialog::getText(this, i18n("Filter Name"), i18n("Name:"), QLineEdit::Normal, {}, &ok);
if (ok && !str.trimmed().isEmpty()) {
Q_EMIT saveFilter(str);
QPointer<FilterNameDialog> dlg = new FilterNameDialog(this);
if (dlg->exec()) {
Q_EMIT saveFilter(dlg->filterName());
}
delete dlg;
}
void SearchLineStatus::slotToggledLockAction()
......
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