Akonadi

tagcreatejob.h
1/*
2 SPDX-FileCopyrightText: 2014 Christian Mollekopf <mollekopf@kolabsys.com>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#pragma once
8
9#include "akonadicore_export.h"
10#include "job.h"
11
12namespace Akonadi
13{
14class Tag;
15class TagCreateJobPrivate;
16
17/**
18 * @short Job that creates a new tag in the Akonadi storage.
19 * @since 4.13
20 */
21class AKONADICORE_EXPORT TagCreateJob : public Job
22{
24
25public:
26 /**
27 * Creates a new tag create job.
28 *
29 * @param tag The tag to create.
30 * @param parent The parent object.
31 */
32 explicit TagCreateJob(const Tag &tag, QObject *parent = nullptr);
33
34 /**
35 * Returns the created tag with the new unique id, or an invalid tag if the job failed.
36 */
37 [[nodiscard]] Tag tag() const;
38
39 /**
40 * Merges the tag by GID if it is already existing, and returns the merged version.
41 * This is false by default.
42 *
43 * Note that the returned tag does not contain attributes.
44 */
45 void setMergeIfExisting(bool merge);
46
47protected:
48 void doStart() override;
49 bool doHandleResponse(qint64 tag, const Protocol::CommandPtr &response) override;
50
51private:
52 Q_DECLARE_PRIVATE(TagCreateJob)
53};
54
55}
Job(QObject *parent=nullptr)
Creates a new job.
Definition job.cpp:290
TagCreateJob(const Tag &tag, QObject *parent=nullptr)
Creates a new tag create job.
void setMergeIfExisting(bool merge)
Merges the tag by GID if it is already existing, and returns the merged version.
Tag tag() const
Returns the created tag with the new unique id, or an invalid tag if the job failed.
void doStart() override
This method must be reimplemented in the concrete jobs.
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.
An Akonadi Tag.
Definition tag.h:26
Helper integration between Akonadi and Qt.
Q_OBJECTQ_OBJECT
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Feb 21 2025 11:50:40 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.