logsui/AppSrc/CLogsRecentListView.cpp
branchRCL_3
changeset 85 38bb213f60ba
parent 74 6b5524b4f673
--- a/logsui/AppSrc/CLogsRecentListView.cpp	Wed Sep 15 11:56:55 2010 +0300
+++ b/logsui/AppSrc/CLogsRecentListView.cpp	Wed Oct 13 14:15:33 2010 +0300
@@ -29,8 +29,8 @@
 #include <sendui.h> 
 #include <SendUiConsts.h>
 #include <TSendingCapabilities.h>
-#include <sendnorm.rsg>
-#include <logs.rsg>
+#include <Sendnorm.rsg>
+#include <Logs.rsg>
 #include <AiwCommon.hrh>                //KAiwCmdCall
 #include <AiwPoCParameters.h>           //TAiwPocParameterData
 #include <aknViewAppUi.h>
@@ -428,10 +428,11 @@
          
         // Reset array and set dirty which means refresh requested, 
         // will call StateChangedL with state EStateArrayReseted and update the listbox.
-        // Keep db connection.
         CurrentModel()->DoDeactivate( MLogsModel::ESkipClearing,
-                                      MLogsModel::EKeepDBConnection );
+                                      MLogsModel::EResetOnlyArrayWithDirty );
      
+        // On gaining foreground, do a clean read of events
+        iResetAndRefreshOnGainingForeground = MLogsModel::EResetAndRefresh;
         }       
     
     CAknView::ViewDeactivated();
@@ -512,22 +513,14 @@
         // With MLogsModel::ECloseDBConnectionAndResetArray the connection to the database is
         // closed and event array will be deleted. Calls StateChangedL with state EStateArrayReseted 
         // which will update the listbox to empty state.
-        // Keep db connection
         CurrentModel()->DoDeactivate( MLogsModel::ENormalOperation,
-                                      MLogsModel::EKeepDBConnection );
+                                      MLogsModel::ECloseDBConnectionAndResetArray );
 
-        CurrentModel()->DoActivateL( MLogsModel::EResetAndRefresh );
         // Now we can enable bring-to-foreground on view activation:
         AppUi()->SetCustomControl(0); 
         AppUi()->HideInBackground(); 
-        // If listbox needs to redraw,do it.
-        if( CurrentModel()->Count()>0 && 
-              ( iContainer->ListBox()->TopItemIndex() != EventListTop() ||
-                  iContainer->ListBox()->CurrentItemIndex() != EventListCurrent())) 
-             {
-                iContainer->ListBox()->DrawDeferred();
-             }
-       
+        // When coming back to foreground, do a clean read of events
+        iResetAndRefreshOnGainingForeground = MLogsModel::EResetAndRefresh; 
         }
     else
         {
@@ -547,19 +540,11 @@
             logsui.KillTask();  
             return;	
             }
-         
-        // Avoid the flicking when transfer to foreground from background.
-        if(LogsAppUi()->IsBackground())
-          {
-              iContainer->DrawNow();         
-              iEikonEnv->AppUiFactory()->StatusPane()->DrawNow(); 
-              LogsAppUi()->SetCustomControl(0);  
-          
-              CCoeEnv * env = CCoeEnv::Static();
-              env->WsSession().SetWindowGroupOrdinalPosition(env->RootWin().Identifier(),0);
-                            
-           }   
-
+        
+        // By default on gaining foreground, just refresh the list. So when active applications list, 
+        // keylock or some note (like when plugin in the charger) is shown the list doesn't flicker. 
+        // When view is deactivated this is set to MLogsModel::EResetAndRefresh.
+        iResetAndRefreshOnGainingForeground = MLogsModel::ERefresh; 
         }
     
     
@@ -659,9 +644,8 @@
             LOGS_DEBUG_PRINT(LOGS_DEBUG_STRING
                     ( "CLogsRecentListView::DoDeactivate - ReadingFinished" ));  
             ClearMissedCallNotifications();   //Clear cenrep new missed calls counter + notifications          
-            // Keep db connection
             CurrentModel()->DoDeactivate( MLogsModel::ENormalOperation,
-                                          MLogsModel::EKeepDBConnection );//ETrue: disconnect from db. This helps for EMSH-6JDFBV but
+                                          MLogsModel::ECloseDBConnection );//ETrue: disconnect from db. This helps for EMSH-6JDFBV but
                                               //reduces user's perceived performance for other views
                                               //(seems to keep clearing of missed duplicates process alive
                                               // so no need for EFalse here as it would increase probability of 
