Akonadi Contacts

contactgroupexpandjob.h
1 /*
2  This file is part of Akonadi Contact.
3 
4  SPDX-FileCopyrightText: 2009 Tobias Koenig <[email protected]>
5 
6  SPDX-License-Identifier: LGPL-2.0-or-later
7 */
8 
9 #pragma once
10 
11 #include "akonadi-contact_export.h"
12 
13 #include <KJob>
14 #include <kcontacts/addressee.h>
15 #include <kcontacts/contactgroup.h>
16 
17 namespace Akonadi
18 {
19 /**
20  * @short Job that expands a ContactGroup to a list of contacts.
21  *
22  * This job takes a KContacts::ContactGroup object or a name of a contact group and
23  * expands it to a list of KContacts::Addressee objects by creating temporary KContacts::Addressee objects
24  * for the KContacts::ContactGroup::Data objects of the group and fetching the
25  * complete contacts from the Akonadi storage for the
26  * KContacts::ContactGroup::ContactReferences of the group.
27  *
28  * @code
29  *
30  * const KContacts::ContactGroup group = ...;
31  *
32  * Akonadi::ContactGroupExpandJob *job = new Akonadi::ContactGroupExpandJob( group );
33  * connect( job, SIGNAL(result(KJob*)), this, SLOT(expandResult(KJob*)) );
34  * job->start();
35  *
36  * ...
37  *
38  * MyClass::expandResult( KJob *job )
39  * {
40  * Akonadi::ContactGroupExpandJob *expandJob = qobject_cast<Akonadi::ContactGroupExpandJob*>( job );
41  * const KContacts::Addressee::List contacts = expandJob->contacts();
42  * // do something with the contacts
43  * }
44  *
45  * @endcode
46  *
47  * @author Tobias Koenig <[email protected]>
48  * @since 4.4
49  */
50 class AKONADI_CONTACT_EXPORT ContactGroupExpandJob : public KJob
51 {
52  Q_OBJECT
53 
54 public:
55  /**
56  * Creates a new contact group expand job.
57  *
58  * @param group The contact group to expand.
59  * @param parent The parent object.
60  */
61  explicit ContactGroupExpandJob(const KContacts::ContactGroup &group, QObject *parent = nullptr);
62 
63  /**
64  * Creates a new contact group expand job.
65  *
66  * @param name The name of the contact group to expand.
67  * @param parent The parent object.
68  *
69  * @since 4.5
70  */
71  explicit ContactGroupExpandJob(const QString &name, QObject *parent = nullptr);
72 
73  /**
74  * Destroys the contact group expand job.
75  */
76  ~ContactGroupExpandJob() override;
77 
78  /**
79  * Returns the list of contacts.
80  */
81  Q_REQUIRED_RESULT KContacts::Addressee::List contacts() const;
82 
83  /**
84  * Starts the expand job.
85  */
86  void start() override;
87 
88 private:
89  //@cond PRIVATE
90  class Private;
91  Private *const d;
92 
93  // Already use with QMetaObject::invokeMethod
94  Q_PRIVATE_SLOT(d, void resolveGroup())
95  //@endcond
96 };
97 }
98 
AddresseeList List
Job that expands a ContactGroup to a list of contacts.
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Wed Jun 23 2021 23:09:24 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.