photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxmediaselectionpopup.cpp
branchRCL_3
changeset 75 01504893d9cb
parent 64 34937ec34dac
equal deleted inserted replaced
68:5b238bc8ffb6 75:01504893d9cb
    13 *
    13 *
    14 * Description:    Generic selection popup class
    14 * Description:    Generic selection popup class
    15 *
    15 *
    16 */
    16 */
    17 
    17 
       
    18 
       
    19 /**
       
    20  * @internal reviewed 06/06/2007 by Dave Schofield
       
    21  * @internal reviewed 13/07/2007 by Aki Vanhatalo
       
    22  */
    18 // INCLUDE FILES
    23 // INCLUDE FILES
    19 
    24 
    20 #include "glxmediaselectionpopup.h"
    25 #include "glxmediaselectionpopup.h"
    21 
    26 
    22 #include <data_caging_path_literals.hrh>// for KDC_APP_RESOURCE_DIR
    27 #include <data_caging_path_literals.hrh>// for KDC_APP_RESOURCE_DIR
   241 					}
   246 					}
   242 				else
   247 				else
   243 					{
   248 					{
   244 					cbaContainer->SetCommandSetL(R_AVKON_SOFTKEYS_CANCEL);
   249 					cbaContainer->SetCommandSetL(R_AVKON_SOFTKEYS_CANCEL);
   245 					}
   250 					}
   246                 //LSK / SK1’s visibility is determined by the screen context, if single click support enabled.
       
   247                 //As suggested by Avkon, disable the CEikCba’s item specific softkey default behavior.
       
   248 				CEikCba* eikCba = static_cast<CEikCba*>( cbaContainer->ButtonGroup() );
       
   249 				if( eikCba )
       
   250 					{
       
   251 					eikCba->EnableItemSpecificSoftkey( EFalse );
       
   252 					}
       
   253 				cbaContainer->DrawDeferred();
   251 				cbaContainer->DrawDeferred();
       
   252 
   254                 }
   253                 }
   255             listBox->DrawDeferred();
   254             listBox->DrawDeferred();
   256 
   255 
   257             //Forward for default processing, if static item is selected(i.e. For Tags)
   256             //Forward for default processing, if static item is selected(i.e. For Tags)
   258 			//or if List Box's Multiple selection is Disabled(i.e. For Albums)
   257 			//or if List Box's Multiple selection is Disabled(i.e. For Albums)
   333 //  
   332 //  
   334 TKeyResponse CGlxSingleGraphicPopupMenuStyleListBox::OfferKeyEventL(
   333 TKeyResponse CGlxSingleGraphicPopupMenuStyleListBox::OfferKeyEventL(
   335 		const TKeyEvent& aKeyEvent, TEventCode aType)
   334 		const TKeyEvent& aKeyEvent, TEventCode aType)
   336 	{
   335 	{
   337     TRACER("CGlxSingleGraphicPopupMenuStyleListBox::OfferKeyEventL");
   336     TRACER("CGlxSingleGraphicPopupMenuStyleListBox::OfferKeyEventL");
   338     //Note: To add custom implementation to OfferKeyEventL(), change 
   337 
   339     //CAknSingleGraphicPopupMenuStyleListBox to CGlxSingleGraphicPopupMenuStyleListBox.
       
   340     
       
   341     //Based on the selected item index, disable the MultipleSelection flag
   338     //Based on the selected item index, disable the MultipleSelection flag
   342     //to stop the flickering of 'marked box', when Highlighted 'New Tag' is selected.
   339     //to stop the flickering of 'marked box', when Highlighted 'New Tag' is selected.
   343     CGlxMediaListAdaptor* mediaListAdaptor =
   340     CGlxMediaListAdaptor* mediaListAdaptor =
   344             static_cast<CGlxMediaListAdaptor*> (Model()->ItemTextArray());
   341             static_cast<CGlxMediaListAdaptor*> (Model()->ItemTextArray());
   345     TInt currItemIndx = View()->CurrentItemIndex();
   342     TInt currItemIndx = View()->CurrentItemIndex();
   486         aAccepted = EFalse;
   483         aAccepted = EFalse;
   487         }
   484         }
   488 
   485 
   489     iMediaList->RemoveMediaListObserver(this); // We no longer require any callbacks from the media list
   486     iMediaList->RemoveMediaListObserver(this); // We no longer require any callbacks from the media list
   490 
   487 
       
   488 
   491     CMPXCollectionPath* path = NULL;
   489     CMPXCollectionPath* path = NULL;
   492     if (aAccepted)
   490     if (aAccepted)
   493         {
   491         {
       
   492 
   494 		//Check if a static item is selected
   493 		//Check if a static item is selected
   495 		if (iMediaListAdaptor->IsStaticItemSelected())
   494 		if (iMediaListAdaptor->IsStaticItemSelected())
   496             {
   495             {
   497 			TFileName uiutilitiesrscfile;
   496 			TFileName uiutilitiesrscfile;
   498 			uiutilitiesrscfile.Append(
   497 			uiutilitiesrscfile.Append(
   518             else
   517             else
   519                 {
   518                 {
   520                 // The error is neither KErrNone or KErrCancel, leave.
   519                 // The error is neither KErrNone or KErrCancel, leave.
   521                 User::Leave(error);
   520                 User::Leave(error);
   522                 }
   521                 }
       
   522 
   523             }
   523             }
   524         else
   524         else
   525             {
   525             {
   526             iMediaList->SetFocusL(NGlxListDefs::EAbsolute,
   526             iMediaList->SetFocusL(NGlxListDefs::EAbsolute,
   527                     iListBox->CurrentItemIndex());
   527                     iListBox->CurrentItemIndex());
   883             KGlxMediaCollectionPluginSpecificNewMediaItemTitle);
   883             KGlxMediaCollectionPluginSpecificNewMediaItemTitle);
   884     attributeContext->AddAttributeL(
   884     attributeContext->AddAttributeL(
   885             KGlxMediaCollectionPluginSpecificSelectMediaPopupTitle);
   885             KGlxMediaCollectionPluginSpecificSelectMediaPopupTitle);
   886     rootList->AddContextL(attributeContext, KGlxFetchContextPriorityBlocking);
   886     rootList->AddContextL(attributeContext, KGlxFetchContextPriorityBlocking);
   887 
   887 
   888     // Media list must not have been deleted when the destructor of 
   888     // TGlxContextRemover will remove the context when it goes out of scope
   889     // TGlxContextRemover is called while going out-of-scope.
   889     // Used here to avoid a trap and still have safe cleanup   
   890         {
   890     TGlxFetchContextRemover contextRemover(attributeContext, *rootList);
   891         // TGlxContextRemover will remove the context when it goes out of scope
   891     CleanupClosePushL(contextRemover);
   892         // Used here to avoid a trap and still have safe cleanup   
   892     User::LeaveIfError(GlxAttributeRetriever::RetrieveL(*attributeContext,
   893         TGlxFetchContextRemover contextRemover(attributeContext, *rootList);
   893             *rootList, EFalse));
   894         CleanupClosePushL(contextRemover);
   894     // context off the list
   895         User::LeaveIfError(GlxAttributeRetriever::RetrieveL(
   895     CleanupStack::PopAndDestroy(&contextRemover);
   896                 *attributeContext, *rootList, EFalse));
       
   897         // context off the list
       
   898         CleanupStack::PopAndDestroy(&contextRemover);
       
   899         } // Limiting scope of contextRemover
       
   900 
   896 
   901     TInt index = rootList->Index(KGlxIdSpaceIdRoot, iCollectionId);
   897     TInt index = rootList->Index(KGlxIdSpaceIdRoot, iCollectionId);
   902 
   898 
   903     __ASSERT_DEBUG(index> KErrNotFound, Panic(EGlxPanicRequiredItemNotFound));
   899     __ASSERT_DEBUG(index> KErrNotFound, Panic(EGlxPanicRequiredItemNotFound));
   904     TGlxMedia item = rootList->Item(index);
   900     TGlxMedia item = rootList->Item(index);