phonebookui/Phonebook2/NamesListExtension/src/NamesListExView.cpp
branchRCL_3
changeset 18 d4f567ce2e7c
parent 13 a6539d1e8e43
equal deleted inserted replaced
17:2666d9724c76 18:d4f567ce2e7c
    60 #include "Pbk2ContactUiControlProxy.h"
    60 #include "Pbk2ContactUiControlProxy.h"
    61 #include <MPbk2UiControlCmdItem.h>
    61 #include <MPbk2UiControlCmdItem.h>
    62 #include <pbk2mapcommands.hrh>
    62 #include <pbk2mapcommands.hrh>
    63 #include "Pbk2InternalCommands.hrh"
    63 #include "Pbk2InternalCommands.hrh"
    64 #include "CPbk2ContactViewListBox.h"
    64 #include "CPbk2ContactViewListBox.h"
       
    65 #include <pbk2doublelistboxcmditemextension.h>
    65 
    66 
    66 #include "CVPbkContactManager.h"
    67 #include "CVPbkContactManager.h"
    67 #include "MVPbkContactStoreList.h"
    68 #include "MVPbkContactStoreList.h"
    68 #include "VPbkContactStoreUris.h"
    69 #include "VPbkContactStoreUris.h"
    69 #include "TVPbkContactStoreUriPtr.h"
    70 #include "TVPbkContactStoreUriPtr.h"
   109 #include <CPbk2ApplicationServices.h>
   110 #include <CPbk2ApplicationServices.h>
   110 #include <CVPbkContactStoreUriArray.h>
   111 #include <CVPbkContactStoreUriArray.h>
   111 #include <CPbk2StoreConfiguration.h>
   112 #include <CPbk2StoreConfiguration.h>
   112 #include <VPbkContactStoreUris.h>
   113 #include <VPbkContactStoreUris.h>
   113 #include <TVPbkContactStoreUriPtr.h>
   114 #include <TVPbkContactStoreUriPtr.h>
       
   115 #include <Pbk2InternalUID.h>
   114 
   116 
   115 /// Unnamed namespace for local definitions
   117 /// Unnamed namespace for local definitions
   116 namespace {
   118 namespace {
   117 
   119 
   118 #ifdef _DEBUG
   120 #ifdef _DEBUG
   199         iCommandState( ETrue ),
   201         iCommandState( ETrue ),
   200         iCurrentCommandId( KErrNotFound ),
   202         iCurrentCommandId( KErrNotFound ),
   201         iCtrlVisibleStateBeforeLosingForground( ETrue ),
   203         iCtrlVisibleStateBeforeLosingForground( ETrue ),
   202         iFirstTimeActivated( ETrue ),
   204         iFirstTimeActivated( ETrue ),
   203         iContentProvider( aStatusProvider ),
   205         iContentProvider( aStatusProvider ),
   204         iCCAConnection( aCCAConnection )
   206         iCCAConnection( aCCAConnection ),
       
   207         iMarkingModeOn( EFalse )
   205     {
   208     {
   206     }
   209     }
   207 
   210 
   208 // --------------------------------------------------------------------------
   211 // --------------------------------------------------------------------------
   209 // CPbk2NamesListAppView::~CPbk2NamesListAppView
   212 // CPbk2NamesListAppView::~CPbk2NamesListAppView
   414         {
   417         {
   415         iCurrentCommandId = aCommandId;
   418         iCurrentCommandId = aCommandId;
   416         }
   419         }
   417     
   420     
   418     if ( EPbk2CmdOpenCca == aCommandId )
   421     if ( EPbk2CmdOpenCca == aCommandId )
   419     	{
   422         {
   420         iControl->SetOpeningCca( ETrue );
   423         iControl->SetOpeningCca( ETrue );
   421     	}
   424         }
   422 
   425 
   423     // Set focus, keep current focus on the area of the client screen
   426     // Set focus, keep current focus on the area of the client screen
   424     // when scoll to the bottom of Names list view.
   427     // when scoll to the bottom of Names list view.
   425     CPbk2ContactViewListBox* listbox = static_cast<CPbk2ContactViewListBox*>(iControl->ComponentControl(0));
   428     CPbk2ContactViewListBox* listbox = static_cast<CPbk2ContactViewListBox*>(iControl->ComponentControl(0));
   426     if ( EPbk2CmdCreateNew == aCommandId &&
   429     if ( EPbk2CmdCreateNew == aCommandId &&
   561     CleanupStack::PopAndDestroy(2,title); // viewActivationTransaction, title
   564     CleanupStack::PopAndDestroy(2,title); // viewActivationTransaction, title
   562 
   565 
   563     // The application is set here to background if application exit occurs
   566     // The application is set here to background if application exit occurs
   564     PBK2_PROFILE_START
   567     PBK2_PROFILE_START
   565         ( Pbk2Profile::ENamesListViewDoActivateNotifyViewActivatation );
   568         ( Pbk2Profile::ENamesListViewDoActivateNotifyViewActivatation );
   566 
   569     
   567     // The application is set here to background if application exit occurs
   570     // The application is set here to background if application exit occurs
   568     // When the device is powered on, Phonebook will start up automatically and
   571     // When the device is powered on, Phonebook will start up automatically and
   569     // hide itself in the background. At the first time of names list view activation,
   572     // hide itself in the background. At the first time of names list view activation,
   570     // event is generated, the notification needs to be sent to Startup Monitor
   573     // event is generated, the notification needs to be sent to Startup Monitor
   571     // so that making UI controls displaying properly.
   574     // so that making UI controls displaying properly.
   593     PBK2_PROFILE_END
   596     PBK2_PROFILE_END
   594         ( Pbk2Profile::ENamesListViewDoActivateNotifyViewActivatation );
   597         ( Pbk2Profile::ENamesListViewDoActivateNotifyViewActivatation );
   595 
   598 
   596     PBK2_PROFILE_END(Pbk2Profile::ENamesListViewDoActivateL);
   599     PBK2_PROFILE_END(Pbk2Profile::ENamesListViewDoActivateL);
   597 
   600 
       
   601     // It will return the listbox by calling iControl->ComponentControl(0),
       
   602     // which is defined in CPbk2NamesListControl::ComponentControl(TInt aIndex).
   598     CCoeControl* ctrl=iControl->ComponentControl(0);
   603     CCoeControl* ctrl=iControl->ComponentControl(0);
   599     CEikListBox* listbox=static_cast <CEikListBox*> (ctrl);
   604     CEikListBox* listbox=static_cast <CEikListBox*> (ctrl);
   600     listbox->SetListBoxObserver( this );
   605     listbox->SetListBoxObserver( this );
       
   606     listbox->SetMarkingModeObserver( this );
   601 
   607 
   602     // iCtrlVisibleStateBeforeLosingForground records the names list control states before
   608     // iCtrlVisibleStateBeforeLosingForground records the names list control states before
   603     // losing foreground during a command execution. Set the iCtrlVisibleStateBeforeLosingForground
   609     // losing foreground during a command execution. Set the iCtrlVisibleStateBeforeLosingForground
   604     // flag as ETrue as the control should be visible when active a view.
   610     // flag as ETrue as the control should be visible when active a view.
   605     iCtrlVisibleStateBeforeLosingForground = ETrue;
   611     iCtrlVisibleStateBeforeLosingForground = ETrue;
   618     TInt commandCount = iControl->CommandItemCount();
   624     TInt commandCount = iControl->CommandItemCount();
   619        
   625        
   620     // Check if there is need to create MyCard
   626     // Check if there is need to create MyCard
   621     if( FeatureManager::FeatureSupported( KFeatureIdffContactsMycard ) &&
   627     if( FeatureManager::FeatureSupported( KFeatureIdffContactsMycard ) &&
   622         ( !iMyCard && IsPhoneMemoryUsedL() ) )
   628         ( !iMyCard && IsPhoneMemoryUsedL() ) )
   623     	{				
   629         {
   624 		// Get the phoneStore for MyCard
   630         // Get the phoneStore for MyCard
   625 		MVPbkContactStore* phoneStore = iContactManager->ContactStoresL()
   631         MVPbkContactStore* phoneStore = iContactManager->ContactStoresL()
   626     		.Find(VPbkContactStoreUris::DefaultCntDbUri() );
   632             .Find(VPbkContactStoreUris::DefaultCntDbUri() );
   627 		
   633         
   628 		if( phoneStore )
   634         if( phoneStore )
   629 			{
   635             {
   630 			// Create MyCard if not already exist and the phone memory selected
   636             // Create MyCard if not already exist and the phone memory selected
   631 			iMyCard = CPbk2MyCard::NewL( *phoneStore );
   637             iMyCard = CPbk2MyCard::NewL( *phoneStore );
   632 			}
   638             }
   633     	}
   639         }
   634     
   640     
   635     // Add the MyCard item to the top of the list
   641     // Add the MyCard item to the top of the list
   636     if( iMyCard && IsPhoneMemoryUsedL() )
   642     if( iMyCard && IsPhoneMemoryUsedL() )
   637         {
   643         {
   638         CPbk2CmdItemMyCard* cmd = 
   644         CPbk2CmdItemMyCard* cmd = 
   650     
   656     
   651 
   657 
   652    // promotion item disabled until we can support command items at the bottom of the list
   658    // promotion item disabled until we can support command items at the bottom of the list
   653    // if ( IsRclOnL() )  
   659    // if ( IsRclOnL() )  
   654     if( 0 )
   660     if( 0 )
   655 	    {
   661         {
   656         CPbk2CmdItemRemoteContactLookup* rclCmd = CPbk2CmdItemRemoteContactLookup::NewLC();
   662         CPbk2CmdItemRemoteContactLookup* rclCmd = CPbk2CmdItemRemoteContactLookup::NewLC();
   657         // Add the command item to the bottom of the command list
   663         // Add the command item to the bottom of the command list
   658         iControl->AddCommandItemL( rclCmd, commandCount ); // ownership transferred
   664         iControl->AddCommandItemL( rclCmd, commandCount ); // ownership transferred
   659         CleanupStack::Pop( rclCmd );
   665         CleanupStack::Pop( rclCmd );
   660         commandCount++;
   666         commandCount++;
   661 	    }
   667         }
   662     }
   668     }
   663 
   669 
   664 // --------------------------------------------------------------------------
   670 // --------------------------------------------------------------------------
   665 // CPbk2NamesListExView::IsRclOnL
   671 // CPbk2NamesListExView::IsRclOnL
   666 // --------------------------------------------------------------------------
   672 // --------------------------------------------------------------------------
   696 // --------------------------------------------------------------------------
   702 // --------------------------------------------------------------------------
   697 // CPbk2NamesListExView::MyCard
   703 // CPbk2NamesListExView::MyCard
   698 // --------------------------------------------------------------------------
   704 // --------------------------------------------------------------------------
   699 //
   705 //
   700 CPbk2MyCard* CPbk2NamesListExView::MyCard() const
   706 CPbk2MyCard* CPbk2NamesListExView::MyCard() const
   701     {			
   707     {
   702 	TBool phoneMemory = EFalse;
   708     TBool phoneMemory = EFalse;
   703 	
   709     
   704 	TRAP_IGNORE( phoneMemory = IsPhoneMemoryUsedL() );
   710     TRAP_IGNORE( phoneMemory = IsPhoneMemoryUsedL() );
   705 	
   711     
   706 	if( phoneMemory )
   712     if( phoneMemory )
   707 		{
   713         {
   708 		return iMyCard;
   714         return iMyCard;
   709 		}
   715         }
   710 	
   716     
   711 	return NULL;
   717     return NULL;
   712     }
   718     }
   713 
   719 
   714 // --------------------------------------------------------------------------
   720 // --------------------------------------------------------------------------
   715 // CPbk2NamesListExView::DoDeactivate
   721 // CPbk2NamesListExView::DoDeactivate
   716 // --------------------------------------------------------------------------
   722 // --------------------------------------------------------------------------
   756     iControlState = NULL;
   762     iControlState = NULL;
   757     
   763     
   758     if (iContainer)
   764     if (iContainer)
   759         {
   765         {
   760         CCoeEnv::Static()->AppUi()->RemoveFromStack(iContainer);
   766         CCoeEnv::Static()->AppUi()->RemoveFromStack(iContainer);
       
   767         if( iMarkingModeOn )
       
   768             {
       
   769             // It will return the listbox by calling
       
   770             // iControl->ComponentControl(0), which is defined
       
   771             // in CPbk2NamesListControl::ComponentControl(TInt aIndex).
       
   772             CCoeControl* ctrl=iControl->ComponentControl(0);
       
   773             CEikListBox* listbox=static_cast <CEikListBox*> (ctrl);
       
   774             listbox->SetMarkingMode(EFalse);
       
   775             }
   761         // Store current state, safe to ignore. There's no real harm,
   776         // Store current state, safe to ignore. There's no real harm,
   762         // if theres no stored state when activating this view again
   777         // if theres no stored state when activating this view again
   763         TRAP_IGNORE(StoreStateL());
   778         TRAP_IGNORE(StoreStateL());
   764         iControl->SetObserver(NULL);
   779         iControl->SetObserver(NULL);
   765         delete iContainer;
   780         delete iContainer;
   788     //This is called after CPbk2CommandHandler::PerformStandardMenuFilteringL
   803     //This is called after CPbk2CommandHandler::PerformStandardMenuFilteringL
   789     //so we can safely remove here anything that may already also be removed
   804     //so we can safely remove here anything that may already also be removed
   790     //there.
   805     //there.
   791     switch (aResourceId)
   806     switch (aResourceId)
   792         {
   807         {
       
   808         case R_AVKON_MENUPANE_MARK_MULTIPLE:
       
   809             {
       
   810             TInt pos;
       
   811             if ( aMenuPane->MenuItemExists( EAknCmdMarkingModeEnter, pos ) &&
       
   812                     iControl->NumberOfContacts() <= 0 )
       
   813                 {
       
   814                 aMenuPane->SetItemDimmed( EAknCmdMarkingModeEnter, ETrue );
       
   815                 }
       
   816             break;
       
   817             }
   793         case R_PHONEBOOK2_NAMESLIST_SEND_URL_MENU:
   818         case R_PHONEBOOK2_NAMESLIST_SEND_URL_MENU:
   794             {
   819             {
   795             DimItem( aMenuPane, EPbk2CmdGoToURL );
   820             DimItem( aMenuPane, EPbk2CmdGoToURL );
       
   821             if ( iControl->ContactsMarked() && iMarkingModeOn )
       
   822                 {
       
   823                 aMenuPane->SetItemDimmed( EPbk2CmdSend, EFalse );
       
   824                 }
   796             break;
   825             break;
   797             }
   826             }
   798         case R_PHONEBOOK2_NAMELIST_CREATE_MESSAGE_MENU:
   827         case R_PHONEBOOK2_NAMESLIST_COPY_MENU:  
   799             {
   828             {
   800             TInt pos;
   829             TInt pos;
   801             if ( aMenuPane->MenuItemExists( EPbk2CmdWriteNoQuery, pos ) )
   830             if ( aMenuPane->MenuItemExists( EPbk2CmdCopy, pos ) && iMarkingModeOn
   802                 {
   831                     && iControl->NumberOfContacts() > 0  )
   803                 aMenuPane->SetItemSpecific( EPbk2CmdWriteNoQuery, !iControl->ContactsMarked() );
   832                 {
       
   833                 // Show Copy item both in pop up menu and Options
       
   834                 // when Marking mode is active.
       
   835                 aMenuPane->SetItemSpecific( EPbk2CmdCopy, ETrue );
       
   836                 aMenuPane->SetItemDimmed( EPbk2CmdCopy, EFalse );
   804                 }
   837                 }
   805             break;
   838             break;
   806             }
   839             }
   807         default:
   840         default:
   808             {
   841             {
   898                 result = ETrue;
   931                 result = ETrue;
   899                 break;
   932                 break;
   900                 }
   933                 }
   901             case EKeyBackspace:
   934             case EKeyBackspace:
   902                 {
   935                 {
   903                 if ( (itemSpecEnabled && (iControl->NumberOfContacts() > 0))
   936                 if ( itemSpecEnabled &&  ( iControl->FindTextL() == KNullDesC ) )
   904                     || iControl->ContactsMarked() )
       
   905                     {
   937                     {
   906                     if (iControl->FindTextL() == KNullDesC)
   938                     TBool contactsMarked( iControl->ContactsMarked() );
       
   939 
       
   940                     MPbk2UiControlCmdItem* cmdItem = const_cast<MPbk2UiControlCmdItem*> ( iControl->FocusedCommandItem() );
       
   941 
       
   942                     TBool onMyCard = cmdItem && ( EPbk2CmdOpenMyCard == cmdItem->CommandId() );
       
   943 
       
   944                     if ( !contactsMarked && onMyCard )
   907                         {
   945                         {
       
   946                         //Check to see whether the current focus is on MyCard or not
       
   947                         //When none of the contacts are marked and with focus on MyCard,
       
   948                         //  pressing BackSpace/Del key leads to deletion of MyCard
       
   949     
       
   950                         // get extension point and my card link
       
   951                         TAny* object = cmdItem->ControlCmdItemExtension( TUid::Uid( KPbk2ControlCmdItemExtensionUID ) );
       
   952                         if(  object )
       
   953                             {
       
   954                             MPbk2DoubleListboxCmdItemExtension* extension =
       
   955                                     static_cast<MPbk2DoubleListboxCmdItemExtension*>( object );
       
   956                             // if extension exists
       
   957                             if( extension )
       
   958                                 {
       
   959                                 const MVPbkContactLink* link = extension->Link();
       
   960                                 // if link exists, then MyCard has been Assigned
       
   961                                 if( link )
       
   962                                     {
       
   963                                     HandleCommandL( EPbk2CmdDeleteMyCard );
       
   964                                     result = ETrue;
       
   965                                     }
       
   966                                 }
       
   967                             }
       
   968                         }
       
   969                     else if(  ( contactsMarked ) || (iControl->NumberOfContacts() > 0) )
       
   970                        {
   908                         HandleCommandL(EPbk2CmdDeleteMe);
   971                         HandleCommandL(EPbk2CmdDeleteMe);
   909                         result = ETrue;
   972                         result = ETrue;
       
   973                        }
       
   974                     }
       
   975                 break;
       
   976                 }
       
   977 
       
   978             case EKeyEnter: // FALLTHROUGH
       
   979             case EKeyOK:
       
   980                 {
       
   981                 if ( !ShiftDown(aKeyEvent) ) // pure OK key
       
   982                     {
       
   983                     if ( iControl->ContactsMarked() && itemSpecEnabled )
       
   984                         {
       
   985                         result = EFalse;
   910                         }
   986                         }
   911                     }
   987                     }
   912                 break;
   988                 break;
   913                 }
   989                 }
   914 
       
   915             case EKeyEnter: // FALLTHROUGH
       
   916             case EKeyOK:
       
   917                 {
       
   918                 if ( !ShiftDown(aKeyEvent) ) // pure OK key
       
   919 					{
       
   920 					if ( iControl->ContactsMarked() && itemSpecEnabled )					
       
   921 					    {
       
   922                         iView.LaunchPopupMenuL(
       
   923                             R_PHONEBOOK2_NAMESLIST_CONTEXT_MENUBAR_ITEMS_MARKED);
       
   924                         result = ETrue;
       
   925 					    }
       
   926 					else if ( iControl->NumberOfContacts() == 0 )
       
   927 					    {
       
   928                         result = ETrue;
       
   929 					    }
       
   930 					}
       
   931                 break;
       
   932                 }
       
   933             default:
   990             default:
   934                 {
   991                 {
   935                 break;
   992                 break;
   936                 }
   993                 }
   937             }
   994             }
   956     if( AknLayoutUtils::PenEnabled() )
  1013     if( AknLayoutUtils::PenEnabled() )
   957         {
  1014         {
   958         switch ( aEventType )
  1015         switch ( aEventType )
   959             {
  1016             {
   960             case EEventItemSingleClicked:
  1017             case EEventItemSingleClicked:
   961             	{
  1018                 {
   962                 ShowContextMenuL();
  1019                 ShowContextMenuL();
   963                 break;
  1020                 break;
   964                 }
  1021                 }
   965 #if 0            	
  1022 #if 0                
   966             case EEventEmptyAreaClicked:  //An empty area of non-empty listbox was clicked 
  1023             case EEventEmptyAreaClicked:  //An empty area of non-empty listbox was clicked 
   967             case EEventEmptyListClicked:  //An empty listbox was clicked                
  1024             case EEventEmptyListClicked:  //An empty listbox was clicked                
   968                 {
  1025                 {
   969                 ProcessEmptyAreaClickL();
  1026                 ProcessEmptyAreaClickL();
   970                 break;
  1027                 break;
   993                     !iControl->ContactsMarked())
  1050                     !iControl->ContactsMarked())
   994                     {
  1051                     {
   995                     // Select key is mapped to "Open Contact" command
  1052                     // Select key is mapped to "Open Contact" command
   996                     HandleCommandL(EPbk2CmdOpenCca);
  1053                     HandleCommandL(EPbk2CmdOpenCca);
   997                     }
  1054                     }
   998                 else if (iControl->ContactsMarked())
       
   999             		{
       
  1000                 	iView.LaunchPopupMenuL(
       
  1001                     	R_PHONEBOOK2_NAMESLIST_CONTEXT_MENUBAR_ITEMS_MARKED);
       
  1002                     }
       
  1003                 break;
  1055                 break;
  1004                 }
  1056                 }
  1005             default:
  1057             default:
  1006                break;
  1058                break;
  1007             }
  1059             }
  1080         {
  1132         {
  1081         if ( iControl->NumberOfContacts() > 0 || iControl->CommandItemCount() > 0) 
  1133         if ( iControl->NumberOfContacts() > 0 || iControl->CommandItemCount() > 0) 
  1082             {
  1134             {
  1083             if ( iPointerEventInspector->FocusedItemPointed() )
  1135             if ( iPointerEventInspector->FocusedItemPointed() )
  1084                 {
  1136                 {
  1085                 if ( iControl->ContactsMarked() )
  1137                 if ( !iControl->ContactsMarked() )
  1086                     {
       
  1087                     // Display marked items context menu
       
  1088                     iView.LaunchPopupMenuL
       
  1089                         ( R_PHONEBOOK2_NAMESLIST_CONTEXT_MENUBAR_ITEMS_MARKED );
       
  1090                     }
       
  1091                 else
       
  1092                     {
  1138                     {
  1093                     // cancel the long tap animation with pointer up event
  1139                     // cancel the long tap animation with pointer up event
  1094                     TPointerEvent event;
  1140                     TPointerEvent event;
  1095                     event.iType = TPointerEvent::EButton1Up;
  1141                     event.iType = TPointerEvent::EButton1Up;
  1096                     iContainer->LongTapDetectorL().PointerEventL( event );
  1142                     iContainer->LongTapDetectorL().PointerEventL( event );
  1129         {
  1175         {
  1130         if ( iControl->NumberOfContacts() == 0 ) 
  1176         if ( iControl->NumberOfContacts() == 0 ) 
  1131             {
  1177             {
  1132             MTouchFeedback* feedback = MTouchFeedback::Instance();
  1178             MTouchFeedback* feedback = MTouchFeedback::Instance();
  1133             if ( feedback )
  1179             if ( feedback )
  1134                    {
  1180                 {
  1135                    feedback->InstantFeedback( ETouchFeedbackBasic );
  1181                 feedback->InstantFeedback( ETouchFeedbackBasic );
  1136                    }			
  1182                 }
  1137             HandleCommandL( EPbk2CmdCreateNew );
  1183             HandleCommandL( EPbk2CmdCreateNew );
  1138             }
  1184             }
  1139         }    
  1185         }    
  1140     }
  1186     }
  1141 #endif
  1187 #endif
  1241     MVPbkContactStore* phoneStore = NULL;
  1287     MVPbkContactStore* phoneStore = NULL;
  1242     
  1288     
  1243     Reset();
  1289     Reset();
  1244            
  1290            
  1245     if( iMyCard )
  1291     if( iMyCard )
  1246     	{
  1292         {
  1247 		return;
  1293         return;
  1248     	}
  1294         }
  1249        
  1295        
  1250     if( FeatureManager::FeatureSupported( KFeatureIdffContactsMycard ) )
  1296     if( FeatureManager::FeatureSupported( KFeatureIdffContactsMycard ) )
  1251 	   {    				
  1297         {
  1252 		// Get the phoneStore for MyCard
  1298         // Get the phoneStore for MyCard
  1253 		TRAP_IGNORE( phoneStore = iContactManager->ContactStoresL().
  1299         TRAP_IGNORE( phoneStore = iContactManager->ContactStoresL().
  1254 			Find( VPbkContactStoreUris::DefaultCntDbUri() ) );    		
  1300             Find( VPbkContactStoreUris::DefaultCntDbUri() ) );
  1255 	   }
  1301         }
  1256                
  1302                
  1257     if( !phoneStore )
  1303     if( !phoneStore )
  1258     	{
  1304         {
  1259         TRAP_IGNORE( iContactManager->LoadContactStoreL( 
  1305         TRAP_IGNORE( iContactManager->LoadContactStoreL( 
  1260                 VPbkContactStoreUris::DefaultCntDbUri() ) );
  1306                 VPbkContactStoreUris::DefaultCntDbUri() ) );
  1261     	}
  1307         }
  1262     }
  1308     }
  1263 
  1309 
  1264 // --------------------------------------------------------------------------
  1310 // --------------------------------------------------------------------------
  1265 // CPbk2NamesListExView::ConfigurationChangedComplete
  1311 // CPbk2NamesListExView::ConfigurationChangedComplete
  1266 // --------------------------------------------------------------------------
  1312 // --------------------------------------------------------------------------
  1513             iControl->DrawNow();
  1559             iControl->DrawNow();
  1514             }
  1560             }
  1515         }
  1561         }
  1516     }
  1562     }
  1517 
  1563 
       
  1564 // -----------------------------------------------------------------------------
       
  1565 // CPbk2NamesListExView::MarkingModeStatusChanged
       
  1566 // -----------------------------------------------------------------------------
       
  1567 //
       
  1568 void CPbk2NamesListExView::MarkingModeStatusChanged( TBool aActivated )
       
  1569     {
       
  1570     iMarkingModeOn = aActivated;
       
  1571 
       
  1572     // It will return the control findbox by calling
       
  1573     // iControl->ComponentControl(1), which is defined
       
  1574     // in CPbk2NamesListControl::ComponentControl(TInt aIndex).
       
  1575     if ( !iMarkingModeOn && iControl->ComponentControl(1)->IsVisible() )
       
  1576         {
       
  1577         // Clear the text of the FindBox, when canceling from Marking mode.
       
  1578         TRAP_IGNORE( iControl->ResetFindL() );
       
  1579         }
       
  1580     iControl->SetMarkingMode( aActivated );
       
  1581 
       
  1582     // It will return the control listbox by calling
       
  1583     // iControl->ComponentControl(0), which is defined
       
  1584     // in CPbk2NamesListControl::ComponentControl(TInt aIndex).
       
  1585     CPbk2ContactViewListBox* listbox = 
       
  1586         static_cast<CPbk2ContactViewListBox*>(iControl->ComponentControl(0));
       
  1587     listbox->SetMarkingModeState( aActivated );
       
  1588     }
       
  1589 
       
  1590 // -----------------------------------------------------------------------------
       
  1591 // CPbk2NamesListExView::ExitMarkingMode
       
  1592 // Called by avkon, if the return value is ETrue, 
       
  1593 // the Marking mode will be canceled after any operation, 
       
  1594 // otherwise the Marking mode keep active.
       
  1595 // -----------------------------------------------------------------------------
       
  1596 //
       
  1597 TBool CPbk2NamesListExView::ExitMarkingMode() const
       
  1598     {
       
  1599     return EFalse; 
       
  1600     }
       
  1601     
  1518 //---------------------------------------------------------------------------
  1602 //---------------------------------------------------------------------------
  1519 // CPbk2NamesListExView::CreateControlsL
  1603 // CPbk2NamesListExView::CreateControlsL
  1520 // --------------------------------------------------------------------------
  1604 // --------------------------------------------------------------------------
  1521 //
  1605 //
  1522 inline void CPbk2NamesListExView::CreateControlsL()
  1606 inline void CPbk2NamesListExView::CreateControlsL()
  1523     {
  1607     {
  1524 	
  1608     
  1525     if (!iContainer)
  1609     if (!iContainer)
  1526         {
  1610         {
  1527         PBK2_PROFILE_START(Pbk2Profile::ENamesListViewCreateControls);
  1611         PBK2_PROFILE_START(Pbk2Profile::ENamesListViewCreateControls);
  1528         // Create the container and control
  1612         // Create the container and control
  1529         PBK2_PROFILE_START(Pbk2Profile::ENamesListViewCreateContainer);
  1613         PBK2_PROFILE_START(Pbk2Profile::ENamesListViewCreateContainer);
  1626             }
  1710             }
  1627         else if ( listContainsContacts && contactsMarked )
  1711         else if ( listContainsContacts && contactsMarked )
  1628             {
  1712             {
  1629             // Set middle softkey as Context Icon
  1713             // Set middle softkey as Context Icon
  1630             iView.Cba()->SetCommandSetL( R_PBK2_SOFTKEYS_OPTIONS_EXIT_CONTEXT );
  1714             iView.Cba()->SetCommandSetL( R_PBK2_SOFTKEYS_OPTIONS_EXIT_CONTEXT );
  1631             // Change context menu when marked items
       
  1632             iView.MenuBar()->SetContextMenuTitleResourceId
       
  1633                 ( R_PHONEBOOK2_NAMESLIST_CONTEXT_MENUBAR_ITEMS_MARKED );
       
  1634             }
  1715             }
  1635         else // not listContainsContacts && not contactsMarked
  1716         else // not listContainsContacts && not contactsMarked
  1636             {
  1717             {
  1637 #ifndef ECE_DISABLE_CONTEXT_MENU
  1718 #ifndef ECE_DISABLE_CONTEXT_MENU
  1638             // Set middle softkey as Context Icon.
  1719             // Set middle softkey as Context Icon.
  1854 // --------------------------------------------------------------------------
  1935 // --------------------------------------------------------------------------
  1855 // CPbk2NamesListExView::IsPhoneMemoryUsedL
  1936 // CPbk2NamesListExView::IsPhoneMemoryUsedL
  1856 // --------------------------------------------------------------------------
  1937 // --------------------------------------------------------------------------
  1857 //
  1938 //
  1858 TBool CPbk2NamesListExView::IsPhoneMemoryUsedL() const
  1939 TBool CPbk2NamesListExView::IsPhoneMemoryUsedL() const
  1859 	{
  1940     {
  1860 	CPbk2ApplicationServices* appServices = CPbk2ApplicationServices::InstanceL();
  1941     CPbk2ApplicationServices* appServices = CPbk2ApplicationServices::InstanceL();
  1861 			
  1942             
  1862 	// Get current configuration
  1943     // Get current configuration
  1863 	CPbk2StoreConfiguration& storeConfig = appServices->StoreConfiguration();
  1944     CPbk2StoreConfiguration& storeConfig = appServices->StoreConfiguration();
  1864 	
  1945     
  1865 	CVPbkContactStoreUriArray* uriArray = storeConfig.CurrentConfigurationL();
  1946     CVPbkContactStoreUriArray* uriArray = storeConfig.CurrentConfigurationL();
  1866 			
  1947             
  1867 	TVPbkContactStoreUriPtr contactUri( VPbkContactStoreUris::DefaultCntDbUri() );		
  1948     TVPbkContactStoreUriPtr contactUri( VPbkContactStoreUris::DefaultCntDbUri() );
  1868 			
  1949             
  1869 	// Check is phone memory included
  1950     // Check is phone memory included
  1870 	TBool phoneMemory = uriArray->IsIncluded( contactUri );
  1951     TBool phoneMemory = uriArray->IsIncluded( contactUri );
  1871 	
  1952     
  1872 	delete uriArray;		
  1953     delete uriArray;        
  1873 	Release( appServices );
  1954     Release( appServices );
  1874 	
  1955     
  1875 	return phoneMemory;
  1956     return phoneMemory;
  1876 	}
  1957     }
  1877 	
  1958     
  1878 // --------------------------------------------------------------------------
  1959 // --------------------------------------------------------------------------
  1879 // CPbk2NamesListExView::HandleGainingForeground
  1960 // CPbk2NamesListExView::HandleGainingForeground
  1880 // --------------------------------------------------------------------------
  1961 // --------------------------------------------------------------------------
  1881 //
  1962 //
  1882 void CPbk2NamesListExView::HandleGainingForeground()
  1963 void CPbk2NamesListExView::HandleGainingForeground()