Akonadi Mime

specialmailcollectionsrequestjob.h
1/*
2 SPDX-FileCopyrightText: 2009 Constantin Berzan <exit3219@gmail.com>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#pragma once
8
9#include "akonadi-mime_export.h"
10#include "specialmailcollections.h"
11
12#include <Akonadi/SpecialCollectionsRequestJob>
13
14#include <memory>
15
16namespace Akonadi
17{
18class SpecialMailCollectionsRequestJobPrivate;
19
20/**
21 * @short A job to request SpecialMailCollections.
22 *
23 * Use this job to request the SpecialMailCollections you need. You can request both
24 * default SpecialMailCollections and SpecialMailCollections in a given resource. The default
25 * SpecialMailCollections resource is created when the first default SpecialCollection is
26 * requested, but if a SpecialCollection in a custom resource is requested, this
27 * job expects that resource to exist already.
28 *
29 * If the folders you requested already exist, this job simply succeeds.
30 * Otherwise, it creates the required collections and registers them with
31 * SpecialMailCollections.
32 *
33 * Example:
34 *
35 * @code
36 *
37 * SpecialMailCollectionsRequestJob *job = new SpecialMailCollectionsRequestJob( this );
38 * job->requestDefaultCollection( SpecialMailCollections::Outbox );
39 * connect( job, SIGNAL(result(KJob*)),
40 * this, SLOT(requestDone(KJob*)) );
41 *
42 * ...
43 *
44 * MyClass::requestDone( KJob *job )
45 * {
46 * if ( job->error() )
47 * return;
48 *
49 * SpecialMailCollectionsRequestJob *requestJob = qobject_cast<SpecialMailCollectionsRequestJob*>( job );
50 *
51 * const Collection collection = requestJob->collection();
52 * ...
53 * }
54 *
55 * @endcode
56 *
57 * @author Constantin Berzan <exit3219@gmail.com>
58 * @since 4.4
59 */
61{
62 Q_OBJECT
63
64public:
65 /**
66 * Creates a new special mail collections request job.
67 */
68 explicit SpecialMailCollectionsRequestJob(QObject *parent = nullptr);
69
70 /**
71 * Destroys the special mail collections request job.
72 */
74
75 /**
76 * Requests a special mail collection of the given @p type in the default resource.
77 */
78 void requestDefaultCollection(SpecialMailCollections::Type type);
79
80 /**
81 * Requests a special mail collection of the given @p type in the given resource @p instance.
82 */
83 void requestCollection(SpecialMailCollections::Type type, const AgentInstance &instance);
84
85private:
86 //@cond PRIVATE
87 friend class SpecialMailCollectionsRequestJobPrivate;
88
89 std::unique_ptr<SpecialMailCollectionsRequestJobPrivate> const d;
90 //@endcond
91};
92} // namespace Akonadi
~SpecialMailCollectionsRequestJob() override
Destroys the special mail collections request job.
Type
Describes the possible types of special mail collections.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Oct 11 2024 12:18:09 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.