30 #include <ganes/HgItem.h> // HG Item |
30 #include <ganes/HgItem.h> // HG Item |
31 #include <ganes/HgGrid.h> // Hg Grid Widget |
31 #include <ganes/HgGrid.h> // Hg Grid Widget |
32 #include <AknsBasicBackgroundControlContext.h> // Background Context |
32 #include <AknsBasicBackgroundControlContext.h> // Background Context |
33 |
33 |
34 #include <glxuistd.h> // KGlxFetchontextPriorityNormal and KGlxIconsFilename |
34 #include <glxuistd.h> // KGlxFetchontextPriorityNormal and KGlxIconsFilename |
35 #include <glxcollectionpluginall.hrh> // All item collection plugin id |
|
36 #include <glxfilterfactory.h> // For Filters required in Medilaits |
35 #include <glxfilterfactory.h> // For Filters required in Medilaits |
37 #include <glxresourceutilities.h> // for CGlxResourceUtilities |
36 #include <glxresourceutilities.h> // for CGlxResourceUtilities |
38 #include <glxfetcherdialog.rsg> // FOR GETTING Dialog ID AND RESOURCE ID |
37 #include <glxfetcherdialog.rsg> // FOR GETTING Dialog ID AND RESOURCE ID |
39 #include <glxattributecontext.h> // TMPXAttribute |
38 #include <glxattributecontext.h> // TMPXAttribute |
40 #include <glxattributeretriever.h> // CGlxAttributeRetriever |
39 #include <glxattributeretriever.h> // CGlxAttributeRetriever |
56 #include "mglxeventobserver.h" |
55 #include "mglxeventobserver.h" |
57 #include "glxfetcher.hrh" |
56 #include "glxfetcher.hrh" |
58 #include "glxfetchercommandhandler.h" |
57 #include "glxfetchercommandhandler.h" |
59 |
58 |
60 const TInt KPadding(7); |
59 const TInt KPadding(7); |
61 const TInt KNoOfPages(4); |
|
62 const TInt KBufferTreshold(1); |
|
63 const TInt KItemsPerPage(18); |
|
64 const TInt KBufferSize(KNoOfPages * KItemsPerPage); |
|
65 const TInt KBufferTresholdSize(KBufferTreshold * KItemsPerPage); |
|
66 |
60 |
67 //----------------------------------------------------------------------------- |
61 //----------------------------------------------------------------------------- |
68 // Two-phased constructor. |
62 // Two-phased constructor. |
69 //----------------------------------------------------------------------------- |
63 //----------------------------------------------------------------------------- |
70 CGlxFetcherContainer* CGlxFetcherContainer::NewL( |
64 CGlxFetcherContainer* CGlxFetcherContainer::NewL( |
167 |
160 |
168 iHgGrid->SetFlags( CHgScroller::EHgScrollerSelectionMode ); |
161 iHgGrid->SetFlags( CHgScroller::EHgScrollerSelectionMode ); |
169 iMultipleMarkNotStarted = EFalse; |
162 iMultipleMarkNotStarted = EFalse; |
170 } |
163 } |
171 } |
164 } |
|
165 |
172 // --------------------------------------------------------------------------- |
166 // --------------------------------------------------------------------------- |
173 // CreateMediaListL() |
167 // CreateMediaListL() |
174 // Creates a collection path |
168 // Creates a collection path |
175 // Create a filter as requested filtertype |
169 // Create a filter as requested filtertype |
176 // Creates the medialist |
170 // Creates the medialist |
197 GLX_LOG_INFO1("CGlxFetcherContainer::MediaListL - Path level = %d", |
191 GLX_LOG_INFO1("CGlxFetcherContainer::MediaListL - Path level = %d", |
198 path->Levels()); |
192 path->Levels()); |
199 |
193 |
200 CleanupStack::PopAndDestroy( path ); |
194 CleanupStack::PopAndDestroy( path ); |
201 } |
195 } |
|
196 |
202 // --------------------------------------------------------------------------- |
197 // --------------------------------------------------------------------------- |
203 // CreateHgGridWidgetL |
198 // CreateHgGridWidgetL |
204 // --------------------------------------------------------------------------- |
199 // --------------------------------------------------------------------------- |
205 // |
200 // |
206 void CGlxFetcherContainer::CreateHgGridWidgetL() |
201 void CGlxFetcherContainer::CreateHgGridWidgetL() |
250 // Setting Selction observer for getting callback on key event change |
245 // Setting Selction observer for getting callback on key event change |
251 iHgGrid->SetSelectionObserver(*this); |
246 iHgGrid->SetSelectionObserver(*this); |
252 // This Displays the scrollbar at the opening of the Grid view |
247 // This Displays the scrollbar at the opening of the Grid view |
253 iHgGrid->SetScrollBarTypeL(CHgScroller::EHgScrollerTimeStrip ); |
248 iHgGrid->SetScrollBarTypeL(CHgScroller::EHgScrollerTimeStrip ); |
254 // Enable Buffer support |
249 // Enable Buffer support |
255 iHgGrid->EnableScrollBufferL(*this, KBufferSize, KBufferTresholdSize); |
250 iHgGrid->EnableScrollBufferL(*this, (KNoOfPages |
|
251 * iUiUtility->VisibleItemsInPageGranularityL()), |
|
252 KBufferTresholdSize); |
256 // Enable Marking support |
253 // Enable Marking support |
257 iHgGrid->SetMarkingObserver(*this); |
254 iHgGrid->SetMarkingObserver(*this); |
258 |
255 |
259 iHgGrid->SetFocus(ETrue); |
256 iHgGrid->SetFocus(ETrue); |
260 } |
257 } |
263 // CreateGridMediaListObserverL |
260 // CreateGridMediaListObserverL |
264 // --------------------------------------------------------------------------- |
261 // --------------------------------------------------------------------------- |
265 // |
262 // |
266 void CGlxFetcherContainer::CreateGridMediaListObserverL() |
263 void CGlxFetcherContainer::CreateGridMediaListObserverL() |
267 { |
264 { |
268 iGlxGridMLObserver = CGlxGridViewMLObserver::NewL(*iMediaList, iHgGrid, |
265 iGlxGridMLObserver = CGlxGridViewMLObserver::NewL(*this, *iMediaList, |
269 iFilterType); |
266 iHgGrid, iFilterType); |
270 } |
267 } |
271 |
268 |
272 // --------------------------------------------------------------------------- |
269 // --------------------------------------------------------------------------- |
273 // BufferPositionChanged |
270 // Request |
274 // --------------------------------------------------------------------------- |
271 // --------------------------------------------------------------------------- |
275 // |
272 // |
276 void CGlxFetcherContainer::Request(TInt aRequestStart, TInt aRequestEnd, |
273 void CGlxFetcherContainer::Request(TInt aRequestStart, TInt aRequestEnd, |
277 THgScrollDirection /*aDirection*/) |
274 THgScrollDirection /*aDirection*/) |
278 { |
275 { |
279 TRACER("CGlxFetcherContainer::Request()"); |
276 TRACER("CGlxFetcherContainer::Request()"); |
280 TRAP_IGNORE(RequestL( aRequestStart, aRequestEnd )); |
277 TRAP_IGNORE(RequestL( aRequestStart, aRequestEnd )); |
281 } |
278 } |
|
279 |
282 // --------------------------------------------------------------------------- |
280 // --------------------------------------------------------------------------- |
283 // RequestL |
281 // RequestL |
284 // --------------------------------------------------------------------------- |
282 // --------------------------------------------------------------------------- |
285 // |
283 // |
286 void CGlxFetcherContainer::RequestL(TInt aRequestStart, TInt aRequestEnd) |
284 void CGlxFetcherContainer::RequestL(TInt aRequestStart, TInt aRequestEnd) |
301 if(visIndex<0 || mediaCount<=0) |
299 if(visIndex<0 || mediaCount<=0) |
302 { |
300 { |
303 visIndex = 0; |
301 visIndex = 0; |
304 } |
302 } |
305 |
303 |
306 GLX_LOG_INFO1("CGlxGridViewImp::Request - SetVisibleWindowIndex " |
304 GLX_LOG_INFO1("CGlxFetcherContainer::Request - SetVisibleWindowIndex " |
307 "visIndex(%d)", visIndex); |
305 "visIndex(%d)", visIndex); |
308 iMediaList->SetVisibleWindowIndexL(visIndex); |
306 iMediaList->SetVisibleWindowIndexL(visIndex); |
309 } |
307 } |
310 for (TInt i=aRequestStart; i<= aRequestEnd; i++) |
308 for (TInt i=aRequestStart; i<= aRequestEnd; i++) |
311 { |
309 { |
312 SetIconsL(i); |
310 SetIconsL(i); |
313 TInt firstIndex = iHgGrid->FirstIndexOnScreen(); |
311 TInt firstIndex = iHgGrid->FirstIndexOnScreen(); |
314 TInt lastOnScreen = firstIndex + iHgGrid->ItemsOnScreen() - 1; |
312 TInt lastOnScreen = firstIndex + iHgGrid->ItemsOnScreen() - 1; |
315 if (i >= firstIndex && i <= lastOnScreen) |
313 if (i >= firstIndex && i <= lastOnScreen) |
316 { |
314 { |
317 GLX_LOG_INFO1("CGlxGridViewImp::Request - RefreshScreen i(%d)", i); |
315 GLX_LOG_INFO1("CGlxFetcherContainer::Request - RefreshScreen i(%d)", i); |
318 iHgGrid->RefreshScreen(i); |
316 iHgGrid->RefreshScreen(i); |
319 } |
317 } |
320 } |
318 } |
321 } |
319 } |
322 // --------------------------------------------------------------------------- |
320 |
323 // SetIcons |
321 // --------------------------------------------------------------------------- |
|
322 // SetIconsL |
324 // --------------------------------------------------------------------------- |
323 // --------------------------------------------------------------------------- |
325 // |
324 // |
326 void CGlxFetcherContainer::SetIconsL(TInt aIndex) |
325 void CGlxFetcherContainer::SetIconsL(TInt aIndex) |
327 { |
326 { |
328 TRACER("CGlxFetcherContainer::SetIconsL()"); |
327 TRACER("CGlxFetcherContainer::SetIconsL()"); |
341 if (value) |
340 if (value) |
342 { |
341 { |
343 CFbsBitmap* bitmap = new (ELeave) CFbsBitmap; |
342 CFbsBitmap* bitmap = new (ELeave) CFbsBitmap; |
344 bitmap->Duplicate( value->iBitmap->Handle()); |
343 bitmap->Duplicate( value->iBitmap->Handle()); |
345 iHgGrid->ItemL(aIndex).SetIcon(CGulIcon::NewL(bitmap)); |
344 iHgGrid->ItemL(aIndex).SetIcon(CGulIcon::NewL(bitmap)); |
346 GLX_LOG_INFO1("### CGlxGridViewImp::Request value-Index is %d",aIndex); |
345 GLX_LOG_INFO1("### CGlxFetcherContainer::Request value-Index is %d",aIndex); |
347 } |
346 } |
348 else if (item.GetIconInfo(icon)) |
347 else if (item.GetIconInfo(icon)) |
349 { |
348 { |
350 GLX_LOG_INFO1("CGlxGridViewImp::Request - icon(%d)", aIndex); |
349 GLX_LOG_INFO1("CGlxFetcherContainer::Request - icon(%d)", aIndex); |
351 CFbsBitmap* bitmap = NULL; |
350 CFbsBitmap* bitmap = NULL; |
352 CFbsBitmap* mask = NULL; |
351 CFbsBitmap* mask = NULL; |
353 AknsUtils::CreateIconLC(AknsUtils::SkinInstance(), KAknsIIDNone, |
352 AknsUtils::CreateIconLC(AknsUtils::SkinInstance(), KAknsIIDNone, |
354 bitmap, mask, icon.bmpfile, icon.bitmapId, icon.maskId); |
353 bitmap, mask, icon.bmpfile, icon.bitmapId, icon.maskId); |
355 __ASSERT_DEBUG(bitmap, Panic(EGlxPanicNullPointer)); |
354 __ASSERT_DEBUG(bitmap, Panic(EGlxPanicNullPointer)); |
361 EAspectRatioPreservedAndUnusedSpaceRemoved); |
360 EAspectRatioPreservedAndUnusedSpaceRemoved); |
362 |
361 |
363 iHgGrid->ItemL(aIndex).SetIcon(CGulIcon::NewL(bitmap, mask)); |
362 iHgGrid->ItemL(aIndex).SetIcon(CGulIcon::NewL(bitmap, mask)); |
364 CleanupStack::Pop(mask); |
363 CleanupStack::Pop(mask); |
365 CleanupStack::Pop(bitmap); |
364 CleanupStack::Pop(bitmap); |
366 GLX_LOG_INFO1("### CGlxGridViewImp::Request GetIconInfo-Index is %d", |
365 GLX_LOG_INFO1("### CGlxFetcherContainer::Request GetIconInfo-Index is %d", |
367 aIndex); |
366 aIndex); |
368 } |
367 } |
369 else if (KErrNone != tnError && KErrNotSupported != tnError) |
368 else if (KErrNone != tnError && KErrNotSupported != tnError) |
370 { |
369 { |
371 GLX_LOG_INFO2( |
370 GLX_LOG_INFO2( |
372 "CGlxGridViewImp::Request - image_corrupted tnError(%d), " |
371 "CGlxFetcherContainer::Request - image_corrupted tnError(%d), " |
373 "i(%d)", tnError, aIndex); |
372 "i(%d)", tnError, aIndex); |
374 |
373 |
375 CFbsBitmap* bitmap = NULL; |
374 CFbsBitmap* bitmap = NULL; |
376 CFbsBitmap* mask = NULL; |
375 CFbsBitmap* mask = NULL; |
377 AknsUtils::CreateIconLC(AknsUtils::SkinInstance(), KAknsIIDNone, |
376 AknsUtils::CreateIconLC(AknsUtils::SkinInstance(), KAknsIIDNone, |
439 TRACER("CGlxFetcherContainer::Release()"); |
438 TRACER("CGlxFetcherContainer::Release()"); |
440 // This has to do nothing on default |
439 // This has to do nothing on default |
441 } |
440 } |
442 |
441 |
443 // --------------------------------------------------------------------------- |
442 // --------------------------------------------------------------------------- |
444 // HandleSelect |
443 // HandleSelectL |
445 // --------------------------------------------------------------------------- |
444 // --------------------------------------------------------------------------- |
446 // |
445 // |
447 void CGlxFetcherContainer::HandleSelectL( TInt aIndex ) |
446 void CGlxFetcherContainer::HandleSelectL( TInt aIndex ) |
448 { |
447 { |
449 TRACER("CGlxGridViewImp::HandleSelect()"); |
448 TRACER("CGlxFetcherContainer::HandleSelectL()"); |
|
449 GLX_LOG_INFO1("CGlxFetcherContainer::HandleSelectL(%d)", aIndex); |
450 // Make sure that the Selection Index is inside medialist count |
450 // Make sure that the Selection Index is inside medialist count |
451 if (aIndex <iMediaList->Count() && aIndex >=0) |
451 if (aIndex < iMediaList->Count() && aIndex >= 0) |
452 { |
452 { |
453 // Setting the focus of the medialist |
453 // Setting the focus of the medialist |
454 iMediaList->SetFocusL(NGlxListDefs::EAbsolute, aIndex); |
454 iMediaList->SetFocusL(NGlxListDefs::EAbsolute, aIndex); |
455 } |
455 |
456 } |
456 //Show Left Soft Key when media is selected |
457 |
457 CEikButtonGroupContainer* cbaContainer = |
458 // --------------------------------------------------------------------------- |
458 CEikButtonGroupContainer::Current(); |
459 // HandleOpen |
459 cbaContainer->SetCommandSetL(R_AVKON_SOFTKEYS_OK_CANCEL); |
|
460 cbaContainer->DrawDeferred(); |
|
461 } |
|
462 } |
|
463 |
|
464 // --------------------------------------------------------------------------- |
|
465 // HandleOpenL |
460 // --------------------------------------------------------------------------- |
466 // --------------------------------------------------------------------------- |
461 // |
467 // |
462 void CGlxFetcherContainer::HandleOpenL( TInt aIndex ) |
468 void CGlxFetcherContainer::HandleOpenL( TInt aIndex ) |
463 { |
469 { |
464 TRACER("CGlxFetcherContainer::HandleOpenL()"); |
470 TRACER("CGlxFetcherContainer::HandleOpenL()"); |
480 // HandleMarkingL |
486 // HandleMarkingL |
481 // --------------------------------------------------------------------------- |
487 // --------------------------------------------------------------------------- |
482 // |
488 // |
483 void CGlxFetcherContainer::HandleMarkingL( TInt aIndex, TBool/* aMarked*/ ) |
489 void CGlxFetcherContainer::HandleMarkingL( TInt aIndex, TBool/* aMarked*/ ) |
484 { |
490 { |
485 TRACER("CGlxGridViewImp::HandleMarkingL()"); |
491 TRACER("CGlxFetcherContainer::HandleMarkingL()"); |
486 HandleMultipleMarkingL(aIndex); |
492 HandleMultipleMarkingL(aIndex); |
487 iEventObserver.HandleMarkEventL(); |
493 iEventObserver.HandleMarkEventL(); |
488 } |
494 } |
489 |
495 |
490 // --------------------------------------------------------------------------- |
496 // --------------------------------------------------------------------------- |
491 // HandleMultipleMarkingL |
497 // HandleMultipleMarkingL |
492 // --------------------------------------------------------------------------- |
498 // --------------------------------------------------------------------------- |
493 // |
499 // |
494 void CGlxFetcherContainer::HandleMultipleMarkingL(TInt aIndex ) |
500 void CGlxFetcherContainer::HandleMultipleMarkingL(TInt aIndex ) |
495 { |
501 { |
496 TRACER("CGlxGridViewImp::HandleMultipleMarkingL()"); |
502 TRACER("CGlxFetcherContainer::HandleMultipleMarkingL()"); |
497 if(iMediaList->IsSelected(aIndex)) |
503 if(iMediaList->IsSelected(aIndex)) |
498 { |
504 { |
499 if(iHgGrid) |
505 if(iHgGrid) |
500 { |
506 { |
501 if(iMultiSelectionEnabled) |
507 if(iMultiSelectionEnabled) |