Messagelib

searchlinecommand.h
1/*
2 SPDX-FileCopyrightText: 2024-2025 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 IsDeleted,
48 IsAction,
49 Larger,
50 Smaller,
51 OlderThan,
52 NewerThan,
54 };
55 Q_ENUM(SearchLineType)
56 struct MESSAGELIST_EXPORT SearchLineInfo {
57 SearchLineType type = SearchLineType::Unknown;
58 QString argument;
59 void clear();
60 [[nodiscard]] bool isValid() const;
61 [[nodiscard]] bool operator==(const SearchLineInfo &other) const;
62 [[nodiscard]] bool isValidDate() const;
63 [[nodiscard]] bool mustBeUnique() const;
64 [[nodiscard]] qint64 convertArgumentAsSize() const;
65 };
66 SearchLineCommand();
67 ~SearchLineCommand();
68
69 void parseSearchLineCommand(const QString &str);
70
71 [[nodiscard]] QString generateCommadLineStr() const;
72
73 [[nodiscard]] QList<SearchLineInfo> searchLineInfo() const;
74 void setSearchLineInfo(const QList<SearchLineInfo> &newSearchLineInfo);
75
76 [[nodiscard]] static bool hasSubType(const QString &v);
77 [[nodiscard]] static bool hasSubType(SearchLineCommand::SearchLineType type);
78
79 [[nodiscard]] bool isEmpty() const;
80
81 static QString searchLineTypeToString(SearchLineCommand::SearchLineType type);
82
83 [[nodiscard]] bool hasOnlyOneLiteralCommand() const;
84
85private:
86 [[nodiscard]] MESSAGELIST_NO_EXPORT QString convertSearchLinetypeToTranslatedString(SearchLineCommand::SearchLineType type) const;
87 [[nodiscard]] MESSAGELIST_NO_EXPORT SearchLineInfo isAnotherInfo(QString tmp, SearchLineInfo searchLineInfo);
88 MESSAGELIST_NO_EXPORT void appendSearchLineInfo(SearchLineInfo searchLineInfo);
89 static QMap<QString, SearchLineCommand::SearchLineType> mKeyList;
90 QList<SearchLineInfo> mSearchLineInfo;
91};
92}
93}
94Q_DECLARE_TYPEINFO(MessageList::Core::SearchLineCommand::SearchLineInfo, Q_RELOCATABLE_TYPE);
95MESSAGELIST_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)
QAction * clear(const QObject *recvr, const char *slot, QObject *parent)
bool operator==(const StyleDelim &l, const StyleDelim &r)
The implementation independent part of the MessageList library.
Definition aggregation.h:22
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Jan 31 2025 12:05:41 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.