filtersavedmenu.cpp 988 Bytes
Newer Older
1
2
3
4
5
6
7
/*
  SPDX-FileCopyrightText: 2021 Laurent Montel <montel@kde.org>

  SPDX-License-Identifier: GPL-2.0-or-later
*/

#include "filtersavedmenu.h"
Laurent Montel's avatar
Laurent Montel committed
8
9
#include <KLocalizedString>
#include <QAction>
10
11
12
13
using namespace MessageList::Core;

FilterSavedMenu::FilterSavedMenu(QWidget *parent)
    : QMenu(parent)
Laurent Montel's avatar
Laurent Montel committed
14
15
    , mSaveAction(new QAction(i18n("Save Filter..."), this))
    , mConfigureAction(new QAction(i18n("Configure..."), this))
16
17
{
    connect(this, &FilterSavedMenu::aboutToShow, this, &FilterSavedMenu::slotShowMenu);
Laurent Montel's avatar
Laurent Montel committed
18
    connect(mSaveAction, &QAction::triggered, this, &FilterSavedMenu::saveFilter);
Laurent Montel's avatar
Laurent Montel committed
19
    connect(mConfigureAction, &QAction::triggered, this, &FilterSavedMenu::configureFilters);
20
21
22
23
24
25
26
27
}

FilterSavedMenu::~FilterSavedMenu()
{
}

void FilterSavedMenu::slotShowMenu()
{
Laurent Montel's avatar
Laurent Montel committed
28
    // TODO load current Filter saved action
Laurent Montel's avatar
Laurent Montel committed
29
    mListAction.clear();
Laurent Montel's avatar
Laurent Montel committed
30
31
32
33
34
35
    if (isEmpty()) {
        addSeparator();
        addAction(mSaveAction);
        addSeparator();
        addAction(mConfigureAction);
    }
36
}