KIMAP2

job.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_JOB_H
21#define KIMAP2_JOB_H
22
23#include "kimap2_export.h"
24
25#include <KJob>
26#include <QtNetwork/QAbstractSocket>
27
28namespace KIMAP2
29{
30
31class Session;
32class SessionPrivate;
33class JobPrivate;
34struct Message;
35
36enum ErrorCodes {
37 ConnectionLost = KJob::UserDefinedError + 1,
38 CommandFailed,
39 CouldNotConnect,
40 SslHandshakeFailed,
41 HostNotFound,
42 LoginFailed,
43 LastError
44};
45
46class KIMAP2_EXPORT Job : public KJob
47{
48 Q_OBJECT
49 Q_DECLARE_PRIVATE(Job)
50
51 friend class SessionPrivate;
52
53public:
54 virtual ~Job();
55
56 Session *session() const;
57
58 void start() Q_DECL_OVERRIDE;
59
60private:
61 virtual void doStart() = 0;
62 virtual void handleResponse(const Message &response);
63 virtual void connectionLost();
64 void setSocketError(QAbstractSocket::SocketError);
65 void setErrorMessage(const QString &message);
66
67protected:
68 enum HandlerResponse {
69 Handled = 0,
70 NotHandled
71 };
72
73 HandlerResponse handleErrorReplies(const Message &response);
74
75 explicit Job(Session *session);
76 explicit Job(JobPrivate &dd);
77
78 JobPrivate *const d_ptr;
79};
80
81}
82
83#endif
Q_SCRIPTABLE Q_NOREPLY void start()
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 29 2024 11:56:35 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.