photosgallery/gallery/src/glxappui.cpp
branchRCL_3
changeset 13 71da52165949
parent 2 7d9067c6fcb1
child 18 bcb43dc84c44
equal deleted inserted replaced
9:6b87b143d312 13:71da52165949
    17 
    17 
    18 
    18 
    19  
    19  
    20 
    20 
    21 #include "glxappui.h"
    21 #include "glxappui.h"
       
    22 #include "glxcachemanager.h"
       
    23 #include "glxiadupdate.h"
    22 
    24 
    23 #include <avkon.hrh>
    25 #include <avkon.hrh>
    24 #include <StringLoader.h>    
    26 #include <StringLoader.h>    
    25 #include <aknnotewrappers.h>
    27 #include <aknnotewrappers.h>
    26 #include <AknUtils.h>
    28 #include <AknUtils.h>
    57 #include <AknGlobalNote.h>
    59 #include <AknGlobalNote.h>
    58 #include <hal.h>
    60 #include <hal.h>
    59 #include <hal_data.h>
    61 #include <hal_data.h>
    60 #include <oommonitorsession.h>
    62 #include <oommonitorsession.h>
    61 #include <glxtracer.h>
    63 #include <glxtracer.h>
    62 #include "glxcachemanager.h"//OOM
    64 
    63 //OOM
    65 //OOM
    64 
       
    65 #include <oommonitorplugin.h>
    66 #include <oommonitorplugin.h>
    66 #include <oommonitorsession.h>
    67 #include <oommonitorsession.h>
    67 
       
    68 //OOM
       
    69 
       
    70 
       
    71 #include <glxbackservicewrapper.h>
       
    72 
       
    73 
       
    74 #include <glxuistd.h>
    68 #include <glxuistd.h>
    75 #include <apgcli.h>
    69 #include <apgcli.h>
    76 #include "glxiadupdate.h"
       
    77 
    70 
    78 //constants
    71 //constants
    79 const TInt KGlxGridThumbnailPages          = 9 ;       // 4 page Down + 4 page Up + 1 Visible page = 9 page 
    72 const TInt KGlxGridThumbnailPages          = 9 ;       // 4 page Down + 4 page Up + 1 Visible page = 9 page 
    80 const TInt KGlxFullThumbnailCount         = 11 ;       // 5 Thumnail Front + 5 Thumbnail Rear + 1 Visible = 11 page
    73 const TInt KGlxFullThumbnailCount         = 11 ;       // 5 Thumnail Front + 5 Thumbnail Rear + 1 Visible = 11 page
    81 #ifdef __MARM
    74 #ifdef __MARM
    85 #endif
    78 #endif
    86 const TInt KGlxMaxMemoryToDecodeCapturedPicture = 2 * KGlxMaxMegaPixelsSupportedByCamera ;
    79 const TInt KGlxMaxMemoryToDecodeCapturedPicture = 2 * KGlxMaxMegaPixelsSupportedByCamera ;
    87 const TInt KGlxMemoryForOOMFwk          = 1048576 ; // 1 MB
    80 const TInt KGlxMemoryForOOMFwk          = 1048576 ; // 1 MB
    88 const TInt KGlxThumbNailRepresentation    = 2;         // Thumbnail Representation; Could be 3 also 
    81 const TInt KGlxThumbNailRepresentation    = 2;         // Thumbnail Representation; Could be 3 also 
    89 
    82 
    90 _LIT8( KPhotosSuiteNavigation, "SuiteNavigation" );
       
    91 _LIT8( KPhotosCaptured, "Captured" );
    83 _LIT8( KPhotosCaptured, "Captured" );
    92 _LIT8( KPhotosMonths, "Months" );
    84 _LIT8( KPhotosMonths, "Months" );
    93 _LIT8( KPhotosTags, "Tags" );
    85 _LIT8( KPhotosTags, "Tags" );
    94 _LIT8( KPhotosAlbums, "Albums" );
    86 _LIT8( KPhotosAlbums, "Albums" );
    95 _LIT8( KPhotosAllValue,"Allcs");
    87 _LIT8( KPhotosAllValue,"Allcs");
    96 
    88 
    97 _LIT8( KPhotosSuiteExitMessage, "mm://photossuite?action=exit" );
       
    98 
       
    99 // Matrix uid, needed for activating the suite view.
       
   100 const TInt KMatrixUid = 0x101F4CD2;
       
   101 const TInt KCapturedAlbumId = 2 ;
    89 const TInt KCapturedAlbumId = 2 ;
   102         
    90         
   103 /**
    91 /**
   104  * Start Delay for the periodic timer, in microseconds
    92  * Start Delay for the periodic timer, in microseconds
   105  */
    93  */
   125     // Create navigational state 
   113     // Create navigational state 
   126     iNavigationalState = CGlxNavigationalState::InstanceL();
   114     iNavigationalState = CGlxNavigationalState::InstanceL();
   127     
   115     
   128     iNavigationalState->AddObserverL( *this );
   116     iNavigationalState->AddObserverL( *this );
   129 
   117 
   130     // Create Back Stepping Service wrapper
       
   131 	iBSWrapper = CGlxBackServiceWrapper::NewL( TUid::Uid( KGlxGalleryApplicationUid ) );
       
   132 	iNavigationalState->SetBackExitStatus(EFalse);
   118 	iNavigationalState->SetBackExitStatus(EFalse);
   133     
   119     
   134     iFocusLostLowMemory = EFalse;
   120     iFocusLostLowMemory = EFalse;
   135     
   121     
   136     // Get an instance of view utility
   122     // Get an instance of view utility
   169     if ( iUiUtility )
   155     if ( iUiUtility )
   170         {
   156         {
   171         iUiUtility->Close();
   157         iUiUtility->Close();
   172         }
   158         }
   173 
   159 
   174     if( iBSWrapper )
       
   175         {	
       
   176         delete iBSWrapper;    
       
   177         }
       
   178     if (iPeriodic)
   160     if (iPeriodic)
   179         {
   161         {
   180         iPeriodic->Cancel();
   162         iPeriodic->Cancel();
   181         delete iPeriodic;
   163         delete iPeriodic;
   182         }
   164         }
   197     GLX_LOG_INFO1("PHOTOS LOGS: void CGlxAppUi::HandleCommandL(TInt aCommand = %d)",aCommand );
   179     GLX_LOG_INFO1("PHOTOS LOGS: void CGlxAppUi::HandleCommandL(TInt aCommand = %d)",aCommand );
   198     switch(aCommand)
   180     switch(aCommand)
   199         {
   181         {
   200         case EEikCmdExit:
   182         case EEikCmdExit:
   201             {
   183             {
   202             // Send message to Menu and exit.
       
   203             /**
       
   204             * In case of exit is pressed from options menu of photos grid, this flag will be 
       
   205             * false. so it will launch matrix menu. If we don't call LaunchMmViewL, in the above 
       
   206             * scenario, photos will exit,but photosuite will come. This is misleading to user.
       
   207             */
       
   208             if(!iEndKeyPressed)
       
   209 	            {
       
   210 	            LaunchMmViewL( KPhotosSuiteExitMessage );	
       
   211 	            }
       
   212             iUiUtility->SetExitingState(ETrue);
   184             iUiUtility->SetExitingState(ETrue);
   213             Exit();
   185             Exit();
   214             }
   186             }
   215             break;
   187             break;
   216         case EAknSoftkeyExit:
   188         case EAknSoftkeyExit:
   607             else
   579             else
   608                 {
   580                 {
   609                 User::Leave(KErrNotSupported);
   581                 User::Leave(KErrNotSupported);
   610                 }
   582                 }
   611             iNavigationalState->SetBackExitStatus(ETrue);
   583             iNavigationalState->SetBackExitStatus(ETrue);
   612             TBuf8<15> buf;
       
   613             buf.Append( KPhotosSuiteNavigation );
       
   614             TRAP_IGNORE(iBSWrapper->ForwardActivationEventL( buf, ETrue ))
       
   615 
       
   616             break;
   584             break;
   617         }
   585         }
   618     CleanupStack::PopAndDestroy(&stream);
   586     CleanupStack::PopAndDestroy(&stream);
   619     iNavigationalState->SetStartingLevel(path->Levels());
   587     iNavigationalState->SetStartingLevel(path->Levels());
   620     iNavigationalState->NavigateToL( *path );
   588     iNavigationalState->NavigateToL( *path );
   853     GLX_DEBUG2("CGlxAppUi::DoCheckForIADUpdatesL(-) took <%d> us", 
   821     GLX_DEBUG2("CGlxAppUi::DoCheckForIADUpdatesL(-) took <%d> us", 
   854                     (TInt)stopTime.MicroSecondsFrom(startTime).Int64());
   822                     (TInt)stopTime.MicroSecondsFrom(startTime).Int64());
   855 #endif    
   823 #endif    
   856     }
   824     }
   857 
   825 
   858 // ---------------------------------------------------------------------------
       
   859 // LaunchMmViewL
       
   860 //
       
   861 // ---------------------------------------------------------------------------
       
   862 //
       
   863 void CGlxAppUi::LaunchMmViewL( const TDesC8& aMessage )
       
   864     {
       
   865  	TRACER("CGlxNsAppUi::LaunchMmViewL()");
       
   866 	TApaTaskList taskList( iCoeEnv->WsSession() );
       
   867 	TApaTask task = taskList.FindApp( TUid::Uid( KMatrixUid ) );
       
   868 
       
   869 	if ( task.Exists() )
       
   870 		{
       
   871 		task.SendMessage( TUid::Uid( KUidApaMessageSwitchOpenFileValue ),aMessage );
       
   872 		}
       
   873 	else
       
   874 		{ // app not yet running
       
   875 		RApaLsSession appArcSession;
       
   876 		CleanupClosePushL( appArcSession );
       
   877 		User::LeaveIfError( appArcSession.Connect() );      
       
   878 		TApaAppInfo appInfo;
       
   879 		TInt err = appArcSession.GetAppInfo( appInfo, 
       
   880 		TUid::Uid( KMatrixUid ) );
       
   881 		if( err == KErrNone )
       
   882 			{
       
   883 			CApaCommandLine* cmdLine = CApaCommandLine::NewLC();
       
   884 			cmdLine->SetExecutableNameL( appInfo.iFullName );
       
   885 			cmdLine->SetCommandL( EApaCommandRun );
       
   886 			cmdLine->SetTailEndL( aMessage );
       
   887 			appArcSession.StartApp( *cmdLine );
       
   888 			CleanupStack::PopAndDestroy( cmdLine );
       
   889 			}
       
   890 		CleanupStack::PopAndDestroy( &appArcSession ); 
       
   891 		}
       
   892     }
       
   893 
       
   894 // -----------------------------------------------------------------------------
   826 // -----------------------------------------------------------------------------
   895 // ClosePhotosL
   827 // ClosePhotosL
   896 // -----------------------------------------------------------------------------
   828 // -----------------------------------------------------------------------------
   897 //
   829 //
   898 void CGlxAppUi::ClosePhotosL()
   830 void CGlxAppUi::ClosePhotosL()