Akonadi

job.h
1 /*
2  Copyright (c) 2006 Tobias Koenig <[email protected]>
3  2006 Marc Mutz <[email protected]>
4  2006 - 2007 Volker Krause <[email protected]>
5 
6  This library is free software; you can redistribute it and/or modify it
7  under the terms of the GNU Library General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or (at your
9  option) any later version.
10 
11  This library is distributed in the hope that it will be useful, but WITHOUT
12  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
14  License for more details.
15 
16  You should have received a copy of the GNU Library General Public License
17  along with this library; see the file COPYING.LIB. If not, write to the
18  Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19  02110-1301, USA.
20 */
21 
22 #ifndef AKONADI_JOB_H
23 #define AKONADI_JOB_H
24 
25 #include "akonadicore_export.h"
26 
27 #include <KCompositeJob>
28 
29 class QString;
30 
31 namespace Akonadi
32 {
33 
34 namespace Protocol
35 {
36 class Command;
37 using CommandPtr = QSharedPointer<Command>;
38 }
39 
40 class JobPrivate;
41 class Session;
42 class SessionPrivate;
43 
93 class AKONADICORE_EXPORT Job : public KCompositeJob
94 {
95  Q_OBJECT
96 
97  friend class Session;
98  friend class SessionPrivate;
99 
100 public:
105 
111  enum Error {
112  ConnectionFailed = UserDefinedError,
116  UserError = UserDefinedError + 42
117  };
118 
128  explicit Job(QObject *parent = nullptr);
129 
133  ~Job() override;
134 
139  void start() override;
140 
145  Q_REQUIRED_RESULT QString errorString() const override;
146 
147 Q_SIGNALS:
153  void aboutToStart(Akonadi::Job *job);
154 
163  void writeFinished(Akonadi::Job *job);
164 
165 protected:
171  virtual void doStart() = 0;
172 
184  virtual bool doHandleResponse(qint64 tag, const Protocol::CommandPtr &response);
185 
194  bool addSubjob(KJob *job) override;
195 
201  bool removeSubjob(KJob *job) override;
202 
206  bool doKill() override;
207 
212  void emitWriteFinished();
213 
214 protected Q_SLOTS:
215  void slotResult(KJob *job) override;
216 
217 protected:
218  //@cond PRIVATE
219  Job(JobPrivate *dd, QObject *parent);
220  JobPrivate *const d_ptr;
221  //@endcond
222 
223 private:
224  Q_DECLARE_PRIVATE(Job)
225 
226  //@cond PRIVATE
227  Q_PRIVATE_SLOT(d_func(), void slotSubJobAboutToStart(Akonadi::Job *))
228  Q_PRIVATE_SLOT(d_func(), void startNext())
229  Q_PRIVATE_SLOT(d_func(), void signalCreationToJobTracker())
230  Q_PRIVATE_SLOT(d_func(), void signalStartedToJobTracker())
231  Q_PRIVATE_SLOT(d_func(), void delayedEmitResult())
232  //@endcond
233 };
234 
235 }
236 
237 #endif
The server protocol version is too old or too new.
Definition: job.h:113
Unknown error.
Definition: job.h:115
Base class for all actions in the Akonadi storage.
Definition: job.h:93
A communication session with the Akonadi storage.
Definition: core/session.h:67
QList< Job * > List
Describes a list of jobs.
Definition: job.h:104
ASAP CLI session.
Helper integration between Akonadi and Qt.
The user canceled this job.
Definition: job.h:114
Error
Describes the error codes that can be emitted by this class.
Definition: job.h:111
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sun May 24 2020 22:46:16 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.