KPeople

contactmonitor.h
1/*
2 Abstract class to load a monitor changes for a single contact
3 SPDX-FileCopyrightText: 2013 David Edmundson <davidedmundson@kde.org>
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
17namespace KPeople
18{
19class 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 */
30class KPEOPLEBACKEND_EXPORT ContactMonitor : public QObject
31{
32 Q_OBJECT
33public:
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;
46Q_SIGNALS:
47 /**
48 * Emitted whenever the contact changes
49 */
51
52protected:
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
59private:
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.
void contactChanged()
Emitted whenever the contact changes.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri May 3 2024 11:48:33 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.