KPeople 5.109.0
allcontactsmonitor.h
1/*
2 SPDX-FileCopyrightText: 2013 David Edmundson <davidedmundson@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.1-or-later
5*/
6
7#ifndef ALLCONTACTSMONITOR_H
8#define ALLCONTACTSMONITOR_H
9
10#include <QObject>
11#include <QSharedPointer>
12
13#include <kpeoplebackend/abstractcontact.h>
14#include <kpeoplebackend/kpeoplebackend_export.h>
15
16namespace KPeople
17{
18class AllContactsMonitorPrivate;
19
28class KPEOPLEBACKEND_EXPORT AllContactsMonitor : public QObject
29{
30 Q_OBJECT
31public:
32 explicit AllContactsMonitor(); // TODO make protected? this isn't useful unless subclassed
33 ~AllContactsMonitor() override;
34
38 virtual QMap<QString, AbstractContact::Ptr> contacts();
39
40 // TODO redo as a state enum - InitialLoad, Fail, Loaded
41 bool isInitialFetchComplete() const;
42
43 bool initialFetchSuccess() const;
44
45Q_SIGNALS:
49 void contactChanged(const QString &contactUri, const KPeople::AbstractContact::Ptr &contact);
50
54 void contactAdded(const QString &contactUri, const KPeople::AbstractContact::Ptr &contact);
55
59 void contactRemoved(const QString &contactUri);
60
69 void initialFetchComplete(bool success);
70
71protected Q_SLOTS:
80 void emitInitialFetchComplete(bool success);
81
82private:
83 Q_DISABLE_COPY(AllContactsMonitor)
84 Q_DECLARE_PRIVATE(AllContactsMonitor)
85 AllContactsMonitorPrivate *d_ptr;
86};
87
88}
89typedef QSharedPointer<KPeople::AllContactsMonitor> AllContactsMonitorPtr;
90
91#endif // ALLCONTACTSMONITOR_H
This class should be subclassed by each datasource and return a list of all contacts that the datasou...
Definition allcontactsmonitor.h:29
void contactRemoved(const QString &contactUri)
DataSources should emit this whenever a contact is removed and they are no longer able to supply up-t...
void emitInitialFetchComplete(bool success)
DataSources should call this once they have finished initial retrieval of all contacts from their sto...
void contactAdded(const QString &contactUri, const KPeople::AbstractContact::Ptr &contact)
DataSources should emit this whenever a contact is added.
void contactChanged(const QString &contactUri, const KPeople::AbstractContact::Ptr &contact)
DataSources should emit this whenever a known contact changes.
virtual QMap< QString, AbstractContact::Ptr > contacts()
Returns all currently loaded contacts.
void initialFetchComplete(bool success)
Notifies that the DataSource has completed it's initial fetch.