photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxcommandhandlerupload.cpp
changeset 2 7d9067c6fcb1
parent 0 4e91876724a2
child 18 bcb43dc84c44
equal deleted inserted replaced
1:9ba538e329bd 2:7d9067c6fcb1
    51     const TUid KOpenModeOneClick = { 2 };
    51     const TUid KOpenModeOneClick = { 2 };
    52     // Command to request for the tooltip
    52     // Command to request for the tooltip
    53     const TUid KCmdGetOneClickToolTip = { 15 };    
    53     const TUid KCmdGetOneClickToolTip = { 15 };    
    54     }
    54     }
    55 
    55 
    56 // Get the AppUi instance
       
    57 // This class does not have access to a CEikonEnv and hence 
       
    58 // pls ignore the code scanner warning - Using CEikonEnv::Static
       
    59 #define GetAppUi() (dynamic_cast<CAknAppUi*>(CEikonEnv::Static()->EikAppUi()))
       
    60 
       
    61 // ----------------------------------------------------------------------------
    56 // ----------------------------------------------------------------------------
    62 // Two-phased constructor.
    57 // Two-phased constructor.
    63 // ----------------------------------------------------------------------------
    58 // ----------------------------------------------------------------------------
    64 EXPORT_C CGlxCommandHandlerUpload* CGlxCommandHandlerUpload::NewL(
    59 EXPORT_C CGlxCommandHandlerUpload* CGlxCommandHandlerUpload::NewL(
    65 									MGlxMediaListProvider* aMediaListProvider, 
    60 									MGlxMediaListProvider* aMediaListProvider, 
   368 // ----------------------------------------------------------------------------
   363 // ----------------------------------------------------------------------------
   369 //
   364 //
   370 void CGlxCommandHandlerUpload::SetToolTipL()
   365 void CGlxCommandHandlerUpload::SetToolTipL()
   371     {
   366     {
   372     TRACER("CGlxCommandHandlerUpload::SetToolTipL");
   367     TRACER("CGlxCommandHandlerUpload::SetToolTipL");
   373     
   368 
   374     CAknToolbar* toolbar = GetAppUi()->CurrentFixedToolbar();
   369     CAknToolbar* toolbar = iAvkonAppUi->CurrentFixedToolbar();
   375 
   370     if (!toolbar)
   376     if(toolbar)
   371         {
   377         {
   372         return;
   378         CAknButton* uploadButton = static_cast<CAknButton*>     
   373         }
   379         (toolbar->ControlOrNull( EGlxCmdUpload ));
   374 
   380                     
   375     CAknButton* uploadButton =
   381         if(uploadButton && iUploadSupported)
   376             static_cast<CAknButton*> (toolbar->ControlOrNull(EGlxCmdUpload));
   382             {
   377 
   383             // Get the tooltip text from AIW ShareOnline application
   378     if (uploadButton && iUploadSupported)
   384             HBufC* toolTipText = NULL;
   379         {
   385             
   380         // Get the tooltip text from AIW ShareOnline application
   386             // GetToolTipL might allocate memory. Hence toolTipText should 
   381         HBufC* toolTipText = NULL;
   387             // be popped and destroyed if present.
   382 
   388             GetToolTipL(toolTipText);     
   383         // GetToolTipL might allocate memory. Hence toolTipText should 
   389             
   384         // be popped and destroyed if present.
   390             if( toolTipText )
   385         GetToolTipL(toolTipText);
   391                 {                
   386 
   392                 // Get current button state and set the help text(tool tip)             
   387         if (toolTipText)
   393                 CAknButtonState* currentState = uploadButton->State();
   388             {
   394                 
   389             // Get current button state and set the help text(tool tip)             
   395                TBool dimmed = uploadButton->IsDimmed();
   390             CAknButtonState* currentState = uploadButton->State();
   396                if(dimmed)
   391 
   397                		{
   392             TBool dimmed = uploadButton->IsDimmed();
   398                		uploadButton->SetDimmed(EFalse);
   393             if (dimmed)
   399                 	currentState->SetHelpTextL( toolTipText->Des()); 
   394                 {
   400                 	uploadButton->SetDimmed(ETrue);
   395                 uploadButton->SetDimmed(EFalse);
   401               		}
   396                 currentState->SetHelpTextL(toolTipText->Des());
   402               	else
   397                 uploadButton->SetDimmed(ETrue);
   403               		{
       
   404               		currentState->SetHelpTextL( toolTipText->Des()); 	
       
   405               		}
       
   406                 CleanupStack::PopAndDestroy(toolTipText);
       
   407                 }
   398                 }
   408             else
   399             else
   409                 {
   400                 {
   410                 User::Leave(KErrArgument);
   401                 currentState->SetHelpTextL(toolTipText->Des());
   411                 }            
   402                 }
       
   403             CleanupStack::PopAndDestroy(toolTipText);
   412             }
   404             }
   413         }
   405         else
       
   406             {
       
   407             User::Leave(KErrArgument);
       
   408             }
       
   409         } // if(uploadButton && iUploadSupported)
   414     }
   410     }
   415 
   411 
   416 // End of file
   412 // End of file
   417 
   413