|
1 /* |
|
2 * Copyright (c) 2008-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: Implementation of list view |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 // INCLUDE FILES |
|
22 |
|
23 #include "glxlistviewimp.h" |
|
24 #include "glxpreviewthumbnailbinding.h" |
|
25 |
|
26 #include <mpxcollectionutility.h> |
|
27 #include <mpxcollectionpath.h> |
|
28 #include <glxcollectiongeneraldefs.h> |
|
29 #include <ganes/HgDoubleGraphicList.h> |
|
30 #include <ganes/HgGrid.h> |
|
31 #include <ganes/HgItem.h> |
|
32 #include <data_caging_path_literals.hrh> |
|
33 #include <glxuistd.h> |
|
34 #include <glxicons.mbg> |
|
35 #include <gulicon.h> |
|
36 #include <AknsBasicBackgroundControlContext.h> |
|
37 #include <mglxmedialist.h> //MGlxMediaList |
|
38 #include <glxtracer.h> |
|
39 #include <glxlog.h> //Glx Logs |
|
40 #include <glxlistviewplugin.rsg> |
|
41 #include <glxmedialistmulmodelprovider.h> //CGlxMediaListMulModelProvider |
|
42 #include <aknViewAppUi.h> |
|
43 #include <StringLoader.h> //StringLoader |
|
44 #include <glxsetappstate.h> |
|
45 |
|
46 const TInt KListDataWindowSize(10); |
|
47 |
|
48 // ======== MEMBER FUNCTIONS ======== |
|
49 |
|
50 // --------------------------------------------------------------------------- |
|
51 // C++ default constructor can NOT contain any code that might leave. |
|
52 // --------------------------------------------------------------------------- |
|
53 // |
|
54 CGlxListViewImp::CGlxListViewImp(TInt aViewUid, const TListViewResourceIds& aResourceIds): |
|
55 iViewUid(aViewUid), |
|
56 iResourceIds(aResourceIds) |
|
57 { |
|
58 } |
|
59 |
|
60 |
|
61 // --------------------------------------------------------------------------- |
|
62 // Two-phased constructor. |
|
63 // --------------------------------------------------------------------------- |
|
64 // |
|
65 CGlxListViewImp* CGlxListViewImp::NewL(MGlxMediaListFactory* aMediaListFactory, |
|
66 TInt aViewUid, |
|
67 const TListViewResourceIds& aResourceIds, |
|
68 const TDesC& aTitle) |
|
69 { |
|
70 TRACER("CGlxListViewImp::NewL"); |
|
71 |
|
72 CGlxListViewImp* self = CGlxListViewImp::NewLC(aMediaListFactory, aViewUid, |
|
73 aResourceIds, aTitle); |
|
74 CleanupStack::Pop(self); |
|
75 return self; |
|
76 } |
|
77 |
|
78 // --------------------------------------------------------------------------- |
|
79 // Two-phased constructor. |
|
80 // --------------------------------------------------------------------------- |
|
81 // |
|
82 CGlxListViewImp* CGlxListViewImp::NewLC(MGlxMediaListFactory* aMediaListFactory, |
|
83 TInt aViewUid, |
|
84 const TListViewResourceIds& aResourceIds, |
|
85 const TDesC& aTitle) |
|
86 { |
|
87 TRACER("CGlxListViewImp::NewLC"); |
|
88 |
|
89 CGlxListViewImp* self = new (ELeave) CGlxListViewImp(aViewUid, aResourceIds); |
|
90 CleanupStack::PushL(self); |
|
91 self->ConstructL(aMediaListFactory, aTitle); |
|
92 return self; |
|
93 } |
|
94 |
|
95 // --------------------------------------------------------------------------- |
|
96 // Symbian 2nd phase constructor can leave. |
|
97 // --------------------------------------------------------------------------- |
|
98 // |
|
99 void CGlxListViewImp::ConstructL(MGlxMediaListFactory* aMediaListFactory, |
|
100 const TDesC& aTitle) |
|
101 { |
|
102 TRACER("CGlxListViewImp::ConsrtuctL"); |
|
103 |
|
104 BaseConstructL(iResourceIds.iViewId); |
|
105 ViewBaseConstructL(); |
|
106 MLViewBaseConstructL(aMediaListFactory, aTitle); |
|
107 CAknToolbar* toolbar = Toolbar(); |
|
108 if(toolbar) |
|
109 { |
|
110 toolbar->DisableToolbarL(ETrue); |
|
111 } |
|
112 |
|
113 //Register the view to recieve toolbar events. ViewBase handles the events |
|
114 SetToolbarObserver(this); |
|
115 } |
|
116 |
|
117 // --------------------------------------------------------------------------- |
|
118 // Destructor |
|
119 // --------------------------------------------------------------------------- |
|
120 // |
|
121 CGlxListViewImp::~CGlxListViewImp() |
|
122 { |
|
123 TRACER("CGlxListViewImp::~CGlxListViewImp"); |
|
124 delete iTitletext; |
|
125 } |
|
126 |
|
127 // --------------------------------------------------------------------------- |
|
128 // ControlGroupId |
|
129 // --------------------------------------------------------------------------- |
|
130 // |
|
131 TInt CGlxListViewImp::ControlGroupId() const |
|
132 { |
|
133 TRACER("CGlxListViewImp::ControlGroupId()"); |
|
134 return reinterpret_cast<TInt>(this); |
|
135 } |
|
136 |
|
137 // --------------------------------------------------------------------------- |
|
138 // From CAknView |
|
139 // Returns views id. |
|
140 // --------------------------------------------------------------------------- |
|
141 // |
|
142 TUid CGlxListViewImp::Id() const |
|
143 { |
|
144 TRACER("CGlxListViewImp::Id()"); |
|
145 return TUid::Uid(iViewUid); |
|
146 } |
|
147 |
|
148 // --------------------------------------------------------------------------- |
|
149 // From CAknView |
|
150 // Handles a view activation. |
|
151 // --------------------------------------------------------------------------- |
|
152 // |
|
153 void CGlxListViewImp::DoMLViewActivateL(const TVwsViewId& /* aPrevViewId */, |
|
154 TUid /* aCustomMessageId */, const TDesC8& /* aCustomMessage */) |
|
155 { |
|
156 TRACER("CGlxListViewImp::DoMLViewActivateL"); |
|
157 iNextViewActivationEnabled = ETrue; |
|
158 if(StatusPane()) |
|
159 { |
|
160 StatusPane()->MakeVisible(ETrue); |
|
161 CEikStatusPane* statusPane = iEikonEnv->AppUiFactory()->StatusPane(); |
|
162 CAknTitlePane* titlePane = ( CAknTitlePane* )statusPane->ControlL( |
|
163 TUid::Uid( EEikStatusPaneUidTitle )); |
|
164 const TDesC* titletext = titlePane->Text(); |
|
165 HBufC* temptitle = titletext->AllocLC(); |
|
166 TPtr titleptr = temptitle->Des(); |
|
167 titleptr.Trim(); |
|
168 if(!temptitle->Length()) |
|
169 { |
|
170 if( iTitletext ) |
|
171 { |
|
172 // Set the required Title |
|
173 titlePane->SetTextL( *iTitletext ); |
|
174 } |
|
175 } |
|
176 CleanupStack::PopAndDestroy(temptitle); |
|
177 } |
|
178 |
|
179 GlxSetAppState::SetState(EGlxInListView); |
|
180 |
|
181 // Separate contexts so that some attributes are loaded before others |
|
182 iTitleAttributeContext = CGlxDefaultAttributeContext::NewL(); |
|
183 iTitleAttributeContext->SetRangeOffsets( KListDataWindowSize, |
|
184 KListDataWindowSize ); |
|
185 iTitleAttributeContext->AddAttributeL( KMPXMediaGeneralTitle ); |
|
186 |
|
187 iSubtitleAttributeContext = CGlxDefaultAttributeContext::NewL(); |
|
188 iSubtitleAttributeContext->SetRangeOffsets( KListDataWindowSize, |
|
189 KListDataWindowSize ); |
|
190 iSubtitleAttributeContext->AddAttributeL( |
|
191 KGlxMediaCollectionPluginSpecificSubTitle ); |
|
192 |
|
193 iMediaList->AddContextL( iTitleAttributeContext, KMaxTInt ); |
|
194 iMediaList->AddContextL( iSubtitleAttributeContext, KMaxTInt ); |
|
195 |
|
196 iMediaList->AddMediaListObserverL(this); |
|
197 TRect apRect = iEikonEnv->EikAppUi()->ApplicationRect(); |
|
198 iBgContext = CAknsBasicBackgroundControlContext::NewL( |
|
199 KAknsIIDQsnBgScreen,apRect,ETrue); |
|
200 |
|
201 iPreviewTNBinding = CGlxPreviewThumbnailBinding::NewL(*this); |
|
202 CreateListL(); |
|
203 if (iPreviewTNBinding) |
|
204 { |
|
205 iPopulateListTNs = ETrue; |
|
206 CMPXCollectionPath* path = iMediaList->PathLC( |
|
207 NGlxListDefs::EPathFocusOrSelection ); |
|
208 iPreviewTNBinding->HandleItemChangedL(*path, iPopulateListTNs); |
|
209 CleanupStack::PopAndDestroy( path ); |
|
210 } |
|
211 |
|
212 } |
|
213 |
|
214 // --------------------------------------------------------------------------- |
|
215 // From CAknView |
|
216 // View deactivation function. |
|
217 // --------------------------------------------------------------------------- |
|
218 // |
|
219 void CGlxListViewImp::DoMLViewDeactivate() |
|
220 { |
|
221 TRACER("CGlxListViewImp::DoMLViewDeactivate"); |
|
222 if(StatusPane()) |
|
223 { |
|
224 if(iTitletext) |
|
225 { |
|
226 delete iTitletext; |
|
227 iTitletext = NULL; |
|
228 } |
|
229 CEikStatusPane* statusPane = iEikonEnv->AppUiFactory()->StatusPane(); |
|
230 TRAP_IGNORE(CAknTitlePane* titlePane = ( CAknTitlePane* )statusPane->ControlL( |
|
231 TUid::Uid( EEikStatusPaneUidTitle )); |
|
232 iTitletext = titlePane->Text()->AllocL()); |
|
233 } |
|
234 |
|
235 iMediaList->RemoveContext( iTitleAttributeContext ); |
|
236 delete iTitleAttributeContext; |
|
237 iTitleAttributeContext = NULL; |
|
238 |
|
239 iMediaList->RemoveContext( iSubtitleAttributeContext ); |
|
240 delete iSubtitleAttributeContext; |
|
241 iSubtitleAttributeContext = NULL; |
|
242 |
|
243 iMediaList->RemoveMediaListObserver( this ); |
|
244 delete iPreviewTNBinding; |
|
245 iPreviewTNBinding = NULL; |
|
246 DestroyListViewWidget(); |
|
247 } |
|
248 |
|
249 // --------------------------------------------------------------------------- |
|
250 // Destroys the Widget |
|
251 // --------------------------------------------------------------------------- |
|
252 // |
|
253 void CGlxListViewImp::DestroyListViewWidget() |
|
254 { |
|
255 TRACER("CGlxListViewImp::DestroyListViewWidget"); |
|
256 |
|
257 if (iList) |
|
258 { |
|
259 AppUi()->RemoveFromStack(iList); |
|
260 delete iList; |
|
261 iList = NULL; |
|
262 } |
|
263 delete iBgContext; |
|
264 iBgContext = NULL; |
|
265 if(iUiUtility->ViewNavigationDirection() == EGlxNavigationBackwards ) |
|
266 { |
|
267 iLastFocusedIndex = 0; |
|
268 } |
|
269 } |
|
270 |
|
271 // --------------------------------------------------------------------------- |
|
272 // From CGlxViewBase |
|
273 // Command handling function. |
|
274 // --------------------------------------------------------------------------- |
|
275 // |
|
276 TBool CGlxListViewImp::HandleViewCommandL(TInt aCommand) |
|
277 { |
|
278 TRACER("CGlxListViewImp::HandleViewCommandL"); |
|
279 |
|
280 if (aCommand == EAknCmdOpen) |
|
281 { |
|
282 //Navigational State to be used |
|
283 if( iNextViewActivationEnabled ) |
|
284 { |
|
285 iNextViewActivationEnabled = EFalse; |
|
286 iUiUtility->SetViewNavigationDirection(EGlxNavigationForwards); |
|
287 //Navigate to the next view |
|
288 CMPXCollectionPath* path = |
|
289 iMediaList->PathLC( NGlxListDefs::EPathFocusOrSelection ); |
|
290 iCollectionUtility->Collection().OpenL(*path); |
|
291 CleanupStack::PopAndDestroy(path); |
|
292 } |
|
293 return ETrue; |
|
294 } |
|
295 else |
|
296 { |
|
297 return EFalse; |
|
298 } |
|
299 } |
|
300 |
|
301 // ----------------------------------------------------------------------------- |
|
302 // Called by the framework when the application status pane |
|
303 // size is changed. Passes the new client rectangle to the |
|
304 // AppView |
|
305 // ----------------------------------------------------------------------------- |
|
306 // |
|
307 void CGlxListViewImp::HandleStatusPaneSizeChange ( ) |
|
308 { |
|
309 if ( iBgContext ) |
|
310 { |
|
311 TRect apRect = iEikonEnv->EikAppUi()->ApplicationRect(); |
|
312 iBgContext->SetRect( apRect ); |
|
313 } |
|
314 |
|
315 if(iList) |
|
316 { |
|
317 TRAP_IGNORE (iList->InitScreenL(ClientRect()); ) |
|
318 } |
|
319 } |
|
320 |
|
321 TTypeUid::Ptr CGlxListViewImp::MopSupplyObject(TTypeUid aId) |
|
322 { |
|
323 if (iBgContext) |
|
324 { |
|
325 return MAknsControlContext::SupplyMopObject(aId, iBgContext ); |
|
326 } |
|
327 |
|
328 return CAknView::MopSupplyObject(aId); |
|
329 } |
|
330 |
|
331 void CGlxListViewImp::Request(TInt /*aRequestStart*/, TInt /*aRequestEnd*/, |
|
332 THgScrollDirection /*aDirection*/) |
|
333 { |
|
334 TRACER("CGlxListViewImp::Request"); |
|
335 } |
|
336 |
|
337 void CGlxListViewImp::Release(TInt /*aBufferStart*/, TInt /*aBufferEnd*/) |
|
338 { |
|
339 TRACER("CGlxListViewImp::Release"); |
|
340 } |
|
341 |
|
342 void CGlxListViewImp::HandleSelectL( TInt aIndex ) |
|
343 { |
|
344 TRACER("CGlxListViewImp::HandleSelectL"); |
|
345 if(0 <= aIndex && aIndex < iMediaList->Count()) |
|
346 { |
|
347 iPopulateListTNs = EFalse; |
|
348 iMediaList->SetFocusL(NGlxListDefs::EAbsolute, aIndex); |
|
349 } |
|
350 } |
|
351 |
|
352 void CGlxListViewImp::HandleOpenL( TInt aIndex ) |
|
353 { |
|
354 TRACER("CGlxListViewImp::HandleOpenL"); |
|
355 if( iNextViewActivationEnabled && ( aIndex >= 0 && aIndex < |
|
356 iMediaList->Count())) |
|
357 { |
|
358 iMediaList->SetFocusL(NGlxListDefs::EAbsolute,aIndex); |
|
359 iLastFocusedIndex = iMediaList->FocusIndex(); |
|
360 iNextViewActivationEnabled = EFalse; |
|
361 iUiUtility->SetViewNavigationDirection(EGlxNavigationForwards); |
|
362 //Navigate to the next view |
|
363 CMPXCollectionPath* path = |
|
364 iMediaList->PathLC( NGlxListDefs::EPathFocusOrSelection ); |
|
365 iCollectionUtility->Collection().OpenL(*path); |
|
366 CleanupStack::PopAndDestroy(path); |
|
367 } |
|
368 } |
|
369 |
|
370 void CGlxListViewImp::PreviewTNReadyL(CFbsBitmap* aBitmap, CFbsBitmap* |
|
371 /*aMask*/, TInt /*aIndex*/) |
|
372 { |
|
373 TRACER("CGlxListViewImp::PreviewTNReadyL"); |
|
374 |
|
375 TInt focusIndex = iMediaList->FocusIndex(); |
|
376 TInt mediaCount = iMediaList->Count(); |
|
377 |
|
378 if (aBitmap) |
|
379 { |
|
380 iList->ItemL(focusIndex).SetIcon(CGulIcon::NewL(aBitmap)); |
|
381 } |
|
382 else |
|
383 { |
|
384 //Displays default thumbnail if aBitmap is NULL |
|
385 |
|
386 TFileName resFile(KDC_APP_BITMAP_DIR); |
|
387 resFile.Append(KGlxIconsFilename); |
|
388 CFbsBitmap* defaultBitmap = AknIconUtils::CreateIconL(resFile, |
|
389 EMbmGlxiconsQgn_prop_image_notcreated); |
|
390 AknIconUtils::SetSize(defaultBitmap, |
|
391 CHgDoubleGraphicList::PreferredImageSize()); |
|
392 |
|
393 iList->ItemL(focusIndex).SetIcon(CGulIcon::NewL(defaultBitmap)); |
|
394 } |
|
395 |
|
396 TInt firstIndex = iList->FirstIndexOnScreen(); |
|
397 TInt itemsOnScreen = iList->ItemsOnScreen(); |
|
398 TInt lastOnScreen = firstIndex + itemsOnScreen - 1; |
|
399 if (lastOnScreen > (mediaCount - 1)) |
|
400 { |
|
401 lastOnScreen = mediaCount; |
|
402 } |
|
403 |
|
404 if (!iPopulateListTNs || focusIndex == lastOnScreen) |
|
405 { |
|
406 GLX_DEBUG2("CGlxListViewImp::PreviewTNReadyL()" |
|
407 " RefreshScreen - focusIndex(%d)", focusIndex); |
|
408 iList->RefreshScreen(focusIndex); |
|
409 } |
|
410 |
|
411 if (iPopulateListTNs) |
|
412 { |
|
413 if(iStartIndex == KErrNotFound) |
|
414 { |
|
415 iStartIndex = focusIndex; |
|
416 } |
|
417 |
|
418 TInt count = iMediaList->Count(); |
|
419 if(count) |
|
420 { |
|
421 TInt focus = (focusIndex+1)%count; |
|
422 if (focus != iStartIndex) |
|
423 { |
|
424 iMediaList->SetFocusL(NGlxListDefs::EAbsolute, focus); |
|
425 } |
|
426 else |
|
427 { |
|
428 iPopulateListTNs = EFalse; |
|
429 |
|
430 // iStartIndex holds the focus index of the item. |
|
431 // If the focus is not on 0th index and if USB is Connected/Disconnected |
|
432 // or some files are deleted from file manager, |
|
433 // Once the updation of all items is done, the focus should be set to |
|
434 // previous focus index(not to 0th index). |
|
435 |
|
436 iMediaList->SetFocusL(NGlxListDefs::EAbsolute, |
|
437 iStartIndex); |
|
438 iList->SetSelectedIndex(iStartIndex); |
|
439 iList->RefreshScreen(iStartIndex); |
|
440 |
|
441 iStartIndex = KErrNotFound; |
|
442 |
|
443 /* The medialist doesn't give the callback for focuschanged if the count is one. |
|
444 * So we have to explicitly start the timer of 2 seconds after populating the list |
|
445 * TN's ie., after gettting the first thumbnail. |
|
446 * The callback is not given because the setfocus index is same as the focused index |
|
447 * in medialist. |
|
448 */ |
|
449 if(count==1) |
|
450 { |
|
451 iPreviewTNBinding->StartTimer( iPopulateListTNs ); |
|
452 } |
|
453 } |
|
454 } |
|
455 } |
|
456 } |
|
457 |
|
458 // ---------------------------------------------------------------------------- |
|
459 // CreateListL |
|
460 // ---------------------------------------------------------------------------- |
|
461 // |
|
462 void CGlxListViewImp::CreateListL() |
|
463 { |
|
464 TRACER("CGlxListViewImp::CreateListL"); |
|
465 |
|
466 iPopulateListTNs = ETrue; |
|
467 iStartIndex = KErrNotFound; |
|
468 TInt mediaCount = iMediaList->Count(); |
|
469 GLX_DEBUG2("CGlxListViewImp::CreateListL() mediaCount=%d", mediaCount); |
|
470 |
|
471 if (!iList) |
|
472 { |
|
473 TFileName resFile(KDC_APP_BITMAP_DIR); |
|
474 resFile.Append(KGlxIconsFilename); |
|
475 CFbsBitmap* bitmap = AknIconUtils::CreateIconL(resFile, |
|
476 EMbmGlxiconsQgn_prop_image_notcreated); |
|
477 AknIconUtils::SetSize(bitmap, |
|
478 CHgDoubleGraphicList::PreferredImageSize()); |
|
479 |
|
480 iList = CHgDoubleGraphicList::NewL( |
|
481 ClientRect(), |
|
482 mediaCount, |
|
483 CGulIcon::NewL(bitmap) ); |
|
484 |
|
485 iList->SetMopParent(this); |
|
486 |
|
487 iList->SetSelectionObserver(*this); |
|
488 |
|
489 if (iUiUtility->ViewNavigationDirection() == EGlxNavigationBackwards) |
|
490 { |
|
491 GLX_DEBUG1("CGlxListViewImp::CreateListL() - SetEmptyTextL()"); |
|
492 //set the text to be shown if the list is empty. |
|
493 HBufC* emptyText = StringLoader::LoadLC(R_LIST_EMPTY_VIEW_TEXT); |
|
494 iList->SetEmptyTextL(*emptyText); |
|
495 CleanupStack::PopAndDestroy(emptyText); |
|
496 iLastFocusedIndex = iMediaList->FocusIndex(); |
|
497 } |
|
498 |
|
499 //Fix for ESLM-7SAHPT::Clear Flag to Disable QWERTY search input in list view |
|
500 iList->ClearFlags(CHgScroller::EHgScrollerSearchWithQWERTY ); |
|
501 |
|
502 AppUi()->AddToStackL(iList); |
|
503 } |
|
504 |
|
505 if (mediaCount) |
|
506 { |
|
507 for (TInt i=0; i<mediaCount; i++) |
|
508 { |
|
509 const TGlxMedia& item = iMediaList->Item(i); |
|
510 iList->ItemL(i).SetTitleL(item.Title()); |
|
511 iList->ItemL(i).SetTextL(item.SubTitle()); |
|
512 } |
|
513 |
|
514 iMediaList->SetFocusL(NGlxListDefs::EAbsolute, iLastFocusedIndex); |
|
515 iList->SetSelectedIndex(iLastFocusedIndex); |
|
516 iList->RefreshScreen(iLastFocusedIndex); |
|
517 } |
|
518 } |
|
519 |
|
520 // ---------------------------------------------------------------------------- |
|
521 // HandleItemAddedL |
|
522 // ---------------------------------------------------------------------------- |
|
523 // |
|
524 void CGlxListViewImp::HandleItemAddedL( TInt aStartIndex, TInt aEndIndex, |
|
525 MGlxMediaList* /*aList*/ ) |
|
526 { |
|
527 TRACER("CGlxListViewImp::HandleItemAddedL"); |
|
528 |
|
529 if (iList) |
|
530 { |
|
531 for (TInt i = aStartIndex; i<= aEndIndex; i++) |
|
532 { |
|
533 const TGlxMedia& item = iMediaList->Item(i); |
|
534 iList->InsertItem(CHgItem::NewL(CHgItem::EHgItemFlagsNone, |
|
535 NULL, item.Title(), item.SubTitle()), i); |
|
536 } |
|
537 |
|
538 if(aStartIndex == aEndIndex ) |
|
539 { |
|
540 iLastFocusedIndex = aStartIndex; |
|
541 iPopulateListTNs = EFalse; |
|
542 iMediaList->SetFocusL(NGlxListDefs::EAbsolute, iLastFocusedIndex); |
|
543 } |
|
544 |
|
545 iList->SetSelectedIndex(iLastFocusedIndex); |
|
546 iList->RefreshScreen(iLastFocusedIndex); |
|
547 } |
|
548 } |
|
549 |
|
550 // ---------------------------------------------------------------------------- |
|
551 // HandleItemRemoved |
|
552 // ---------------------------------------------------------------------------- |
|
553 // |
|
554 void CGlxListViewImp::HandleItemRemovedL( TInt aStartIndex, TInt aEndIndex, |
|
555 MGlxMediaList* aList ) |
|
556 { |
|
557 TRACER("CGlxListViewImp::HandleItemRemovedL"); |
|
558 |
|
559 if(iMediaList == aList) |
|
560 { |
|
561 for(TInt i = aStartIndex;i <= aEndIndex; i++ ) |
|
562 { |
|
563 iList->RemoveItem(i); |
|
564 } |
|
565 |
|
566 if(aEndIndex >= iList->ItemCount()) |
|
567 { |
|
568 iList->SetSelectedIndex(iList->ItemCount()-1); |
|
569 } |
|
570 iList->RefreshScreen(iList->FirstIndexOnScreen()); |
|
571 } |
|
572 } |
|
573 |
|
574 // ---------------------------------------------------------------------------- |
|
575 // HandleAttributesAvailableL |
|
576 // ---------------------------------------------------------------------------- |
|
577 // |
|
578 void CGlxListViewImp::HandleAttributesAvailableL( TInt aItemIndex, |
|
579 const RArray<TMPXAttribute>& aAttributes, MGlxMediaList* /*aList*/ ) |
|
580 { |
|
581 TRACER("CGlxListViewImp::HandleAttributesAvailableL"); |
|
582 |
|
583 TMPXAttribute titleAttrib(KMPXMediaGeneralTitle); |
|
584 TMPXAttribute subTitleAttrib(KGlxMediaCollectionPluginSpecificSubTitle); |
|
585 TIdentityRelation< TMPXAttribute > match ( &TMPXAttribute::Match ); |
|
586 |
|
587 const TGlxMedia& item = iMediaList->Item(aItemIndex); |
|
588 |
|
589 if (KErrNotFound != aAttributes.Find(titleAttrib, match)) |
|
590 { |
|
591 iList->ItemL(aItemIndex).SetTitleL(item.Title()); |
|
592 iList->RefreshScreen(aItemIndex); |
|
593 } |
|
594 |
|
595 if (KErrNotFound != aAttributes.Find(subTitleAttrib, match)) |
|
596 { |
|
597 iList->ItemL(aItemIndex).SetTextL(item.SubTitle()); |
|
598 iList->RefreshScreen(aItemIndex); |
|
599 |
|
600 // Set iPopulateListTNs to ETrue and refresh all the items in |
|
601 // list view if subtitle is updated |
|
602 if (iPreviewTNBinding && !iPopulateListTNs) |
|
603 { |
|
604 iPopulateListTNs = ETrue; |
|
605 iStartIndex = KErrNotFound; |
|
606 CMPXCollectionPath* path = iMediaList->PathLC( |
|
607 NGlxListDefs::EPathFocusOrSelection ); |
|
608 iPreviewTNBinding->HandleItemChangedL(*path, iPopulateListTNs); |
|
609 CleanupStack::PopAndDestroy( path ); |
|
610 } |
|
611 } |
|
612 } |
|
613 |
|
614 // ---------------------------------------------------------------------------- |
|
615 // HandleFocusChangedL |
|
616 // ---------------------------------------------------------------------------- |
|
617 // |
|
618 void CGlxListViewImp::HandleFocusChangedL( NGlxListDefs:: |
|
619 TFocusChangeType /*aType*/, TInt /*aNewIndex*/, TInt /*aOldIndex*/, |
|
620 MGlxMediaList* /*aList*/ ) |
|
621 { |
|
622 TRACER( "CGlxListViewImp::HandleFocusChangedL"); |
|
623 |
|
624 if (iPreviewTNBinding) |
|
625 { |
|
626 CMPXCollectionPath* path = iMediaList->PathLC( |
|
627 NGlxListDefs::EPathFocusOrSelection ); |
|
628 iPreviewTNBinding->HandleItemChangedL(*path, iPopulateListTNs); |
|
629 CleanupStack::PopAndDestroy( path ); |
|
630 } |
|
631 } |
|
632 |
|
633 // ---------------------------------------------------------------------------- |
|
634 // HandleItemSelected |
|
635 // ---------------------------------------------------------------------------- |
|
636 // |
|
637 void CGlxListViewImp::HandleItemSelectedL(TInt /*aIndex*/, |
|
638 TBool /*aSelected*/, MGlxMediaList* /*aList*/ ) |
|
639 { |
|
640 } |
|
641 |
|
642 // ---------------------------------------------------------------------------- |
|
643 // HandleMessageL |
|
644 // ---------------------------------------------------------------------------- |
|
645 // |
|
646 void CGlxListViewImp::HandleMessageL( const CMPXMessage& /*aMessage*/, |
|
647 MGlxMediaList* /*aList*/ ) |
|
648 { |
|
649 |
|
650 } |
|
651 |
|
652 // ---------------------------------------------------------------------------- |
|
653 // HandleError |
|
654 // ---------------------------------------------------------------------------- |
|
655 // |
|
656 void CGlxListViewImp::HandleError( TInt /*aError*/ ) |
|
657 { |
|
658 |
|
659 } |
|
660 |
|
661 // ---------------------------------------------------------------------------- |
|
662 // HandleCommandCompleteL |
|
663 // ---------------------------------------------------------------------------- |
|
664 // |
|
665 void CGlxListViewImp::HandleCommandCompleteL( CMPXCommand* /*aCommandResult*/, |
|
666 TInt /*aError*/, MGlxMediaList* /*aList*/ ) |
|
667 { |
|
668 |
|
669 } |
|
670 |
|
671 // ---------------------------------------------------------------------------- |
|
672 // HandleMediaL |
|
673 // ---------------------------------------------------------------------------- |
|
674 // |
|
675 void CGlxListViewImp::HandleMediaL( TInt /*aListIndex*/, MGlxMediaList* /*aList*/ ) |
|
676 { |
|
677 |
|
678 } |
|
679 |
|
680 // ---------------------------------------------------------------------------- |
|
681 // HandlePopulatedL |
|
682 // ---------------------------------------------------------------------------- |
|
683 // |
|
684 void CGlxListViewImp::HandlePopulatedL( MGlxMediaList* /*aList*/ ) |
|
685 { |
|
686 TRACER("CGlxListViewImp::HandlePopulatedL()"); |
|
687 if (iList) |
|
688 { |
|
689 //set the text to be shown if the list is empty. |
|
690 HBufC* emptyText = StringLoader::LoadLC(R_LIST_EMPTY_VIEW_TEXT); |
|
691 iList->SetEmptyTextL(*emptyText); |
|
692 CleanupStack::PopAndDestroy(emptyText); |
|
693 |
|
694 GLX_DEBUG2("CGlxListViewImp::HandlePopulatedL() MediaList Count()=%d", |
|
695 iMediaList->Count()); |
|
696 if (iMediaList->Count() <= 0) |
|
697 { |
|
698 GLX_DEBUG1("CGlxListViewImp::HandlePopulatedL() - SetEmptyTextL()"); |
|
699 iList->DrawNow(); |
|
700 } |
|
701 } |
|
702 } |
|
703 |
|
704 // ---------------------------------------------------------------------------- |
|
705 // HandleItemModifiedL |
|
706 // ---------------------------------------------------------------------------- |
|
707 // |
|
708 void CGlxListViewImp::HandleItemModifiedL( const RArray<TInt>& /*aItemIndexes*/, |
|
709 MGlxMediaList* /*aList*/ ) |
|
710 { |
|
711 |
|
712 } |
|
713 |
|
714 // End of File |