1 /* |
|
2 * Copyright (c) 2003 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: This file contains the header file of the CCbsTopicList class. |
|
15 * |
|
16 * The server-side topic list subsession class. |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 |
|
22 #ifndef CCBSTOPICLIST_H |
|
23 #define CCBSTOPICLIST_H |
|
24 |
|
25 // INCLUDES |
|
26 #include "CCbsObject.h" |
|
27 #include "MCbsDbTopicListObserver.H" |
|
28 |
|
29 // FORWARD DECLARATIONS |
|
30 class CCbsSession; |
|
31 class CCbsRecEtel; |
|
32 class CCbsDbImpTopicList; |
|
33 |
|
34 // CLASS DECLARATION |
|
35 |
|
36 /** |
|
37 * Subsession for managing the topic list. |
|
38 */ |
|
39 class CCbsTopicList |
|
40 : public CCbsObject, public MCbsDbTopicListObserver |
|
41 { |
|
42 public: // New functions |
|
43 /** |
|
44 * Creates a new instance of the class. |
|
45 * |
|
46 * @param aSession Session |
|
47 * @param aTopicList Topic list |
|
48 * @param aReceiver Receiver. |
|
49 * @return The new instance of CCbsSettings. |
|
50 */ |
|
51 static CCbsTopicList* NewL( CCbsSession& aSession, |
|
52 CCbsDbImpTopicList& aTopicList, |
|
53 CCbsRecEtel& aReceiver ); |
|
54 |
|
55 /** |
|
56 * Destructor. |
|
57 */ |
|
58 ~CCbsTopicList(); |
|
59 |
|
60 public: // From CCbsObject |
|
61 |
|
62 /** |
|
63 * Handle the requests for the object. |
|
64 * |
|
65 * @param aMessage The message to be handled |
|
66 * @return ETrue, if the request was handled here |
|
67 */ |
|
68 TBool HandleRequestsL( const RMessage2& aMessage ); |
|
69 |
|
70 private: // From MCbsDbTopicListObserver |
|
71 |
|
72 /** |
|
73 * Called when the topic list is initialized. |
|
74 */ |
|
75 void TopicListInitializedIndL(); |
|
76 |
|
77 /** |
|
78 * Called whenever a topic is created. If necessary, |
|
79 * the client will be notified. |
|
80 * |
|
81 * @param aHandle A handle to the topic. |
|
82 */ |
|
83 void TopicAddedIndL( const TCbsDbTopicNumber& aNumber ); |
|
84 |
|
85 /** |
|
86 * Called whenever a topic is deleted. If necessary, |
|
87 * the client will be notified. |
|
88 * |
|
89 * @param aHandle A handle to the topic. |
|
90 */ |
|
91 void TopicDeletedIndL( const TCbsDbTopicNumber& aNumber ); |
|
92 |
|
93 /** |
|
94 * Called whenever a topic is modified. If necessary, |
|
95 * the client will be notified. |
|
96 * |
|
97 * @param aHandle A handle to the topic. |
|
98 */ |
|
99 void TopicModifiedIndL( const TCbsDbTopicNumber& aNumber ); |
|
100 |
|
101 /** |
|
102 * Called whenever a new message has been received. |
|
103 * If necessary, the client will be notified. |
|
104 * |
|
105 * @param aHandle A handle to the topic. |
|
106 */ |
|
107 void TopicNewMessageReceivedIndL( const TCbsDbMessageHandle& aHandle ); |
|
108 |
|
109 private: |
|
110 /** |
|
111 * Constructor. |
|
112 * |
|
113 * @param aSession Session |
|
114 * @param aTopicList Topic list manager |
|
115 * @param aReceiver Receiver |
|
116 */ |
|
117 CCbsTopicList( CCbsSession& aSession, |
|
118 CCbsDbImpTopicList& aTopicList, |
|
119 CCbsRecEtel& aReceiver ); |
|
120 |
|
121 /** |
|
122 * Finalizes construction. |
|
123 */ |
|
124 void ConstructL(); |
|
125 |
|
126 /** |
|
127 * Closes and destroys the subsession. |
|
128 * |
|
129 * Note that after the call has completed, the object is no longer |
|
130 * valid. It is also left for the callee's task to complete |
|
131 * the request. |
|
132 */ |
|
133 void CloseTopicList(); |
|
134 |
|
135 /** |
|
136 * Returns the total number of topics to the client. |
|
137 */ |
|
138 void GetTopicCountL(); |
|
139 |
|
140 /** |
|
141 * Returns the requested topic to the client. |
|
142 */ |
|
143 void GetTopicL(); |
|
144 |
|
145 /** |
|
146 * Finds a topic by number and returns it to the client. |
|
147 */ |
|
148 void FindTopicByNumberL(); |
|
149 |
|
150 /** |
|
151 * Deletes a topic by its number and returns it to the client. |
|
152 */ |
|
153 void DeleteTopicL(); |
|
154 |
|
155 /** |
|
156 * Changes a topic name and number. |
|
157 */ |
|
158 void ChangeTopicNameAndNumberL(); |
|
159 |
|
160 /** |
|
161 * Changes topic subscription status. |
|
162 */ |
|
163 void ChangeTopicSubscriptionStatusL(); |
|
164 |
|
165 /** |
|
166 * Changes topic hotmark status. |
|
167 */ |
|
168 void ChangeTopicHotmarkStatusL(); |
|
169 |
|
170 /** |
|
171 * Adds a topic to the list. |
|
172 */ |
|
173 void AddTopicL(); |
|
174 |
|
175 /** |
|
176 * Sets up a pending notification request. |
|
177 */ |
|
178 void NotifyOnEvent(); |
|
179 |
|
180 /** |
|
181 * Cancels a pending notification request. |
|
182 */ |
|
183 void NotifyOnEventCancel(); |
|
184 |
|
185 /** |
|
186 * Returns the number of "new" topics to the client. |
|
187 * |
|
188 * By new it is referred to topics that are created because of |
|
189 * topic detection since last power on. |
|
190 */ |
|
191 void GetNewTopicsCountL(); |
|
192 |
|
193 /** |
|
194 * Retrieves the number of the topic that was added |
|
195 * last to the topic list. |
|
196 */ |
|
197 void GetLatestTopicNumberL(); |
|
198 |
|
199 /** |
|
200 * Returns the total amount of unread messages. |
|
201 */ |
|
202 void GetUnreadMessageCountL(); |
|
203 |
|
204 /** |
|
205 * Returns a handle to the latest (that is not yet taken) |
|
206 * hotmarked message handle. |
|
207 */ |
|
208 void GetHotmarkedMessageHandleL(); |
|
209 |
|
210 /** |
|
211 * Returns the number of hotmarked, unread messages. |
|
212 */ |
|
213 void GetUnreadHotmarkedMessageCountL(); |
|
214 |
|
215 /** |
|
216 * Deletes all topics. |
|
217 */ |
|
218 void DeleteAllL(); |
|
219 |
|
220 /** |
|
221 * If there is a pending notify request, notifies |
|
222 * the client. |
|
223 * |
|
224 * @param aEvent The type of event |
|
225 * @param aNumber The topic which was affected |
|
226 */ |
|
227 void NotifyClientL( TCbsTopicListEvent aEvent, |
|
228 TCbsTopicNumber aNumber ); |
|
229 |
|
230 /** |
|
231 * Retrieves and returns the numbers of topics that |
|
232 * precede and succeed the given topic in topic list. |
|
233 * |
|
234 * Also returns two flags indicating whether the |
|
235 * given topic is the first and/or the last topic in list. |
|
236 */ |
|
237 void GetNextAndPrevTopicNumberL(); |
|
238 |
|
239 private: // Prohibited operators and functions |
|
240 |
|
241 // Copy constructor |
|
242 CCbsTopicList( const CCbsTopicList& ); |
|
243 |
|
244 // Assignment operator |
|
245 CCbsTopicList& operator=( const CCbsTopicList& ); |
|
246 |
|
247 private: // Data |
|
248 |
|
249 // Referebce to the topic list db. |
|
250 CCbsDbImpTopicList& iTopicList; |
|
251 |
|
252 // Reference to the receiver. |
|
253 CCbsRecEtel& iReceiver; |
|
254 |
|
255 // Indicates whether there is an active notify request. |
|
256 TBool iIsMessage; |
|
257 |
|
258 // The message for pending notify request. |
|
259 RMessage2 iMessage; |
|
260 |
|
261 }; |
|
262 |
|
263 #endif // CCBSTOPICLIST_H |
|
264 |
|
265 // End of File |
|
266 |
|
267 |
|