File indexing completed on 2024-05-12 15:44:26

0001 /*
0002     SPDX-FileCopyrightText: 2013 David Edmundson <davidedmundson@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.1-or-later
0005 */
0006 
0007 #ifndef DEFAULTCONTACTMONITOR_H
0008 #define DEFAULTCONTACTMONITOR_H
0009 
0010 #include <QSharedPointer>
0011 
0012 #include "backends/allcontactsmonitor.h"
0013 #include "backends/contactmonitor.h"
0014 
0015 using namespace KPeople;
0016 
0017 /*
0018  * If plugins don't implement a ContactWatcher, we repurpose the whole model, and single out changes for one contact
0019  * ideally plugins (especially slow ones) will implement their own contact monitor.
0020  */
0021 
0022 class KPEOPLEBACKEND_EXPORT DefaultContactMonitor : public ContactMonitor
0023 {
0024     Q_OBJECT
0025 public:
0026     DefaultContactMonitor(const QString &contactUri, const AllContactsMonitorPtr &allContactsWatcher);
0027 private Q_SLOTS:
0028     void onContactAdded(const QString &contactUri, const AbstractContact::Ptr &contact);
0029     void onContactChanged(const QString &contactUri, const AbstractContact::Ptr &contact);
0030     void onContactRemoved(const QString &contactUri);
0031 
0032 private:
0033     AllContactsMonitorPtr m_allContactsMonitor;
0034 };
0035 
0036 #endif // DEFAULTCONTACTMONITOR_H