File indexing completed on 2024-05-12 05:17:14

0001 /*
0002     SPDX-FileCopyrightText: 2009 Kevin Ottens <ervin@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "kimap_export.h"
0010 
0011 #include <KJob>
0012 
0013 namespace KIMAP
0014 {
0015 class Session;
0016 class SessionPrivate;
0017 class JobPrivate;
0018 struct Response;
0019 
0020 class KIMAP_EXPORT Job : public KJob
0021 {
0022     Q_OBJECT
0023     Q_DECLARE_PRIVATE(Job)
0024 
0025     friend class SessionPrivate;
0026 
0027 public:
0028     ~Job() override;
0029 
0030     Session *session() const;
0031 
0032     void start() override;
0033 
0034 private:
0035     virtual void doStart() = 0;
0036     virtual void handleResponse(const Response &response);
0037     virtual void connectionLost();
0038 
0039 protected:
0040     enum HandlerResponse { Handled = 0, NotHandled };
0041 
0042     HandlerResponse handleErrorReplies(const Response &response);
0043 
0044     explicit Job(Session *session);
0045     explicit Job(JobPrivate &dd);
0046 
0047     JobPrivate *const d_ptr;
0048 };
0049 
0050 }