photosgallery/controllers/fetcher/src/glxfetchercontainer.cpp
branchRCL_3
changeset 25 191387a8b767
parent 22 2dac0fdba72b
child 30 a60acebbbd9d
equal deleted inserted replaced
22:2dac0fdba72b 25:191387a8b767
   157 	// Create the control here
   157 	// Create the control here
   158     CreateHgGridWidgetL();
   158     CreateHgGridWidgetL();
   159     
   159     
   160     CreateGridMediaListObserverL();
   160     CreateGridMediaListObserverL();
   161 	
   161 	
   162     CreateEmptyDisplayL( iFilterType );
       
   163 	
       
   164 	// If multiple image selection is allowed, then set marking flag on grid widget.
   162 	// If multiple image selection is allowed, then set marking flag on grid widget.
   165 	if(iMultiSelectionEnabled)
   163 	if(iMultiSelectionEnabled)
   166 	    {
   164 	    {
   167 	    // Fetcher CommandHandler must be created after creating the medialist
   165 	    // Fetcher CommandHandler must be created after creating the medialist
   168 	    iFetcherCommandHandler = CGlxFetcherCommandHandler::NewL( this , this );
   166 	    iFetcherCommandHandler = CGlxFetcherCommandHandler::NewL( this , this );
   169 	    
   167 	    
   170 	    iHgGrid->SetFlags( CHgScroller::EHgScrollerSelectionMode );
   168 	    iHgGrid->SetFlags( CHgScroller::EHgScrollerSelectionMode );
   171 	    iMultipleMarkNotStarted = EFalse;
   169 	    iMultipleMarkNotStarted = EFalse;
   172 	    }
   170 	    }
   173 	}
       
   174 // ---------------------------------------------------------------------------
       
   175 // CreateEmptyDisplayL
       
   176 // Displays the empty string if no items in grid with respect to item selected.
       
   177 // ---------------------------------------------------------------------------
       
   178 //  
       
   179 void CGlxFetcherContainer::CreateEmptyDisplayL( TGlxFilterItemType aFilterType )
       
   180 	{
       
   181 	TRACER("CGlxFetcherContainer::CreateEmptyDisplayL");
       
   182     if (aFilterType == EGlxFilterImage)
       
   183         {
       
   184         HBufC* emptyText = 
       
   185                   StringLoader::LoadLC(R_FETCHER_EMPTY_VIEW_TEXT_IMAGE);
       
   186         iHgGrid->SetEmptyTextL(*emptyText);
       
   187         CleanupStack::PopAndDestroy(emptyText);
       
   188         }
       
   189     else if (aFilterType == EGlxFilterVideo)
       
   190         {
       
   191         HBufC* emptyText = 
       
   192                   StringLoader::LoadLC(R_FETCHER_EMPTY_VIEW_TEXT_VIDEO);
       
   193         iHgGrid->SetEmptyTextL(*emptyText);
       
   194         CleanupStack::PopAndDestroy(emptyText);
       
   195         }
       
   196 	}
   171 	}
   197 // ---------------------------------------------------------------------------
   172 // ---------------------------------------------------------------------------
   198 // CreateMediaListL()
   173 // CreateMediaListL()
   199 // Creates a collection path
   174 // Creates a collection path
   200 // Create a filter as requested filtertype
   175 // Create a filter as requested filtertype
   236 
   211 
   237     iThumbnailContext = CGlxThumbnailContext::NewL( &iBlockyIterator ); // set the thumbnail context
   212     iThumbnailContext = CGlxThumbnailContext::NewL( &iBlockyIterator ); // set the thumbnail context
   238     iThumbnailContext->SetDefaultSpec( iUiUtility->GetGridIconSize().iWidth,
   213     iThumbnailContext->SetDefaultSpec( iUiUtility->GetGridIconSize().iWidth,
   239             iUiUtility->GetGridIconSize().iHeight );
   214             iUiUtility->GetGridIconSize().iHeight );
   240 
   215 
   241     CGlxDefaultAttributeContext* attrContext = CGlxDefaultAttributeContext::NewL();
       
   242     CleanupStack::PushL(attrContext);
       
   243     attrContext->AddAttributeL(KMPXMediaGeneralCount);
       
   244     attrContext->SetRangeOffsets(KItemsPerPage, KItemsPerPage);
       
   245     iMediaList->AddContextL(attrContext, KGlxFetchContextPriorityGridViewVisibleThumbnail);
       
   246     User::LeaveIfError(GlxAttributeRetriever::RetrieveL(*attrContext,*iMediaList,EFalse));
       
   247     iMediaList->RemoveContext(attrContext);
       
   248     CleanupStack::PopAndDestroy( attrContext );
       
   249     iMediaList->AddContextL(iThumbnailContext, KGlxFetchContextPriorityNormal );
   216     iMediaList->AddContextL(iThumbnailContext, KGlxFetchContextPriorityNormal );
   250 
   217 
   251     if (!iHgGrid)
   218     if (!iHgGrid)
   252         {
   219         {
   253         TRect rect;
   220         TRect rect;
   274                 bitmap, mask));
   241                 bitmap, mask));
   275         CleanupStack::Pop(mask);
   242         CleanupStack::Pop(mask);
   276         CleanupStack::Pop(bitmap);
   243         CleanupStack::Pop(bitmap);
   277         }
   244         }
   278 
   245 
       
   246 	// Set the grid to use different layout for landscape mode in fetcher
       
   247     //iHgGrid->SetToolbarVisibility(EFalse);
   279     iHgGrid->SetSelectedIndex(iMediaList->FocusIndex());
   248     iHgGrid->SetSelectedIndex(iMediaList->FocusIndex());
   280     // Setting to MopParent to update background skin
   249     // Setting to MopParent to update background skin
   281     iHgGrid->SetMopParent(this);
   250     iHgGrid->SetMopParent(this);
   282     // Setting Selction observer for getting callback on key event change
   251     // Setting Selction observer for getting callback on key event change
   283     iHgGrid->SetSelectionObserver(*this);
   252     iHgGrid->SetSelectionObserver(*this);
   295 // CreateGridMediaListObserverL
   264 // CreateGridMediaListObserverL
   296 // ---------------------------------------------------------------------------
   265 // ---------------------------------------------------------------------------
   297 //  
   266 //  
   298 void CGlxFetcherContainer::CreateGridMediaListObserverL()
   267 void CGlxFetcherContainer::CreateGridMediaListObserverL()
   299     {
   268     {
   300     iGlxGridMLObserver = CGlxGridViewMLObserver::NewL(*iMediaList , iHgGrid);
   269     iGlxGridMLObserver = CGlxGridViewMLObserver::NewL(*iMediaList, iHgGrid,
       
   270             iFilterType);
   301     }
   271     }
   302     
   272     
   303 // ---------------------------------------------------------------------------
   273 // ---------------------------------------------------------------------------
   304 // BufferPositionChanged
   274 // BufferPositionChanged
   305 // ---------------------------------------------------------------------------
   275 // ---------------------------------------------------------------------------