Akonadi

tagdeletejob.cpp
1 /*
2  SPDX-FileCopyrightText: 2014 Christian Mollekopf <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 #include "tagdeletejob.h"
8 #include "job_p.h"
9 #include "protocolhelper_p.h"
10 
11 using namespace Akonadi;
12 
13 class Akonadi::TagDeleteJobPrivate : public JobPrivate
14 {
15 public:
16  explicit TagDeleteJobPrivate(TagDeleteJob *parent)
17  : JobPrivate(parent)
18  {
19  }
20 
21  Tag::List mTagsToRemove;
22 };
23 
24 TagDeleteJob::TagDeleteJob(const Akonadi::Tag &tag, QObject *parent)
25  : Job(new TagDeleteJobPrivate(this), parent)
26 {
28  d->mTagsToRemove << tag;
29 }
30 
31 TagDeleteJob::TagDeleteJob(const Tag::List &tags, QObject *parent)
32  : Job(new TagDeleteJobPrivate(this), parent)
33 {
35  d->mTagsToRemove = tags;
36 }
37 
39 {
41 
42  d->sendCommand(Protocol::DeleteTagCommandPtr::create(ProtocolHelper::entitySetToScope(d->mTagsToRemove)));
43 }
44 
45 bool TagDeleteJob::doHandleResponse(qint64 tag, const Protocol::CommandPtr &response)
46 {
47  if (!response->isResponse() || response->type() != Protocol::Command::DeleteTag) {
48  return Job::doHandleResponse(tag, response);
49  }
50 
51  return true;
52 }
53 
55 {
56  Q_D(const TagDeleteJob);
57  return d->mTagsToRemove;
58 }
An Akonadi Tag.
Definition: tag.h:25
Tag tag() const
Returns the created tag with the new unique id, or an invalid tag if the job failed.
Tag::List tags() const
Returns the tags passed to the constructor.
void doStart() override
This method must be reimplemented in the concrete jobs.
Base class for all actions in the Akonadi storage.
Definition: job.h:80
Job that deletes tags.
Definition: tagdeletejob.h:22
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
bool doHandleResponse(qint64 tag, const Protocol::CommandPtr &response) override
This method should be reimplemented in the concrete jobs in case you want to handle incoming data.
Q_D(Todo)
Helper integration between Akonadi and Qt.
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Thu Jun 30 2022 03:51:47 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.