logsui/AppSrc/CLogsRecentListView.cpp
branchRCL_3
changeset 58 d4f567ce2e7c
parent 57 2666d9724c76
child 64 c1e8ba0c2b16
equal deleted inserted replaced
57:2666d9724c76 58:d4f567ce2e7c
   426             StoreEvenListCurrentFocus();
   426             StoreEvenListCurrentFocus();
   427             }
   427             }
   428          
   428          
   429         // Reset array and set dirty which means refresh requested, 
   429         // Reset array and set dirty which means refresh requested, 
   430         // will call StateChangedL with state EStateArrayReseted and update the listbox.
   430         // will call StateChangedL with state EStateArrayReseted and update the listbox.
       
   431         // Keep db connection.
   431         CurrentModel()->DoDeactivate( MLogsModel::ESkipClearing,
   432         CurrentModel()->DoDeactivate( MLogsModel::ESkipClearing,
   432                                       MLogsModel::EResetOnlyArrayWithDirty );
   433                                       MLogsModel::EKeepDBConnection );
   433      
   434      
   434         // On gaining foreground, do a clean read of events
       
   435         iResetAndRefreshOnGainingForeground = MLogsModel::EResetAndRefresh;
       
   436         }       
   435         }       
   437     
   436     
   438     CAknView::ViewDeactivated();
   437     CAknView::ViewDeactivated();
   439     }
   438     }
   440 
   439 
   511         // so this view is waiting when Logs is again foregrounded.    
   510         // so this view is waiting when Logs is again foregrounded.    
   512         //
   511         //
   513         // With MLogsModel::ECloseDBConnectionAndResetArray the connection to the database is
   512         // With MLogsModel::ECloseDBConnectionAndResetArray the connection to the database is
   514         // closed and event array will be deleted. Calls StateChangedL with state EStateArrayReseted 
   513         // closed and event array will be deleted. Calls StateChangedL with state EStateArrayReseted 
   515         // which will update the listbox to empty state.
   514         // which will update the listbox to empty state.
       
   515         // Keep db connection
   516         CurrentModel()->DoDeactivate( MLogsModel::ENormalOperation,
   516         CurrentModel()->DoDeactivate( MLogsModel::ENormalOperation,
   517                                       MLogsModel::ECloseDBConnectionAndResetArray );
   517                                       MLogsModel::EKeepDBConnection );
   518 
   518 
       
   519         CurrentModel()->DoActivateL( MLogsModel::EResetAndRefresh );
   519         // Now we can enable bring-to-foreground on view activation:
   520         // Now we can enable bring-to-foreground on view activation:
   520         AppUi()->SetCustomControl(0); 
   521         AppUi()->SetCustomControl(0); 
   521         AppUi()->HideInBackground(); 
   522         AppUi()->HideInBackground(); 
   522         // When coming back to foreground, do a clean read of events
   523         // If listbox needs to redraw,do it.
   523         iResetAndRefreshOnGainingForeground = MLogsModel::EResetAndRefresh; 
   524         if( CurrentModel()->Count()>0 && 
       
   525               ( iContainer->ListBox()->TopItemIndex() != EventListTop() ||
       
   526                   iContainer->ListBox()->CurrentItemIndex() != EventListCurrent())) 
       
   527              {
       
   528                 iContainer->ListBox()->DrawDeferred();
       
   529              }
       
   530        
   524         }
   531         }
   525     else
   532     else
   526         {
   533         {
   527         // Just to make sure the inputblocker is not on
   534         // Just to make sure the inputblocker is not on
   528         RemoveInputBlocker();
   535         RemoveInputBlocker();
   538             TInt wgId = CCoeEnv::Static()->RootWin().WindowGroupId();
   545             TInt wgId = CCoeEnv::Static()->RootWin().WindowGroupId();
   539             logsui.SetWgId( wgId );
   546             logsui.SetWgId( wgId );
   540             logsui.KillTask();  
   547             logsui.KillTask();  
   541             return;	
   548             return;	
   542             }
   549             }
   543         
   550          
   544         // By default on gaining foreground, just refresh the list. So when active applications list, 
   551         // Avoid the flicking when transfer to foreground from background.
   545         // keylock or some note (like when plugin in the charger) is shown the list doesn't flicker. 
   552         if(LogsAppUi()->IsBackground())
   546         // When view is deactivated this is set to MLogsModel::EResetAndRefresh.
   553           {
   547         iResetAndRefreshOnGainingForeground = MLogsModel::ERefresh; 
   554               iContainer->DrawNow();         
       
   555               iEikonEnv->AppUiFactory()->StatusPane()->DrawNow(); 
       
   556               LogsAppUi()->SetCustomControl(0);  
       
   557           
       
   558               CCoeEnv * env = CCoeEnv::Static();
       
   559               env->WsSession().SetWindowGroupOrdinalPosition(env->RootWin().Identifier(),0);
       
   560                             
       
   561            }   
       
   562 
   548         }
   563         }
   549     
   564     
   550     
   565     
   551     if( CurrentModel()->Count() )
   566     if( CurrentModel()->Count() )
   552           {
   567           {
   642         if ( ReadingFinished() )
   657         if ( ReadingFinished() )
   643             {
   658             {
   644             LOGS_DEBUG_PRINT(LOGS_DEBUG_STRING
   659             LOGS_DEBUG_PRINT(LOGS_DEBUG_STRING
   645                     ( "CLogsRecentListView::DoDeactivate - ReadingFinished" ));  
   660                     ( "CLogsRecentListView::DoDeactivate - ReadingFinished" ));  
   646             ClearMissedCallNotifications();   //Clear cenrep new missed calls counter + notifications          
   661             ClearMissedCallNotifications();   //Clear cenrep new missed calls counter + notifications          
       
   662             // Keep db connection
   647             CurrentModel()->DoDeactivate( MLogsModel::ENormalOperation,
   663             CurrentModel()->DoDeactivate( MLogsModel::ENormalOperation,
   648                                           MLogsModel::ECloseDBConnection );//ETrue: disconnect from db. This helps for EMSH-6JDFBV but
   664                                           MLogsModel::EKeepDBConnection );//ETrue: disconnect from db. This helps for EMSH-6JDFBV but
   649                                               //reduces user's perceived performance for other views
   665                                               //reduces user's perceived performance for other views
   650                                               //(seems to keep clearing of missed duplicates process alive
   666                                               //(seems to keep clearing of missed duplicates process alive
   651                                               // so no need for EFalse here as it would increase probability of 
   667                                               // so no need for EFalse here as it would increase probability of 
   652                                               // EMSH-6JDFBV occurring again   
   668                                               // EMSH-6JDFBV occurring again   
   653                                     
   669                                     
   655                               
   671                               
   656         else
   672         else
   657             {
   673             {
   658             LOGS_DEBUG_PRINT(LOGS_DEBUG_STRING
   674             LOGS_DEBUG_PRINT(LOGS_DEBUG_STRING
   659                     ( "CLogsRecentListView::DoDeactivate - Reading interrupted" )); 
   675                     ( "CLogsRecentListView::DoDeactivate - Reading interrupted" )); 
       
   676             // Keep db connection
   660             CurrentModel()->DoDeactivate( MLogsModel::ESkipClearing,
   677             CurrentModel()->DoDeactivate( MLogsModel::ESkipClearing,
   661                                           MLogsModel::ECloseDBConnection );
   678                                           MLogsModel::EKeepDBConnection );
   662             }    
   679             }    
   663         }
   680         }
   664     else
   681     else
   665         {
   682         {
   666         CurrentModel()->DoDeactivate( MLogsModel::ENormalOperation,
   683         CurrentModel()->DoDeactivate( MLogsModel::ENormalOperation,
   667                                       MLogsModel::ECloseDBConnection );//ETrue: disconnect from db. This helps for EMSH-6JDFBV but
   684                                       MLogsModel::EKeepDBConnection );//ETrue: disconnect from db. This helps for EMSH-6JDFBV but
   668                                               //reduces user's perceived performance for other views
   685                                               //reduces user's perceived performance for other views
   669                                               //EFalse: don't disconnect from db. This keeps read data cached in Logs.
   686                                               //EFalse: don't disconnect from db. This keeps read data cached in Logs.
   670         }
   687         }
   671         
   688         
   672     //To prevent second time flicker of context menu if ctx mnu was was displayed
   689     //To prevent second time flicker of context menu if ctx mnu was was displayed
   852                  //If menu is shown, we need to close it as focus is lost
   869                  //If menu is shown, we need to close it as focus is lost
   853                 if (MenuBar()->IsDisplayed())
   870                 if (MenuBar()->IsDisplayed())
   854                     {
   871                     {
   855                     MenuBar()->StopDisplayingMenuBar();
   872                     MenuBar()->StopDisplayingMenuBar();
   856                     }
   873                     }
   857                 
   874                  }
   858                 SetEventListCurrent( KErrNotFound );//just to make sure that UI does not try to read anything from eventarray                
       
   859                 TRAPD( err, model->DoActivateL( iResetAndRefreshOnGainingForeground ) );  
       
   860                 if( err ) 
       
   861                     {
       
   862                     iCoeEnv->HandleError( err );
       
   863                     }
       
   864                 if( err == KErrDiskFull )
       
   865                     {
       
   866                     RWsSession& wsSession = CCoeEnv::Static()->WsSession();  
       
   867                     TApaTask logsui( wsSession );
       
   868                     TInt wgId = CCoeEnv::Static()->RootWin().WindowGroupId();
       
   869                     logsui.SetWgId( wgId );
       
   870                     logsui.KillTask();  
       
   871                     return;
       
   872                     }
       
   873                 
       
   874                 // By default on gaining foreground, just refresh the list. So when active applications list, 
       
   875                 // keylock or some note (like when plugin in the charger) is shown the list doesn't flicker. 
       
   876                 // When view is deactivated this is set to MLogsModel::EResetAndRefresh.
       
   877                 iResetAndRefreshOnGainingForeground = MLogsModel::ERefresh;
       
   878                 }
       
   879             else
   875             else
   880                 {
   876                 {
   881                 // Change ELogsNoChange_PbkUpdPending to ELogsNoChange now so there is no need to 
   877                 // Change ELogsNoChange_PbkUpdPending to ELogsNoChange now so there is no need to 
   882                 // differentiate those in StateChangedL
   878                 // differentiate those in StateChangedL
   883                 iFocusChangeControl = ELogsNoChange;
   879                 iFocusChangeControl = ELogsNoChange;
   884                 }
   880                 }
   885             }
   881             }
       
   882         // Sure "ClearMissedCallNotificationsL" is called.
       
   883         ClearMissedCallNotificationsL();
   886         
   884         
   887         RemoveInputBlocker(); //just in case
   885         RemoveInputBlocker(); //just in case
   888         }                            
   886         }                            
   889     TRACE_EXIT_POINT; 
   887     TRACE_EXIT_POINT; 
   890     }
   888     }
   991             // and they cannot be cleared in DoDeactivate anymore
   989             // and they cannot be cleared in DoDeactivate anymore
   992             if( LogsAppUi()->ExecutionMode() == ELogsInBackground_ExitOrEndPressed && currView == EStmMissedListViewId )
   990             if( LogsAppUi()->ExecutionMode() == ELogsInBackground_ExitOrEndPressed && currView == EStmMissedListViewId )
   993                 {
   991                 {
   994                  LOGS_DEBUG_PRINT(LOGS_DEBUG_STRING
   992                  LOGS_DEBUG_PRINT(LOGS_DEBUG_STRING
   995                     ( "CLogsRecentListView::HandleLosingForeground - clear duplicates" ));      
   993                     ( "CLogsRecentListView::HandleLosingForeground - clear duplicates" ));      
       
   994                  // Keep db connection
   996                 model->DoDeactivate( MLogsModel::ENormalOperation, 
   995                 model->DoDeactivate( MLogsModel::ENormalOperation, 
   997                                      MLogsModel::ECloseDBConnection );    //EFalse: don't disconnect from db 
   996                                      MLogsModel::EKeepDBConnection );    //EFalse: don't disconnect from db 
   998                 }
   997                 }
   999             else    
   998             else    
  1000                 {
   999                 {
  1001                 LOGS_DEBUG_PRINT(LOGS_DEBUG_STRING
  1000                 LOGS_DEBUG_PRINT(LOGS_DEBUG_STRING
  1002                     ( "CLogsRecentListView::HandleLosingForeground - skip clearing" )); 
  1001                     ( "CLogsRecentListView::HandleLosingForeground - skip clearing" )); 
  1003                 //Other loss of foreground (call or AppKey). We'll not touch duplicate counters
  1002                 //Other loss of foreground (call or AppKey). We'll not touch duplicate counters
       
  1003                 // Keep db connection
  1004                 model->DoDeactivate( MLogsModel::ESkipClearing, //Don't update db (for missed view)
  1004                 model->DoDeactivate( MLogsModel::ESkipClearing, //Don't update db (for missed view)
  1005                                      MLogsModel::ECloseDBConnection );    //ETrue: disconnect from db in order to immediately to stop
  1005                                      MLogsModel::EKeepDBConnection );    //ETrue: disconnect from db in order to immediately to stop
  1006                                                  //EFalse: don't disconnect from db                                     
  1006                                                  //EFalse: don't disconnect from db                                     
  1007                 }
  1007                 }
  1008             }
  1008             }
  1009         }
  1009         }
  1010     
  1010     
  1092             iContainer->UpdateL();      //Calls HandleItemAdditionL (plus sets Empty text if needed)    
  1092             iContainer->UpdateL();      //Calls HandleItemAdditionL (plus sets Empty text if needed)    
  1093             // Fetch data for extension
  1093             // Fetch data for extension
  1094             iContainer->ControlExtension()->HandleAdditionalData( 
  1094             iContainer->ControlExtension()->HandleAdditionalData( 
  1095                 *CurrentModel(), 
  1095                 *CurrentModel(), 
  1096                 *iContainer->ListBox() );
  1096                 *iContainer->ListBox() );
  1097             ClearMissedCallNotificationsL();
  1097             // Add condition check: To avoid Missing Call Note don't display ,do not call "ClearMissedCallNotificationsL" when logs is in background.
       
  1098             if(!LogsAppUi()->IsBackground())
       
  1099                 ClearMissedCallNotificationsL();
  1098             // When event reading is finished, remove inputblocker
  1100             // When event reading is finished, remove inputblocker
  1099             RemoveInputBlocker();
  1101             RemoveInputBlocker();
  1100             }        
  1102             }        
  1101         // If focus is not retained, refresh the UI when a screenful of events is read
  1103         // If focus is not retained, refresh the UI when a screenful of events is read
  1102         else if( iFocusChangeControl == ELogsOkToChange && count == KNbrShownEntries ) 
  1104         else if( iFocusChangeControl == ELogsOkToChange && count == KNbrShownEntries ) 
  1269     {
  1271     {
  1270     TInt result = CLogsBaseView::HandleNotifyL( aCmdId, aEventId, aEventParamList, aInParamList );        
  1272     TInt result = CLogsBaseView::HandleNotifyL( aCmdId, aEventId, aEventParamList, aInParamList );        
  1271     return result;    
  1273     return result;    
  1272     }
  1274     }
  1273 
  1275 
       
  1276 void CLogsRecentListView::ViewActivatedL(const TVwsViewId& aPrevViewId,TUid aCustomMessageId,const TDesC8& aCustomMessage)
       
  1277     {
       
  1278     //To avoid the flicking when transfer to foreground from background,we control the view show manually.
       
  1279     if(LogsAppUi()->IsBackground()  &&     
       
  1280              LogsAppUi()->ActiveViewId() != LogsCurrentRecentViewId() )
       
  1281         {
       
  1282             LogsAppUi()->SetCustomControl(1);
       
  1283         }      
       
  1284     
       
  1285       CLogsBaseView::ViewActivatedL(aPrevViewId,aCustomMessageId,aCustomMessage);
       
  1286       
       
  1287     }
  1274 
  1288 
  1275 //  End of File  
  1289 //  End of File