|
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 LOGSREADERSTATECONTEXT_H |
|
19 #define LOGSREADERSTATECONTEXT_H |
|
20 |
|
21 // INCLUDES |
|
22 #include <QList> |
|
23 #include <QHash> |
|
24 |
|
25 // FORWARD DECLARATION |
|
26 class LogsReaderStateBase; |
|
27 class CLogView; |
|
28 class CLogViewDuplicate; |
|
29 class CLogViewEvent; |
|
30 class LogsEvent; |
|
31 class LogsEventStrings; |
|
32 class TRequestStatus; |
|
33 class LogsReaderObserver; |
|
34 class CLogClient; |
|
35 |
|
36 // CLASS DECLARATION |
|
37 |
|
38 class ContactCacheEntry |
|
39 { |
|
40 public: |
|
41 inline ContactCacheEntry() : mRemoteParty(QString()), mContactLocalId(0) {} |
|
42 inline ContactCacheEntry( const ContactCacheEntry& entry ); |
|
43 inline ContactCacheEntry(QString remoteParty, unsigned int contactId); |
|
44 |
|
45 QString mRemoteParty; |
|
46 unsigned int mContactLocalId; |
|
47 }; |
|
48 |
|
49 |
|
50 /** |
|
51 * Context for reader state machine |
|
52 */ |
|
53 class LogsReaderStateContext { |
|
54 public: |
|
55 |
|
56 /** |
|
57 * Change state |
|
58 * @param state, new state |
|
59 */ |
|
60 virtual void setCurrentState(const LogsReaderStateBase& state) = 0; |
|
61 |
|
62 /** |
|
63 * Get log view |
|
64 * @return current log view |
|
65 */ |
|
66 virtual CLogView& logView() = 0; |
|
67 |
|
68 /** |
|
69 * Get duplicates view |
|
70 * @return current duplicates view |
|
71 */ |
|
72 virtual CLogViewDuplicate& duplicatesView() = 0; |
|
73 |
|
74 /** |
|
75 * Get event container |
|
76 * @return events |
|
77 */ |
|
78 virtual QList<LogsEvent*>& events() = 0; |
|
79 |
|
80 /** |
|
81 * Get view index |
|
82 * @return ref to view index |
|
83 */ |
|
84 virtual int& index() = 0; |
|
85 |
|
86 /** |
|
87 * Get commonly used strings |
|
88 * @return strings |
|
89 */ |
|
90 virtual LogsEventStrings& strings() = 0; |
|
91 |
|
92 /** |
|
93 * Request status for async operations |
|
94 * inside states |
|
95 * @return reqstatus |
|
96 */ |
|
97 virtual TRequestStatus& reqStatus() = 0; |
|
98 |
|
99 /** |
|
100 * Get observer |
|
101 * @return observer |
|
102 */ |
|
103 virtual LogsReaderObserver& observer() = 0; |
|
104 |
|
105 /** |
|
106 * Get contact cache |
|
107 * @return cache (key:telnum, value:contactname) |
|
108 */ |
|
109 virtual QHash<QString, ContactCacheEntry>& contactCache() = 0; |
|
110 |
|
111 /** |
|
112 * Get ID of the event to be handled |
|
113 * @return ID of the event |
|
114 */ |
|
115 virtual int currentEventId() = 0; |
|
116 |
|
117 /** |
|
118 * Get log client |
|
119 * @return log client |
|
120 */ |
|
121 virtual CLogClient& logClient() = 0; |
|
122 |
|
123 /** |
|
124 * Check if current view is recent view. |
|
125 * @return true if recent view |
|
126 */ |
|
127 virtual bool isRecentView() = 0; |
|
128 |
|
129 /** |
|
130 * Get event container for duplicated events |
|
131 * @return duplicated events |
|
132 */ |
|
133 virtual QList<LogsEvent*>& duplicatedEvents() = 0; |
|
134 }; |
|
135 |
|
136 |
|
137 |
|
138 inline ContactCacheEntry::ContactCacheEntry( const ContactCacheEntry& entry ) |
|
139 { |
|
140 mRemoteParty = entry.mRemoteParty; |
|
141 mContactLocalId = entry.mContactLocalId; |
|
142 } |
|
143 |
|
144 inline ContactCacheEntry::ContactCacheEntry(QString remoteParty, unsigned int contactId) |
|
145 { |
|
146 mRemoteParty = remoteParty; |
|
147 mContactLocalId = contactId; |
|
148 } |
|
149 |
|
150 #endif // LOGSREADERSTATECONTEXT_H |
|
151 |
|
152 |
|
153 // End of File |
|
154 |
|
155 |
|
156 |
|
157 |