photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxmediaselectionpopup.cpp
branchRCL_3
changeset 27 34937ec34dac
parent 26 5b3385a43d68
equal deleted inserted replaced
26:5b3385a43d68 27:34937ec34dac
    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  */
       
    23 // INCLUDE FILES
    18 // INCLUDE FILES
    24 
    19 
    25 #include "glxmediaselectionpopup.h"
    20 #include "glxmediaselectionpopup.h"
    26 
    21 
    27 #include <data_caging_path_literals.hrh>// for KDC_APP_RESOURCE_DIR
    22 #include <data_caging_path_literals.hrh>// for KDC_APP_RESOURCE_DIR
   246 					}
   241 					}
   247 				else
   242 				else
   248 					{
   243 					{
   249 					cbaContainer->SetCommandSetL(R_AVKON_SOFTKEYS_CANCEL);
   244 					cbaContainer->SetCommandSetL(R_AVKON_SOFTKEYS_CANCEL);
   250 					}
   245 					}
       
   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 					}
   251 				cbaContainer->DrawDeferred();
   253 				cbaContainer->DrawDeferred();
   252 
       
   253                 }
   254                 }
   254             listBox->DrawDeferred();
   255             listBox->DrawDeferred();
   255 
   256 
   256             //Forward for default processing, if static item is selected(i.e. For Tags)
   257             //Forward for default processing, if static item is selected(i.e. For Tags)
   257 			//or if List Box's Multiple selection is Disabled(i.e. For Albums)
   258 			//or if List Box's Multiple selection is Disabled(i.e. For Albums)
   332 //  
   333 //  
   333 TKeyResponse CGlxSingleGraphicPopupMenuStyleListBox::OfferKeyEventL(
   334 TKeyResponse CGlxSingleGraphicPopupMenuStyleListBox::OfferKeyEventL(
   334 		const TKeyEvent& aKeyEvent, TEventCode aType)
   335 		const TKeyEvent& aKeyEvent, TEventCode aType)
   335 	{
   336 	{
   336     TRACER("CGlxSingleGraphicPopupMenuStyleListBox::OfferKeyEventL");
   337     TRACER("CGlxSingleGraphicPopupMenuStyleListBox::OfferKeyEventL");
   337 
   338     //Note: To add custom implementation to OfferKeyEventL(), change 
       
   339     //CAknSingleGraphicPopupMenuStyleListBox to CGlxSingleGraphicPopupMenuStyleListBox.
       
   340     
   338     //Based on the selected item index, disable the MultipleSelection flag
   341     //Based on the selected item index, disable the MultipleSelection flag
   339     //to stop the flickering of 'marked box', when Highlighted 'New Tag' is selected.
   342     //to stop the flickering of 'marked box', when Highlighted 'New Tag' is selected.
   340     CGlxMediaListAdaptor* mediaListAdaptor =
   343     CGlxMediaListAdaptor* mediaListAdaptor =
   341             static_cast<CGlxMediaListAdaptor*> (Model()->ItemTextArray());
   344             static_cast<CGlxMediaListAdaptor*> (Model()->ItemTextArray());
   342     TInt currItemIndx = View()->CurrentItemIndex();
   345     TInt currItemIndx = View()->CurrentItemIndex();
   483         aAccepted = EFalse;
   486         aAccepted = EFalse;
   484         }
   487         }
   485 
   488 
   486     iMediaList->RemoveMediaListObserver(this); // We no longer require any callbacks from the media list
   489     iMediaList->RemoveMediaListObserver(this); // We no longer require any callbacks from the media list
   487 
   490 
   488 
       
   489     CMPXCollectionPath* path = NULL;
   491     CMPXCollectionPath* path = NULL;
   490     if (aAccepted)
   492     if (aAccepted)
   491         {
   493         {
   492 
       
   493 		//Check if a static item is selected
   494 		//Check if a static item is selected
   494 		if (iMediaListAdaptor->IsStaticItemSelected())
   495 		if (iMediaListAdaptor->IsStaticItemSelected())
   495             {
   496             {
   496 			TFileName uiutilitiesrscfile;
   497 			TFileName uiutilitiesrscfile;
   497 			uiutilitiesrscfile.Append(
   498 			uiutilitiesrscfile.Append(
   517             else
   518             else
   518                 {
   519                 {
   519                 // The error is neither KErrNone or KErrCancel, leave.
   520                 // The error is neither KErrNone or KErrCancel, leave.
   520                 User::Leave(error);
   521                 User::Leave(error);
   521                 }
   522                 }
   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     // TGlxContextRemover will remove the context when it goes out of scope
   888     // Media list must not have been deleted when the destructor of 
   889     // Used here to avoid a trap and still have safe cleanup   
   889     // TGlxContextRemover is called while going out-of-scope.
   890     TGlxFetchContextRemover contextRemover(attributeContext, *rootList);
   890         {
   891     CleanupClosePushL(contextRemover);
   891         // TGlxContextRemover will remove the context when it goes out of scope
   892     User::LeaveIfError(GlxAttributeRetriever::RetrieveL(*attributeContext,
   892         // Used here to avoid a trap and still have safe cleanup   
   893             *rootList, EFalse));
   893         TGlxFetchContextRemover contextRemover(attributeContext, *rootList);
   894     // context off the list
   894         CleanupClosePushL(contextRemover);
   895     CleanupStack::PopAndDestroy(&contextRemover);
   895         User::LeaveIfError(GlxAttributeRetriever::RetrieveL(
       
   896                 *attributeContext, *rootList, EFalse));
       
   897         // context off the list
       
   898         CleanupStack::PopAndDestroy(&contextRemover);
       
   899         } // Limiting scope of contextRemover
   896 
   900 
   897     TInt index = rootList->Index(KGlxIdSpaceIdRoot, iCollectionId);
   901     TInt index = rootList->Index(KGlxIdSpaceIdRoot, iCollectionId);
   898 
   902 
   899     __ASSERT_DEBUG(index> KErrNotFound, Panic(EGlxPanicRequiredItemNotFound));
   903     __ASSERT_DEBUG(index> KErrNotFound, Panic(EGlxPanicRequiredItemNotFound));
   900     TGlxMedia item = rootList->Item(index);
   904     TGlxMedia item = rootList->Item(index);