logsui/AppSrc/CLogsRecentListView.cpp
branchRCL_3
changeset 85 38bb213f60ba
parent 74 6b5524b4f673
equal deleted inserted replaced
74:6b5524b4f673 85:38bb213f60ba
    27 #include <StringLoader.h> 
    27 #include <StringLoader.h> 
    28 #include <CMessageData.h>
    28 #include <CMessageData.h>
    29 #include <sendui.h> 
    29 #include <sendui.h> 
    30 #include <SendUiConsts.h>
    30 #include <SendUiConsts.h>
    31 #include <TSendingCapabilities.h>
    31 #include <TSendingCapabilities.h>
    32 #include <sendnorm.rsg>
    32 #include <Sendnorm.rsg>
    33 #include <logs.rsg>
    33 #include <Logs.rsg>
    34 #include <AiwCommon.hrh>                //KAiwCmdCall
    34 #include <AiwCommon.hrh>                //KAiwCmdCall
    35 #include <AiwPoCParameters.h>           //TAiwPocParameterData
    35 #include <AiwPoCParameters.h>           //TAiwPocParameterData
    36 #include <aknViewAppUi.h>
    36 #include <aknViewAppUi.h>
    37 #include <AiwServiceHandler.h>
    37 #include <AiwServiceHandler.h>
    38 #include <AiwGenericParam.h>
    38 #include <AiwGenericParam.h>
   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.
       
   432         CurrentModel()->DoDeactivate( MLogsModel::ESkipClearing,
   431         CurrentModel()->DoDeactivate( MLogsModel::ESkipClearing,
   433                                       MLogsModel::EKeepDBConnection );
   432                                       MLogsModel::EResetOnlyArrayWithDirty );
   434      
   433      
       
   434         // On gaining foreground, do a clean read of events
       
   435         iResetAndRefreshOnGainingForeground = MLogsModel::EResetAndRefresh;
   435         }       
   436         }       
   436     
   437     
   437     CAknView::ViewDeactivated();
   438     CAknView::ViewDeactivated();
   438     }
   439     }
   439 
   440 
   510         // so this view is waiting when Logs is again foregrounded.    
   511         // so this view is waiting when Logs is again foregrounded.    
   511         //
   512         //
   512         // With MLogsModel::ECloseDBConnectionAndResetArray the connection to the database is
   513         // With MLogsModel::ECloseDBConnectionAndResetArray the connection to the database is
   513         // closed and event array will be deleted. Calls StateChangedL with state EStateArrayReseted 
   514         // closed and event array will be deleted. Calls StateChangedL with state EStateArrayReseted 
   514         // which will update the listbox to empty state.
   515         // which will update the listbox to empty state.
   515         // Keep db connection
       
   516         CurrentModel()->DoDeactivate( MLogsModel::ENormalOperation,
   516         CurrentModel()->DoDeactivate( MLogsModel::ENormalOperation,
   517                                       MLogsModel::EKeepDBConnection );
   517                                       MLogsModel::ECloseDBConnectionAndResetArray );
   518 
   518 
   519         CurrentModel()->DoActivateL( MLogsModel::EResetAndRefresh );
       
   520         // Now we can enable bring-to-foreground on view activation:
   519         // Now we can enable bring-to-foreground on view activation:
   521         AppUi()->SetCustomControl(0); 
   520         AppUi()->SetCustomControl(0); 
   522         AppUi()->HideInBackground(); 
   521         AppUi()->HideInBackground(); 
   523         // If listbox needs to redraw,do it.
   522         // When coming back to foreground, do a clean read of events
   524         if( CurrentModel()->Count()>0 && 
   523         iResetAndRefreshOnGainingForeground = MLogsModel::EResetAndRefresh; 
   525               ( iContainer->ListBox()->TopItemIndex() != EventListTop() ||
       
   526                   iContainer->ListBox()->CurrentItemIndex() != EventListCurrent())) 
       
   527              {
       
   528                 iContainer->ListBox()->DrawDeferred();
       
   529              }
       
   530        
       
   531         }
   524         }
   532     else
   525     else
   533         {
   526         {
   534         // Just to make sure the inputblocker is not on
   527         // Just to make sure the inputblocker is not on
   535         RemoveInputBlocker();
   528         RemoveInputBlocker();
   545             TInt wgId = CCoeEnv::Static()->RootWin().WindowGroupId();
   538             TInt wgId = CCoeEnv::Static()->RootWin().WindowGroupId();
   546             logsui.SetWgId( wgId );
   539             logsui.SetWgId( wgId );
   547             logsui.KillTask();  
   540             logsui.KillTask();  
   548             return;	
   541             return;	
   549             }
   542             }
   550          
   543         
   551         // Avoid the flicking when transfer to foreground from background.
   544         // By default on gaining foreground, just refresh the list. So when active applications list, 
   552         if(LogsAppUi()->IsBackground())
   545         // keylock or some note (like when plugin in the charger) is shown the list doesn't flicker. 
   553           {
   546         // When view is deactivated this is set to MLogsModel::EResetAndRefresh.
   554               iContainer->DrawNow();         
   547         iResetAndRefreshOnGainingForeground = MLogsModel::ERefresh; 
   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 
       
   563         }
   548         }
   564     
   549     
   565     
   550     
   566     if( CurrentModel()->Count() )
   551     if( CurrentModel()->Count() )
   567           {
   552           {
   657         if ( ReadingFinished() )
   642         if ( ReadingFinished() )
   658             {
   643             {
   659             LOGS_DEBUG_PRINT(LOGS_DEBUG_STRING
   644             LOGS_DEBUG_PRINT(LOGS_DEBUG_STRING
   660                     ( "CLogsRecentListView::DoDeactivate - ReadingFinished" ));  
   645                     ( "CLogsRecentListView::DoDeactivate - ReadingFinished" ));  
   661             ClearMissedCallNotifications();   //Clear cenrep new missed calls counter + notifications          
   646             ClearMissedCallNotifications();   //Clear cenrep new missed calls counter + notifications          
   662             // Keep db connection
       
   663             CurrentModel()->DoDeactivate( MLogsModel::ENormalOperation,
   647             CurrentModel()->DoDeactivate( MLogsModel::ENormalOperation,
   664                                           MLogsModel::EKeepDBConnection );//ETrue: disconnect from db. This helps for EMSH-6JDFBV but
   648                                           MLogsModel::ECloseDBConnection );//ETrue: disconnect from db. This helps for EMSH-6JDFBV but
   665                                               //reduces user's perceived performance for other views
   649                                               //reduces user's perceived performance for other views
   666                                               //(seems to keep clearing of missed duplicates process alive
   650                                               //(seems to keep clearing of missed duplicates process alive
   667                                               // so no need for EFalse here as it would increase probability of 
   651                                               // so no need for EFalse here as it would increase probability of 
   668                                               // EMSH-6JDFBV occurring again   
   652                                               // EMSH-6JDFBV occurring again   
   669                                     
   653                                     
   671                               
   655                               
   672         else
   656         else
   673             {
   657             {
   674             LOGS_DEBUG_PRINT(LOGS_DEBUG_STRING
   658             LOGS_DEBUG_PRINT(LOGS_DEBUG_STRING
   675                     ( "CLogsRecentListView::DoDeactivate - Reading interrupted" )); 
   659                     ( "CLogsRecentListView::DoDeactivate - Reading interrupted" )); 
   676             // Keep db connection
       
   677             CurrentModel()->DoDeactivate( MLogsModel::ESkipClearing,
   660             CurrentModel()->DoDeactivate( MLogsModel::ESkipClearing,
   678                                           MLogsModel::EKeepDBConnection );
   661                                           MLogsModel::ECloseDBConnection );
   679             }    
   662             }    
   680         }
   663         }
   681     else
   664     else
   682         {
   665         {
   683         CurrentModel()->DoDeactivate( MLogsModel::ENormalOperation,
   666         CurrentModel()->DoDeactivate( MLogsModel::ENormalOperation,
   684                                       MLogsModel::EKeepDBConnection );//ETrue: disconnect from db. This helps for EMSH-6JDFBV but
   667                                       MLogsModel::ECloseDBConnection );//ETrue: disconnect from db. This helps for EMSH-6JDFBV but
   685                                               //reduces user's perceived performance for other views
   668                                               //reduces user's perceived performance for other views
   686                                               //EFalse: don't disconnect from db. This keeps read data cached in Logs.
   669                                               //EFalse: don't disconnect from db. This keeps read data cached in Logs.
   687         }
   670         }
   688         
   671         
   689     //To prevent second time flicker of context menu if ctx mnu was was displayed
   672     //To prevent second time flicker of context menu if ctx mnu was was displayed
   869                  //If menu is shown, we need to close it as focus is lost
   852                  //If menu is shown, we need to close it as focus is lost
   870                 if (MenuBar()->IsDisplayed())
   853                 if (MenuBar()->IsDisplayed())
   871                     {
   854                     {
   872                     MenuBar()->StopDisplayingMenuBar();
   855                     MenuBar()->StopDisplayingMenuBar();
   873                     }
   856                     }
   874                  }
   857                 
       
   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                 }
   875             else
   879             else
   876                 {
   880                 {
   877                 // Change ELogsNoChange_PbkUpdPending to ELogsNoChange now so there is no need to 
   881                 // Change ELogsNoChange_PbkUpdPending to ELogsNoChange now so there is no need to 
   878                 // differentiate those in StateChangedL
   882                 // differentiate those in StateChangedL
   879                 iFocusChangeControl = ELogsNoChange;
   883                 iFocusChangeControl = ELogsNoChange;
   880                 }
   884                 }
   881             }
   885             }
   882         // Sure "ClearMissedCallNotifications" is called.
       
   883         ClearMissedCallNotifications();
       
   884         
   886         
   885         RemoveInputBlocker(); //just in case
   887         RemoveInputBlocker(); //just in case
   886         }                            
   888         }                            
   887     TRACE_EXIT_POINT; 
   889     TRACE_EXIT_POINT; 
   888     }
   890     }
   989             // and they cannot be cleared in DoDeactivate anymore
   991             // and they cannot be cleared in DoDeactivate anymore
   990             if( LogsAppUi()->ExecutionMode() == ELogsInBackground_ExitOrEndPressed && currView == EStmMissedListViewId )
   992             if( LogsAppUi()->ExecutionMode() == ELogsInBackground_ExitOrEndPressed && currView == EStmMissedListViewId )
   991                 {
   993                 {
   992                  LOGS_DEBUG_PRINT(LOGS_DEBUG_STRING
   994                  LOGS_DEBUG_PRINT(LOGS_DEBUG_STRING
   993                     ( "CLogsRecentListView::HandleLosingForeground - clear duplicates" ));      
   995                     ( "CLogsRecentListView::HandleLosingForeground - clear duplicates" ));      
   994                  // Keep db connection
       
   995                 model->DoDeactivate( MLogsModel::ENormalOperation, 
   996                 model->DoDeactivate( MLogsModel::ENormalOperation, 
   996                                      MLogsModel::EKeepDBConnection );    //EFalse: don't disconnect from db 
   997                                      MLogsModel::ECloseDBConnection );    //EFalse: don't disconnect from db 
   997                 }
   998                 }
   998             else    
   999             else    
   999                 {
  1000                 {
  1000                 LOGS_DEBUG_PRINT(LOGS_DEBUG_STRING
  1001                 LOGS_DEBUG_PRINT(LOGS_DEBUG_STRING
  1001                     ( "CLogsRecentListView::HandleLosingForeground - skip clearing" )); 
  1002                     ( "CLogsRecentListView::HandleLosingForeground - skip clearing" )); 
  1002                 //Other loss of foreground (call or AppKey). We'll not touch duplicate counters
  1003                 //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::EKeepDBConnection );    //ETrue: disconnect from db in order to immediately to stop
  1005                                      MLogsModel::ECloseDBConnection );    //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             // Add condition check: To avoid Missing Call Note don't display ,do not call "ClearMissedCallNotificationsL" when logs is in background.
  1097             ClearMissedCallNotificationsL();
  1098             if(!LogsAppUi()->IsBackground())
       
  1099                 ClearMissedCallNotificationsL();
       
  1100             // When event reading is finished, remove inputblocker
  1098             // When event reading is finished, remove inputblocker
  1101             RemoveInputBlocker();
  1099             RemoveInputBlocker();
  1102             }        
  1100             }        
  1103         // If focus is not retained, refresh the UI when a screenful of events is read
  1101         // If focus is not retained, refresh the UI when a screenful of events is read
  1104         else if( iFocusChangeControl == ELogsOkToChange && count == KNbrShownEntries ) 
  1102         else if( iFocusChangeControl == ELogsOkToChange && count == KNbrShownEntries ) 
  1271     {
  1269     {
  1272     TInt result = CLogsBaseView::HandleNotifyL( aCmdId, aEventId, aEventParamList, aInParamList );        
  1270     TInt result = CLogsBaseView::HandleNotifyL( aCmdId, aEventId, aEventParamList, aInParamList );        
  1273     return result;    
  1271     return result;    
  1274     }
  1272     }
  1275 
  1273 
  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     }
       
  1288 
  1274 
  1289 //  End of File  
  1275 //  End of File