KPeople

contactmonitor.h
1 /*
2  Abstract class to load a monitor changes for a single contact
3  SPDX-FileCopyrightText: 2013 David Edmundson <[email protected]>
4 
5  SPDX-License-Identifier: LGPL-2.1-or-later
6 */
7 
8 #ifndef CONTACTMONITOR_H
9 #define CONTACTMONITOR_H
10 
11 #include <QObject>
12 
13 #include <kpeoplebackend/kpeoplebackend_export.h>
14 
15 #include "abstractcontact.h"
16 
17 namespace KPeople
18 {
19 class ContactMonitorPrivate;
20 
21 /**
22  * This class loads data for a single contact from a datasource.
23  *
24  * Datasources should subclass this and call setContact() when the contact loads or changes.
25  * It is used for optimising performance over loading all contacts and filtering the results.
26  * Subclasses are expected to be asynchronous in loading data.
27  *
28  * @since 5.8
29  */
30 class KPEOPLEBACKEND_EXPORT ContactMonitor : public QObject
31 {
32  Q_OBJECT
33 public:
34  ContactMonitor(const QString &contactUri);
35  ~ContactMonitor() override;
36 
37  /**
38  * The ID of the contact being loaded
39  */
40  QString contactUri() const;
41 
42  /**
43  * The currently loaded information on this contact.
44  */
45  AbstractContact::Ptr contact() const;
46 Q_SIGNALS:
47  /**
48  * Emitted whenever the contact changes
49  */
50  void contactChanged();
51 
52 protected:
53  /**
54  * Sets or updates the contact and emits contactChanged
55  * Subclasses should call this when data is loaded or changes
56  */
57  void setContact(const AbstractContact::Ptr &contact);
58 
59 private:
60  Q_DISABLE_COPY(ContactMonitor)
61  Q_DECLARE_PRIVATE(ContactMonitor)
62  ContactMonitorPrivate *d_ptr;
63 };
64 
65 }
67 
68 #endif // CONTACTMONITOR_H
This class loads data for a single contact from a datasource.
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Thu Jan 27 2022 22:42:01 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.