File indexing completed on 2024-05-05 03:57:07
0001 /* 0002 SPDX-FileCopyrightText: 2013 David Edmundson <davidedmundson@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.1-or-later 0005 */ 0006 0007 #ifndef FAKECONTACTSOURCE_H 0008 #define FAKECONTACTSOURCE_H 0009 0010 #include <backends/allcontactsmonitor.h> 0011 #include <backends/basepersonsdatasource.h> 0012 0013 /** 0014 the fake datasource is configured with 0015 0016 ID - NAME - email - phone 0017 contact1 - Contact1 - contact1@example.com - 0018 contact2 - PersonA - contact2@example.com - +1 234 567 890 0019 contact3 - PersonA - contact3@example.com - +34 666 777 999 0020 contact4 - PersonA - contact4@example.com 0021 */ 0022 0023 class FakeContactSource : public KPeople::BasePersonsDataSource 0024 { 0025 public: 0026 FakeContactSource(QObject *parent, const QVariantList &args = QVariantList()); 0027 QString sourcePluginId() const override; 0028 0029 void remove(const QString &uri); 0030 void changeProperty(const QString &key, const QVariant &value); 0031 0032 protected: 0033 KPeople::AllContactsMonitor *createAllContactsMonitor() override; 0034 }; 0035 0036 //---------------------------------------------------------------------------- 0037 0038 class FakeAllContactsMonitor : public KPeople::AllContactsMonitor 0039 { 0040 Q_OBJECT 0041 public: 0042 explicit FakeAllContactsMonitor(); 0043 void changeProperty(const QString &key, const QVariant &value); 0044 QMap<QString, KPeople::AbstractContact::Ptr> contacts() override; 0045 0046 void remove(const QString &uri); 0047 0048 private: 0049 QMap<QString, KPeople::AbstractContact::Ptr> m_contacts; 0050 }; 0051 0052 #endif // FAKECONTACTSOURCE_H