idlehomescreen/xmluirendering/uiengine/src/xnviewmanager.cpp
branchRCL_3
changeset 17 b8fae6b8a148
parent 12 9674c1a575e9
child 18 d05a55b217df
--- a/idlehomescreen/xmluirendering/uiengine/src/xnviewmanager.cpp	Mon Mar 15 12:39:47 2010 +0200
+++ b/idlehomescreen/xmluirendering/uiengine/src/xnviewmanager.cpp	Wed Mar 31 21:17:19 2010 +0300
@@ -63,7 +63,8 @@
 const TInt KPSCategoryUid( 0x200286E3 );
 const TInt KPSCrashCountKey( 1 );     
 const TInt KStabilityInterval( 60000000 ); // 1 minute
-const TInt KCrashRestoreThreshold( 3 );
+const TInt KCrashRestoreDefaultThreshold( 3 );
+const TInt KCrashRestoreAllTreshold( 4 );
 
 // ============================ LOCAL FUNCTIONS ===============================
 // -----------------------------------------------------------------------------
@@ -353,28 +354,7 @@
     
     iComposer = CXnComposer::NewL( *iHspsWrapper );
     
-    // Robustness checks.
-    TInt crashCount = 0;
-    RProperty::Get( TUid::Uid( KPSCategoryUid ),
-                    KPSCrashCountKey,
-                    crashCount );    
-            
-    if( crashCount >= KCrashRestoreThreshold )
-        {
-        iHspsWrapper->RestoreRootL();
-        ResetCrashCount();        
-        ShowErrorNoteL( R_QTN_HS_ERROR_WIDGETS_REMOVED );        
-        }
-    else if( crashCount > 0 )
-        {
-        // Start stability timer to ensure that
-        // if system is stabile at least KStabilityInterval
-        // then crash count is reset to 0. 
-        iStabilityTimer = CPeriodic::NewL( CActive::EPriorityStandard );
-        iStabilityTimer->Start( KStabilityInterval,
-                                KStabilityInterval,
-                                TCallBack( SystemStabileTimerCallback, this ) );
-        }       
+    DoRobustnessCheckL();
     }
 
 // -----------------------------------------------------------------------------
@@ -1234,7 +1214,11 @@
             retval = iHspsWrapper->RemovePluginL( view->PluginId() );
             
             // Notify observers of view list change
-            NotifyViewRemovalL( *view );
+            TRAPD( err, NotifyViewRemovalL( *view ) );
+            if ( err != KErrNone )
+                {
+                // ignored
+                }            
 
             iRootData->DestroyViewData( view );
                                                                    
@@ -1307,7 +1291,11 @@
         iHspsWrapper->RemovePluginL( view->PluginId() );
         
         // Notify observers of view list change
-        NotifyViewRemovalL( *view );
+        TRAPD( err, NotifyViewRemovalL( *view ) );
+        if ( err != KErrNone )
+            {
+            // ignored
+            }   
 
         iRootData->DestroyViewData( view );
         
@@ -1773,17 +1761,50 @@
 // -----------------------------------------------------------------------------
 // CXnViewManager::ShowErrorNoteL 
 // -----------------------------------------------------------------------------
-void CXnViewManager::ShowErrorNoteL( const TInt aResourceId )
+void CXnViewManager::ShowErrorNoteL()
     {        
-    HBufC* msg( StringLoader::LoadLC( aResourceId ) );
-        
-    CAknErrorNote* note = new ( ELeave ) CAknErrorNote;
-    CleanupStack::PushL( note );
+    CAknQueryDialog* query = CAknQueryDialog::NewL();
+    query->PrepareLC( R_HS_CONTENT_REMOVED_VIEW );
+
+    HBufC* queryText( StringLoader::LoadLC( R_HS_ERROR_CONTENT_REMOVED ) );    
+    query->SetPromptL( queryText->Des() );    
+    CleanupStack::PopAndDestroy( queryText );
+
+    query->RunLD();   
+    }
+
+// -----------------------------------------------------------------------------
+// CXnViewManager::DoRobustnessCheckL 
+// -----------------------------------------------------------------------------
+void CXnViewManager::DoRobustnessCheckL()
+    {
+    TInt crashCount = 0;
+    RProperty::Get( TUid::Uid( KPSCategoryUid ),
+                    KPSCrashCountKey,
+                    crashCount );    
     
-    note->ExecuteLD( *msg );
+    if( crashCount == KCrashRestoreDefaultThreshold )
+        {    
+        TInt err = iHspsWrapper->RestoreDefaultConfL();         
+        ShowErrorNoteL();
+        }
+    else if( crashCount >= KCrashRestoreAllTreshold )
+        {       
+        TInt err = iHspsWrapper->RestoreRootL();              
+        ResetCrashCount();
+        return;
+        }
     
-    CleanupStack::Pop( note );
-    CleanupStack::PopAndDestroy( msg );    
+    if( crashCount > 0 )
+        {        
+        // Start stability timer to ensure that
+        // if system is stabile at least KStabilityInterval
+        // then crash count is reset to 0. 
+        iStabilityTimer = CPeriodic::NewL( CActive::EPriorityStandard );
+        iStabilityTimer->Start( KStabilityInterval,
+                                KStabilityInterval,
+                                TCallBack( SystemStabileTimerCallback, this ) );
+        }           
     }
 
 // End of file