photosgallery/controllers/fetcher/src/glxfetcherdialog.cpp
branchRCL_3
changeset 47 f9e827349359
parent 25 191387a8b767
child 57 ea65f74e6de4
equal deleted inserted replaced
35:420f6808bf21 47:f9e827349359
   211 //-----------------------------------------------------------------------------
   211 //-----------------------------------------------------------------------------
   212 // CGlxFetcherDialog::OkToExitL
   212 // CGlxFetcherDialog::OkToExitL
   213 //-----------------------------------------------------------------------------
   213 //-----------------------------------------------------------------------------
   214 TBool CGlxFetcherDialog::OkToExitL(TInt aKeycode)
   214 TBool CGlxFetcherDialog::OkToExitL(TInt aKeycode)
   215 	{
   215 	{
   216 	TRACER("CGlxFetcherDialog::OkToExitL");
   216     TRACER("CGlxFetcherDialog::OkToExitL");
   217 	GLX_LOG_INFO1("CGlxFetcherDialog::OkToExitL : %d",aKeycode );
   217     GLX_LOG_INFO1("CGlxFetcherDialog::OkToExitL : %d",aKeycode );
   218     TBool retVal = ETrue;
   218     TBool retVal = ETrue;
   219     TBool retrieveUriValue = EFalse;
   219     TBool retrieveUriValue = EFalse;
   220     switch( aKeycode )
   220     switch (aKeycode)
   221         {
   221         {
   222         case EAknSoftkeySelect :
   222         case EAknSoftkeySelect:
   223         case EGlxCmdSelectMarked :
   223         case EGlxCmdSelectMarked:
   224         case EAknSoftkeyOk :
   224         case EAknSoftkeyOk:
   225         case EAknCmdOpen :
   225         case EAknCmdOpen:
   226             {
   226             {
   227             // Retreives the uri's of the selected files and verifies if it is a 
   227             // Retreives the uri's of the selected files and verifies if it is a 
   228             // supported format
   228             // supported format
   229             if (!iFetchUri)
   229             if (!iFetchUri)
   230                 {
   230                 {
   231                 iFetchUri = ETrue;
   231                 iFetchUri = ETrue;
   232                 retrieveUriValue = iFetcherContainer->RetrieveUrisL(iSelectedFiles, iFetchUri);
   232                 retrieveUriValue = iFetcherContainer->RetrieveUrisL(
   233                 if ( iVerifier && !iVerifier->VerifySelectionL( &iSelectedFiles ) )
   233                         iSelectedFiles, iFetchUri);
       
   234                 if (iVerifier
       
   235                         && !iVerifier->VerifySelectionL(&iSelectedFiles))
   234                     {
   236                     {
       
   237                     GLX_LOG_INFO("CGlxFetcherDialog::OkToExitL : "
       
   238                             " VerifySelectionL() failed!");
   235                     iSelectedFiles.Reset();
   239                     iSelectedFiles.Reset();
   236                     retVal = EFalse;
   240                     retVal = EFalse;
   237                     //if the corrupt file is selected then reset the flag to again enable
   241                     //if the corrupt file is selected then reset the flag to again enable
   238                     //the selection.
   242                     //the selection.
   239                     iFetcherContainer->SetFileAttached(EFalse);
   243                     iFetcherContainer->SetFileAttached(EFalse);
   240                     } 
   244                     }
   241                 if (!retrieveUriValue)
   245                 if (!retrieveUriValue)
   242                     {
   246                     {
   243                     retVal = EFalse;
   247                     retVal = EFalse;
   244                     }
   248                     }
   245                 if (iMultiSelectionEnabled && retVal)
   249                 if (iMultiSelectionEnabled && retVal)
   246                     {
   250                     {
   247                     iFetcherContainer->DoExecuteL(EGlxCmdEndMultipleMarking);    
   251                     iFetcherContainer->DoExecuteL(EGlxCmdEndMultipleMarking);
   248                     }
   252                     }
   249                 }
   253                 }
   250             else
   254             else
   251                 {
   255                 {
   252                 // if uri is being fetched then do not set the return value true, else it would cause
   256                 // if uri is being fetched then do not set the return value true, else it would cause
   253                 // Destructor of Dialog to be called and result in a crash when OKtoExitL is called multiple times.
   257                 // Destructor of Dialog to be called and result in a crash when OKtoExitL is called multiple times.
   254                 retVal = EFalse;
   258                 retVal = EFalse;
   255                 }
   259                 }
   256             break;
   260             break;
   257             }
   261             }
   258         case EAknSoftkeyCancel : // exit dialog
   262         case EAknSoftkeyCancel: // exit dialog
   259         case EAknCmdExit :
   263         case EAknCmdExit:
   260             {
   264             {
   261             break;
   265             break;
   262             }
   266             }
   263         case EAknCmdMark:
   267         case EAknCmdMark:
   264         case EAknSoftkeyMark:
   268         case EAknSoftkeyMark:
   265             {
   269             {
   266             if (iMultiSelectionEnabled)
   270             if (iMultiSelectionEnabled)
   267                 {                
   271                 {
   268                 if(iUiUtility->IsPenSupported())
   272                 if (iUiUtility->IsPenSupported())
   269                     {
   273                     {
   270                     //Since the MSK is disabled we always get EAknCmdMark
   274                     //Since the MSK is disabled we always get EAknCmdMark
   271                     //when we select msk hardkey in touch phone, so we need 
   275                     //when we select msk hardkey in touch phone, so we need 
   272                     //to toggle between mark/unmark on the same hardkey event
   276                     //to toggle between mark/unmark on the same hardkey event
   273                     if (!iMarkStarted)
   277                     if (!iMarkStarted)
   274                         {
   278                         {
   275                         iFetcherContainer->DoExecuteL(EGlxCmdStartMultipleMarking);
   279                         iFetcherContainer->DoExecuteL(
       
   280                                 EGlxCmdStartMultipleMarking);
   276                         iMarkStarted = ETrue;
   281                         iMarkStarted = ETrue;
   277                         }
   282                         }
   278                     else
   283                     else
   279                         {
   284                         {
   280                         MGlxMediaList& mediaList = iFetcherContainer->MediaList();
   285                         MGlxMediaList& mediaList =
   281                         TInt focusIdx = mediaList.FocusIndex();                        
   286                                 iFetcherContainer->MediaList();
   282                         if ( mediaList.IsSelected(focusIdx) )
   287                         TInt focusIdx = mediaList.FocusIndex();
       
   288                         if (mediaList.IsSelected(focusIdx))
   283                             iFetcherContainer->DoExecuteL(EAknCmdUnmark);
   289                             iFetcherContainer->DoExecuteL(EAknCmdUnmark);
   284                         else
   290                         else
   285                             iFetcherContainer->DoExecuteL(EAknCmdMark);
   291                             iFetcherContainer->DoExecuteL(EAknCmdMark);
   286                         }
   292                         }
   287                     }
   293                     }
   288                 else
   294                 else
   289                     {
   295                     {
   290                     if (!iMarkStarted)
   296                     if (!iMarkStarted)
   291                         {
   297                         {
   292                         iFetcherContainer->DoExecuteL(EGlxCmdStartMultipleMarking);
   298                         iFetcherContainer->DoExecuteL(
       
   299                                 EGlxCmdStartMultipleMarking);
   293                         iMarkStarted = ETrue;
   300                         iMarkStarted = ETrue;
   294                         }
   301                         }
   295                     else
   302                     else
   296                         {
   303                         {
   297                         iFetcherContainer->DoExecuteL(EAknCmdMark);
   304                         iFetcherContainer->DoExecuteL(EAknCmdMark);
   305         case EAknSoftkeyUnmark:
   312         case EAknSoftkeyUnmark:
   306             {
   313             {
   307             if (iMultiSelectionEnabled)
   314             if (iMultiSelectionEnabled)
   308                 {
   315                 {
   309                 iFetcherContainer->DoExecuteL(EAknCmdUnmark);
   316                 iFetcherContainer->DoExecuteL(EAknCmdUnmark);
   310 				                
   317 
   311                 //@ fix for ELWU-7RA7NX 
   318                 //@ fix for ELWU-7RA7NX 
   312                 //@ Reset the flag on no selection, else it'll not pass the events to container for
   319                 //@ Reset the flag on no selection, else it'll not pass the events to container for
   313                 //@ EGlxCmdStartMultipleMarking  case.
   320                 //@ EGlxCmdStartMultipleMarking  case.
   314                 MGlxMediaList& mediaList = iFetcherContainer->MediaList() ;
   321                 MGlxMediaList& mediaList = iFetcherContainer->MediaList();
   315                 if ( mediaList.SelectionCount() <= 0 )
   322                 if (mediaList.SelectionCount() <= 0)
   316 	                {
   323                     {
   317 	                iMarkStarted = EFalse;	
   324                     iMarkStarted = EFalse;
   318 	                } 
   325                     }
   319 					
   326 
   320                 HBufC* mskTextMark = StringLoader::LoadLC( R_GLX_MARKING_MARK );
   327                 HBufC* mskTextMark = StringLoader::LoadLC(R_GLX_MARKING_MARK);
   321                 HBufC* rskTextCancel = StringLoader::LoadLC( R_GLX_SOFTKEY_CANCEL );
   328                 HBufC* rskTextCancel = StringLoader::LoadLC(
       
   329                         R_GLX_SOFTKEY_CANCEL);
   322                 iUiUtility->ScreenFurniture()->ModifySoftkeyIdL(
   330                 iUiUtility->ScreenFurniture()->ModifySoftkeyIdL(
   323                         CEikButtonGroupContainer::EMiddleSoftkeyPosition, 
   331                         CEikButtonGroupContainer::EMiddleSoftkeyPosition,
   324                         EAknCmdMark, 0, *mskTextMark);
   332                         EAknCmdMark, 0, *mskTextMark);
   325                 iUiUtility->ScreenFurniture()->ModifySoftkeyIdL(
   333                 iUiUtility->ScreenFurniture()->ModifySoftkeyIdL(
   326                         CEikButtonGroupContainer::ERightSoftkeyPosition,
   334                         CEikButtonGroupContainer::ERightSoftkeyPosition,
   327                         EAknSoftkeyCancel, 0, *rskTextCancel);
   335                         EAknSoftkeyCancel, 0, *rskTextCancel);
   328                 CleanupStack::PopAndDestroy(rskTextCancel);
   336                 CleanupStack::PopAndDestroy(rskTextCancel);
   329                 CleanupStack::PopAndDestroy(mskTextMark);
   337                 CleanupStack::PopAndDestroy(mskTextMark);
   330                 }
   338                 }
   331             retVal = EFalse;
   339             retVal = EFalse;
   332             break;
   340             break;
   333             }
   341             }
   334         default :
   342         default:
   335             break;
   343             break;
   336         }
   344         }
       
   345 
       
   346     GLX_LOG_INFO1("CGlxFetcherDialog::OkToExitL : retVal(%d)", retVal);
   337     return retVal;
   347     return retVal;
   338 	}
   348     }
   339 
   349 
   340 //-----------------------------------------------------------------------------
   350 //-----------------------------------------------------------------------------
   341 // CGlxFetcherDialog::SizeChanged
   351 // CGlxFetcherDialog::SizeChanged
   342 //-----------------------------------------------------------------------------
   352 //-----------------------------------------------------------------------------
   343 void CGlxFetcherDialog::SizeChanged()
   353 void CGlxFetcherDialog::SizeChanged()
   429 // Callback from the container for double tap events
   439 // Callback from the container for double tap events
   430 // Offers the event from container to Dialog
   440 // Offers the event from container to Dialog
   431 //-----------------------------------------------------------------------------
   441 //-----------------------------------------------------------------------------
   432 void CGlxFetcherDialog::HandleDoubleTapEventL(TInt aCommandId)
   442 void CGlxFetcherDialog::HandleDoubleTapEventL(TInt aCommandId)
   433     {
   443     {
   434     TRACER("CGlxFetcherDialog::HandleTapEvent");
   444     TRACER("CGlxFetcherDialog::HandleDoubleTapEventL");
   435     Extension()->iPublicFlags.Set(CEikDialogExtension::EDelayedExit);
   445     Extension()->iPublicFlags.Set(CEikDialogExtension::EDelayedExit);
   436     ProcessCommandL(aCommandId);
   446     ProcessCommandL(aCommandId);
   437     Extension()->iPublicFlags.Clear(CEikDialogExtension::EDelayedExit);
   447     Extension()->iPublicFlags.Clear(CEikDialogExtension::EDelayedExit);
   438     }
   448     }
   439     
   449