|
1 /* |
|
2 * Copyright (c) 2005 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 the License "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: FolderItem either contains a list of FolderItems or contains |
|
15 * information about a feed. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #include "FeedsServerFolderItem.h" |
|
21 #include "FolderAttributes.h" |
|
22 #include "FeedAttributes.h" |
|
23 #include "PackedFolder.h" |
|
24 |
|
25 // ----------------------------------------------------------------------------- |
|
26 // CFolderItem::NewL |
|
27 // |
|
28 // Two-phased constructor. |
|
29 // ----------------------------------------------------------------------------- |
|
30 // |
|
31 CFolderItem* CFolderItem::NewL(TInt aFolderListId, CFeedsEntity* aFeedsEntity) |
|
32 { |
|
33 CFolderItem* self = new (ELeave) CFolderItem(aFolderListId, aFeedsEntity); |
|
34 |
|
35 CleanupStack::PushL(self); |
|
36 self->ConstructL(*aFeedsEntity); |
|
37 CleanupStack::Pop(); |
|
38 |
|
39 return self; |
|
40 } |
|
41 |
|
42 // ----------------------------------------------------------------------------- |
|
43 // CFolderItem::NewFolderL |
|
44 // |
|
45 // Two-phased constructor. |
|
46 // ----------------------------------------------------------------------------- |
|
47 // |
|
48 CFolderItem* CFolderItem::NewFolderL( TInt aFolderListId, const TDesC& aTitle, TInt aEntryId, TInt aStatusCode) |
|
49 { |
|
50 CFolderItem* self = new (ELeave) CFolderItem( aFolderListId ); |
|
51 |
|
52 CleanupStack::PushL(self); |
|
53 self->ConstructL(); |
|
54 CleanupStack::Pop(); |
|
55 |
|
56 self->iTitle.Set(aTitle); |
|
57 self->iIsFolder = ETrue; |
|
58 self->iEntryId = aEntryId; |
|
59 |
|
60 // Set the timestamp to the current time as they don't apply to folders. |
|
61 self->iTimestamp.UniversalTime(); |
|
62 self->iStatusCode = aStatusCode; |
|
63 return self; |
|
64 } |
|
65 |
|
66 // ----------------------------------------------------------------------------- |
|
67 // CFolderItem::NewFeedL |
|
68 // |
|
69 // Two-phased constructor. |
|
70 // ----------------------------------------------------------------------------- |
|
71 // |
|
72 CFolderItem* CFolderItem::NewFeedL( TInt aFolderListId, const TDesC& aTitle, const TDesC& aUrl, |
|
73 TInt aEntryId, TInt aFeedId, const TTime& aTimestamp, TInt aStatusCode, const TInt& aUnreadCount) |
|
74 { |
|
75 CFolderItem* self = new (ELeave) CFolderItem( aFolderListId ); |
|
76 |
|
77 CleanupStack::PushL(self); |
|
78 self->ConstructL(); |
|
79 CleanupStack::Pop(); |
|
80 |
|
81 self->iTitle.Set(aTitle); |
|
82 self->iSourceUrl.Set(aUrl); |
|
83 self->iEntryId = aEntryId; |
|
84 self->iFeedId = aFeedId; |
|
85 self->iTimestamp = aTimestamp; |
|
86 self->iUnreadCount = aUnreadCount; |
|
87 self->iStatusCode = aStatusCode; |
|
88 |
|
89 return self; |
|
90 } |
|
91 |
|
92 // ----------------------------------------------------------------------------- |
|
93 // CFolderItem::CFolderItem |
|
94 // C++ default constructor can NOT contain any code, that |
|
95 // might leave. aPackedFolder is adopted |
|
96 // ----------------------------------------------------------------------------- |
|
97 // |
|
98 CFolderItem::CFolderItem(TInt aFolderListId, CFeedsEntity* aFeedsEntity): |
|
99 iLeakTracker(CLeakTracker::EFolderItem), iFeedsEntity(aFeedsEntity), |
|
100 iFolderListId(aFolderListId) |
|
101 { |
|
102 } |
|
103 |
|
104 // ----------------------------------------------------------------------------- |
|
105 // CFolderItem::CFolderItem |
|
106 // C++ default constructor can NOT contain any code, that |
|
107 // might leave. |
|
108 // ----------------------------------------------------------------------------- |
|
109 // |
|
110 CFolderItem::CFolderItem( TInt aFolderListId ): |
|
111 iLeakTracker(CLeakTracker::EFolderItem), iFolderListId(aFolderListId) |
|
112 { |
|
113 } |
|
114 |
|
115 // ----------------------------------------------------------------------------- |
|
116 // CFolderItem::ConstructL |
|
117 // Symbian 2nd phase constructor can leave. |
|
118 // by this method. |
|
119 // ----------------------------------------------------------------------------- |
|
120 // |
|
121 void CFolderItem::ConstructL() |
|
122 { |
|
123 } |
|
124 |
|
125 // ----------------------------------------------------------------------------- |
|
126 // CFolderItem::ConstructL |
|
127 // Symbian 2nd phase constructor can leave. |
|
128 // by this method. |
|
129 // ----------------------------------------------------------------------------- |
|
130 // |
|
131 void CFolderItem::ConstructL(const CFeedsEntity& aFeedsEntity) |
|
132 { |
|
133 TPtrC title; |
|
134 TPtrC url; |
|
135 TInt feedId; |
|
136 TTime timestamp; |
|
137 TInt unreadCount; |
|
138 CItemMini* miniItem = NULL; |
|
139 TPtrC attributeValue; |
|
140 TInt statusCode; |
|
141 |
|
142 ConstructL(); |
|
143 |
|
144 for(TInt i=0 ; i< aFeedsEntity.GetChildren().Count(); i++ ) |
|
145 { |
|
146 CFolderItem *newItem = CFolderItem::NewL( iFolderListId, aFeedsEntity.GetChildren()[i]); |
|
147 newItem->iParent = this; |
|
148 iFolderItems.Append( newItem); |
|
149 } |
|
150 |
|
151 iEntryId = iFeedsEntity->GetId(); |
|
152 |
|
153 iFeedsEntity->GetIntegerValue( EFolderAttributeStatus, statusCode); |
|
154 iStatusCode = statusCode; |
|
155 |
|
156 if(iFeedsEntity->GetType() == EFolder) |
|
157 { |
|
158 iIsFolder = ETrue; |
|
159 |
|
160 iFeedsEntity->GetStringValue( EFolderAttributeTitle, title); |
|
161 iTitle.Set(title); |
|
162 |
|
163 // Set the timestamp to the current time as they don't apply to folders. |
|
164 iTimestamp.UniversalTime(); |
|
165 |
|
166 } |
|
167 else if( iFeedsEntity->GetType() == EFeed) |
|
168 { |
|
169 iIsFolder = EFalse; |
|
170 |
|
171 iFeedsEntity->GetIntegerValue( EFeedAttributeFeedId, feedId); |
|
172 iFeedId = feedId; |
|
173 |
|
174 iFeedsEntity->GetStringValue( EFeedAttributeTitle, title); |
|
175 iTitle.Set(title); |
|
176 |
|
177 iFeedsEntity->GetStringValue( EFeedAttributeLink, url); |
|
178 iSourceUrl.Set(url); |
|
179 |
|
180 iFeedsEntity->GetTimeValue( EFeedAttributeTimestamp, iTimestamp); |
|
181 |
|
182 iFeedsEntity->GetIntegerValue( EFolderAttributeUnreadCount, unreadCount); |
|
183 iUnreadCount = unreadCount; |
|
184 |
|
185 } |
|
186 else if( iFeedsEntity->GetType() == EMiniItem) |
|
187 { |
|
188 iIsFolder = EFalse; |
|
189 |
|
190 miniItem = CItemMini::NewL(); |
|
191 |
|
192 iMiniItems.Append( miniItem); |
|
193 |
|
194 miniItem->iId = iEntryId = iFeedsEntity->GetId(); |
|
195 |
|
196 iFeedsEntity->GetStringValue( EFolderAttributeMiniItemTitle, title); |
|
197 miniItem->iTitle.Set( url); |
|
198 |
|
199 } |
|
200 } |
|
201 |
|
202 // ----------------------------------------------------------------------------- |
|
203 // CFolderItem::~CFolderItem |
|
204 // Deconstructor. |
|
205 // ----------------------------------------------------------------------------- |
|
206 // |
|
207 EXPORT_C CFolderItem::~CFolderItem() |
|
208 { |
|
209 // Delete the items values. |
|
210 iFolderItems.ResetAndDestroy(); |
|
211 |
|
212 iMiniItems.ResetAndDestroy(); |
|
213 |
|
214 delete iPackedFolder; |
|
215 } |
|
216 |
|
217 // ----------------------------------------------------------------------------- |
|
218 // CFolderItem::FolderListId |
|
219 // |
|
220 // Returns the folder-list-id associated with this item. |
|
221 // ----------------------------------------------------------------------------- |
|
222 // |
|
223 EXPORT_C TInt CFolderItem::FolderListId(void) const |
|
224 { |
|
225 return iFolderListId; |
|
226 } |
|
227 |
|
228 // ----------------------------------------------------------------------------- |
|
229 // CFolderItem::Parent |
|
230 // |
|
231 // Returns the parent folder or NULL if this is the root folder. |
|
232 // ----------------------------------------------------------------------------- |
|
233 // |
|
234 EXPORT_C const CFolderItem* CFolderItem::Parent(void) const |
|
235 { |
|
236 return iParent; |
|
237 } |
|
238 |
|
239 // ----------------------------------------------------------------------------- |
|
240 // CFolderItem::IsFolder |
|
241 // |
|
242 // Returns true if this is a folder. |
|
243 // ----------------------------------------------------------------------------- |
|
244 // |
|
245 EXPORT_C TBool CFolderItem::IsFolder(void) const |
|
246 { |
|
247 return iIsFolder; |
|
248 } |
|
249 |
|
250 // ----------------------------------------------------------------------------- |
|
251 // CFolderItem::Name |
|
252 // |
|
253 // Returns the name of the item. |
|
254 // ----------------------------------------------------------------------------- |
|
255 // |
|
256 EXPORT_C const TDesC& CFolderItem::Name(void) const |
|
257 { |
|
258 return iTitle; |
|
259 } |
|
260 |
|
261 // ----------------------------------------------------------------------------- |
|
262 // CFolderItem::SourceUrl |
|
263 // |
|
264 // Returns the source url of the item. |
|
265 // ----------------------------------------------------------------------------- |
|
266 // |
|
267 EXPORT_C const TDesC& CFolderItem::SourceUrl(void) const |
|
268 { |
|
269 if (!iIsFolder) |
|
270 { |
|
271 return iSourceUrl; |
|
272 } |
|
273 else |
|
274 { |
|
275 return KNullDesC; |
|
276 } |
|
277 } |
|
278 |
|
279 // ----------------------------------------------------------------------------- |
|
280 // CFolderItem::Name |
|
281 // |
|
282 // Returns the name of the item. |
|
283 // ----------------------------------------------------------------------------- |
|
284 // |
|
285 EXPORT_C const TTime& CFolderItem::Timestamp(void) const |
|
286 { |
|
287 return iTimestamp; |
|
288 } |
|
289 |
|
290 // ----------------------------------------------------------------------------- |
|
291 // CFolderItem::UnreadCount |
|
292 // |
|
293 // Returns the number of unread topics for this folder-item. |
|
294 // ----------------------------------------------------------------------------- |
|
295 // |
|
296 EXPORT_C TInt CFolderItem::UnreadCount(void) const |
|
297 { |
|
298 return iUnreadCount; |
|
299 } |
|
300 |
|
301 // ----------------------------------------------------------------------------- |
|
302 // CFolderItem::GetFolderUnreadCount |
|
303 // |
|
304 // Recursively marches through folder/feed hierarchy and counts the number of |
|
305 // unread according to the style in aCountType |
|
306 // |
|
307 // ----------------------------------------------------------------------------- |
|
308 // |
|
309 |
|
310 TInt CFolderItem::GetFolderUnreadCount(const CFolderItem* aFolder, TCountType aCountType) |
|
311 { |
|
312 TInt folderItemCount = 0; |
|
313 TInt unreadCount = 0; |
|
314 |
|
315 if(NULL == aFolder) |
|
316 { |
|
317 return 0; |
|
318 } |
|
319 |
|
320 folderItemCount = aFolder->FolderItemCount(); |
|
321 for(TInt i=0; i < folderItemCount; i++) |
|
322 { |
|
323 const CFolderItem* itemInFolder = aFolder->FolderItemAt( i ); |
|
324 if(itemInFolder->IsFolder()) |
|
325 { |
|
326 // recurse through this folder |
|
327 unreadCount += GetFolderUnreadCount(itemInFolder,aCountType); |
|
328 } |
|
329 else |
|
330 { |
|
331 // update according to desired count |
|
332 // UnreadTopcs counts all unread articles within a feed |
|
333 // UnreadFeeds just counts the feed as unread if at least one |
|
334 // article remains unread |
|
335 if(aCountType == ECountUnreadTopics) |
|
336 { |
|
337 unreadCount += itemInFolder->UnreadCount(); |
|
338 } |
|
339 else if(aCountType == ECountUnreadFeeds) |
|
340 { |
|
341 if(itemInFolder->UnreadCount() > 0) |
|
342 { |
|
343 unreadCount++; |
|
344 } |
|
345 } |
|
346 } |
|
347 } |
|
348 return unreadCount; |
|
349 } |
|
350 |
|
351 // ----------------------------------------------------------------------------- |
|
352 // CFolderItem::UnreadFeedCountRecursive |
|
353 // |
|
354 // Returns the number of unread feeds (those with > 1 undread topics) for this |
|
355 // folder-item and all folders below it recursively |
|
356 // ----------------------------------------------------------------------------- |
|
357 // |
|
358 EXPORT_C TInt CFolderItem::UnreadFeedCountRecursive(void) const |
|
359 { |
|
360 return GetFolderUnreadCount(this, ECountUnreadFeeds); |
|
361 } |
|
362 |
|
363 // ----------------------------------------------------------------------------- |
|
364 // CFolderItem::UnreadTopicCountRecursive |
|
365 // |
|
366 // Returns the number of unread topics (i.e., all articles within feed) for this |
|
367 // folder-item and all folders below it recursively |
|
368 // ----------------------------------------------------------------------------- |
|
369 // |
|
370 EXPORT_C TInt CFolderItem::UnreadTopicCountRecursive(void) const |
|
371 { |
|
372 return GetFolderUnreadCount(this, ECountUnreadTopics); |
|
373 } |
|
374 |
|
375 // ----------------------------------------------------------------------------- |
|
376 // CFolderItem::Id |
|
377 // |
|
378 // Returns the unique id for this folder-item. |
|
379 // ----------------------------------------------------------------------------- |
|
380 // |
|
381 EXPORT_C TInt CFolderItem::Id(void) const |
|
382 { |
|
383 return iEntryId; |
|
384 } |
|
385 |
|
386 |
|
387 // ----------------------------------------------------------------------------- |
|
388 // CFolderItem::FeedId |
|
389 // |
|
390 // Returns the associated feed id for this folder-item. The |
|
391 // method panics if the folder-item is a folder (rather than a feed). |
|
392 // ----------------------------------------------------------------------------- |
|
393 // |
|
394 EXPORT_C TInt CFolderItem::FeedId(void) const |
|
395 { |
|
396 return iFeedId; |
|
397 } |
|
398 |
|
399 |
|
400 // ----------------------------------------------------------------------------- |
|
401 // CFolderItem::FolderItem |
|
402 // |
|
403 // Returns the folder-item at the given index |
|
404 // ----------------------------------------------------------------------------- |
|
405 // |
|
406 EXPORT_C const CFolderItem* CFolderItem::FolderItemAt(TInt aIndex) const |
|
407 { |
|
408 if (iIsFolder && (iFolderItems.Count() > 0) && (aIndex >= 0) && (aIndex < iFolderItems.Count())) |
|
409 { |
|
410 return iFolderItems[aIndex]; |
|
411 } |
|
412 else |
|
413 { |
|
414 return NULL; |
|
415 } |
|
416 } |
|
417 |
|
418 // ----------------------------------------------------------------------------- |
|
419 // CFolderItem::Index |
|
420 // |
|
421 // Returns the index of the given folder-item. |
|
422 // ----------------------------------------------------------------------------- |
|
423 // |
|
424 EXPORT_C TInt CFolderItem::Index(const CFolderItem& aItem) const |
|
425 { |
|
426 return iFolderItems.Find(&aItem); |
|
427 } |
|
428 |
|
429 // ----------------------------------------------------------------------------- |
|
430 // CFolderItem::FolderItemCount |
|
431 // |
|
432 // Returns the number of items. |
|
433 // ----------------------------------------------------------------------------- |
|
434 // |
|
435 EXPORT_C TInt CFolderItem::FolderItemCount(void) const |
|
436 { |
|
437 if (iIsFolder) |
|
438 { |
|
439 return iFolderItems.Count(); |
|
440 } |
|
441 else |
|
442 { |
|
443 return 0; |
|
444 } |
|
445 } |
|
446 |
|
447 // ----------------------------------------------------------------------------- |
|
448 // CFolderItem::Search |
|
449 // |
|
450 // Searches for a FolderItem with the given name. If "this" |
|
451 // isn't a folder it only checks whether or not it matches |
|
452 // the given name. If "this" is a folder it also checks |
|
453 // all embedded items. |
|
454 // ----------------------------------------------------------------------------- |
|
455 // |
|
456 EXPORT_C const CFolderItem* CFolderItem::Search(const TDesC& aName) const |
|
457 { |
|
458 // If "this" matches then return it. |
|
459 if (iTitle.CompareF(aName) == 0) |
|
460 { |
|
461 return this; |
|
462 } |
|
463 |
|
464 // Otherwise if this is a folder, search it's children too. |
|
465 if (IsFolder()) |
|
466 { |
|
467 for (TInt i = 0; i < FolderItemCount(); i++) |
|
468 { |
|
469 const CFolderItem* child; |
|
470 const CFolderItem* item; |
|
471 |
|
472 child = FolderItemAt(i); |
|
473 if ((item = child->Search(aName)) != NULL) |
|
474 { |
|
475 return item; |
|
476 } |
|
477 } |
|
478 } |
|
479 |
|
480 // Otherwise no match was found. |
|
481 return NULL; |
|
482 } |
|
483 |
|
484 // ----------------------------------------------------------------------------- |
|
485 // CFolderItem::Search |
|
486 // |
|
487 // Searches for a FolderItem with the given id. If "this" |
|
488 // isn't a folder it only checks whether or not it matches |
|
489 // the given id. If "this" is a folder it also checks |
|
490 // all embedded items. |
|
491 // ----------------------------------------------------------------------------- |
|
492 // |
|
493 EXPORT_C const CFolderItem* CFolderItem::Search(TInt aFolderItemId) const |
|
494 { |
|
495 // If "this" matches then return it. |
|
496 if (iEntryId == aFolderItemId) |
|
497 { |
|
498 return this; |
|
499 } |
|
500 |
|
501 // Otherwise if this is a folder, search it's children too. |
|
502 if (IsFolder()) |
|
503 { |
|
504 for (TInt i = 0; i < FolderItemCount(); i++) |
|
505 { |
|
506 const CFolderItem* child; |
|
507 const CFolderItem* item; |
|
508 |
|
509 child = FolderItemAt(i); |
|
510 if ((item = child->Search(aFolderItemId)) != NULL) |
|
511 { |
|
512 return item; |
|
513 } |
|
514 } |
|
515 } |
|
516 |
|
517 // Otherwise no match was found. |
|
518 return NULL; |
|
519 } |
|
520 |
|
521 // ----------------------------------------------------------------------------- |
|
522 // CFolderItem::MiniItemsCount |
|
523 // |
|
524 // Returns the number of mini items. |
|
525 // ----------------------------------------------------------------------------- |
|
526 // |
|
527 EXPORT_C TInt CFolderItem::MiniItemsCount(void) const |
|
528 { |
|
529 return iMiniItems.Count(); |
|
530 } |
|
531 |
|
532 // ----------------------------------------------------------------------------- |
|
533 // CFolderItem::MiniItemAt |
|
534 // |
|
535 // Return The mini item. |
|
536 // ----------------------------------------------------------------------------- |
|
537 // |
|
538 EXPORT_C const CItemMini* CFolderItem::MiniItemAt(TInt aIndex) const |
|
539 { |
|
540 if ( (iMiniItems.Count() > 0) && (aIndex >= 0) && (aIndex < iMiniItems.Count()) ) |
|
541 { |
|
542 return iMiniItems[ aIndex ]; |
|
543 } |
|
544 else |
|
545 { |
|
546 return NULL; |
|
547 } |
|
548 } |
|
549 |
|
550 |
|
551 // ----------------------------------------------------------------------------- |
|
552 // CFolderItem::AddMiniItem |
|
553 // |
|
554 // Add a mini item to the array of mini items. |
|
555 // ----------------------------------------------------------------------------- |
|
556 // |
|
557 EXPORT_C void CFolderItem::AddMiniItem( CItemMini* aMiniItem ) |
|
558 { |
|
559 iMiniItems.Append( aMiniItem ); |
|
560 } |
|
561 |
|
562 |
|
563 // ----------------------------------------------------------------------------- |
|
564 // CFolderItem::AddItemL |
|
565 // |
|
566 // Adds aItem as a child of this FolderItem. aItem is adopted by this method. |
|
567 // ----------------------------------------------------------------------------- |
|
568 // |
|
569 void CFolderItem::AddItemL(CFolderItem* aItem) |
|
570 { |
|
571 // Insert the item. |
|
572 if (iIsFolder) |
|
573 { |
|
574 User::LeaveIfError(iFolderItems.Append(aItem)); |
|
575 |
|
576 // Set the parentage. |
|
577 aItem->iParent = this; |
|
578 } |
|
579 else |
|
580 { |
|
581 User::Leave(KErrNotSupported); |
|
582 } |
|
583 } |
|
584 |
|
585 |
|
586 // ----------------------------------------------------------------------------- |
|
587 // CFolderItem::SetUnreadCount |
|
588 // |
|
589 // Sets the number of unread topics for this folder-item. |
|
590 // ----------------------------------------------------------------------------- |
|
591 // |
|
592 EXPORT_C void CFolderItem::SetUnreadCount(TInt aUnreadCount) |
|
593 { |
|
594 iUnreadCount = aUnreadCount; |
|
595 } |
|
596 |
|
597 // ----------------------------------------------------------------------------- |
|
598 // CFolderItem::Status |
|
599 // |
|
600 // Returns status of Folder Item |
|
601 // ----------------------------------------------------------------------------- |
|
602 // |
|
603 EXPORT_C TInt CFolderItem::Status() const |
|
604 { |
|
605 return iStatusCode; |
|
606 } |
|
607 |
|
608 // ----------------------------------------------------------------------------- |
|
609 // CItemMini::NewL |
|
610 // |
|
611 // Two-phased constructor. |
|
612 // ----------------------------------------------------------------------------- |
|
613 // |
|
614 CItemMini* CItemMini::NewL() |
|
615 { |
|
616 CItemMini* self = new (ELeave) CItemMini(); |
|
617 |
|
618 CleanupStack::PushL(self); |
|
619 self->ConstructL(); |
|
620 CleanupStack::Pop(); |
|
621 |
|
622 return self; |
|
623 } |
|
624 |
|
625 // ----------------------------------------------------------------------------- |
|
626 // CItemMini::CItemMini |
|
627 // C++ default constructor can NOT contain any code, that |
|
628 // might leave. |
|
629 // ----------------------------------------------------------------------------- |
|
630 // |
|
631 CItemMini::CItemMini(): |
|
632 iLeakTracker(CLeakTracker::EMiniItem), iTitle(KNullDesC) |
|
633 { |
|
634 } |
|
635 |
|
636 // ----------------------------------------------------------------------------- |
|
637 // CItem::ConstructL |
|
638 // Symbian 2nd phase constructor can leave. |
|
639 // ----------------------------------------------------------------------------- |
|
640 // |
|
641 void CItemMini::ConstructL() |
|
642 { |
|
643 } |
|
644 |
|
645 // ----------------------------------------------------------------------------- |
|
646 // CItemMini::~CItemMini |
|
647 // Deconstructor. |
|
648 // ----------------------------------------------------------------------------- |
|
649 // |
|
650 CItemMini::~CItemMini() |
|
651 { |
|
652 } |
|
653 |
|
654 // ----------------------------------------------------------------------------- |
|
655 // CItemMini::Id |
|
656 // |
|
657 // Returns the item's id. |
|
658 // ----------------------------------------------------------------------------- |
|
659 // |
|
660 EXPORT_C TInt CItemMini::Id() const |
|
661 { |
|
662 return iId; |
|
663 } |
|
664 |
|
665 // ----------------------------------------------------------------------------- |
|
666 // CItemMini::Title |
|
667 // |
|
668 // Returns the item's title. |
|
669 // ----------------------------------------------------------------------------- |
|
670 // |
|
671 EXPORT_C const TDesC& CItemMini::Title() const |
|
672 { |
|
673 return iTitle; |
|
674 } |
|
675 |
|
676 // ----------------------------------------------------------------------------- |
|
677 // CItemMini::SetAttribute |
|
678 // |
|
679 // Sets an attribute. |
|
680 // ----------------------------------------------------------------------------- |
|
681 // |
|
682 void CItemMini::SetAttribute(TUint aAttribute, const TPtrC& aAttributeValue) |
|
683 { |
|
684 switch (aAttribute) |
|
685 { |
|
686 case EFolderAttributeMiniItemTitle: |
|
687 iTitle.Set(aAttributeValue); |
|
688 break; |
|
689 |
|
690 case EFolderAttributeMiniItemId: |
|
691 { |
|
692 TLex16 lex(aAttributeValue); |
|
693 TInt64 id; |
|
694 |
|
695 lex.Val(id); |
|
696 iId = id; |
|
697 } |
|
698 break; |
|
699 |
|
700 default: |
|
701 break; |
|
702 } |
|
703 } |
|
704 |