Update the post insert behaviour of the RtcomEventLogger backend to update storage...
[qwerkisync] / DBBackends / RtcomEventLogger.h
index d99d4c4..728c137 100644 (file)
 #define DBBACKENDS_RTCOMEVENTLOGGER_H
 
 #include "iDBBackend.h"
-
-class Settings;
+#include "Settings.h"
 
 class _RTComElAttachment;
 typedef _RTComElAttachment RTComElAttachment;
 class _RTComElEvent;
 typedef _RTComElEvent RTComElEvent;
+class _RTComEl;
+typedef _RTComEl RTComEl;
 
 template <typename T1> class QList;
+class QString;
+class QStringList;
 
 #include <QHash>
 
 namespace DBBackends
 {
+       namespace RtcomEventLoggerComponents { class TriggerDisabler; }
+
        class RtcomEventLogger : public iDBBackend
        {
        public:
                RtcomEventLogger(const Settings &settings);
                RtcomEventLogger(const Settings &settings, const EventTypes::RtcomEvent &event);
 
+               virtual void PreInsert();
                virtual void Insert(EventTypes::iEvent &event, const NumberToNameLookup &numberToNameLookup);
+               virtual void PostInsert();
                virtual void Process(EventProcessors::iEventProcessor &eventProcessor);
 
        protected:
@@ -48,20 +55,26 @@ namespace DBBackends
 
        protected:
                virtual EventTypes::iEvent *const CreateEvent(RTComElEvent &revent, QList<RTComElAttachment*> &rattachments);
+               void ProcessService(EventProcessors::iEventProcessor &processor, const EventTypes::eEventTypes service, const RTComEl &el);
+
+               virtual const QList<uint> &InsertedIDs() const { return m_InsertedIDs; }
+
+       public:
+               virtual void ClearInsertedIDs();
 
        private:
+               void UpdateInsertedStorageTimes();
+               void Reindex();
+               QStringList IntsToStringList(QList<uint> &values);
+
                const Settings &m_Settings;
 
-               enum ServiceID
-               {
-                       SERVICE_ID_CALL,
-                       SERVICE_ID_CHAT,
-                       SERVICE_ID_SMS,
-                       SERVICE_ID_MMS,
-                       SERVICE_ID_SIZE
-               };
+               QHash<EventTypes::eEventTypes, int> m_ServiceIDs;
+
+               QList<uint> m_InsertedIDs;
+               QList<uint> &InsertedIDs() { return m_InsertedIDs; }
 
-               QHash<ServiceID, int> m_ServiceIDs;
+               RtcomEventLoggerComponents::TriggerDisabler *m_TriggerDisabler;
        };
 }