idlehomescreen/xmluirendering/uiengine/src/xnviewmanager.cpp
branchRCL_3
changeset 102 ba63c83f4716
parent 88 3321d3e205b6
--- a/idlehomescreen/xmluirendering/uiengine/src/xnviewmanager.cpp	Wed Sep 15 12:00:00 2010 +0300
+++ b/idlehomescreen/xmluirendering/uiengine/src/xnviewmanager.cpp	Wed Oct 13 14:18:30 2010 +0300
@@ -60,6 +60,7 @@
 
 // Constants
 _LIT8( KEmptyWidgetUid, "0x2001f47f" );
+_LIT8( KTemplateViewUID, "0x20026f50" );
 
 const TInt KPSCategoryUid( 0x200286E3 );
 const TInt KPSCrashCountKey( 1 );     
@@ -891,10 +892,27 @@
 // Activates the next view
 // -----------------------------------------------------------------------------
 //
-void CXnViewManager::ActivateNextViewL()
+void CXnViewManager::ActivateNextViewL( TInt /*aEffectId*/ )
     { 
     CXnViewData& next( NextViewData() );
-    ActivateViewL( next, KGfxContextActivateNextView );
+    
+    if ( !next.Occupied() )
+        {    
+        TInt err( next.Load() );
+        
+        if ( err )
+            {
+            HandleErrorNotes( err );            
+            return;            
+            }
+        }
+        
+    // Activate view
+    if ( next.Occupied() && !next.Active() )
+        {
+        iAppUiAdapter.ViewAdapter().ActivateContainerL( 
+            next, EFalse, KGfxContextActivateNextView );                        
+        }
     }
 
 // -----------------------------------------------------------------------------
@@ -902,23 +920,13 @@
 // Activates the previous view
 // -----------------------------------------------------------------------------
 //
-void CXnViewManager::ActivatePreviousViewL()
+void CXnViewManager::ActivatePreviousViewL( TInt /*aEffectId*/ )
     {    
     CXnViewData& prev( PreviousViewData() );
-    ActivateViewL( prev, KGfxContextActivatePrevView );
-    }
 
-// -----------------------------------------------------------------------------
-// CXnViewManager::ActivatePreviousViewL()
-// Activates the previous view
-// -----------------------------------------------------------------------------
-//
-void CXnViewManager::ActivateViewL( CXnViewData& aViewData, TUid aEffect, 
-    TBool aUpdateBg )
-    {    
-    if ( !aViewData.Occupied() )
+    if ( !prev.Occupied() )
         {
-        TInt err( aViewData.Load() );
+        TInt err( prev.Load() );
         
         if ( err )
             {
@@ -928,10 +936,10 @@
         }
         
     // Activate view
-    if ( aViewData.Occupied() && !aViewData.Active() )
+    if ( prev.Occupied() && !prev.Active() )
         {
         iAppUiAdapter.ViewAdapter().ActivateContainerL( 
-            aViewData, EFalse, aEffect, aUpdateBg );
+            prev, EFalse, KGfxContextActivatePrevView );                                
         }
     }
 
@@ -946,14 +954,11 @@
         {
         return KErrGeneral;
         }
-    
-    // If phone layout is mirrored new view needs to be added to left. Other right.
-    TInt mirror = AknLayoutUtils::LayoutMirrored() ? 0 : 1;
-    
+
     // Add new view (template view) to hsps
     CAddPluginResult* result = iHspsWrapper->AddPluginL( 
         iRootData->ConfigurationId(), aInfo.Uid(),
-        ViewIndex() + mirror ); 
+        ViewIndex() + 1 ); 
     CleanupStack::PushL( result );
 
     TInt retval( result->Status() );
@@ -982,7 +987,7 @@
             
             TInt index( views.Find( &ActiveViewData() ) );
             
-            views.InsertL( newView, index + mirror );
+            views.InsertL( newView, index + 1 );
             
             // Root data owns the new view now
             CleanupStack::Pop( newView );            
@@ -1025,14 +1030,11 @@
         
         return;        
         }
-    
-    // If phone layout is mirrored new view needs to be added to left. Other right.
-    TInt mirror = AknLayoutUtils::LayoutMirrored() ? 0 : 1;
-    
+
     // Add new view (template view) to hsps
     CAddPluginResult* result = iHspsWrapper->AddPluginL( 
-        iRootData->ConfigurationId(), iRootData->TemplateViewUid(),
-        ViewIndex() + mirror ); 
+        iRootData->ConfigurationId(), KTemplateViewUID,
+        ViewIndex() + 1 ); 
     CleanupStack::PushL( result );
         
     TInt status( result->Status() );
@@ -1068,16 +1070,16 @@
             
             TInt index( views.Find( &ActiveViewData() ) );
             
-            views.InsertL( newView, index + mirror );
+            views.InsertL( newView, index + 1 );
             
             // Root data owns the new view now
             CleanupStack::Pop( newView );
             
+            // Activate view
+            iAppUiAdapter.ViewAdapter().ActivateContainerL( *newView, ETrue );
+            
             // Inform observers about added view
             NotifyViewAdditionL( *newView );
-
-            // Activate view
-            iAppUiAdapter.ViewAdapter().ActivateContainerL( *newView, ETrue );            
             }
         else
             {                      
@@ -1409,7 +1411,7 @@
         UpdateCachesL();
         
         // Schedule remaining views loading
-        iRootData->LoadRemainingViewsL();
+        iRootData->LoadRemainingViews();
         }
     
     HandleErrorNotes( err );         
@@ -1483,7 +1485,7 @@
         
     TRAP_IGNORE( bg.StoreWallpaperL() );
 
-    TRAP_IGNORE( self->NotifyContainerActivatedL( active ) );
+    self->NotifyContainerActivatedL( active );
     
     return KErrNone;
     }
@@ -1505,19 +1507,6 @@
     }
 
 // -----------------------------------------------------------------------------
-// CXnViewManager::NotifyViewLoadedL()
-// Notifies view is activated
-// -----------------------------------------------------------------------------
-//
-void CXnViewManager::NotifyViewLoadedL( const CXnViewData& aViewData )
-    {
-    for ( TInt i = 0; i < iObservers.Count(); i++ )
-        {
-        iObservers[i]->NotifyViewLoadedL( aViewData );
-        }
-    }
-
-// -----------------------------------------------------------------------------
 // CXnViewManager::NotifyViewDeactivatedL()
 // Notifies view is deactivated
 // -----------------------------------------------------------------------------