KIMAP2

listjob.h
1/*
2 Copyright (c) 2009 Kevin Ottens <ervin@kde.org>
3
4 This library is free software; you can redistribute it and/or modify it
5 under the terms of the GNU Library General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or (at your
7 option) any later version.
8
9 This library is distributed in the hope that it will be useful, but WITHOUT
10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12 License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to the
16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 02110-1301, USA.
18*/
19
20#ifndef KIMAP2_LISTJOB_H
21#define KIMAP2_LISTJOB_H
22
23#include "kimap2_export.h"
24
25#include "job.h"
26
27namespace KIMAP2
28{
29
30class Session;
31struct Message;
32class ListJobPrivate;
33
34struct KIMAP2_EXPORT MailBoxDescriptor {
36 QChar separator;
37
38 inline bool operator==(const MailBoxDescriptor &other) const
39 {
40 return other.name == name && other.separator == separator;
41 }
42
43 inline bool operator<(const MailBoxDescriptor &other) const
44 {
45 return other.name < name || (other.name == name && other.separator < separator);
46 }
47};
48
49class KIMAP2_EXPORT ListJob : public Job
50{
51 Q_OBJECT
52 Q_DECLARE_PRIVATE(ListJob)
53
54 friend class SessionPrivate;
55
56public:
57 enum Option {
58 NoOption = 0x0, /**< List only subscribed mailboxes. (Uses the LSUB IMAP command.) */
59 IncludeUnsubscribed, /**< List subscribed and unsubscribed mailboxes. (Uses the LIST IMAP command.) */
60 IncludeFolderRoleFlags /**< List subscribed and unsubscribed mailboxes with flags to identify standard mailboxes whose name may be localized.
61 The server must support the XLIST extension. */
62 };
63
64 explicit ListJob(Session *session);
65 virtual ~ListJob();
66
67 void setOption(Option option);
68 Option option() const;
69
70 void setQueriedNamespaces(const QList<MailBoxDescriptor> &namespaces);
71 QList<MailBoxDescriptor> queriedNamespaces() const;
72
73Q_SIGNALS:
74 void resultReceived(const KIMAP2::MailBoxDescriptor &descriptors, const QList<QByteArray> &flags);
75
76protected:
77 void doStart() Q_DECL_OVERRIDE;
78 void handleResponse(const Message &response) Q_DECL_OVERRIDE;
79
80private:
81
82 /**
83 * @brief Converts a mailbox descriptor's name to uppercase if it is the Inbox or an Inbox subfolder.
84 * This is according to the RFC3501, 5.1. Mailbox Naming section.
85 *
86 * @param descriptor the descriptor to convert, conversion happens in place
87 **/
88 void convertInboxName(KIMAP2::MailBoxDescriptor &descriptor);
89};
90
91}
92
93Q_DECLARE_METATYPE(KIMAP2::MailBoxDescriptor)
94
95#endif
QString name(StandardAction id)
bool operator<(const PosRange< Trait > &l, const PosRange< Trait > &r)
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:56:30 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.