Commit d8d28306 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Fix save filter

parent 5aff922e
......@@ -9,6 +9,7 @@
#include "core/widgetbase.h"
#include "core/aggregation.h"
#include "core/filter.h"
#include "core/filtersavedmanager.h"
#include "core/manager.h"
#include "core/messageitem.h"
#include "core/model.h"
......@@ -121,6 +122,7 @@ Widget::Widget(QWidget *pParent)
connect(d->quickSearchLine, &QuickSearchLine::searchOptionChanged, this, &Widget::searchEditTextEdited);
connect(d->quickSearchLine, &QuickSearchLine::statusButtonsClicked, this, &Widget::slotStatusButtonsClicked);
connect(d->quickSearchLine, &QuickSearchLine::forceLostFocus, this, &Widget::forceLostFocus);
connect(d->quickSearchLine, &QuickSearchLine::saveFilter, this, &Widget::slotSaveFilter);
g->addWidget(d->quickSearchLine, 0);
d->quickSearchWarning = new QuickSearchWarning(this);
g->addWidget(d->quickSearchWarning, 0);
......@@ -160,6 +162,13 @@ Widget::~Widget()
delete d;
}
void Widget::slotSaveFilter(const QString &filterName)
{
if (d->mFilter) {
FilterSavedManager::self()->saveFilter(d->mFilter, filterName);
}
}
void Widget::changeQuicksearchVisibility(bool show)
{
QLineEdit *const lineEdit = d->quickSearchLine->searchEdit();
......
......@@ -251,6 +251,7 @@ protected Q_SLOTS:
*/
void slotViewHeaderSectionClicked(int logicalIndex);
void slotStatusButtonsClicked();
void slotSaveFilter(const QString &filterName);
private:
class Private;
......
......@@ -31,8 +31,8 @@ void FilterSavedMenu::slotShowMenu()
FilterSavedManager::self()->loadMenu(this);
if (isEmpty()) {
addSeparator();
addAction(mSaveAction);
addSeparator();
addAction(mConfigureAction);
}
addAction(mSaveAction);
addSeparator();
addAction(mConfigureAction);
}
......@@ -42,6 +42,7 @@ QuickSearchLine::QuickSearchLine(QWidget *parent)
connect(mSearchEdit, &QLineEdit::textChanged, this, &QuickSearchLine::slotSearchEditTextEdited);
connect(mSearchEdit, &SearchLineStatus::clearButtonClicked, this, &QuickSearchLine::slotClearButtonClicked);
connect(mSearchEdit, &SearchLineStatus::saveFilter, this, &QuickSearchLine::saveFilter);
hbox->addWidget(mSearchEdit);
......
......@@ -64,6 +64,7 @@ Q_SIGNALS:
void searchOptionChanged();
void statusButtonsClicked();
void forceLostFocus();
void saveFilter(const QString &filterName);
protected:
bool eventFilter(QObject *object, QEvent *e) override;
......
......@@ -136,6 +136,7 @@ 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);
// TODO FilterSavedManager::self()->saveFilter(,str);
// TODO
}
......
......@@ -39,6 +39,7 @@ Q_SIGNALS:
void searchOptionChanged();
void clearButtonClicked();
void forceLostFocus();
void saveFilter(const QString &filterName);
protected:
void contextMenuEvent(QContextMenuEvent *e) override;
......
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