22 #include <QList> |
22 #include <QList> |
23 #include <QHash> |
23 #include <QHash> |
24 #include <e32base.h> |
24 #include <e32base.h> |
25 #include <logclientchangeobserver.h> |
25 #include <logclientchangeobserver.h> |
26 #include <logviewchangeobserver.h> |
26 #include <logviewchangeobserver.h> |
|
27 #include "logsworker.h" |
27 #include "logsreaderstatecontext.h" |
28 #include "logsreaderstatecontext.h" |
28 #include "logsreaderstates.h" |
29 #include "logsreaderstates.h" |
29 |
30 |
30 // FORWARD DECLARATION |
31 // FORWARD DECLARATION |
31 class CLogViewRecent; |
32 class CLogViewRecent; |
42 |
43 |
43 |
44 |
44 /** |
45 /** |
45 * LogsReader is used to read events from database |
46 * LogsReader is used to read events from database |
46 */ |
47 */ |
47 class LogsReader : public CActive, |
48 class LogsReader : public LogsWorker, |
48 public MLogClientChangeObserver, |
49 public MLogClientChangeObserver, |
49 public MLogViewChangeObserver, |
50 public MLogViewChangeObserver, |
50 public LogsReaderStateContext |
51 public LogsReaderStateContext |
51 { |
52 { |
52 |
53 |
115 */ |
116 */ |
116 int readDuplicates(int eventId); |
117 int readDuplicates(int eventId); |
117 |
118 |
118 protected: // From CActive |
119 protected: // From CActive |
119 |
120 |
120 void RunL(); |
|
121 void DoCancel(); |
|
122 TInt RunError(TInt error); |
121 TInt RunError(TInt error); |
123 |
122 |
124 private: // From MLogClientChangeObserver |
123 private: // From MLogClientChangeObserver |
125 |
124 |
126 void HandleLogClientChangeEventL( TUid aChangeType, |
125 void HandleLogClientChangeEventL( TUid aChangeType, |
140 void HandleLogViewChangeEventDeletedL( |
139 void HandleLogViewChangeEventDeletedL( |
141 TLogId aId, TInt aViewIndex, |
140 TLogId aId, TInt aViewIndex, |
142 TInt aChangeIndex, TInt aTotalChangeCount); |
141 TInt aChangeIndex, TInt aTotalChangeCount); |
143 |
142 |
144 private: // From LogsReaderStateContext |
143 private: // From LogsReaderStateContext |
145 |
144 |
146 inline void setCurrentState(const LogsReaderStateBase& state); |
|
147 inline CLogView& logView(); |
|
148 inline CLogViewDuplicate& duplicatesView(); |
|
149 inline QList<LogsEvent*>& events(); |
145 inline QList<LogsEvent*>& events(); |
150 inline int& index(); |
|
151 inline LogsEventStrings& strings(); |
146 inline LogsEventStrings& strings(); |
152 inline TRequestStatus& reqStatus(); |
|
153 inline LogsReaderObserver& observer(); |
147 inline LogsReaderObserver& observer(); |
154 inline QHash<QString, ContactCacheEntry>& contactCache(); |
148 inline QHash<QString, ContactCacheEntry>& contactCache(); |
155 inline int currentEventId(); |
|
156 inline CLogClient& logClient(); |
|
157 inline bool isRecentView(); |
|
158 inline QList<LogsEvent*>& duplicatedEvents(); |
149 inline QList<LogsEvent*>& duplicatedEvents(); |
159 |
150 |
160 private: |
151 private: |
161 |
152 |
162 void startL(); |
153 void startL(); |
166 /** |
157 /** |
167 * Cancel all outstanding requests if possible. In case of deleting is |
158 * Cancel all outstanding requests if possible. In case of deleting is |
168 * in progress, it will leave with error |
159 * in progress, it will leave with error |
169 */ |
160 */ |
170 void cancelCurrentRequestL(); |
161 void cancelCurrentRequestL(); |
171 LogsReaderStateBase& currentState(); |
|
172 void initializeReadStates(); |
162 void initializeReadStates(); |
173 void initializeModifyingStates(); |
163 void initializeModifyingStates(); |
174 void initializeDuplicateReadingStates(); |
164 void initializeDuplicateReadingStates(); |
175 void handleViewChange( int totalChangeCount = 1 ); |
165 void handleViewChange( int totalChangeCount = 1 ); |
176 void handleError(int error); |
166 void handleError(int error); |
181 void setGlobalObserver(); |
171 void setGlobalObserver(); |
182 void clearGlobalObserver(); |
172 void clearGlobalObserver(); |
183 |
173 |
184 private: // data |
174 private: // data |
185 |
175 |
186 CLogViewRecent* mLogViewRecent; |
|
187 CLogViewEvent* mLogViewEvent; |
|
188 CLogViewDuplicate* mDuplicatesView; |
|
189 |
|
190 RFs& mFsSession; |
176 RFs& mFsSession; |
191 CLogClient& mLogClient; |
|
192 LogsEventStrings& mStrings; |
177 LogsEventStrings& mStrings; |
193 QList<LogsEvent*>& mEvents; |
178 QList<LogsEvent*>& mEvents; |
194 LogsReaderObserver& mObserver; |
179 LogsReaderObserver& mObserver; |
195 bool mReadAllEvents; |
180 |
196 |
181 QList<LogsStateBase*> mReadStates; |
197 int mIndex; |
182 QList<LogsStateBase*> mModifyingStates; |
198 QList<LogsReaderStateBase*> mReadStates; |
183 QList<LogsStateBase*> mDuplicateReadingStates; |
199 QList<LogsReaderStateBase*> mModifyingStates; |
184 |
200 QList<LogsReaderStateBase*> mDuplicateReadingStates; |
|
201 int mCurrentStateIndex; |
|
202 QList<LogsReaderStateBase*>* mCurrentStateMachine; |
|
203 |
|
204 QHash<QString, ContactCacheEntry> mContactCache; |
185 QHash<QString, ContactCacheEntry> mContactCache; |
205 QList<LogsEvent*> mDuplicatedEvents; |
186 QList<LogsEvent*> mDuplicatedEvents; |
206 |
187 |
207 int mCurrentEventId; |
|
208 bool mGlobalObserverSet; |
188 bool mGlobalObserverSet; |
209 }; |
189 }; |
210 |
190 |
211 #endif // LOGSREADER_H |
191 #endif // LOGSREADER_H |
212 |
192 |