Akonadi

transactionjobs.cpp
1/*
2 SPDX-FileCopyrightText: 2006 Volker Krause <vkrause@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#include "transactionjobs.h"
8
9#include "job_p.h"
10#include "private/protocol_p.h"
11
12using namespace Akonadi;
13
14class Akonadi::TransactionJobPrivate : public JobPrivate
15{
16public:
17 explicit TransactionJobPrivate(Job *parent)
18 : JobPrivate(parent)
19 {
20 }
21};
22
23TransactionJob::TransactionJob(QObject *parent)
24 : Job(new TransactionJobPrivate(this), parent)
25{
26 Q_ASSERT(parent);
27}
28
29TransactionJob::~TransactionJob()
30{
31}
32
33void TransactionJob::doStart()
34{
35 Q_D(TransactionJob);
36
37 Protocol::TransactionCommand::Mode mode;
39 mode = Protocol::TransactionCommand::Begin;
41 mode = Protocol::TransactionCommand::Rollback;
42 } else if (qobject_cast<TransactionCommitJob *>(this)) {
43 mode = Protocol::TransactionCommand::Commit;
44 } else {
45 Q_ASSERT(false);
46 mode = Protocol::TransactionCommand::Invalid;
47 }
48
49 d->sendCommand(Protocol::TransactionCommandPtr::create(mode));
50}
51
52bool TransactionJob::doHandleResponse(qint64 tag, const Protocol::CommandPtr &response)
53{
54 if (!response->isResponse() || response->type() != Protocol::Command::Transaction) {
55 return Job::doHandleResponse(tag, response);
56 }
57
58 return true;
59}
60
62 : TransactionJob(parent)
63{
64}
65
69
71 : TransactionJob(parent)
72{
73}
74
78
80 : TransactionJob(parent)
81{
82}
83
87
88#include "moc_transactionjobs.cpp"
Base class for all actions in the Akonadi storage.
Definition job.h:81
virtual bool doHandleResponse(qint64 tag, const Protocol::CommandPtr &response)
This method should be reimplemented in the concrete jobs in case you want to handle incoming data.
Definition job.cpp:381
~TransactionBeginJob() override
Destroys the transaction begin job.
TransactionBeginJob(QObject *parent)
Creates a new transaction begin job.
~TransactionCommitJob() override
Destroys the transaction commit job.
TransactionCommitJob(QObject *parent)
Creates a new transaction commit job.
TransactionRollbackJob(QObject *parent)
Creates a new transaction rollback job.
~TransactionRollbackJob() override
Destroys the transaction rollback job.
Helper integration between Akonadi and Qt.
T qobject_cast(QObject *object)
Q_D(Todo)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Oct 4 2024 11:57:20 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.