KIMAP

listjob.h
1 /*
2  SPDX-FileCopyrightText: 2009 Kevin Ottens <[email protected]>
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 
13 namespace KIMAP
14 {
15 class Session;
16 struct Response;
17 class ListJobPrivate;
18 
19 struct KIMAP_EXPORT MailBoxDescriptor {
20  QString name;
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 
34 class KIMAP_EXPORT ListJob : public Job
35 {
36  Q_OBJECT
37  Q_DECLARE_PRIVATE(ListJob)
38 
39  friend class SessionPrivate;
40 
41 public:
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 
64 Q_SIGNALS:
65  void mailBoxesReceived(const QList<KIMAP::MailBoxDescriptor> &descriptors, const QList<QList<QByteArray>> &flags);
66 
67 protected:
68  void doStart() override;
69  void handleResponse(const Response &response) override;
70 
71 private:
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 }
bool operator==(const Qt3DRender::QGraphicsApiFilter &reference, const Qt3DRender::QGraphicsApiFilter &sample)
const char * name(StandardAction id)
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Sun Dec 3 2023 03:51:44 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.