Messagelib

searchlinecommand.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_private_export.h"
9#include <QDebug>
10#include <QMap>
11#include <QObject>
12#include <QStringList>
13namespace MessageList
14{
15namespace Core
16{
17class MESSAGELIST_TESTS_EXPORT SearchLineCommand
18{
19 Q_GADGET
20public:
21 enum SearchLineType {
22 Unknown = 0,
23 HasStateOrAttachment,
24 Literal,
25 To,
26 Bcc,
27 Cc,
28 From,
29 Subject,
30 Body,
31 Date,
32 Size,
35 IsImportant,
36 IsRead,
37 IsUnRead,
38 IsIgnored,
39 IsHam,
40 IsSpam,
41 IsWatched,
42 IsReplied,
43 IsForwarded,
44 Larger,
45 Smaller,
46 OlderThan,
47 NewerThan,
49 };
50 Q_ENUM(SearchLineType)
51 struct MESSAGELIST_TESTS_EXPORT SearchLineInfo {
52 SearchLineType type = SearchLineType::Unknown;
53 QString argument;
54 void clear();
55 [[nodiscard]] bool isValid() const;
56 [[nodiscard]] bool operator==(const SearchLineInfo &other) const;
57 [[nodiscard]] bool isValidDate() const;
58 [[nodiscard]] bool mustBeUnique() const;
59 [[nodiscard]] qint64 convertArgumentAsSize() const;
60 };
61 SearchLineCommand();
62 ~SearchLineCommand();
63
64 void parseSearchLineCommand(const QString &str);
65
66 [[nodiscard]] QString generateCommadLineStr() const;
67
68 [[nodiscard]] QList<SearchLineInfo> searchLineInfo() const;
69 void setSearchLineInfo(const QList<SearchLineInfo> &newSearchLineInfo);
70
71 [[nodiscard]] static bool hasSubType(const QString &v);
72 [[nodiscard]] static bool hasSubType(SearchLineCommand::SearchLineType type);
73
74 [[nodiscard]] bool isEmpty() const;
75
76private:
77 [[nodiscard]] MESSAGELIST_NO_EXPORT QString convertSearchLinetypeToTranslatedString(SearchLineCommand::SearchLineType type) const;
78 [[nodiscard]] MESSAGELIST_NO_EXPORT SearchLineInfo isAnotherInfo(QString tmp, SearchLineInfo searchLineInfo);
79 MESSAGELIST_NO_EXPORT void appendSearchLineInfo(SearchLineInfo searchLineInfo);
81 QList<SearchLineInfo> mSearchLineInfo;
82};
83}
84}
85Q_DECLARE_TYPEINFO(MessageList::Core::SearchLineCommand::SearchLineInfo, Q_RELOCATABLE_TYPE);
86MESSAGELIST_TESTS_EXPORT QDebug operator<<(QDebug debug, const MessageList::Core::SearchLineCommand::SearchLineInfo &info);
AKONADI_MIME_EXPORT const char HasInvitation[]
AKONADI_MIME_EXPORT const char HasAttachment[]
AKONADI_MIME_EXPORT const char Body[]
bool isValid(QStringView ifopt)
KGuiItem clear()
bool operator==(const StyleDelim &l, const StyleDelim &r)
QDebug operator<<(QDebug dbg, const PerceptualColor::MultiSpinBoxSection &value)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:07:25 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.