|
1 /* |
|
2 * Copyright (c) 2002 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 * Item array for the message items to be displayed by mce. |
|
16 * Main view items are kept in memory (CArrayFixFlat<TMceListItem>) when created but |
|
17 * Message view list items are fetched from the msgs when needed in MdcaPoint function |
|
18 * |
|
19 */ |
|
20 |
|
21 |
|
22 |
|
23 #ifndef MCEMAINVIEWLISTITEMARRAY_H |
|
24 #define MCEMAINVIEWLISTITEMARRAY_H |
|
25 |
|
26 // INCLUDES |
|
27 |
|
28 #include <bldvariant.hrh> |
|
29 #include <msvapi.h> // MMsvSessionObserver |
|
30 #include <bamdesca.h> // MDesCArray |
|
31 #include <badesca.h> // CDesCArrayFlat |
|
32 |
|
33 |
|
34 #include "MceListItem.h" |
|
35 #include "MceUtils.h" |
|
36 #include "MceUtilsIdleClass.h" |
|
37 |
|
38 #include "mcetemplate.h" |
|
39 #include <PhCltTypes.h> |
|
40 |
|
41 // CONSTANTS |
|
42 |
|
43 // FORWARD DECLARATIONS |
|
44 class CMsvSession; |
|
45 class CMceBitmapResolver; |
|
46 class MMtmUiDataRegistryObserver; |
|
47 class CMtmUiDataRegistry; |
|
48 class CImumInternalApi; |
|
49 class CImumInSettingsData; |
|
50 class CMceLogEngine; |
|
51 class CRepository; |
|
52 class CCoeEnv; |
|
53 |
|
54 /** |
|
55 * Main view list item array observer. |
|
56 * Called when main view list item texts are updated |
|
57 * @since S60 5.0 |
|
58 */ |
|
59 class MMceMainViewListItemArrayObserver |
|
60 { |
|
61 public: |
|
62 /** |
|
63 * Called when idle loader has changed main view text |
|
64 * TODO: add what has happened, add, remove, update etc.? |
|
65 */ |
|
66 virtual void MceListItemArrayChangedL( |
|
67 ) = 0; |
|
68 }; |
|
69 |
|
70 |
|
71 // CLASS DECLARATION |
|
72 |
|
73 /** |
|
74 * Item array for the message items to be displayed by mce. |
|
75 * Main view items are kept in memory (CArrayFixFlat<TMceListItem>) when created but |
|
76 * Message view list items are fetched from the msgs when needed in MdcaPoint function |
|
77 */ |
|
78 class CMceMainViewListItemArray : |
|
79 public CArrayFixFlat<TMceListItem>, |
|
80 public MMsvSessionObserver, |
|
81 public MDesCArray, |
|
82 public MMceUtilsIdleClassObserver |
|
83 { |
|
84 public: |
|
85 /** |
|
86 * Two-phased constructor. |
|
87 */ |
|
88 static CMceMainViewListItemArray* NewL( |
|
89 CMsvSessionPtr aSession, |
|
90 TMsvId aFolderId, |
|
91 TMceListType aListType, |
|
92 CMceBitmapResolver& aBitmapResolver ); |
|
93 |
|
94 /** |
|
95 * Destructor. |
|
96 */ |
|
97 virtual ~CMceMainViewListItemArray(); |
|
98 |
|
99 public: |
|
100 |
|
101 /** |
|
102 * Returns list index of the message |
|
103 * @param aItemId: item to be searched. |
|
104 * @return Index of the item. |
|
105 */ |
|
106 TInt ItemIndex( TMsvId aItemId ) const; |
|
107 |
|
108 |
|
109 /** |
|
110 * Returns list index of the extra item: |
|
111 * KMceWriteMessageListIdValue |
|
112 * KMceNoMailboxesListIdValue |
|
113 * KMceDeliveryReportsListIdValue |
|
114 * @param aItemId: item to be searched. |
|
115 * @return Index of the item. |
|
116 * @since S60 v5.0 |
|
117 */ |
|
118 TInt ExtraItemIndex( TInt aItemId ) const; |
|
119 |
|
120 /** |
|
121 * Returns message id of the list item. |
|
122 * @param aIndex: index of the item to be returned |
|
123 * @return message id (TMsvId) |
|
124 */ |
|
125 TMsvId ItemId( TInt aIndex ) const; |
|
126 |
|
127 /** |
|
128 * @param aIndex |
|
129 * @return TMceListItem |
|
130 */ |
|
131 const TMceListItem Item( TInt aIndex ) const; |
|
132 |
|
133 /** |
|
134 * Changes folder of the list. |
|
135 * @param aFolderId: folder id to be changed. |
|
136 */ |
|
137 void SetFolderL( TMsvId aFolderId ); |
|
138 |
|
139 /** |
|
140 * Returns main view's extra item command text. |
|
141 * See more details of main view extra items from |
|
142 * mceextraitems project. |
|
143 * @param aCommandId: command id received from the menu (CMceMainViewListView::StartAppL) |
|
144 * @return: command text buffer. for example 'http://www.nokia.com'. |
|
145 * if aCommandId not found, then empty buffer returned. |
|
146 * @since S60 v5.0 |
|
147 */ |
|
148 HBufC* ExtraItemCommandLC( TInt aCommandId ); |
|
149 |
|
150 private: |
|
151 /** |
|
152 * Add item not in msgs (CBS, ...). |
|
153 * @param aNewItem: TMceListItem to be added to the list |
|
154 * @param aIndex: index in the list to be added (0 = first) |
|
155 */ |
|
156 void AddExtraItemL( TMceListItem& aNewItem, TInt aIndex ); |
|
157 |
|
158 /** |
|
159 * Add item not in msgs (CBS, ...). |
|
160 * @param aNewItem: TMceListItem to be added to the list |
|
161 * @param aIndex: index in the list to be added (0 = first) |
|
162 * @param aIconIndex: index of the icon in file MceExtraIcons |
|
163 * @param aApplicationUid: Related Application uid. This is used |
|
164 * when loading correct application icon. If this is not set, |
|
165 * then icon is loaded from MceExtraIcons. |
|
166 */ |
|
167 void AddExtraItemWithIconL( |
|
168 TMceListItem& aNewItem, |
|
169 TInt aIndex, |
|
170 TInt aIconIndex, |
|
171 TUid aApplicationUid ); |
|
172 |
|
173 public: |
|
174 /** |
|
175 * Help needs info, if remote folder or own folder |
|
176 */ |
|
177 TBool IsFolderRemote() const; |
|
178 |
|
179 /** |
|
180 * Checks if mail account is always online |
|
181 * @param aAccount: service id |
|
182 * @param aAlwaysOnlineSettings: CIMASettingsDataExtension reference |
|
183 * Returns ETrue, if always online account |
|
184 */ |
|
185 TBool AlwaysOnlineAccountL( |
|
186 const TMsvId aAccount, |
|
187 const CImumInSettingsData& aAlwaysOnlineSettings ) const; |
|
188 |
|
189 /** |
|
190 * Sets roaming flag |
|
191 * @param aRoaming: roaming flag |
|
192 */ |
|
193 void SetRoaming( TBool aRoaming ); |
|
194 |
|
195 /** |
|
196 * Gets roaming flag |
|
197 */ |
|
198 TBool Roaming() const; |
|
199 |
|
200 /** |
|
201 * Sets always online flag |
|
202 * @param aAlwaysOnline: always online flag |
|
203 */ |
|
204 void SetAlwaysOnline( TBool aAlwaysOnline ); |
|
205 |
|
206 /* |
|
207 * Gets results from MceUtils::GetHealthyMailboxListL |
|
208 * @para aCount: iMailboxArray.Count() |
|
209 * @return err from MceUtils::GetHealthyMailBoxL() |
|
210 * from 3.2 |
|
211 */ |
|
212 TInt GetHealthyMailboxListResult( TInt& aCount ); |
|
213 |
|
214 |
|
215 public: // Functions from base classes |
|
216 |
|
217 /** |
|
218 * From MDesCArray |
|
219 */ |
|
220 virtual TInt MdcaCount() const; |
|
221 |
|
222 /** |
|
223 * From MDesCArray |
|
224 */ |
|
225 virtual TPtrC MdcaPoint(TInt aIndex) const; |
|
226 |
|
227 public: // Functions from base classes |
|
228 /** |
|
229 * From MMsvSessionObserver |
|
230 */ |
|
231 virtual void HandleSessionEventL( |
|
232 TMsvSessionEvent aEvent, |
|
233 TAny* aArg1, |
|
234 TAny* aArg2, |
|
235 TAny* aArg3); |
|
236 |
|
237 /** |
|
238 * Reconstructs main view folder list |
|
239 */ |
|
240 void ConstructMainViewL(); |
|
241 |
|
242 /** |
|
243 * Help needs folder id |
|
244 */ |
|
245 TMsvId FolderId() const; |
|
246 |
|
247 /** |
|
248 * Help needs info, if remote account is connected |
|
249 */ |
|
250 TBool IsConnected() const; |
|
251 |
|
252 /** |
|
253 * Returns the pointer to Imum's internal email API |
|
254 * |
|
255 * @since S60 v3.2 |
|
256 * @return pointer to email API |
|
257 */ |
|
258 CImumInternalApi* GetEmailApi(); |
|
259 |
|
260 /** |
|
261 * |
|
262 */ |
|
263 void ResetIconIndexL( TInt aIndex ); |
|
264 |
|
265 /** |
|
266 * |
|
267 */ |
|
268 void StartListUpdateL(); |
|
269 |
|
270 TBool MMceUtilsIdleClassStepL(); |
|
271 void SetListItemArrayObserver( MMceMainViewListItemArrayObserver* aObserver ); |
|
272 |
|
273 private: |
|
274 |
|
275 /** |
|
276 * By default Symbian OS constructor is private. |
|
277 */ |
|
278 void ConstructL(); |
|
279 |
|
280 /** |
|
281 * |
|
282 */ |
|
283 CMceMainViewListItemArray( |
|
284 CMsvSessionPtr aSession, |
|
285 TMsvId aFolderId, |
|
286 TMceListType aListType, |
|
287 CMceBitmapResolver& aBitmapResolver ); |
|
288 |
|
289 /** |
|
290 * Adds TMsvEntry to the array (used only in Main view). |
|
291 * @param aEntry TMsvEntry of the item to be added. |
|
292 * @return nothing |
|
293 */ |
|
294 void AddItemL( const TMsvEntry& aEntry ); |
|
295 |
|
296 /** |
|
297 * Adds main view folders to the array (used only in Main view) |
|
298 */ |
|
299 void AddFoldersL(); |
|
300 |
|
301 /** |
|
302 * Adds folders Inbox and Documents to the array |
|
303 * (used only in Main view). |
|
304 */ |
|
305 void AddInboxDocumentsL(); |
|
306 |
|
307 /** |
|
308 * Adds folders Draft, Sent, Outbox to the array |
|
309 * (used only in Main view). |
|
310 */ |
|
311 void AddDraftSentOutboxL(); |
|
312 |
|
313 /** |
|
314 * Appends aSourceString to aTargetString and changes KColumnListSeparator |
|
315 * characters to space characters. |
|
316 * @param aTargetString buffer to append aSource string. |
|
317 * @param aSourceString source buffer. |
|
318 */ |
|
319 void StripAndAppendString(TDes& aTargetString, const TDesC& aSourceString) const; |
|
320 |
|
321 /** |
|
322 * Creates string for main view listbox. Called by MdcaPoint. |
|
323 * @param aIndex: index of the message to be drawn |
|
324 */ |
|
325 TPtrC MakeStringForMainView( TInt aIndex ) const; |
|
326 |
|
327 /** |
|
328 * Checks if always online account and always online date/time valid |
|
329 * @param aAccount: service id |
|
330 * @return ETrue,if always online account and always online date/time valid |
|
331 */ |
|
332 TBool AlwaysOnlineDateTimeValidL( const TMsvId aAccount, TBool &aoDefined ) const; |
|
333 |
|
334 |
|
335 /** |
|
336 * Handles folders, messages string |
|
337 * @param aBuffer: buffer to be append |
|
338 * @param aEntry TMsvEntry of the item. |
|
339 */ |
|
340 void HandleFolderMessagesStringL( TDes& aBuffer, const TMsvEntry& aEntry ) const; |
|
341 |
|
342 /** |
|
343 * |
|
344 * |
|
345 * @since S60 v3.2 |
|
346 * @param |
|
347 * @return |
|
348 * @leave &(leavedesc)s |
|
349 */ |
|
350 void StoreIndex( const TInt aIndex ); |
|
351 |
|
352 /** |
|
353 * |
|
354 * |
|
355 * @since S60 v3.1 |
|
356 * @param |
|
357 * @return |
|
358 * @leave |
|
359 */ |
|
360 void MakeItemL( |
|
361 TMceListItem& aListItem, |
|
362 const TMsvEntry& aEntry ) const; |
|
363 |
|
364 /** |
|
365 * |
|
366 * |
|
367 * @since S60 v3.1 |
|
368 * @param |
|
369 * @return |
|
370 * @leave |
|
371 */ |
|
372 void InsertItemL( |
|
373 const TMsvEntry& aEntry, |
|
374 const TInt aIndex ); |
|
375 |
|
376 /** |
|
377 * Checks if the entry can be added to list |
|
378 * |
|
379 * @since S60 v3.1 |
|
380 * @param aEntry Entry to be checked |
|
381 * @param aId Id to be checked |
|
382 * @return ETrue when the entry can be added to list |
|
383 * @return EFalse when the entry can NOT be added to list |
|
384 */ |
|
385 TBool ShouldAddToListL( |
|
386 const TMsvEntry& aEntry, |
|
387 const TMsvId aId ); |
|
388 |
|
389 |
|
390 /** |
|
391 * Gathers all the services that needs to be shown to the list |
|
392 * |
|
393 * @since S60 v3.1 |
|
394 * @leave KErrNoMemory when failed to add item to list |
|
395 * @return Index of the draft folder |
|
396 */ |
|
397 TInt CollectServicesL( const TMsvId aId ); |
|
398 |
|
399 /** |
|
400 * |
|
401 * |
|
402 * @since S60 v3.1 |
|
403 * @param |
|
404 * @return |
|
405 * @leave |
|
406 */ |
|
407 void AddMailboxesL( const TInt aMailboxIndex ); |
|
408 |
|
409 /** |
|
410 * |
|
411 */ |
|
412 void AppendMessageCountString( TDes& aBuffer, TInt aMessageCount) const; |
|
413 |
|
414 |
|
415 |
|
416 /** |
|
417 * Adds items 'Write message', 'Mailbox' and 'Delivery reports' |
|
418 * from the string resource. Note that this is different |
|
419 * than iExtraItemsArray despite naming... |
|
420 * @since S60 v5.0 |
|
421 */ |
|
422 void AddExtraItemFromResourceL( TInt aResourceId, TInt aCommandId ); |
|
423 |
|
424 |
|
425 /** |
|
426 * Adds items from mceextraitems resource file to iExtraItemsArray. |
|
427 * That is done only on construct. If main view items needs to be refreshed |
|
428 * then items are read from iExtraItemsArray and no need to |
|
429 * open resource again. |
|
430 * @since S60 v5.0 |
|
431 */ |
|
432 void ReadExtraItemsResourceL(); |
|
433 |
|
434 /** |
|
435 * Adds mceextraitem from iExtraItemsArray to actual main view array. |
|
436 * @param: aIndex: index of the item in iExtraItemsArray. |
|
437 * @since S60 v5.0 |
|
438 */ |
|
439 void AddExtraItemCommandL( TInt aIndex ); |
|
440 |
|
441 /** |
|
442 * Adds TMsvEntry item from message store to main view array |
|
443 * @param: aEntryId: id of the entry to be added. |
|
444 * @since S60 v5.0 |
|
445 */ |
|
446 void AddFolderItemL( TMsvId aEntryId ); |
|
447 |
|
448 /** |
|
449 * Reads main view item order from the central repository. |
|
450 * Order of the items are stored in iMainViewItems so |
|
451 * when refresh is needed, no need to open cenrep file again. |
|
452 * @since S60 v5.0 |
|
453 */ |
|
454 void ReadMainViewItemsFromRepositoryL(); |
|
455 |
|
456 //Calculates the visible count excluding FS email stuff |
|
457 TInt FindVisibleCountL(TMsvId serviceId) const; |
|
458 private: // Data |
|
459 CMsvSessionPtr iSession; |
|
460 CMsvEntry* iFolderEntry; |
|
461 CMceBitmapResolver& iBitmapResolver; |
|
462 MMtmUiDataRegistryObserver* iRegistryObserver; |
|
463 HBufC* iListBoxText; |
|
464 CDesCArrayFlat* iNumberOfMessagesStrings; |
|
465 TBool iAlwaysOnline; |
|
466 TBool iRoaming; |
|
467 // Array of mailbox Ids |
|
468 MImumInHealthServices::RMailboxIdArray iMailboxArray; |
|
469 // Owned: Pointer to email API object |
|
470 CImumInternalApi* iEmailApi; |
|
471 TInt iErrGetHealthyMailBoxList; |
|
472 TInt iMaiboxArrayCount; |
|
473 |
|
474 CMceUtilsIdleClass* iIdleLoader; |
|
475 TInt iIdleCounter; |
|
476 MMceMainViewListItemArrayObserver* iListItemArrayObserver; |
|
477 |
|
478 CCoeEnv* iCoeEnv; |
|
479 CMtmUiDataRegistry* iUiRegistry; |
|
480 CMsvEntrySelection* iMainViewItems; |
|
481 CMceMainViewExtraItemArray* iExtraItemsArray; |
|
482 |
|
483 TInt iDescriptionLength; |
|
484 //FS Email stuff |
|
485 TBool iSelectableEmail; |
|
486 |
|
487 /** |
|
488 * CMail Changes, it will be True if |
|
489 * KFeatureIdFfEmailFramework is enabled |
|
490 */ |
|
491 TBool iEmailFramework; |
|
492 }; |
|
493 |
|
494 #endif // MCEMAINVIEWLISTITEMARRAY_H |
|
495 |
|
496 // End of File |