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_export.h"
9#include <QDebug>
10#include <QMap>
11#include <QObject>
12#include <QStringList>
13namespace MessageList
14{
15namespace Core
16{
17class MESSAGELIST_EXPORT SearchLineCommand
18{
19 Q_GADGET
20public:
21 enum SearchLineType : uint8_t {
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 IsEncrypted,
45 IsQueued,
46 IsSent,
47 Larger,
48 Smaller,
49 OlderThan,
50 NewerThan,
52 };
53 Q_ENUM(SearchLineType)
54 struct MESSAGELIST_EXPORT SearchLineInfo {
55 SearchLineType type = SearchLineType::Unknown;
56 QString argument;
57 void clear();
58 [[nodiscard]] bool isValid() const;
59 [[nodiscard]] bool operator==(const SearchLineInfo &other) const;
60 [[nodiscard]] bool isValidDate() const;
61 [[nodiscard]] bool mustBeUnique() const;
62 [[nodiscard]] qint64 convertArgumentAsSize() const;
63 };
64 SearchLineCommand();
65 ~SearchLineCommand();
66
67 void parseSearchLineCommand(const QString &str);
68
69 [[nodiscard]] QString generateCommadLineStr() const;
70
71 [[nodiscard]] QList<SearchLineInfo> searchLineInfo() const;
72 void setSearchLineInfo(const QList<SearchLineInfo> &newSearchLineInfo);
73
74 [[nodiscard]] static bool hasSubType(const QString &v);
75 [[nodiscard]] static bool hasSubType(SearchLineCommand::SearchLineType type);
76
77 [[nodiscard]] bool isEmpty() const;
78
79 static QString searchLineTypeToString(SearchLineCommand::SearchLineType type);
80
81private:
82 [[nodiscard]] MESSAGELIST_NO_EXPORT QString convertSearchLinetypeToTranslatedString(SearchLineCommand::SearchLineType type) const;
83 [[nodiscard]] MESSAGELIST_NO_EXPORT SearchLineInfo isAnotherInfo(QString tmp, SearchLineInfo searchLineInfo);
84 MESSAGELIST_NO_EXPORT void appendSearchLineInfo(SearchLineInfo searchLineInfo);
86 QList<SearchLineInfo> mSearchLineInfo;
87};
88}
89}
90Q_DECLARE_TYPEINFO(MessageList::Core::SearchLineCommand::SearchLineInfo, Q_RELOCATABLE_TYPE);
91MESSAGELIST_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[]
QDebug operator<<(QDebug dbg, const DcrawInfoContainer &c)
bool isValid(QStringView ifopt)
bool operator==(const StyleDelim &l, const StyleDelim &r)
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.