photosgallery/gallery/src/glxappui.cpp
changeset 2 7d9067c6fcb1
parent 1 9ba538e329bd
child 13 71da52165949
equal deleted inserted replaced
1:9ba538e329bd 2:7d9067c6fcb1
    92 _LIT8( KPhotosMonths, "Months" );
    92 _LIT8( KPhotosMonths, "Months" );
    93 _LIT8( KPhotosTags, "Tags" );
    93 _LIT8( KPhotosTags, "Tags" );
    94 _LIT8( KPhotosAlbums, "Albums" );
    94 _LIT8( KPhotosAlbums, "Albums" );
    95 _LIT8( KPhotosAllValue,"Allcs");
    95 _LIT8( KPhotosAllValue,"Allcs");
    96 
    96 
    97 _LIT8( KPhotoSuiteActivationMessage, "mm://root/photossuite?exit=hide" );
       
    98 _LIT8( KPhotosSuiteExitMessage, "mm://photossuite?action=exit" );
    97 _LIT8( KPhotosSuiteExitMessage, "mm://photossuite?action=exit" );
    99 
    98 
   100 // Matrix uid, needed for activating the suite view.
    99 // Matrix uid, needed for activating the suite view.
   101 const TInt KMatrixUid = 0x101F4CD2;
   100 const TInt KMatrixUid = 0x101F4CD2;
   102 const TInt KCapturedAlbumId = 2 ;
   101 const TInt KCapturedAlbumId = 2 ;
   103         
   102         
       
   103 /**
       
   104  * Start Delay for the periodic timer, in microseconds
       
   105  */
       
   106 const TInt KPeriodicStartDelay = 60000000; // 60 secs
   104 // -----------------------------------------------------------------------------
   107 // -----------------------------------------------------------------------------
   105 // Constructor
   108 // Constructor
   106 // -----------------------------------------------------------------------------
   109 // -----------------------------------------------------------------------------
   107 //
   110 //
   108 CGlxAppUi::CGlxAppUi()
   111 CGlxAppUi::CGlxAppUi()
   169         }
   172         }
   170 
   173 
   171     if( iBSWrapper )
   174     if( iBSWrapper )
   172         {	
   175         {	
   173         delete iBSWrapper;    
   176         delete iBSWrapper;    
       
   177         }
       
   178     if (iPeriodic)
       
   179         {
       
   180         iPeriodic->Cancel();
       
   181         delete iPeriodic;
   174         }
   182         }
   175     
   183     
   176     if( iIadUpdate )
   184     if( iIadUpdate )
   177         {	
   185         {	
   178     	delete iIadUpdate;
   186     	delete iIadUpdate;
   280     TRACER("TBool CGlxAppUi::ProcessCommandParametersL(TApaCommand aCommand, TFileName& aDocumentName, const TDesC8& aTail)");
   288     TRACER("TBool CGlxAppUi::ProcessCommandParametersL(TApaCommand aCommand, TFileName& aDocumentName, const TDesC8& aTail)");
   281     
   289     
   282     TRAPD(err, HandleActivationMessageL(aCommand, aDocumentName, aTail));
   290     TRAPD(err, HandleActivationMessageL(aCommand, aDocumentName, aTail));
   283     if ( KErrNone != err )
   291     if ( KErrNone != err )
   284         {
   292         {
   285         // Open photos suite view
   293         // Open navigational state at root level
   286         LaunchMmViewL( KPhotoSuiteActivationMessage );
   294         CMPXCollectionPath* newState = CMPXCollectionPath::NewL();
   287         Exit();
   295         CleanupStack::PushL( newState );
       
   296         iNavigationalState->NavigateToL( *newState );
       
   297         CleanupStack::PopAndDestroy( newState );
   288         }
   298         }
   289 
   299 
   290     if(0 == aTail.CompareC(KNullDesC8))
   300     if(0 == aTail.CompareC(KNullDesC8))
   291         {
   301         {
   292       	return ETrue;
   302       	return ETrue;
   522     TUid msgUid;
   532     TUid msgUid;
   523     RDesReadStream stream(aData);
   533     RDesReadStream stream(aData);
   524     CleanupClosePushL(stream);
   534     CleanupClosePushL(stream);
   525     stream >> msgUid;
   535     stream >> msgUid;
   526     
   536     
   527     //Check for the IADUpdate
   537     //Start a timer to check for thr IAD update after 30 Secs.
   528     //TBD: Need to check the location this has to be called.
   538     if(!iPeriodic)
   529     //This might not be proper place.
   539         {
   530     DoCheckForIADUpdatesL();
   540         iPeriodic = CPeriodic::NewL(CActive::EPriorityLow);
       
   541         }    
       
   542     if ( !iPeriodic->IsActive() )
       
   543         {
       
   544         iPeriodic->Start( KPeriodicStartDelay, KMaxTInt, 
       
   545                 TCallBack( &PeriodicCallback, static_cast<TAny*>(this) ) );
       
   546         }
   531     
   547     
   532     switch ( msgUid.iUid )
   548     switch ( msgUid.iUid )
   533         {
   549         {
   534         case KGlxActivationCmdShowLastModified:
   550         case KGlxActivationCmdShowLastModified:
   535             // Go to camera album full screen view
   551             // Go to camera album full screen view
   536             GLX_LOG_INFO("CGlxAppUi::HandleActivationMessageL: show last modified");
   552             GLX_LOG_INFO("CGlxAppUi::HandleActivationMessageL: show last modified");
   537             // Send the command to reset the view
   553             // Send the command to reset the view
   538             ProcessCommandL(EGlxCmdResetView);
   554             ProcessCommandL(EGlxCmdResetView);
   539             // Not using KGlxCollectionPluginCameraImplementationUid
   555             // Not using KGlxCollectionPluginCameraImplementationUid
       
   556             iNavigationalState->SetBackExitStatus(ETrue);
   540             path->AppendL(KGlxCollectionPluginAlbumsImplementationUid);            
   557             path->AppendL(KGlxCollectionPluginAlbumsImplementationUid);            
   541             path->AppendL(KCapturedAlbumId);
   558             path->AppendL(KCapturedAlbumId);
   542             SetActivationParamL(KGlxActivationFullScreen);
   559             SetActivationParamL(KGlxActivationFullScreen);
   543             break;
   560             break;
   544 
   561 
   545         case KGlxActivationCameraAlbum:
   562         case KGlxActivationCameraAlbum:
   546             // Go to camera album tile view
   563             // Go to camera album tile view
   547             GLX_LOG_INFO("CGlxAppUi::HandleActivationMessageL: camera album");
   564             GLX_LOG_INFO("CGlxAppUi::HandleActivationMessageL: camera album");
       
   565             iNavigationalState->SetBackExitStatus(ETrue);
   548             path->AppendL(KGlxCollectionPluginAlbumsImplementationUid);
   566             path->AppendL(KGlxCollectionPluginAlbumsImplementationUid);
   549             path->AppendL(KCapturedAlbumId);
   567             path->AppendL(KCapturedAlbumId);
   550             break;
   568             break;
   551 
   569 
   552         case KGlxActivationPhotosMenu:
   570         case KGlxActivationPhotosMenu:
   553             // Open the main view
   571             // Open the main view
   554             GLX_LOG_INFO("CGlxAppUi::HandleActivationMessageL: photos menu");
   572             GLX_LOG_INFO("CGlxAppUi::HandleActivationMessageL: photos menu");
   555             break;            
   573             break;
       
   574             
       
   575         case KGlxActivationAllView:
       
   576             GLX_LOG_INFO("CGlxAppUi::HandleActivationMessageL: Show all photos");
       
   577             // Send the command to reset the view
       
   578             ProcessCommandL(EGlxCmdResetView);
       
   579             path->AppendL(KGlxCollectionPluginAllImplementationUid);            
       
   580         	break;            
   556 
   581 
   557         default:
   582         default:
   558             GLX_LOG_INFO("CGlxAppUi::HandleActivationMessageL: unknown command");
   583             GLX_LOG_INFO("CGlxAppUi::HandleActivationMessageL: unknown command");
   559 
   584 
   560 
   585 
   561             if(0 == aData.CompareC(KPhotosCaptured))
   586             if(0 == aData.CompareC(KPhotosCaptured))
   562                 {
   587                 {
   563                 iNavigationalState->SetBackExitStatus(ETrue);
       
   564                 path->AppendL(KGlxCollectionPluginAlbumsImplementationUid);
   588                 path->AppendL(KGlxCollectionPluginAlbumsImplementationUid);
   565 				path->AppendL(KCapturedAlbumId);
   589 				path->AppendL(KCapturedAlbumId);
   566                 }
   590                 }
   567             else if(0 == aData.CompareC(KPhotosAllValue))
   591             else if(0 == aData.CompareC(KPhotosAllValue))
   568                 {
   592                 {
   569                 iNavigationalState->SetBackExitStatus(ETrue);
       
   570                 path->AppendL(KGlxCollectionPluginAllImplementationUid);
   593                 path->AppendL(KGlxCollectionPluginAllImplementationUid);
   571                 }
   594                 }
   572             else if(0 == aData.CompareC(KPhotosMonths))
   595             else if(0 == aData.CompareC(KPhotosMonths))
   573                 {
   596                 {
   574                 iNavigationalState->SetBackExitStatus(ETrue);
       
   575                 path->AppendL(KGlxCollectionPluginMonthsImplementationUid);
   597                 path->AppendL(KGlxCollectionPluginMonthsImplementationUid);
   576                 }
   598                 }
   577             else if(0 == aData.CompareC(KPhotosAlbums))
   599             else if(0 == aData.CompareC(KPhotosAlbums))
   578                 {
   600                 {
   579                 iNavigationalState->SetBackExitStatus(ETrue);
       
   580                 path->AppendL(KGlxCollectionPluginAlbumsImplementationUid);
   601                 path->AppendL(KGlxCollectionPluginAlbumsImplementationUid);
   581                 }
   602                 }
   582             else if(0 == aData.CompareC(KPhotosTags))
   603             else if(0 == aData.CompareC(KPhotosTags))
   583                 {
   604                 {
   584                 iNavigationalState->SetBackExitStatus(ETrue);
       
   585                 path->AppendL(KGlxTagCollectionPluginImplementationUid);
   605                 path->AppendL(KGlxTagCollectionPluginImplementationUid);
   586                 }
   606                 }
   587             else
   607             else
   588                 {
   608                 {
   589                 User::Leave(KErrNotSupported);
   609                 User::Leave(KErrNotSupported);
   590                 }
   610                 }
       
   611             iNavigationalState->SetBackExitStatus(ETrue);
   591             TBuf8<15> buf;
   612             TBuf8<15> buf;
   592             buf.Append( KPhotosSuiteNavigation );
   613             buf.Append( KPhotosSuiteNavigation );
   593             TRAP_IGNORE(iBSWrapper->ForwardActivationEventL( buf, ETrue ))
   614             TRAP_IGNORE(iBSWrapper->ForwardActivationEventL( buf, ETrue ))
   594 
   615 
   595             break;
   616             break;
   596         }
   617         }
   597     CleanupStack::PopAndDestroy(&stream);
   618     CleanupStack::PopAndDestroy(&stream);
       
   619     iNavigationalState->SetStartingLevel(path->Levels());
   598     iNavigationalState->NavigateToL( *path );
   620     iNavigationalState->NavigateToL( *path );
   599     CleanupStack::PopAndDestroy(path);
   621     CleanupStack::PopAndDestroy(path);
   600     
   622     
   601     // Introduced to fix bug EMJN-78GH6N. Rowland Cook 10/12/2007
   623     // Introduced to fix bug EMJN-78GH6N. Rowland Cook 10/12/2007
   602     if (0 != iEikonEnv->RootWin().OrdinalPosition())
   624     if (0 != iEikonEnv->RootWin().OrdinalPosition())
   782     MGlxCache* cacheManager = MGlxCache::InstanceL();
   804     MGlxCache* cacheManager = MGlxCache::InstanceL();
   783     cacheManager->StopRAMReleaseL();
   805     cacheManager->StopRAMReleaseL();
   784     cacheManager->Close();
   806     cacheManager->Close();
   785     }
   807     }
   786 
   808 
   787 // ---------------------------------------------------------------------------
   809 // -----------------------------------------------------------------------------
   788 // CGlxAppUi::DoCheckForIADUpdatesL()
   810 // Callback from periodic timer
       
   811 // -----------------------------------------------------------------------------
       
   812 //
       
   813 TInt CGlxAppUi::PeriodicCallback(TAny* aPtr)
       
   814     {
       
   815     TRACER("CGlxAppUi::PeriodicCallback(TAny* aPtr)");
       
   816     // get "this" pointer    
       
   817     static_cast<CGlxAppUi*>(aPtr)->PeriodicCallback();
       
   818     return KErrNone;
       
   819     }
       
   820 
       
   821 // -----------------------------------------------------------------------------
       
   822 // Callback from periodic timer, non-static
       
   823 // -----------------------------------------------------------------------------
       
   824 //
       
   825 void CGlxAppUi::PeriodicCallback()
       
   826     {
       
   827     TRACER("CGlxAppUi::PeriodicCallback()");
       
   828     TRAP_IGNORE(DoCheckForIADUpdatesL());
       
   829     iPeriodic->Cancel();
       
   830     }    
       
   831 
       
   832 // ---------------------------------------------------------------------------
       
   833 // CCGlxNsAppUi::DoCheckForIADUpdatesL()
   789 // Check for updates via IAD
   834 // Check for updates via IAD
   790 // ---------------------------------------------------------------------------
   835 // ---------------------------------------------------------------------------
   791 // 
   836 // 
   792 void CGlxAppUi::DoCheckForIADUpdatesL()
   837 void CGlxAppUi::DoCheckForIADUpdatesL()
   793     {
   838     {
   794     TRACER("CGlxAppUi::DoCheckForIADUpdatesL()");
   839     TRACER("CGlxAppUi::DoCheckForIADUpdatesL()");
   795     
   840 #ifdef _DEBUG
       
   841     TTime startTime;
       
   842     GLX_LOG_INFO("CGlxAppUi::DoCheckForIADUpdatesL(+)");  
       
   843     startTime.HomeTime();
       
   844 #endif
   796     if ( !iIadUpdate )
   845     if ( !iIadUpdate )
   797         {
   846         {
   798         iIadUpdate = CGlxIadUpdate::NewL();
   847         iIadUpdate = CGlxIadUpdate::NewL();
   799         }
   848         }
   800     iIadUpdate->StartL();
   849     iIadUpdate->StartL();
       
   850 #ifdef _DEBUG
       
   851     TTime stopTime;
       
   852     stopTime.HomeTime();
       
   853     GLX_DEBUG2("CGlxAppUi::DoCheckForIADUpdatesL(-) took <%d> us", 
       
   854                     (TInt)stopTime.MicroSecondsFrom(startTime).Int64());
       
   855 #endif    
   801     }
   856     }
   802 
   857 
   803 // ---------------------------------------------------------------------------
   858 // ---------------------------------------------------------------------------
   804 // LaunchMmViewL
   859 // LaunchMmViewL
   805 //
   860 //