KIMAP

listjob.h
1/*
2 SPDX-FileCopyrightText: 2009 Kevin Ottens <ervin@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#pragma once
8
9#include "kimap_export.h"
10
11#include "job.h"
12
13namespace KIMAP
14{
15class Session;
16struct Response;
17class ListJobPrivate;
18
19struct KIMAP_EXPORT MailBoxDescriptor {
21 QChar separator;
22
23 inline bool operator==(const MailBoxDescriptor &other) const
24 {
25 return other.name == name && other.separator == separator;
26 }
27
28 inline bool operator<(const MailBoxDescriptor &other) const
29 {
30 return other.name < name || (other.name == name && other.separator < separator);
31 }
32};
33
34class KIMAP_EXPORT ListJob : public Job
35{
36 Q_OBJECT
37 Q_DECLARE_PRIVATE(ListJob)
38
39 friend class SessionPrivate;
40
41public:
42 enum Option {
43 NoOption = 0x0, /**< List only subscribed mailboxes. (Uses the LSUB IMAP command.) */
44 IncludeUnsubscribed, /**< List subscribed and unsubscribed mailboxes. (Uses the LIST IMAP command.) */
45 IncludeFolderRoleFlags /**< List subscribed and unsubscribed mailboxes with flags to identify standard mailboxes whose name may be localized.
46 The server must support the XLIST extension. */
47 };
48
49 explicit ListJob(Session *session);
50 ~ListJob() override;
51
52 KIMAP_DEPRECATED void setIncludeUnsubscribed(bool include);
53 KIMAP_DEPRECATED bool isIncludeUnsubscribed() const;
54
55 void setOption(Option option);
56 [[nodiscard]] Option option() const;
57
58 void setQueriedNamespaces(const QList<MailBoxDescriptor> &namespaces);
59 [[nodiscard]] QList<MailBoxDescriptor> queriedNamespaces() const;
60
61 KIMAP_DEPRECATED QList<MailBoxDescriptor> mailBoxes() const;
62 KIMAP_DEPRECATED QMap<MailBoxDescriptor, QList<QByteArray>> flags() const;
63
64Q_SIGNALS:
65 void mailBoxesReceived(const QList<KIMAP::MailBoxDescriptor> &descriptors, const QList<QList<QByteArray>> &flags);
66
67protected:
68 void doStart() override;
69 void handleResponse(const Response &response) override;
70
71private:
72 Q_PRIVATE_SLOT(d_func(), void emitPendings())
73
74 /**
75 * @brief Converts a mailbox descriptor's name to uppercase if it is the Inbox or an Inbox subfolder.
76 * This is according to the RFC3501, 5.1. Mailbox Naming section.
77 *
78 * @param descriptor the descriptor to convert, conversion happens in place
79 **/
80 void convertInboxName(KIMAP::MailBoxDescriptor &descriptor);
81};
82
83}
KIOCORE_EXPORT bool operator==(const UDSEntry &entry, const UDSEntry &other)
QString name(StandardAction id)
bool operator<(const PosRange< Trait > &l, const PosRange< Trait > &r)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 20 2024 11:51:44 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.