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 #pragma once 0008 0009 #include "changerecorder.h" 0010 #include "changerecorder_p.h" 0011 #include "entitycache_p.h" 0012 0013 #include "akonaditestfake_export.h" 0014 #include "fakeakonadiservercommand.h" 0015 #include "fakeentitycache.h" 0016 0017 class InspectableChangeRecorder; 0018 0019 class InspectableChangeRecorderPrivate : public Akonadi::ChangeRecorderPrivate 0020 { 0021 public: 0022 InspectableChangeRecorderPrivate(FakeMonitorDependenciesFactory *dependenciesFactory, InspectableChangeRecorder *parent); 0023 ~InspectableChangeRecorderPrivate() override 0024 { 0025 } 0026 0027 bool emitNotification(const Akonadi::Protocol::ChangeNotificationPtr &msg) override 0028 { 0029 // TODO: Check/Log 0030 return Akonadi::ChangeRecorderPrivate::emitNotification(msg); 0031 } 0032 }; 0033 0034 class AKONADITESTFAKE_EXPORT InspectableChangeRecorder : public Akonadi::ChangeRecorder 0035 { 0036 Q_OBJECT 0037 public: 0038 explicit InspectableChangeRecorder(FakeMonitorDependenciesFactory *dependenciesFactory, QObject *parent = nullptr); 0039 0040 FakeNotificationConnection *notificationConnection() const 0041 { 0042 return qobject_cast<FakeNotificationConnection *>(d_ptr->ntfConnection); 0043 } 0044 0045 QQueue<Akonadi::Protocol::ChangeNotificationPtr> pendingNotifications() const 0046 { 0047 return d_ptr->pendingNotifications; 0048 } 0049 QQueue<Akonadi::Protocol::ChangeNotificationPtr> pipeline() const 0050 { 0051 return d_ptr->pipeline; 0052 } 0053 0054 Q_SIGNALS: 0055 void dummySignal(); 0056 0057 private Q_SLOTS: 0058 void dispatchNotifications() 0059 { 0060 d_ptr->dispatchNotifications(); 0061 } 0062 0063 void doConnectToNotificationManager(); 0064 0065 private: 0066 struct MessageStruct { 0067 enum Position { 0068 Queued, 0069 FilterPipelined, 0070 Pipelined, 0071 Emitted, 0072 }; 0073 Position position; 0074 }; 0075 QQueue<MessageStruct> m_messages; 0076 };