KPeople

defaultcontactmonitor.cpp
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#include "defaultcontactmonitor_p.h"
9
10DefaultContactMonitor::DefaultContactMonitor(const QString &contactUri, const AllContactsMonitorPtr &allContactsWatcher)
11 : ContactMonitor(contactUri)
12 , m_allContactsMonitor(allContactsWatcher)
13{
14 connect(allContactsWatcher.data(), &AllContactsMonitor::contactAdded, this, &DefaultContactMonitor::onContactAdded);
15 connect(allContactsWatcher.data(), &AllContactsMonitor::contactRemoved, this, &DefaultContactMonitor::onContactRemoved);
16 connect(allContactsWatcher.data(), &AllContactsMonitor::contactChanged, this, &DefaultContactMonitor::onContactChanged);
17
18 const QMap<QString, AbstractContact::Ptr> &contacts = m_allContactsMonitor->contacts();
20 if (it != contacts.constEnd()) {
21 setContact(it.value());
22 }
23}
24
25void DefaultContactMonitor::onContactAdded(const QString &id, const AbstractContact::Ptr &contact)
26{
27 if (id == contactUri()) {
28 setContact(contact);
29 }
30}
31
32void DefaultContactMonitor::onContactChanged(const QString &id, const AbstractContact::Ptr &contact)
33{
34 if (id == contactUri()) {
35 setContact(contact);
36 }
37}
38
39void DefaultContactMonitor::onContactRemoved(const QString &id)
40{
41 if (id == contactUri()) {
42 setContact(AbstractContact::Ptr());
43 }
44}
45
46#include "moc_defaultcontactmonitor_p.cpp"
const_iterator constEnd() const const
const_iterator constFind(const Key &key) const const
T * data() const const
QFuture< ArgsType< Signal > > connect(Sender *sender, Signal signal)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:15:03 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.