File indexing completed on 2024-11-10 04:40:11

0001 /*
0002     SPDX-FileCopyrightText: 2011 Stephen Kelly <steveire@gmail.com>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #include "inspectablemonitor.h"
0008 using namespace std::chrono_literals;
0009 InspectableMonitorPrivate::InspectableMonitorPrivate(FakeMonitorDependenciesFactory *dependenciesFactory, InspectableMonitor *parent)
0010     : Akonadi::MonitorPrivate(dependenciesFactory, parent)
0011 {
0012 }
0013 
0014 void InspectableMonitor::doConnectToNotificationManager()
0015 {
0016     d_ptr->connectToNotificationManager();
0017 }
0018 
0019 InspectableMonitor::InspectableMonitor(FakeMonitorDependenciesFactory *dependenciesFactory, QObject *parent)
0020     : Monitor(new InspectableMonitorPrivate(dependenciesFactory, this), parent)
0021 {
0022     // Make sure signals don't get optimized away.
0023     // TODO: Make this parametrizable in the test class.
0024     connect(this, &Akonadi::Monitor::itemAdded, this, &InspectableMonitor::dummySignal);
0025     connect(this, &Akonadi::Monitor::itemChanged, this, &InspectableMonitor::dummySignal);
0026     connect(this, &Akonadi::Monitor::itemLinked, this, &InspectableMonitor::dummySignal);
0027     connect(this, &Akonadi::Monitor::itemMoved, this, &InspectableMonitor::dummySignal);
0028     connect(this, &Akonadi::Monitor::itemRemoved, this, &InspectableMonitor::dummySignal);
0029     connect(this, &Akonadi::Monitor::itemUnlinked, this, &InspectableMonitor::dummySignal);
0030     connect(this, &Akonadi::Monitor::collectionAdded, this, &InspectableMonitor::dummySignal);
0031     connect(this, SIGNAL(collectionChanged(Akonadi::Collection)), SIGNAL(dummySignal()));
0032     connect(this, SIGNAL(collectionChanged(Akonadi::Collection, QSet<QByteArray>)), SIGNAL(dummySignal()));
0033     connect(this, &Akonadi::Monitor::collectionMoved, this, &InspectableMonitor::dummySignal);
0034     connect(this, &Akonadi::Monitor::collectionRemoved, this, &InspectableMonitor::dummySignal);
0035     connect(this, &Akonadi::Monitor::collectionStatisticsChanged, this, &InspectableMonitor::dummySignal);
0036     connect(this, &Akonadi::Monitor::collectionSubscribed, this, &InspectableMonitor::dummySignal);
0037     connect(this, &Akonadi::Monitor::collectionUnsubscribed, this, &InspectableMonitor::dummySignal);
0038 
0039     QTimer::singleShot(0s, this, [this]() {
0040         doConnectToNotificationManager();
0041     });
0042 }
0043 
0044 #include "moc_inspectablemonitor.cpp"