Commit 7b9536e4 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Add menu

parent d263db74
......@@ -17,6 +17,7 @@ FilterSavedMenu::FilterSavedMenu(QWidget *parent)
connect(this, &FilterSavedMenu::aboutToShow, this, &FilterSavedMenu::slotShowMenu);
connect(mSaveAction, &QAction::triggered, this, &FilterSavedMenu::saveFilter);
connect(mConfigureAction, &QAction::triggered, this, &FilterSavedMenu::configureFilters);
slotShowMenu();
}
FilterSavedMenu::~FilterSavedMenu()
......@@ -25,7 +26,7 @@ FilterSavedMenu::~FilterSavedMenu()
void FilterSavedMenu::slotShowMenu()
{
// TODO
// TODO load current Filter saved action
mListAction.clear();
if (isEmpty()) {
addSeparator();
......
......@@ -5,6 +5,7 @@
*/
#include "searchlinestatus.h"
#include "filtersavedmenu.h"
#include "messagelist_debug.h"
#include <KColorScheme>
......@@ -106,8 +107,13 @@ void SearchLineStatus::initializeActions()
mWithoutFilter = QIcon::fromTheme(QStringLiteral("view-filter"));
mFiltersAction = addAction(mWithoutFilter, QLineEdit::LeadingPosition);
mFiltersAction->setToolTip(i18n("Filter Mails by Status"));
connect(mFiltersAction, &QAction::triggered, this, &SearchLineStatus::showMenu);
mSaveFilterAction = addAction(QIcon::fromTheme(QStringLiteral("edit-find")), QLineEdit::LeadingPosition);
mSaveFilterAction->setToolTip(i18n("Saved Filter"));
mFilterSavedMenu = new FilterSavedMenu(this);
mSaveFilterAction->setMenu(mFilterSavedMenu);
connect(mSaveFilterAction, &QAction::triggered, this, &SearchLineStatus::showSavedFiltersMenu);
}
void SearchLineStatus::slotToggledLockAction()
......@@ -132,6 +138,13 @@ void SearchLineStatus::updateFilters()
updateFilterActionIcon();
}
void SearchLineStatus::showSavedFiltersMenu()
{
if (mFilterSavedMenu->exec(mapToGlobal(QPoint(0, height())))) {
// TODO
}
}
void SearchLineStatus::showMenu()
{
if (mFilterMenu->exec(mapToGlobal(QPoint(0, height())))) {
......
......@@ -17,6 +17,7 @@ namespace MessageList
{
namespace Core
{
class FilterSavedMenu;
class MESSAGELIST_TESTS_EXPORT SearchLineStatus : public QLineEdit
{
Q_OBJECT
......@@ -60,6 +61,7 @@ private:
void clearFilterByAction();
void changeSearchAgainstFromOrToText();
void slotClear();
void showSavedFiltersMenu();
bool mLocked = false;
bool mHasFilter = false;
......@@ -67,6 +69,7 @@ private:
QIcon mWithFilter;
QAction *mLockAction = nullptr;
QAction *mFiltersAction = nullptr;
QAction *mSaveFilterAction = nullptr;
QMenu *mFilterMenu = nullptr;
QCompleter *mCompleter = nullptr;
QList<QAction *> mFilterListActions;
......@@ -76,6 +79,7 @@ private:
QAction *mSearchAgainstFromOrToAction = nullptr;
QAction *mSearchAgainstBccAction = nullptr;
QStringListModel *mCompleterListModel = nullptr;
FilterSavedMenu *mFilterSavedMenu = nullptr;
QStringList mListCompetion;
QString mColorName;
bool mContainsOutboundMessages = false;
......
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