|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef LOGSWORKER_H |
|
19 #define LOGSWORKER_H |
|
20 |
|
21 // INCLUDES |
|
22 #include <QList> |
|
23 #include <e32base.h> |
|
24 #include "logsstatebasecontext.h" |
|
25 |
|
26 // FORWARD DECLARATION |
|
27 class CLogViewRecent; |
|
28 class CLogClient; |
|
29 class CLogViewEvent; |
|
30 class CLogViewDuplicate; |
|
31 class LogsStateBase; |
|
32 |
|
33 // CLASS DECLARATION |
|
34 |
|
35 |
|
36 |
|
37 /** |
|
38 * LogsReader is used to read events from database |
|
39 */ |
|
40 class LogsWorker : public CActive, |
|
41 public LogsStateBaseContext |
|
42 { |
|
43 |
|
44 friend class UT_LogsReader; |
|
45 friend class UT_LogsDbConnector; |
|
46 |
|
47 public: |
|
48 |
|
49 /** |
|
50 * Constructor |
|
51 * @param readAllEvents, true if all events in db should be read, |
|
52 * otherwise only recent events are read |
|
53 */ |
|
54 LogsWorker( bool readAllEvents = false ); |
|
55 |
|
56 /** |
|
57 * Destructor. |
|
58 */ |
|
59 virtual ~LogsWorker(); |
|
60 |
|
61 protected: // From CActive |
|
62 |
|
63 void RunL(); |
|
64 void DoCancel(); |
|
65 TInt RunError(TInt error); |
|
66 |
|
67 protected: // From LogsStateBaseContext |
|
68 |
|
69 inline void setCurrentState(const LogsStateBase& state); |
|
70 inline CLogView& logView(); |
|
71 inline CLogViewDuplicate& duplicatesView(); |
|
72 inline int& index(); |
|
73 inline TRequestStatus& reqStatus(); |
|
74 inline int currentEventId(); |
|
75 inline CLogClient& logClient(); |
|
76 inline bool isRecentView(); |
|
77 |
|
78 protected: |
|
79 |
|
80 LogsStateBase& currentState(); |
|
81 |
|
82 protected: // data |
|
83 |
|
84 bool mReadAllEvents; |
|
85 |
|
86 CLogClient* mLogClient; |
|
87 CLogViewRecent* mLogViewRecent; |
|
88 CLogViewEvent* mLogViewEvent; |
|
89 CLogViewDuplicate* mDuplicatesView; |
|
90 |
|
91 int mIndex; |
|
92 int mCurrentStateIndex; |
|
93 QList<LogsStateBase*>* mCurrentStateMachine; |
|
94 int mCurrentEventId; |
|
95 }; |
|
96 |
|
97 #endif // LOGSWORKER_H |
|
98 |
|
99 |
|
100 // End of File |
|
101 |
|
102 |
|
103 |
|
104 |