Messagelib

searchmessagebybuttons.h
1/*
2 SPDX-FileCopyrightText: 2024 Laurent Montel <montel@kde.org>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#pragma once
8#include "messagelist_export.h"
9#include <Akonadi/MessageStatus>
10#include <QWidget>
11class QHBoxLayout;
12class QButtonGroup;
13class QToolButton;
14namespace MessageList
15{
16namespace Core
17{
18class MESSAGELIST_EXPORT SearchMessageByButtons : public QWidget
19{
20 Q_OBJECT
21public:
22 enum SearchOption : uint8_t {
23 SearchEveryWhere = 1,
24 SearchAgainstBody = 2,
25 SearchAgainstSubject = 4,
26 SearchAgainstFrom = 8,
27 SearchAgainstBcc = 16,
28 SearchAgainstTo = 32,
29 SearchAgainstCc = 64,
30 };
31 Q_ENUM(SearchOption)
32 Q_DECLARE_FLAGS(SearchOptions, SearchOption)
33 explicit SearchMessageByButtons(QWidget *parent = nullptr);
34 ~SearchMessageByButtons() override;
35
36 void changeSearchAgainstFromOrToText();
37
38 void setContainsOutboundMessages(bool containsOutboundMessages);
39 [[nodiscard]] bool containsOutboundMessages() const;
40
41 [[nodiscard]] SearchMessageByButtons::SearchOptions searchOptions() const;
42 void setSearchOptions(SearchMessageByButtons::SearchOptions opts);
43
44 void clearFilter();
45Q_SIGNALS:
46 void searchOptionChanged();
47
48private:
49 MESSAGELIST_NO_EXPORT QToolButton *createFilterButton(const QString &text, SearchOption option);
50 MESSAGELIST_NO_EXPORT void createButtons();
51 QHBoxLayout *const mMainLayout;
52 QButtonGroup *const mButtonGroup;
53 QToolButton *mSearchAgainstFromOrToButton = nullptr;
54 bool mContainsOutboundMessages = false;
55};
56}
57}
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 16:59:12 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.