Akonadi

tagdeletejob.cpp
1 /*
2  Copyright (c) 2014 Christian Mollekopf <[email protected]>
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 #include "tagdeletejob.h"
21 #include "job_p.h"
22 #include "protocolhelper_p.h"
23 
24 using namespace Akonadi;
25 
26 class Akonadi::TagDeleteJobPrivate : public JobPrivate
27 {
28 public:
29  TagDeleteJobPrivate(TagDeleteJob *parent)
30  : JobPrivate(parent)
31  {
32  }
33 
34  Tag::List mTagsToRemove;
35 };
36 
37 TagDeleteJob::TagDeleteJob(const Akonadi::Tag &tag, QObject *parent)
38  : Job(new TagDeleteJobPrivate(this), parent)
39 {
40  Q_D(TagDeleteJob);
41  d->mTagsToRemove << tag;
42 }
43 
44 TagDeleteJob::TagDeleteJob(const Tag::List &tags, QObject *parent)
45  : Job(new TagDeleteJobPrivate(this), parent)
46 {
47  Q_D(TagDeleteJob);
48  d->mTagsToRemove = tags;
49 }
50 
52 {
53  Q_D(TagDeleteJob);
54 
55  d->sendCommand(Protocol::DeleteTagCommandPtr::create(ProtocolHelper::entitySetToScope(d->mTagsToRemove)));
56 }
57 
59 {
60  if (!response->isResponse() || response->type() != Protocol::Command::DeleteTag) {
61  return Job::doHandleResponse(tag, response);
62  }
63 
64  return true;
65 }
66 
68 {
69  Q_D(const TagDeleteJob);
70  return d->mTagsToRemove;
71 }
Tag tag() const
Returns the created tag with the new unique id, or an invalid tag if the job failed.
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:385
Base class for all actions in the Akonadi storage.
Definition: job.h:93
Job that deletes tags.
Definition: tagdeletejob.h:37
void doStart() override
This method must be reimplemented in the concrete jobs.
Definition: item.h:44
Helper integration between Akonadi and Qt.
An Akonadi Tag.
Definition: tag.h:39
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...
QObject * parent() const const
Tag::List tags() const
Returns the tags passed to the constructor.
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Fri Jun 5 2020 23:08:56 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.