@@ -673,15 +657,14 @@
             {
             LOGS_DEBUG_PRINT(LOGS_DEBUG_STRING
                     ( "CLogsRecentListView::DoDeactivate - Reading interrupted" )); 
-            // Keep db connection
             CurrentModel()->DoDeactivate( MLogsModel::ESkipClearing,
-                                          MLogsModel::EKeepDBConnection );
+                                          MLogsModel::ECloseDBConnection );
             }    
         }
     else
         {
         CurrentModel()->DoDeactivate( MLogsModel::ENormalOperation,
-                                      MLogsModel::EKeepDBConnection );//ETrue: disconnect from db. This helps for EMSH-6JDFBV but
+                                      MLogsModel::ECloseDBConnection );//ETrue: disconnect from db. This helps for EMSH-6JDFBV but
                                               //reduces user's perceived performance for other views
                                               //EFalse: don't disconnect from db. This keeps read data cached in Logs.
         }
@@ -871,7 +854,28 @@
                     {
                     MenuBar()->StopDisplayingMenuBar();
                     }
-                 }
+                
+                SetEventListCurrent( KErrNotFound );//just to make sure that UI does not try to read anything from eventarray                
+                TRAPD( err, model->DoActivateL( iResetAndRefreshOnGainingForeground ) );  
+                if( err ) 
+                    {
+                    iCoeEnv->HandleError( err );
+                    }
+                if( err == KErrDiskFull )
+                    {
+                    RWsSession& wsSession = CCoeEnv::Static()->WsSession();  
+                    TApaTask logsui( wsSession );
+                    TInt wgId = CCoeEnv::Static()->RootWin().WindowGroupId();
+                    logsui.SetWgId( wgId );
+                    logsui.KillTask();  
+                    return;
+                    }
+                
+                // By default on gaining foreground, just refresh the list. So when active applications list, 
+                // keylock or some note (like when plugin in the charger) is shown the list doesn't flicker. 
+                // When view is deactivated this is set to MLogsModel::EResetAndRefresh.
+                iResetAndRefreshOnGainingForeground = MLogsModel::ERefresh;
+                }
             else
                 {
                 // Change ELogsNoChange_PbkUpdPending to ELogsNoChange now so there is no need to 
@@ -879,8 +883,6 @@
                 iFocusChangeControl = ELogsNoChange;
                 }
             }
-        // Sure "ClearMissedCallNotifications" is called.
-        ClearMissedCallNotifications();
         
         RemoveInputBlocker(); //just in case
         }                            
@@ -991,18 +993,16 @@
                 {
                  LOGS_DEBUG_PRINT(LOGS_DEBUG_STRING
                     ( "CLogsRecentListView::HandleLosingForeground - clear duplicates" ));      
-                 // Keep db connection
                 model->DoDeactivate( MLogsModel::ENormalOperation, 
-                                     MLogsModel::EKeepDBConnection );    //EFalse: don't disconnect from db 
+                                     MLogsModel::ECloseDBConnection );    //EFalse: don't disconnect from db 
                 }
             else    
                 {
                 LOGS_DEBUG_PRINT(LOGS_DEBUG_STRING
                     ( "CLogsRecentListView::HandleLosingForeground - skip clearing" )); 
                 //Other loss of foreground (call or AppKey). We'll not touch duplicate counters
-                // Keep db connection
                 model->DoDeactivate( MLogsModel::ESkipClearing, //Don't update db (for missed view)
-                                     MLogsModel::EKeepDBConnection );    //ETrue: disconnect from db in order to immediately to stop
+                                     MLogsModel::ECloseDBConnection );    //ETrue: disconnect from db in order to immediately to stop
                                                  //EFalse: don't disconnect from db                                     
                 }
             }
@@ -1094,9 +1094,7 @@
             iContainer->ControlExtension()->HandleAdditionalData( 
                 *CurrentModel(), 
                 *iContainer->ListBox() );
-            // Add condition check: To avoid Missing Call Note don't display ,do not call "ClearMissedCallNotificationsL" when logs is in background.
-            if(!LogsAppUi()->IsBackground())
-                ClearMissedCallNotificationsL();
+            ClearMissedCallNotificationsL();
             // When event reading is finished, remove inputblocker
             RemoveInputBlocker();
             }        
@@ -1273,17 +1271,5 @@
     return result;    
     }
 
-void CLogsRecentListView::ViewActivatedL(const TVwsViewId& aPrevViewId,TUid aCustomMessageId,const TDesC8& aCustomMessage)
-    {
-    //To avoid the flicking when transfer to foreground from background,we control the view show manually.
-    if(LogsAppUi()->IsBackground()  &&     
-             LogsAppUi()->ActiveViewId() != LogsCurrentRecentViewId() )
-        {
-            LogsAppUi()->SetCustomControl(1);
-        }      
-    
-      CLogsBaseView::ViewActivatedL(aPrevViewId,aCustomMessageId,aCustomMessage);
-      
-    }
 
 //  End of File