phonebookui/Phonebook2/NamesListExtension/src/NamesListUiExtensionPlugin.cpp
changeset 0 e686773b3f54
child 3 04ab22b956c2
equal deleted inserted replaced
-1:000000000000 0:e686773b3f54
       
     1 /*
       
     2 * Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Phonebook 2 Names List UI extension plug-in.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include "Pbk2NamesListExtensionPlugin.h"
       
    21 #include "Pbk2NamesListEx.hrh"
       
    22 #include "Pbk2NamesListExView.h"
       
    23 
       
    24 #include "CPbk2NameslistUiControlExtension.h"
       
    25 #include "CPbk2NlxOpenCcaCmd.h"
       
    26 #include "CPbk2NlxAddToTopContactsCmd.h"
       
    27 #include "CPbk2NlxRemoveFromTopContactsCmd.h"
       
    28 #include "CPbk2NlxMoveTopContactsCmd.h"
       
    29 #include "Pbk2NlxMenuFiltering.h"
       
    30 #include "cpbk2deletemycardcmd.h"
       
    31 #include "cpbk2mycard.h"
       
    32 
       
    33 #include "cpbk2openmycardcmd.h"
       
    34 #include "CVPbkContactManager.h"
       
    35 #include <spbcontentprovider.h>
       
    36 
       
    37 // Phonebook 2
       
    38 #include <MPbk2AppUi.h>
       
    39 #include <MPbk2ApplicationServices.h>
       
    40 #include <MPbk2ApplicationServices2.h>
       
    41 #include <CPbk2StoreConfiguration.h>
       
    42 #include <TVPbkContactStoreUriPtr.h>
       
    43 
       
    44 #include <MPbk2ContactUiControl.h>
       
    45 #include <MPbk2ViewExplorer.h>
       
    46 #include <CPbk2ViewState.h>
       
    47 
       
    48 #include <MPbk2ContactUiControlExtension.h>
       
    49 #include <Pbk2Commands.rsg>
       
    50 #include <MVPbkBaseContact.h>
       
    51 #include <MVPbkBaseContactFieldCollection.h>
       
    52 #include <MVPbkBaseContactField.h>
       
    53 #include <MVPbkFieldType.h>
       
    54 #include <MVPbkContactFieldData.h>
       
    55 #include <VPbkEng.rsg>
       
    56 #include <CVPbkTopContactManager.h>
       
    57 #include <VPbkContactStoreUris.h>
       
    58 #include <CVPbkContactStoreUriArray.h>
       
    59 #include <MPbk2ContactUiControl2.h>
       
    60 #include <MVPbkContactStore.h>
       
    61 #include <MVPbkContactStoreList.h>
       
    62 #include <MVPbkContactStoreInfo.h>
       
    63 
       
    64 // Debugging headers
       
    65 
       
    66 #include <Pbk2Debug.h>
       
    67 #include <Pbk2Profile.h>
       
    68 
       
    69 //CCA
       
    70 #include <mccaconnection.h>
       
    71 #include <mccaparameter.h>
       
    72 #include <ccafactory.h>
       
    73 
       
    74 // System includes
       
    75 #include <coemain.h>
       
    76 #include <eikmenub.h>
       
    77 #include <AiwCommon.hrh>
       
    78 #include <avkon.hrh>
       
    79 #include <avkon.rsg>
       
    80 
       
    81 /// Unnamed namespace for local definitions
       
    82 namespace {
       
    83 const TInt KMinNumOfContactsToMerge = 2; // minimum number of contacts to merge
       
    84 } /// namespace
       
    85 
       
    86 // --------------------------------------------------------------------------
       
    87 // CNamesListUIExtensionPlugin::CNamesListUIExtensionPlugin
       
    88 // --------------------------------------------------------------------------
       
    89 //
       
    90 CNamesListUIExtensionPlugin::CNamesListUIExtensionPlugin()
       
    91     {
       
    92     }
       
    93 
       
    94 // --------------------------------------------------------------------------
       
    95 // CNamesListUIExtensionPlugin::~CNamesListUIExtensionPlugin
       
    96 // --------------------------------------------------------------------------
       
    97 //
       
    98 CNamesListUIExtensionPlugin::~CNamesListUIExtensionPlugin()
       
    99     {
       
   100     if ( iCCAConnection )
       
   101         {
       
   102         iCCAConnection->Close();
       
   103         }
       
   104     delete iContentProvider;
       
   105     }
       
   106 
       
   107     
       
   108 
       
   109 // --------------------------------------------------------------------------
       
   110 // CNamesListUIExtensionPlugin::NewL
       
   111 // --------------------------------------------------------------------------
       
   112 //
       
   113 CNamesListUIExtensionPlugin* CNamesListUIExtensionPlugin::NewL()
       
   114     {
       
   115     CNamesListUIExtensionPlugin* self = 
       
   116         new ( ELeave ) CNamesListUIExtensionPlugin();
       
   117     CleanupStack::PushL( self );
       
   118     self->ConstructL();
       
   119     CleanupStack::Pop( self );
       
   120     return self;
       
   121     }
       
   122 
       
   123 // --------------------------------------------------------------------------
       
   124 // CNamesListUIExtensionPlugin::ConstructL
       
   125 // --------------------------------------------------------------------------
       
   126 //
       
   127 void CNamesListUIExtensionPlugin::ConstructL()
       
   128     {
       
   129     }
       
   130 
       
   131 // --------------------------------------------------------------------------
       
   132 // CNamesListUIExtensionPlugin::ContentProviderL
       
   133 // --------------------------------------------------------------------------
       
   134 //
       
   135 inline CSpbContentProvider& CNamesListUIExtensionPlugin::ContentProviderL()
       
   136 	{
       
   137     if( !iContentProvider )
       
   138         {
       
   139         MPbk2ApplicationServices& apps = Phonebook2::Pbk2AppUi()->ApplicationServices();
       
   140         TAny* ext = apps.MPbk2ApplicationServicesExtension( 
       
   141             KMPbk2ApplicationServicesExtension2Uid );
       
   142         if( !ext )
       
   143             {
       
   144             User::Leave( KErrNotReady );
       
   145             }
       
   146         CPbk2StoreManager& storeManager = 
       
   147             static_cast<MPbk2ApplicationServices2*>(ext)->StoreManager();
       
   148         iContentProvider = CSpbContentProvider::NewL( apps.ContactManager(), storeManager,  
       
   149             CSpbContentProvider::EStatusMessage | CSpbContentProvider::EPhoneNumber );
       
   150         }
       
   151 	return *iContentProvider;
       
   152 	}
       
   153 
       
   154 
       
   155 // --------------------------------------------------------------------------
       
   156 // CNamesListUIExtensionPlugin::CreateExtensionViewL
       
   157 // --------------------------------------------------------------------------
       
   158 //
       
   159 MPbk2UIExtensionView* CNamesListUIExtensionPlugin::CreateExtensionViewL
       
   160         ( TUid aViewId, CPbk2UIExtensionView& aView )
       
   161     {
       
   162     MPbk2UIExtensionView* result = NULL;
       
   163     if ( aViewId == TUid::Uid( EPbk2NamesListViewId ) )
       
   164         {
       
   165         iNamesListExViewRef = CPbk2NamesListExView::NewL( 
       
   166             aView, ContentProviderL(), iCCAConnection );
       
   167         result = iNamesListExViewRef;    //ownership not taken
       
   168         }
       
   169 
       
   170     return result;
       
   171     }
       
   172 
       
   173 // --------------------------------------------------------------------------
       
   174 // CNamesListUIExtensionPlugin::DynInitMenuPaneL
       
   175 // --------------------------------------------------------------------------
       
   176 //
       
   177 void CNamesListUIExtensionPlugin::DynInitMenuPaneL(TInt aResourceId,
       
   178         CEikMenuPane* aMenuPane, MPbk2ContactUiControl& aControl )
       
   179     {
       
   180     //This is called before CPbk2CommandHandler::PerformStandardMenuFilteringL
       
   181     //so do not remove anything here that may be removed there.
       
   182     
       
   183     switch ( aResourceId )
       
   184         {
       
   185         case R_PHONEBOOK2_OPEN_CCA:
       
   186             {
       
   187             if ( !Pbk2NlxMenuFiltering::OpenReady( aControl ) )
       
   188                 {
       
   189                 DimItem( aMenuPane, EPbk2CmdOpenCca );                
       
   190                 }
       
   191             break;
       
   192             }
       
   193         case R_PHONEBOOK2_SELECT_ADDFAVORITES:
       
   194             {
       
   195             if ( !Pbk2NlxMenuFiltering::AddToFavoritesCmdSelected( aControl ) ||
       
   196                 aControl.ContactsMarked() ) 
       
   197                 {
       
   198                 DimItem( aMenuPane, EPbk2CmdAddFavourites );
       
   199                 }
       
   200             break;
       
   201             }
       
   202         case R_PHONEBOOK2_SELECT_MYCARD:
       
   203             {
       
   204             if ( !Pbk2NlxMenuFiltering::MyCardCmdSelected( aControl ) ||
       
   205                 aControl.ContactsMarked() ) 
       
   206                 {
       
   207                 DimItem( aMenuPane, EPbk2CmdOpenMyCard );
       
   208                 DimItem( aMenuPane, EPbk2CmdSelectMyCard );
       
   209                 }
       
   210             else
       
   211                 {
       
   212                 if( MyCardLink() )
       
   213                     {
       
   214                     // MyCard exists -> show "open"
       
   215                     DimItem( aMenuPane, EPbk2CmdSelectMyCard );
       
   216                     }
       
   217                 else
       
   218                     {
       
   219                     // MyCard not created -> show "select"
       
   220                     DimItem( aMenuPane, EPbk2CmdOpenMyCard );
       
   221                     }
       
   222                 }
       
   223             break;
       
   224             }
       
   225         case R_PHONEBOOK2_RCL_MENU:
       
   226             {
       
   227             if ( Pbk2NlxMenuFiltering::RclCmdSelectOptSelected( aControl )   ||
       
   228                  Pbk2NlxMenuFiltering::AddToFavoritesCmdSelected( aControl ) ||                    
       
   229                  aControl.ContactsMarked() ||
       
   230                  !(iNamesListExViewRef && iNamesListExViewRef->IsRclOnL())) 
       
   231                 {
       
   232                 DimItem( aMenuPane, EPbk2CmdRcl ); 
       
   233                 }
       
   234             break;
       
   235             }
       
   236         case R_PHONEBOOK2_SELECT_RCL:
       
   237             {
       
   238 			//Promotion item (RclCmdSelectOptSelected) may only be visible if rcl feature is on
       
   239             if ( !Pbk2NlxMenuFiltering::RclCmdSelectOptSelected( aControl )   || 
       
   240                 aControl.ContactsMarked() ) 
       
   241                 {
       
   242                 DimItem( aMenuPane, EPbk2CmdSelectRclCmdItem );
       
   243                 }
       
   244             break;
       
   245             }
       
   246         case R_PHONEBOOK2_ADD_TO_TOPCONTACTS:
       
   247             {
       
   248             TBool dimAdd = EFalse;    
       
   249             if ( aControl.ContactsMarked() )
       
   250                 {
       
   251 // multiple top assign/reassign doesn't work yet, enable when ready                
       
   252 #if 0                
       
   253                 dimAdd = !Pbk2NlxMenuFiltering::NonTopContactMarkedL( aControl );
       
   254 #else
       
   255                 dimAdd = ETrue;
       
   256 #endif                
       
   257                 }
       
   258             else
       
   259                 {
       
   260                 dimAdd = !Pbk2NlxMenuFiltering::TopReadyL( aControl );
       
   261                 }
       
   262             if ( dimAdd )    
       
   263                 {
       
   264                 DimItem( aMenuPane, EPbk2CmdAddToTopContacts );
       
   265                 }
       
   266 
       
   267             break;
       
   268             }
       
   269         case R_PHONEBOOK2_REMOVE_FROM_TOPCONTACTS:
       
   270             {
       
   271             TBool dimRemove = EFalse;    
       
   272             if ( aControl.ContactsMarked() )
       
   273                 {
       
   274 // multiple top assign/reassign doesn't work yet, enable when ready                
       
   275 #if 0                
       
   276                 dimRemove = !Pbk2NlxMenuFiltering::TopContactMarkedL( aControl );
       
   277 #else
       
   278                 dimRemove = ETrue;
       
   279 #endif                
       
   280                 }
       
   281             else
       
   282                 {
       
   283                 dimRemove = !Pbk2NlxMenuFiltering::TopContactSelectedL( aControl );
       
   284                 }
       
   285             if ( dimRemove )    
       
   286                 {
       
   287                 DimItem( aMenuPane, EPbk2CmdRemoveFromTopContacts );
       
   288                 }
       
   289             break;
       
   290             }
       
   291 /* Patrik 23.10.2008 Removed as agreed by ECE program management.
       
   292         case R_PHONEBOOK2_MOVE_TOPCONTACTS:
       
   293             {
       
   294             if( !Pbk2NlxMenuFiltering::TopRearrangingReadyL( aControl ) || 
       
   295                 aControl.ContactsMarked() ) 
       
   296                 {
       
   297                 DimItem( aMenuPane, EPbk2CmdMoveInTopContactsList);
       
   298                 }
       
   299             break;
       
   300             }
       
   301 */
       
   302         case R_PHONEBOOK2_NAMELIST_CALL_CONTACT_MENU:
       
   303             {
       
   304             if ( Pbk2NlxMenuFiltering::AddToFavoritesCmdSelected( aControl ) )
       
   305                 {
       
   306                 DimItem( aMenuPane, EPbk2CmdCall );
       
   307                 }
       
   308             if ( Pbk2NlxMenuFiltering::MyCardCmdSelected( aControl ) )
       
   309                 {
       
   310                 DimItem( aMenuPane, EPbk2CmdCall );
       
   311                 }
       
   312             break;
       
   313             }
       
   314         case R_PHONEBOOK2_NAMELIST_CREATE_MESSAGE_MENU:
       
   315             {
       
   316             if ( !aControl.ContactsMarked() )
       
   317                 {
       
   318                 if ( Pbk2NlxMenuFiltering::AddToFavoritesCmdSelected( aControl ) )
       
   319                     {
       
   320                     DimItem( aMenuPane, EPbk2CmdWriteNoQuery );
       
   321                     }
       
   322                 if ( Pbk2NlxMenuFiltering::MyCardCmdSelected( aControl ) )
       
   323                     {
       
   324                     DimItem( aMenuPane, EPbk2CmdWriteNoQuery );
       
   325                     }
       
   326                 }
       
   327             break;
       
   328             }
       
   329         case R_PHONEBOOK2_NAMESLIST_SEND_URL_MENU:
       
   330             {
       
   331             if ( Pbk2NlxMenuFiltering::AddToFavoritesCmdSelected( aControl ) )
       
   332                 {
       
   333                 DimItem( aMenuPane, EPbk2CmdSend );
       
   334                 }
       
   335             // if mycard is not created and is selected
       
   336 			if( !MyCardLink() && Pbk2NlxMenuFiltering::MyCardCmdSelected( aControl ) )
       
   337 				{
       
   338 				DimItem( aMenuPane, EPbk2CmdSend );
       
   339 				}
       
   340 			break;
       
   341             }
       
   342 
       
   343 #if 0                        
       
   344         case R_PHONEBOOK2_NAMESLIST_EDIT_MENU:  
       
   345             {                                   
       
   346             if ( aControl.ContactsMarked() ||
       
   347                 aControl.NumberOfContacts() == 0 ||
       
   348                 addFavouritesSelected ) 
       
   349                 {
       
   350                 DimItem( aMenuPane, EPbk2CmdEditMe ); 
       
   351                 }
       
   352             break;
       
   353             }
       
   354 #endif            
       
   355         case R_AVKON_MENUPANE_MARKABLE_LIST_IMPLEMENTATION:
       
   356         	{
       
   357         	MPbk2ContactUiControl2* tempControl = 
       
   358         	     reinterpret_cast<MPbk2ContactUiControl2*>
       
   359         	        (aControl.ContactUiControlExtension
       
   360         	            (KMPbk2ContactUiControlExtension2Uid ));
       
   361 
       
   362         	if ( tempControl->FocusedCommandItem() &&
       
   363         		 aControl.ContactsMarked() )
       
   364         		{
       
   365         		DimItem( aMenuPane, EAknCmdMark );
       
   366         		DimItem( aMenuPane, EAknMarkAll );
       
   367         		}
       
   368             if ( Pbk2NlxMenuFiltering::AddToFavoritesCmdSelected( aControl ) )
       
   369                 {
       
   370                 DimItem( aMenuPane, EAknCmdMark );
       
   371                 }
       
   372             if ( Pbk2NlxMenuFiltering::MyCardCmdSelected( aControl ) )
       
   373                 {
       
   374                 DimItem( aMenuPane, EAknCmdMark );
       
   375                 }
       
   376         	break;
       
   377         	}
       
   378         case R_PHONEBOOK2_MARKABLE_LIST_CONTEXT_MENU:
       
   379             {
       
   380             if ( Pbk2NlxMenuFiltering::AddToFavoritesCmdSelected( aControl ) )
       
   381                 {
       
   382                 DimItem( aMenuPane, EAknCmdMark );
       
   383                 DimItem( aMenuPane, EAknCmdUnmark );
       
   384                 }
       
   385             if ( Pbk2NlxMenuFiltering::MyCardCmdSelected( aControl ) )
       
   386                 {
       
   387                 DimItem( aMenuPane, EAknCmdMark );
       
   388                 DimItem( aMenuPane, EAknCmdUnmark );
       
   389                 }
       
   390             break;
       
   391             }
       
   392         case R_AVKON_MENUPANE_MARKABLE_LIST:
       
   393             {
       
   394             if ( !aControl.NumberOfContacts() )
       
   395                 {
       
   396                 DimItem( aMenuPane, EAknCmdEditListMenu );
       
   397                 }
       
   398             break;
       
   399             }
       
   400         case R_PHONEBOOK2_NAMESLIST_COPY_MENU:
       
   401             {
       
   402             MPbk2ContactUiControl2* tempControl = 
       
   403                    reinterpret_cast<MPbk2ContactUiControl2*>
       
   404                        (aControl.ContactUiControlExtension(
       
   405                            KMPbk2ContactUiControlExtension2Uid ));
       
   406 
       
   407             if ( tempControl->FocusedCommandItem() &&
       
   408                  !aControl.ContactsMarked()   )
       
   409                 {
       
   410                 DimItem( aMenuPane, EPbk2CmdCopy );
       
   411                 }
       
   412             break;
       
   413             }
       
   414         case R_PHONEBOOK2_NAMESLIST_DELETE_MENU:
       
   415             {
       
   416             // show delete mycard if mycard command is focused / tapped and 
       
   417             // mycard is available
       
   418             if( !Pbk2NlxMenuFiltering::MyCardCmdSelected( aControl ) ||
       
   419                 !MyCardLink() )
       
   420                 {
       
   421                 DimItem( aMenuPane, EPbk2CmdDeleteMyCard );
       
   422                 }
       
   423             break;
       
   424             }
       
   425         case R_PHONEBOOK2_MERGE_CONTACTS:
       
   426             {
       
   427             MVPbkContactStoreList& storeList = 
       
   428                 Phonebook2::Pbk2AppUi()->ApplicationServices().ContactManager().ContactStoresL();
       
   429             // only phone memory contacts can be merged
       
   430             MVPbkContactStore* store = storeList.Find( VPbkContactStoreUris::DefaultCntDbUri() );
       
   431             TInt numberOfContacts = 0;
       
   432             if( store )
       
   433                 {
       
   434                 MVPbkContactLink* mylink = MyCardLink();
       
   435                 numberOfContacts = store->StoreInfo().NumberOfContactsL() - ( mylink ? 1 : 0 );
       
   436                 }
       
   437             // there must be two contacts to do merge
       
   438             if ( numberOfContacts  < KMinNumOfContactsToMerge )
       
   439                 {
       
   440                 aMenuPane->SetItemDimmed( EPbk2CmdMergeContacts, ETrue );
       
   441                 }
       
   442             break;
       
   443             }
       
   444         default:
       
   445             {
       
   446             break;
       
   447             }
       
   448         }
       
   449     }
       
   450     
       
   451 // --------------------------------------------------------------------------
       
   452 // CNamesListUIExtensionPlugin::DimItem
       
   453 // --------------------------------------------------------------------------
       
   454 //
       
   455 void CNamesListUIExtensionPlugin::DimItem( CEikMenuPane* aMenuPane, TInt aCmd )
       
   456     {
       
   457     TInt p;  
       
   458     
       
   459     if ( aMenuPane->MenuItemExists( aCmd, p ) )
       
   460         {
       
   461         aMenuPane->SetItemDimmed( aCmd, ETrue );    
       
   462         } 
       
   463     }
       
   464     
       
   465 // --------------------------------------------------------------------------
       
   466 // CNamesListUIExtensionPlugin::IsTopContact
       
   467 // --------------------------------------------------------------------------
       
   468 //
       
   469 inline TBool CNamesListUIExtensionPlugin::IsTopContact( 
       
   470 	const MVPbkBaseContact* aContact )
       
   471     {
       
   472     TBool topContact( EFalse );
       
   473 
       
   474     if( aContact ) 
       
   475         {
       
   476         topContact = CVPbkTopContactManager::IsTopContact( *aContact );
       
   477         }
       
   478         
       
   479     return topContact;
       
   480     }
       
   481 
       
   482 // --------------------------------------------------------------------------
       
   483 // CNamesListUIExtensionPlugin::MyCardLink
       
   484 // --------------------------------------------------------------------------
       
   485 //
       
   486 inline MVPbkContactLink* CNamesListUIExtensionPlugin::MyCardLink() const
       
   487     {
       
   488     MVPbkContactLink* result = NULL;
       
   489     if( iNamesListExViewRef )
       
   490         {
       
   491         const CPbk2MyCard* mycard = iNamesListExViewRef->MyCard();
       
   492         if( mycard )
       
   493             {
       
   494             result = mycard->MyCardLink();
       
   495             }
       
   496         }
       
   497     return result;
       
   498     }
       
   499 
       
   500 // --------------------------------------------------------------------------
       
   501 // CNamesListUIExtensionPlugin::UpdateStorePropertiesL
       
   502 // --------------------------------------------------------------------------
       
   503 //
       
   504 void CNamesListUIExtensionPlugin::UpdateStorePropertiesL
       
   505         ( CPbk2StorePropertyArray& /*aPropertyArray*/ )
       
   506     {
       
   507     // Do nothing
       
   508     }
       
   509 
       
   510 // --------------------------------------------------------------------------
       
   511 // CNamesListUIExtensionPlugin::CreatePbk2ContactEditorExtensionL
       
   512 // --------------------------------------------------------------------------
       
   513 //
       
   514 MPbk2ContactEditorExtension*
       
   515     CNamesListUIExtensionPlugin::CreatePbk2ContactEditorExtensionL
       
   516         ( CVPbkContactManager& /*aContactManager*/,
       
   517           CPbk2PresentationContact& /*aContact*/,
       
   518           MPbk2ContactEditorControl& /*aEditorControl*/ )
       
   519     {
       
   520     // Do nothing
       
   521     return NULL;
       
   522     }
       
   523 
       
   524 // --------------------------------------------------------------------------
       
   525 // CNamesListUIExtensionPlugin::CreatePbk2UiControlExtensionL
       
   526 // --------------------------------------------------------------------------
       
   527 //
       
   528 MPbk2ContactUiControlExtension*
       
   529     CNamesListUIExtensionPlugin::CreatePbk2UiControlExtensionL
       
   530         ( CVPbkContactManager& aContactManager )
       
   531     {
       
   532 	CPbk2MyCard* mycard = NULL;
       
   533 	if( iNamesListExViewRef )
       
   534 		{
       
   535 		mycard = iNamesListExViewRef->MyCard();
       
   536 		}
       
   537 	
       
   538     MPbk2ContactUiControlExtension* extension = 
       
   539         CPbk2NameslistUiControlExtension::NewL( aContactManager, ContentProviderL(), mycard );
       
   540     return extension;
       
   541     }
       
   542 
       
   543 // --------------------------------------------------------------------------
       
   544 // CNamesListUIExtensionPlugin::CreatePbk2SettingsViewExtensionL
       
   545 // --------------------------------------------------------------------------
       
   546 //
       
   547 MPbk2SettingsViewExtension*
       
   548         CNamesListUIExtensionPlugin::CreatePbk2SettingsViewExtensionL()
       
   549     {
       
   550     // Do nothing
       
   551     return NULL;
       
   552     }
       
   553 
       
   554 // --------------------------------------------------------------------------
       
   555 // CNamesListUIExtensionPlugin::CreatePbk2AppUiExtensionL
       
   556 // --------------------------------------------------------------------------
       
   557 //
       
   558 MPbk2AppUiExtension* CNamesListUIExtensionPlugin::CreatePbk2AppUiExtensionL
       
   559         ( CVPbkContactManager& /*aContactManager*/ )
       
   560     {
       
   561     // Do nothing
       
   562     return NULL;
       
   563     }
       
   564 
       
   565 // --------------------------------------------------------------------------
       
   566 // CNamesListUIExtensionPlugin::CreatePbk2CommandForIdL
       
   567 // --------------------------------------------------------------------------
       
   568 //
       
   569 MPbk2Command* CNamesListUIExtensionPlugin::CreatePbk2CommandForIdL
       
   570         ( TInt aCommandId, MPbk2ContactUiControl& aUiControl ) const
       
   571     {
       
   572     MPbk2Command* result = NULL;
       
   573     
       
   574     switch( aCommandId ) 
       
   575         {
       
   576         case EPbk2CmdOpenCca:
       
   577             {
       
   578             result = CPbk2NlxOpenCcaCmd::NewL( 
       
   579                 aUiControl, 
       
   580                 const_cast<MCCAConnection*&>( iCCAConnection ) );
       
   581             break;            
       
   582             }
       
   583             
       
   584         case EPbk2CmdAddToTopContacts:
       
   585             {
       
   586             // Give the ETrue argument for aAddFavourites = EFalse.
       
   587             result = CPbk2NlxAddToTopContactsCmd::NewL( aUiControl, EFalse );
       
   588             break;
       
   589             }
       
   590         case EPbk2CmdAddFavourites:
       
   591             {
       
   592             // Give the ETrue argument for aAddFavourites = ETrue.
       
   593             result = CPbk2NlxAddToTopContactsCmd::NewL( aUiControl, ETrue );
       
   594             break;
       
   595             }
       
   596         case EPbk2CmdRemoveFromTopContacts: 
       
   597             {
       
   598             result = CPbk2NlxRemoveFromTopContactsCmd::NewL( aUiControl );
       
   599             break;
       
   600             }     
       
   601         case EPbk2CmdMoveInTopContactsList: 
       
   602             {
       
   603             result = CPbk2NlxMoveTopContactsCmd::NewL( aUiControl );
       
   604             break;
       
   605             }
       
   606         case EPbk2CmdOpenMyCard:    // fallthrough
       
   607         case EPbk2CmdSelectMyCard:
       
   608 			{
       
   609             result = CPbk2OpenMyCardCmd::NewL( 
       
   610                 const_cast<MCCAConnection*&>( iCCAConnection ),
       
   611                 &aUiControl );
       
   612 			break;
       
   613 			}
       
   614         case EPbk2CmdDeleteMyCard:
       
   615             {
       
   616             MVPbkContactLink* mylink = MyCardLink();
       
   617             if( mylink )
       
   618                 {
       
   619                 result = CPbk2DeleteMyCardCmd::NewL( aUiControl, *mylink );
       
   620                 }
       
   621             break;
       
   622             }
       
   623         default:
       
   624             break;                              
       
   625         }
       
   626         
       
   627     return result;
       
   628     }
       
   629 
       
   630 // --------------------------------------------------------------------------
       
   631 // CNamesListUIExtensionPlugin::CreatePbk2AiwInterestForIdL
       
   632 // --------------------------------------------------------------------------
       
   633 //
       
   634 MPbk2AiwInterestItem* CNamesListUIExtensionPlugin::CreatePbk2AiwInterestForIdL
       
   635         ( TInt /*aInterestId*/,
       
   636           CAiwServiceHandler& /*aServiceHandler*/ ) const
       
   637     {
       
   638     // Do nothing
       
   639     return NULL;
       
   640     }
       
   641 
       
   642 // --------------------------------------------------------------------------
       
   643 // CNamesListUIExtensionPlugin::GetHelpContextL
       
   644 // --------------------------------------------------------------------------
       
   645 //
       
   646 TBool CNamesListUIExtensionPlugin::GetHelpContextL
       
   647         ( TCoeHelpContext& /*aContext*/,  const CPbk2AppViewBase& /*aView*/,
       
   648           MPbk2ContactUiControl& /*aUiControl*/ )
       
   649     {
       
   650     return EFalse;
       
   651     }
       
   652 
       
   653 // --------------------------------------------------------------------------
       
   654 // CNamesListUIExtensionPlugin::ApplyDynamicViewGraphChangesL
       
   655 // --------------------------------------------------------------------------
       
   656 //
       
   657 void CNamesListUIExtensionPlugin::ApplyDynamicViewGraphChangesL(
       
   658         CPbk2ViewGraph& /*aViewGraph*/)
       
   659     {
       
   660     // Do nothing
       
   661     }
       
   662 
       
   663 // --------------------------------------------------------------------------
       
   664 // CNamesListUIExtensionPlugin::CmdOpenGroupL
       
   665 // --------------------------------------------------------------------------
       
   666 //
       
   667 void CNamesListUIExtensionPlugin::CmdOpenGroupL
       
   668         ( MPbk2ContactUiControl& /*aUiControl*/ ) const
       
   669     {
       
   670     // Do nothing
       
   671     }
       
   672 // --------------------------------------------------------------------------
       
   673 // CNamesListUIExtensionPlugin::ApplyDynamicPluginInformationDataL
       
   674 //
       
   675 // Allows extensions to add plugin information dynamically
       
   676 // during the application initialisation.
       
   677 //
       
   678 // The UI extension's start-up policy must be KPbk2LoadInStartup.
       
   679 // --------------------------------------------------------------------------
       
   680 //
       
   681 void CNamesListUIExtensionPlugin::ApplyDynamicPluginInformationDataL(
       
   682         CPbk2UIExtensionInformation& /* aUiExtensionInformation */ )
       
   683 	{
       
   684     // Do nothing	
       
   685 	}
       
   686 
       
   687 	MPbk2ContactEditorExtension* CNamesListUIExtensionPlugin::CreatePbk2ContactEditorExtensionL(
       
   688             CVPbkContactManager& /*aContactManager*/,
       
   689             MVPbkStoreContact& /*aContact*/,
       
   690             MPbk2ContactEditorControl& /*aEditorControl*/ )
       
   691     {
       
   692     return NULL;
       
   693     }                
       
   694                       
       
   695 MPbk2SettingsViewExtension* CNamesListUIExtensionPlugin::CreatePbk2SettingsViewExtensionL(
       
   696             CVPbkContactManager& /*aContactManager*/ )
       
   697     {
       
   698     return NULL;
       
   699     }                
       
   700 MPbk2AiwInterestItem* CNamesListUIExtensionPlugin::CreatePbk2AiwInterestForIdL(
       
   701             TInt /*aInterestId*/,
       
   702             CAiwServiceHandler& /*aServiceHandler*/ )
       
   703     {
       
   704     return NULL;
       
   705     }             	
       
   706 
       
   707 TAny* CNamesListUIExtensionPlugin::UIExtensionPluginExtension( TUid aExtensionUid )
       
   708     {
       
   709     TAny* ret = NULL;
       
   710     if (aExtensionUid == ImplementationUid())
       
   711         {
       
   712         ret = static_cast<MPbk2PluginCommandListerner*>( this );
       
   713         }    
       
   714     return ret;
       
   715     }
       
   716 
       
   717 void CNamesListUIExtensionPlugin::HandlePbk2Command( TInt aCommand )
       
   718     {
       
   719     switch( aCommand )
       
   720         {
       
   721         // If Pbk2 goes to the backgound, child applications are closed
       
   722         case EAknCmdHideInBackground:
       
   723             {
       
   724             // Close CCA if it is open
       
   725             if ( iCCAConnection )
       
   726                 {
       
   727                 iCCAConnection->Close();
       
   728                 iCCAConnection = NULL;
       
   729                 }
       
   730             }
       
   731             break;
       
   732         
       
   733         default:
       
   734             break;
       
   735         }
       
   736     }            
       
   737 	
       
   738 //  End of File