|
1 /* |
|
2 * Copyright (c) 2007-2008 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: message flow handling |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef _CIMCVAPPMESSAGEFLOWHANDLER_H |
|
21 #define _CIMCVAPPMESSAGEFLOWHANDLER_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32base.h> |
|
25 #include "mimcvenginemessageobserver.h" |
|
26 #include "mimcvenginechatlistobserver.h" |
|
27 |
|
28 class MIMCVEngineMessageReadInterface; |
|
29 class MIMCVEngineMessageContainer; |
|
30 class CIMCVEngineContextObserver; |
|
31 class CIMCVEngine; |
|
32 // CLASS DECLARATION |
|
33 |
|
34 /** |
|
35 * Flow controller for messages |
|
36 * |
|
37 * @imcvuiapp.exe |
|
38 * @since Series 60 5.0 |
|
39 */ |
|
40 class CIMCVAppMessageFlowHandler : public CTimer, |
|
41 public MIMCVEngineMessageObserver, |
|
42 public MIMCVEngineChatListObserver |
|
43 { |
|
44 |
|
45 |
|
46 |
|
47 public: |
|
48 |
|
49 /** |
|
50 * Should we fetch new messages or not |
|
51 * @param aFetch ETrue if this chat is in foreground and should |
|
52 * receive messages, EFalse otherwise. |
|
53 */ |
|
54 void FetchMessages( TBool aFetch ); |
|
55 |
|
56 |
|
57 |
|
58 protected: // Functions from MIMCVEngineMessageObserver |
|
59 |
|
60 /** |
|
61 * Handle events. |
|
62 * @param aEvent Event to handle. |
|
63 * @param aIndex, Index of message which is affected by event. |
|
64 */ |
|
65 void HandleMessageEvent( TMessageEventType aEvent, TInt aIndex ); |
|
66 |
|
67 private: |
|
68 /* |
|
69 * See MIMCVEngineChatListObserver |
|
70 */ |
|
71 void HandleChatListEvent(TInt aServiceId, TChatListEventType aEvent, |
|
72 MIMCVEngineMessageReadInterface* aContainerInfo ) ; |
|
73 |
|
74 protected: // Functions from CTimer |
|
75 |
|
76 /** |
|
77 * @see CTimer |
|
78 */ |
|
79 void RunL(); |
|
80 |
|
81 /** |
|
82 * @see CActive |
|
83 */ |
|
84 TInt RunError( TInt aError ); |
|
85 |
|
86 |
|
87 |
|
88 private: // New functions |
|
89 |
|
90 /** |
|
91 * Get flow control value from settings |
|
92 */ |
|
93 void UpdateTimeIntervalL(); |
|
94 |
|
95 /** |
|
96 * Is opening on going or not. |
|
97 * @return ETrue if opening on going, EFalse otherwise. |
|
98 */ |
|
99 TBool IsOpening() const; |
|
100 |
|
101 |
|
102 |
|
103 private: |
|
104 |
|
105 /** |
|
106 * C++ default constructor. |
|
107 */ |
|
108 CIMCVAppMessageFlowHandler(MIMCVEngineMessageContainer& aMessageContainer, |
|
109 MIMCVEngineMessageReadInterface& aReadInterface, |
|
110 CIMCVEngine& aActiveEngine ); |
|
111 |
|
112 /** |
|
113 * By default Symbian 2nd phase constructor is private. |
|
114 */ |
|
115 void ConstructL( TBool aScrollOver ); |
|
116 |
|
117 public: // Constructors and destructor |
|
118 |
|
119 /** |
|
120 * Two-phased constructor. |
|
121 * @param aMessageContainer Interface to UI side message container |
|
122 * @param aReadInterface Message read interface |
|
123 * @param aScrollOver Is scroll over required |
|
124 * or not. |
|
125 */ |
|
126 static CIMCVAppMessageFlowHandler* NewL( |
|
127 MIMCVEngineMessageContainer& aMessageContainer, |
|
128 MIMCVEngineMessageReadInterface& aReadInterface, |
|
129 CIMCVEngine& aActiveEngine, |
|
130 TBool aScrollOver ); |
|
131 |
|
132 /** |
|
133 * Destructor. |
|
134 */ |
|
135 virtual ~CIMCVAppMessageFlowHandler(); |
|
136 |
|
137 |
|
138 private: // Data |
|
139 |
|
140 // Interface for UI side message container |
|
141 // Not owned |
|
142 MIMCVEngineMessageContainer& iMessages; |
|
143 |
|
144 // Interface for fetching messages |
|
145 // Not owned |
|
146 MIMCVEngineMessageReadInterface& iReadInterface; |
|
147 |
|
148 CIMCVEngine& iActiveEngine; |
|
149 |
|
150 // time interval for receiving messages |
|
151 TTimeIntervalMicroSeconds32 iTimeInterval; |
|
152 |
|
153 // Is chat deleted already |
|
154 TBool iChatDeleted; |
|
155 |
|
156 // Should we fetch new messages |
|
157 TBool iFetchMessages; |
|
158 |
|
159 // Index for fetching messages |
|
160 TInt iMsgIndex; |
|
161 |
|
162 // Initial count for messages |
|
163 TInt iInitialMsgCount; |
|
164 |
|
165 // Is new message received while opening the chat |
|
166 TBool iNewMsgWhileOpening; |
|
167 |
|
168 // Flag is read from CR variation in class construction |
|
169 // ETrue in releases >= 3.2 |
|
170 // EFalse in releases < 3.2 |
|
171 // Set to EFalse if this handler is used to handle |
|
172 // recorded chat |
|
173 TBool iBgOpeningMode; |
|
174 |
|
175 TInt iAddedUnreadMsgs; |
|
176 |
|
177 |
|
178 }; |
|
179 |
|
180 |
|
181 #endif // _CIMCVAPPMESSAGEFLOWHANDLER_H |
|
182 |
|
183 // End of File |