appinstaller/AppMngr2/src/appmngr2appui.cpp
branchRCL_3
changeset 61 cd189dac02f7
parent 19 7ca52d38f8c3
child 65 7333d7932ef7
--- a/appinstaller/AppMngr2/src/appmngr2appui.cpp	Mon Jun 21 15:48:28 2010 +0300
+++ b/appinstaller/AppMngr2/src/appmngr2appui.cpp	Thu Jul 15 18:47:04 2010 +0300
@@ -32,6 +32,11 @@
 #include <featmgr.h>                    // FeatureManager
 #include <e32property.h>                // RProperty
 #include <hlplch.h>                     // HlpLauncher
+#include <StringLoader.h>               // StringLoader
+#include <appmngr2.rsg>                 // Resource IDs
+#include <AknGlobalNote.h>              // WaitNote
+#include <avkon.rsg>
+
 
 _LIT( KSWInstCommonUIResourceFileName, "SWInstCommonUI.rsc" );
 
@@ -58,6 +63,15 @@
     iResourceFileOffset = iEikonEnv->AddResourceFileL( *fullName );
     CleanupStack::PopAndDestroy( fullName );
 
+    // Let's start global wait note so user can see that 
+    // App. Mngr is scanning memory.
+    HBufC* string = StringLoader::LoadLC( R_QTN_AM_SCANNING_MEMORY );  
+    CAknGlobalNote* note = CAknGlobalNote::NewLC();
+    note->SetSoftkeys( R_AVKON_SOFTKEYS_EMPTY );    
+    FLOG( "CAppMngr2AppUi::ConstructL: ShowNoteL EAknGlobalWaitNote " );
+    iNoteId = note->ShowNoteL( EAknGlobalWaitNote, *string );
+    CleanupStack::PopAndDestroy( 2, string );
+                
     FLOG( "CAppMngr2AppUi::ConstructL, creting model" );
     iModel = CAppMngr2Model::NewL( iEikonEnv->FsSession(), *this );
 
@@ -110,14 +124,23 @@
 CAppMngr2AppUi::~CAppMngr2AppUi()
     {
     FLOG( "CAppMngr2AppUi::~CAppMngr2AppUi" );
+    
+    if( iNoteId )
+        {
+        // If appmngr is closed for some reason let's make sure 
+        // the note is closed.
+        TRAP_IGNORE( CancelNoteL() );
+        }
+    
     delete iIdle;
     delete iModel;
+    
     if( iResourceFileOffset > 0 )
         {
         iEikonEnv->DeleteResourceFile( iResourceFileOffset );
         }
     FeatureManager::UnInitializeLib();    
-    delete iExitTimer;
+    delete iExitTimer;   
     }
 
 // ---------------------------------------------------------------------------
@@ -140,6 +163,9 @@
         {
         CAppMngr2ListView* view = static_cast<CAppMngr2ListView*>( iView );
         TRAP_IGNORE( view->RefreshL( aMoreRefreshesExpected ) );
+        
+        // Let's close global wait note since memory scanning is ready.      
+        TRAP_IGNORE( CancelNoteL() );
         }
     }
 
@@ -154,6 +180,9 @@
         {
         CAppMngr2ListView* view = static_cast<CAppMngr2ListView*>( iView );
         TRAP_IGNORE( view->RefreshL( aMoreRefreshesExpected ) );
+        
+        // Let's close global wait note since memory scanning is ready. 
+        TRAP_IGNORE( CancelNoteL() );
         }
     }
 
@@ -255,3 +284,20 @@
         }
     }
 
+// ---------------------------------------------------------------------------
+// CAppMngr2AppUi::CancelNoteL()
+// ---------------------------------------------------------------------------
+//
+void CAppMngr2AppUi::CancelNoteL()
+    {
+    FLOG( "CAppMngr2AppUi::CancelNoteL: iNoteId = %d", iNoteId );
+     if ( iNoteId )
+         {         
+         CAknGlobalNote* note = CAknGlobalNote::NewLC();
+         FLOG( "CAppMngr2AppUi::CancelNoteL: note->CancelNoteL" );
+         note->CancelNoteL( iNoteId );         
+         CleanupStack::PopAndDestroy();       
+         iNoteId = 0;
+         }        
+    }
+