phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/CCCAppCommLauncherPbkCmd.cpp
branchRCL_3
changeset 20 f4a778e096c2
child 21 9da50d567e3c
equal deleted inserted replaced
19:5b6f26637ad3 20:f4a778e096c2
       
     1 /*
       
     2 * Copyright (c) 2008 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:  Phonebook2 command execution handler
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "CCCAppCommLauncherPbkCmd.h"
       
    20 #include "ccappcommlauncherplugin.h"
       
    21 
       
    22 #include <CPbk2ApplicationServices.h>
       
    23 #include <Pbk2DataCaging.hrh>
       
    24 #include <CPbk2CommandHandler.h>
       
    25 #include <CVPbkContactManager.h>
       
    26 #include <MVPbkContactLinkArray.h>
       
    27 #include <MVPbkContactStore.h>
       
    28 #include <MVPbkStoreContact.h>
       
    29 #include <MVPbkContactOperationBase.h>
       
    30 #include <MVPbkContactLink.h>
       
    31 #include <MPbk2Command.h>
       
    32 #include <Pbk2MenuFilteringFlags.hrh>
       
    33 #include <coemain.h>
       
    34 #include <aknnotewrappers.h>
       
    35 #include <StringLoader.h>
       
    36 
       
    37 _LIT(KPbk2CommandsDllResFileName,   "Pbk2Commands.rsc");
       
    38 _LIT(KPbk2UiControlsDllResFileName, "Pbk2UiControls.rsc");
       
    39 _LIT(KPbk2CommonUiDllResFileName,   "Pbk2CommonUi.rsc"  );
       
    40 
       
    41 /// Unnamed namespace for local definitions
       
    42 namespace
       
    43     {
       
    44     const TInt KNumberOfContacts = 1;
       
    45     } // namespace
       
    46 
       
    47 // ---------------------------------------------------------------------------
       
    48 // CCCAppCommLauncherPbkCmd::CCCAppCommLauncherPbkCmd
       
    49 // ---------------------------------------------------------------------------
       
    50 //
       
    51 CCCAppCommLauncherPbkCmd::CCCAppCommLauncherPbkCmd( CCCAppCommLauncherPlugin& aPlugin ):
       
    52     iCommandsResourceFile( *CCoeEnv::Static() ),
       
    53     iUiControlsResourceFile( *CCoeEnv::Static() ),
       
    54     iCommonUiResourceFile( *CCoeEnv::Static() ),
       
    55     iPlugin( aPlugin )
       
    56     {
       
    57     }
       
    58 
       
    59 
       
    60 // ---------------------------------------------------------------------------
       
    61 // CCCAppCommLauncherPbkCmd::ConstructL
       
    62 // ---------------------------------------------------------------------------
       
    63 //
       
    64 void CCCAppCommLauncherPbkCmd::ConstructL()
       
    65     {
       
    66     PreparePbk2ApplicationServicesL();
       
    67     iCommandHandler = CPbk2CommandHandler::NewL();
       
    68     iCommandHandler->AddMenuCommandObserver( *this );
       
    69     }
       
    70 
       
    71 
       
    72 // ---------------------------------------------------------------------------
       
    73 // CCCAppCommLauncherPbkCmd::NewL
       
    74 // ---------------------------------------------------------------------------
       
    75 //
       
    76 CCCAppCommLauncherPbkCmd* CCCAppCommLauncherPbkCmd::NewL( CCCAppCommLauncherPlugin& aPlugin )
       
    77     {
       
    78     CCCAppCommLauncherPbkCmd* self = CCCAppCommLauncherPbkCmd::NewLC( aPlugin );
       
    79     CleanupStack::Pop( self );
       
    80     return self;
       
    81     }
       
    82 
       
    83 
       
    84 // ---------------------------------------------------------------------------
       
    85 // CCCAppCommLauncherPbkCmd::NewLC
       
    86 // ---------------------------------------------------------------------------
       
    87 //
       
    88 CCCAppCommLauncherPbkCmd* CCCAppCommLauncherPbkCmd::NewLC( CCCAppCommLauncherPlugin& aPlugin )
       
    89     {
       
    90     CCCAppCommLauncherPbkCmd* self = new( ELeave ) CCCAppCommLauncherPbkCmd( aPlugin );
       
    91     CleanupStack::PushL( self );
       
    92     self->ConstructL();
       
    93     return self;
       
    94     }
       
    95 
       
    96 
       
    97 // ---------------------------------------------------------------------------
       
    98 // CCCAppCommLauncherPbkCmd::~CCCAppCommLauncherPbkCmd
       
    99 // ---------------------------------------------------------------------------
       
   100 //
       
   101 CCCAppCommLauncherPbkCmd::~CCCAppCommLauncherPbkCmd()
       
   102     {
       
   103     if ( iCommand )
       
   104         {
       
   105         iCommand->ResetUiControl( *this );
       
   106         }
       
   107 
       
   108     delete iStoreContact;
       
   109     if ( iCommandHandler )
       
   110         {
       
   111         iCommandHandler->RemoveMenuCommandObserver( *this );
       
   112         }
       
   113     delete iCommandHandler;
       
   114     delete iLinks;
       
   115     delete iOperation;
       
   116 
       
   117     // Close contact store
       
   118     if( iContactStore )
       
   119         {
       
   120         iContactStore->Close( *this );
       
   121         }
       
   122 
       
   123     Release( iAppServices );
       
   124 
       
   125     iCommandsResourceFile.Close();
       
   126     iUiControlsResourceFile.Close();
       
   127     iCommonUiResourceFile.Close();
       
   128     }
       
   129 
       
   130 // ---------------------------------------------------------------------------
       
   131 // CCCAppCommLauncherMenuHandler::PreparePbk2ApplicationServicesL
       
   132 // ---------------------------------------------------------------------------
       
   133 //
       
   134 void CCCAppCommLauncherPbkCmd::PreparePbk2ApplicationServicesL()
       
   135     {
       
   136     iCommandsResourceFile.OpenL(
       
   137         KPbk2RomFileDrive, KDC_RESOURCE_FILES_DIR, KPbk2CommandsDllResFileName );
       
   138     iUiControlsResourceFile.OpenL(
       
   139         KPbk2RomFileDrive, KDC_RESOURCE_FILES_DIR, KPbk2UiControlsDllResFileName );
       
   140     iCommonUiResourceFile.OpenL(
       
   141         KPbk2RomFileDrive, KDC_RESOURCE_FILES_DIR, KPbk2CommonUiDllResFileName );
       
   142 
       
   143     iAppServices = CPbk2ApplicationServices::InstanceL();
       
   144     };
       
   145 
       
   146 // ---------------------------------------------------------------------------
       
   147 // CCCAppCommLauncherMenuHandler::ExecutePbk2CmdAssignDefault
       
   148 // ---------------------------------------------------------------------------
       
   149 //
       
   150 void CCCAppCommLauncherPbkCmd::ExecutePbk2CmdAssignDefaultL( const TDesC8& aContact )
       
   151     {
       
   152     TCCAppCommandState& cmdState( iPlugin.CommandState() );
       
   153     if ( !cmdState.IsRunning() )
       
   154         {
       
   155         cmdState.SetRunningAndPushCleanupL();
       
   156         
       
   157         iPbk2CommandId = EPbk2CmdDefaultSettings;
       
   158     
       
   159         if( iLinks )
       
   160             {
       
   161             delete iLinks;
       
   162             iLinks = NULL;
       
   163             }
       
   164     
       
   165         iLinks = iAppServices->ContactManager().CreateLinksLC( aContact );
       
   166     
       
   167         if ( iLinks && iLinks->Count() > 0 )
       
   168             {
       
   169             // operation completes by StoreReady,
       
   170             //  StoreUnavailable or HandleStoreEventL
       
   171             (iLinks->At( 0 )).ContactStore().OpenL( *this );
       
   172             }
       
   173     
       
   174         CleanupStack::Pop( 1 ); // iLinks (deleted in destructor)
       
   175         cmdState.PopCleanup();
       
   176         }
       
   177     }
       
   178 
       
   179 // ---------------------------------------------------------------------------
       
   180 // CCCAppCommLauncherMenuHandler::ExecutePbk2CmdViewImageL
       
   181 // ---------------------------------------------------------------------------
       
   182 //
       
   183 void CCCAppCommLauncherPbkCmd::ExecutePbk2CmdViewImageL( const TDesC8& aContact )
       
   184     {
       
   185     TCCAppCommandState& cmdState( iPlugin.CommandState() );
       
   186     if ( !cmdState.IsRunning() )
       
   187         {
       
   188         cmdState.SetRunningAndPushCleanupL();
       
   189         
       
   190         iPbk2CommandId = EPbk2CmdViewImage;
       
   191     
       
   192         if( iLinks )
       
   193             {
       
   194             delete iLinks;
       
   195             iLinks = NULL;
       
   196             }
       
   197     
       
   198         iLinks = iAppServices->ContactManager().CreateLinksLC( aContact );
       
   199     
       
   200         if ( iLinks && iLinks->Count() > 0 )
       
   201             {
       
   202             // operation completes by StoreReady,
       
   203             //  StoreUnavailable or HandleStoreEventL
       
   204             (iLinks->At( 0 )).ContactStore().OpenL( *this );
       
   205             }
       
   206     
       
   207         CleanupStack::Pop( 1 ); // iLinks (deleted in destructor)
       
   208         cmdState.PopCleanup();
       
   209         }
       
   210     }
       
   211 
       
   212 // ---------------------------------------------------------------------------
       
   213 // CCCAppCommLauncherMenuHandler::ExecutePbk2CmdChangeImageL
       
   214 // ---------------------------------------------------------------------------
       
   215 //
       
   216 void CCCAppCommLauncherPbkCmd::ExecutePbk2CmdChangeImageL( const TDesC8& aContact )
       
   217     {
       
   218     TCCAppCommandState& cmdState( iPlugin.CommandState() );
       
   219     if ( !cmdState.IsRunning() )
       
   220         {
       
   221         cmdState.SetRunningAndPushCleanupL();
       
   222         
       
   223         iPbk2CommandId = EPbk2CmdChangeImage;
       
   224     
       
   225         if( iLinks )
       
   226             {
       
   227             delete iLinks;
       
   228             iLinks = NULL;
       
   229             }
       
   230     
       
   231         iLinks = iAppServices->ContactManager().CreateLinksLC( aContact );
       
   232     
       
   233         if ( iLinks && iLinks->Count() > 0 )
       
   234             {
       
   235             // operation completes by StoreReady,
       
   236             //  StoreUnavailable or HandleStoreEventL
       
   237             (iLinks->At( 0 )).ContactStore().OpenL( *this );
       
   238             }
       
   239     
       
   240         CleanupStack::Pop( 1 ); // iLinks (deleted in destructor)
       
   241         cmdState.PopCleanup();
       
   242         }
       
   243     }
       
   244 
       
   245 // ---------------------------------------------------------------------------
       
   246 // CCCAppCommLauncherMenuHandler::ExecutePbk2CmdRemoveImageL
       
   247 // ---------------------------------------------------------------------------
       
   248 //
       
   249 void CCCAppCommLauncherPbkCmd::ExecutePbk2CmdRemoveImageL( const TDesC8& aContact )
       
   250     {
       
   251     TCCAppCommandState& cmdState( iPlugin.CommandState() );
       
   252     if ( !cmdState.IsRunning() )
       
   253         {
       
   254         cmdState.SetRunningAndPushCleanupL();
       
   255         
       
   256         iPbk2CommandId = EPbk2CmdRemoveImage;
       
   257     
       
   258         if( iLinks )
       
   259             {
       
   260             delete iLinks;
       
   261             iLinks = NULL;
       
   262             }
       
   263     
       
   264         iLinks = iAppServices->ContactManager().CreateLinksLC( aContact );
       
   265     
       
   266         if ( iLinks && iLinks->Count() > 0 )
       
   267             {
       
   268             // operation completes by StoreReady,
       
   269             //  StoreUnavailable or HandleStoreEventL
       
   270             (iLinks->At( 0 )).ContactStore().OpenL( *this );
       
   271             }
       
   272     
       
   273         CleanupStack::Pop( 1 ); // iLinks (deleted in destructor)
       
   274         cmdState.PopCleanup();
       
   275         }
       
   276     }
       
   277 
       
   278 // ---------------------------------------------------------------------------
       
   279 // CCCAppCommLauncherMenuHandler::ExecutePbk2CmdAddImageL
       
   280 // ---------------------------------------------------------------------------
       
   281 //
       
   282 void CCCAppCommLauncherPbkCmd::ExecutePbk2CmdAddImageL( const TDesC8& aContact )
       
   283     {
       
   284     TCCAppCommandState& cmdState( iPlugin.CommandState() );
       
   285     if ( !cmdState.IsRunning() )
       
   286         {
       
   287         cmdState.SetRunningAndPushCleanupL();
       
   288         
       
   289         iPbk2CommandId = EPbk2CmdAddImage;
       
   290     
       
   291         if( iLinks )
       
   292             {
       
   293             delete iLinks;
       
   294             iLinks = NULL;
       
   295             }
       
   296     
       
   297         iLinks = iAppServices->ContactManager().CreateLinksLC( aContact );
       
   298     
       
   299         if ( iLinks && iLinks->Count() > 0 )
       
   300             {
       
   301             // operation completes by StoreReady,
       
   302             //  StoreUnavailable or HandleStoreEventL
       
   303             (iLinks->At( 0 )).ContactStore().OpenL( *this );
       
   304             }
       
   305     
       
   306         CleanupStack::Pop( 1 ); // iLinks (deleted in destructor)
       
   307         cmdState.PopCleanup();
       
   308         }
       
   309     }
       
   310 
       
   311 // ---------------------------------------------------------------------------
       
   312 // CCCAppCommLauncherMenuHandler::ExecutePbk2CmdShowOnMapL
       
   313 // ---------------------------------------------------------------------------
       
   314 //
       
   315 void CCCAppCommLauncherPbkCmd::ExecutePbk2CmdShowMapL( const HBufC8* aContact,
       
   316 		TPbk2CommandId aCommandId )
       
   317     {
       
   318     TCCAppCommandState& cmdState( iPlugin.CommandState() );
       
   319     if ( !cmdState.IsRunning() )
       
   320         {
       
   321         cmdState.SetRunningAndPushCleanupL();
       
   322         
       
   323         iPbk2CommandId = aCommandId;
       
   324         
       
   325         if( iLinks )
       
   326             {
       
   327             delete iLinks;
       
   328             iLinks = NULL;
       
   329             }
       
   330         
       
   331         iLinks = iAppServices->ContactManager().CreateLinksLC( *aContact );   
       
   332         
       
   333         if ( iLinks->Count() > 0 )
       
   334             {       
       
   335             // operation completes by StoreReady,
       
   336             //  StoreUnavailable or HandleStoreEventL
       
   337             (iLinks->At( 0 )).ContactStore().OpenL( *this );
       
   338             }
       
   339         
       
   340         CleanupStack::Pop( 1 ); // iLinks (deleted in destructor)
       
   341         cmdState.PopCleanup();
       
   342         }
       
   343     }
       
   344 
       
   345 // ---------------------------------------------------------------------------
       
   346 // CCCAppCommLauncherMenuHandler::ExecutePbk2CmdDeleteL
       
   347 // ---------------------------------------------------------------------------
       
   348 //
       
   349 void CCCAppCommLauncherPbkCmd::ExecutePbk2CmdDeleteL( const TDesC8& aContact )
       
   350     {
       
   351     TCCAppCommandState& cmdState( iPlugin.CommandState() );
       
   352     if ( !cmdState.IsRunning() )
       
   353         {
       
   354         cmdState.SetRunningAndPushCleanupL();
       
   355         
       
   356         iPbk2CommandId = EPbk2CmdDeleteMe;
       
   357         
       
   358         if( iLinks )
       
   359             {
       
   360             delete iLinks;
       
   361             iLinks = NULL;
       
   362             }
       
   363         
       
   364         iLinks = iAppServices->ContactManager().CreateLinksLC( aContact );   
       
   365         
       
   366         if ( iLinks->Count() > 0 )
       
   367             {       
       
   368             // operation completes by StoreReady,
       
   369             //  StoreUnavailable or HandleStoreEventL
       
   370             ( iLinks->At( 0 ) ).ContactStore().OpenL( *this );
       
   371             }
       
   372         
       
   373         CleanupStack::Pop( 1 ); // iLinks (deleted in destructor)
       
   374         cmdState.PopCleanup();
       
   375         }
       
   376     }
       
   377 
       
   378 // ---------------------------------------------------------------------------
       
   379 // CCCAppCommLauncherMenuHandler::HandleError
       
   380 // ---------------------------------------------------------------------------
       
   381 //
       
   382 void CCCAppCommLauncherPbkCmd::HandleError( TInt aError )
       
   383     {
       
   384     iPlugin.CommandState().SetNotRunning();
       
   385     
       
   386     if( KErrNotSupported == aError && 
       
   387         (TPbk2CommandId)EPbk2ExtensionShowOnMap == iPbk2CommandId )
       
   388         {
       
   389         // Show maps specifix error note
       
   390         HBufC* prompt = StringLoader::LoadLC( R_QTN_CCA_ERROR_NOTE_MAPS_NOT_FOUND );
       
   391         CAknErrorNote* note = new ( ELeave ) CAknErrorNote( ETrue );
       
   392         note->ExecuteLD( *prompt );
       
   393         CleanupStack::PopAndDestroy( prompt );        
       
   394         }
       
   395     else
       
   396         {
       
   397         CCoeEnv::Static()->HandleError( aError );
       
   398         }
       
   399     }
       
   400 // ---------------------------------------------------------------------------
       
   401 // CCCAppCommLauncherPbkCmd::StoreReady
       
   402 // ---------------------------------------------------------------------------
       
   403 //
       
   404 void CCCAppCommLauncherPbkCmd::StoreReady(
       
   405     MVPbkContactStore& aContactStore )
       
   406     {
       
   407     iContactStore = &aContactStore;
       
   408     
       
   409     // operation completes by VPbkSingleContactOperationComplete
       
   410     //   or VPbkSingleContactOperationFailed
       
   411     if( iOperation  )
       
   412         {
       
   413         delete iOperation;
       
   414         iOperation = NULL;
       
   415         }
       
   416 
       
   417     TRAPD( err,iOperation = iAppServices->ContactManager().RetrieveContactL( iLinks->At( 0 ), *this ) ;)
       
   418     if( err != KErrNone )
       
   419         {
       
   420         HandleError( err );
       
   421         }
       
   422     }
       
   423 
       
   424 // ---------------------------------------------------------------------------
       
   425 // CCCAppCommLauncherPbkCmd::StoreUnavailable
       
   426 // ---------------------------------------------------------------------------
       
   427 //
       
   428 void CCCAppCommLauncherPbkCmd::StoreUnavailable(
       
   429     MVPbkContactStore& /*aContactStore*/,
       
   430     TInt /*aReason*/)
       
   431     {
       
   432     iPlugin.CommandState().SetNotRunning();
       
   433     }
       
   434 
       
   435 // ---------------------------------------------------------------------------
       
   436 // CCCAppCommLauncherPbkCmd::HandleStoreEventL
       
   437 // ---------------------------------------------------------------------------
       
   438 //
       
   439 void CCCAppCommLauncherPbkCmd::HandleStoreEventL(
       
   440     MVPbkContactStore& /*aContactStore*/,
       
   441     TVPbkContactStoreEvent /*aStoreEvent*/)
       
   442     {
       
   443     }
       
   444 
       
   445 // ---------------------------------------------------------------------------
       
   446 // CCCAppCommLauncherPbkCmd::VPbkSingleContactOperationComplete
       
   447 // ---------------------------------------------------------------------------
       
   448 //
       
   449 void CCCAppCommLauncherPbkCmd::VPbkSingleContactOperationComplete(
       
   450         MVPbkContactOperationBase& /*aOperation*/,
       
   451         MVPbkStoreContact* aContact )
       
   452     {
       
   453     delete iStoreContact;
       
   454     iStoreContact = aContact;
       
   455 
       
   456     TRAPD(err, iCommandHandler->HandleCommandL(
       
   457             iPbk2CommandId, *this, NULL );)
       
   458     if( err != KErrNone )
       
   459         {
       
   460         HandleError( err );
       
   461         }
       
   462     }
       
   463 
       
   464 // ---------------------------------------------------------------------------
       
   465 // CCCAppCommLauncherPbkCmd::VPbkSingleContactOperationFailed
       
   466 // ---------------------------------------------------------------------------
       
   467 //
       
   468 void CCCAppCommLauncherPbkCmd::VPbkSingleContactOperationFailed(
       
   469         MVPbkContactOperationBase& /*aOperation*/,
       
   470         TInt /*aError*/ )
       
   471     {
       
   472     iPlugin.CommandState().SetNotRunning();
       
   473     }
       
   474 
       
   475 // --------------------------------------------------------------------------
       
   476 // CCCAppCommLauncherPbkCmd::ParentControl
       
   477 // --------------------------------------------------------------------------
       
   478 //
       
   479 MPbk2ContactUiControl* CCCAppCommLauncherPbkCmd::ParentControl() const
       
   480 {
       
   481     // Contact info control has no parent control
       
   482     return NULL;
       
   483 }
       
   484 
       
   485 // --------------------------------------------------------------------------
       
   486 // CCCAppCommLauncherPbkCmd::NumberOfContacts
       
   487 // --------------------------------------------------------------------------
       
   488 //
       
   489 TInt CCCAppCommLauncherPbkCmd::NumberOfContacts() const
       
   490 {
       
   491     return KNumberOfContacts;
       
   492 }
       
   493 
       
   494 // --------------------------------------------------------------------------
       
   495 // CCCAppCommLauncherPbkCmd::FocusedContactL
       
   496 // --------------------------------------------------------------------------
       
   497 //
       
   498 const MVPbkBaseContact* CCCAppCommLauncherPbkCmd::FocusedContactL() const
       
   499 {
       
   500     return STATIC_CAST(MVPbkBaseContact*, iStoreContact);
       
   501 }
       
   502 
       
   503 // --------------------------------------------------------------------------
       
   504 // CCCAppCommLauncherPbkCmd::FocusedViewContactL
       
   505 // --------------------------------------------------------------------------
       
   506 //
       
   507 const MVPbkViewContact* CCCAppCommLauncherPbkCmd::FocusedViewContactL() const
       
   508 {
       
   509     return NULL;
       
   510 }
       
   511 
       
   512 // --------------------------------------------------------------------------
       
   513 // CCCAppCommLauncherPbkCmd::FocusedStoreContact
       
   514 // --------------------------------------------------------------------------
       
   515 //
       
   516 const MVPbkStoreContact* CCCAppCommLauncherPbkCmd::FocusedStoreContact() const
       
   517 {
       
   518     return iStoreContact;
       
   519 }
       
   520 
       
   521 // --------------------------------------------------------------------------
       
   522 // CCCAppCommLauncherPbkCmd::SetFocusedContactL
       
   523 // --------------------------------------------------------------------------
       
   524 //
       
   525 void CCCAppCommLauncherPbkCmd::SetFocusedContactL(
       
   526     const MVPbkBaseContact& aContact)
       
   527 {
       
   528     if (!iStoreContact->IsSame(aContact))
       
   529         {
       
   530         MVPbkContactLink* link = aContact.CreateLinkLC();
       
   531         HBufC8* packed = link->PackLC();
       
   532     
       
   533         // Update the CCA parameter contact data
       
   534         HBufC16* link16 = HBufC16::NewLC(packed->Length());
       
   535         link16->Des().Copy(packed->Des());
       
   536         iPlugin.AppEngine()->Parameter().SetContactDataL(link16->Des());
       
   537         iPlugin.AppEngine()->CCAppContactEventL();
       
   538         CleanupStack::PopAndDestroy(3); // link16, packed, link
       
   539     
       
   540         // Update the commlauncher the UI contact data
       
   541         iPlugin.ContactHandler().RefetchContactL();
       
   542         iPlugin.Container().ContactsChangedL();    
       
   543         }
       
   544 }
       
   545 
       
   546 // --------------------------------------------------------------------------
       
   547 // CCCAppCommLauncherPbkCmd::SetFocusedContactL
       
   548 // --------------------------------------------------------------------------
       
   549 //
       
   550 void CCCAppCommLauncherPbkCmd::SetFocusedContactL(
       
   551     const MVPbkContactBookmark& /*aContactBookmark*/)
       
   552 {
       
   553     // Do nothing
       
   554 }
       
   555 
       
   556 // --------------------------------------------------------------------------
       
   557 // CCCAppCommLauncherPbkCmd::SetFocusedContactL
       
   558 // --------------------------------------------------------------------------
       
   559 //
       
   560 void CCCAppCommLauncherPbkCmd::SetFocusedContactL(
       
   561     const MVPbkContactLink& /*aContactLink*/)
       
   562 {
       
   563     // Do nothing
       
   564 }
       
   565 
       
   566 // --------------------------------------------------------------------------
       
   567 // CCCAppCommLauncherPbkCmd::FocusedContactIndex
       
   568 // --------------------------------------------------------------------------
       
   569 //
       
   570 TInt CCCAppCommLauncherPbkCmd::FocusedContactIndex() const
       
   571 {
       
   572     return KErrNotFound;
       
   573 }
       
   574 
       
   575 // --------------------------------------------------------------------------
       
   576 // CCCAppCommLauncherPbkCmd::SetFocusedContactIndexL
       
   577 // --------------------------------------------------------------------------
       
   578 //
       
   579 void CCCAppCommLauncherPbkCmd::SetFocusedContactIndexL(TInt /*aIndex*/)
       
   580 {
       
   581     // Do nothing
       
   582 }
       
   583 
       
   584 // --------------------------------------------------------------------------
       
   585 // CCCAppCommLauncherPbkCmd::NumberOfContactFields
       
   586 // --------------------------------------------------------------------------
       
   587 //
       
   588 TInt CCCAppCommLauncherPbkCmd::NumberOfContactFields() const
       
   589 {
       
   590     TInt cnt = KErrNotSupported;
       
   591     return cnt;
       
   592 }
       
   593 
       
   594 // --------------------------------------------------------------------------
       
   595 // CCCAppCommLauncherPbkCmd::FocusedField
       
   596 // --------------------------------------------------------------------------
       
   597 //
       
   598 const MVPbkBaseContactField* CCCAppCommLauncherPbkCmd::FocusedField() const
       
   599 {
       
   600     return NULL;
       
   601 }
       
   602 
       
   603 // --------------------------------------------------------------------------
       
   604 // CCCAppCommLauncherPbkCmd::FocusedFieldIndex
       
   605 // --------------------------------------------------------------------------
       
   606 //
       
   607 TInt CCCAppCommLauncherPbkCmd::FocusedFieldIndex() const
       
   608 {
       
   609     return 0;
       
   610 }
       
   611 
       
   612 // --------------------------------------------------------------------------
       
   613 // CCCAppCommLauncherPbkCmd::SetFocusedFieldIndex
       
   614 // --------------------------------------------------------------------------
       
   615 //
       
   616 void CCCAppCommLauncherPbkCmd::SetFocusedFieldIndex(TInt /*aIndex*/)
       
   617 {
       
   618     // Do nothing
       
   619 }
       
   620 
       
   621 // --------------------------------------------------------------------------
       
   622 // CCCAppCommLauncherPbkCmd::ContactsMarked
       
   623 // --------------------------------------------------------------------------
       
   624 //
       
   625 TBool CCCAppCommLauncherPbkCmd::ContactsMarked() const
       
   626 {
       
   627     // This control does not support contacts marking
       
   628     return EFalse;
       
   629 }
       
   630 
       
   631 // --------------------------------------------------------------------------
       
   632 // CCCAppCommLauncherPbkCmd::SelectedContactsL
       
   633 // --------------------------------------------------------------------------
       
   634 //
       
   635 MVPbkContactLinkArray* CCCAppCommLauncherPbkCmd::SelectedContactsL() const
       
   636 {
       
   637     // No selection support in contact info control
       
   638     return NULL;
       
   639 }
       
   640 
       
   641 // --------------------------------------------------------------------------
       
   642 // CCCAppCommLauncherPbkCmd::SelectedContactsOrFocusedContactL
       
   643 // --------------------------------------------------------------------------
       
   644 //
       
   645 MVPbkContactLinkArray*
       
   646 CCCAppCommLauncherPbkCmd::SelectedContactsOrFocusedContactL() const
       
   647 {
       
   648     CVPbkContactLinkArray* array = CVPbkContactLinkArray::NewLC();
       
   649 
       
   650     if ( iStoreContact )
       
   651     {
       
   652         MVPbkContactLink* link = iStoreContact->CreateLinkLC();
       
   653         array->AppendL(link);
       
   654         CleanupStack::Pop(); // link
       
   655     }
       
   656     CleanupStack::Pop(); // array
       
   657 
       
   658     return array;
       
   659 }
       
   660 
       
   661 // --------------------------------------------------------------------------
       
   662 // CCCAppCommLauncherPbkCmd::SelectedContactsIteratorL
       
   663 // --------------------------------------------------------------------------
       
   664 //
       
   665 MPbk2ContactLinkIterator*
       
   666 CCCAppCommLauncherPbkCmd::SelectedContactsIteratorL() const
       
   667 {
       
   668     // No selection support in contact info control
       
   669     return NULL;
       
   670 }
       
   671 
       
   672 // --------------------------------------------------------------------------
       
   673 // CCCAppCommLauncherPbkCmd::SelectedContactStoresL
       
   674 // --------------------------------------------------------------------------
       
   675 //
       
   676 CArrayPtr<MVPbkContactStore>*
       
   677 CCCAppCommLauncherPbkCmd::SelectedContactStoresL() const
       
   678 {
       
   679     // This is not a contact store control
       
   680     return NULL;
       
   681 }
       
   682 
       
   683 // --------------------------------------------------------------------------
       
   684 // CCCAppCommLauncherPbkCmd::ClearMarks
       
   685 // --------------------------------------------------------------------------
       
   686 //
       
   687 void CCCAppCommLauncherPbkCmd::ClearMarks()
       
   688 {
       
   689     // Do nothing
       
   690 }
       
   691 
       
   692 // --------------------------------------------------------------------------
       
   693 // CCCAppCommLauncherPbkCmd::SetSelectedContactL
       
   694 // --------------------------------------------------------------------------
       
   695 //
       
   696 void CCCAppCommLauncherPbkCmd::SetSelectedContactL(
       
   697     TInt /*aIndex*/,
       
   698     TBool /*aSelected*/)
       
   699 {
       
   700     // Not supported in Contact Info
       
   701 }
       
   702 
       
   703 // --------------------------------------------------------------------------
       
   704 // CCCAppCommLauncherPbkCmd::SetSelectedContactL
       
   705 // --------------------------------------------------------------------------
       
   706 //
       
   707 void CCCAppCommLauncherPbkCmd::SetSelectedContactL(
       
   708     const MVPbkContactBookmark& /*aContactBookmark*/,
       
   709     TBool /*aSelected*/)
       
   710 {
       
   711     // Not supported
       
   712 }
       
   713 
       
   714 // --------------------------------------------------------------------------
       
   715 // CCCAppCommLauncherPbkCmd::SetSelectedContactL
       
   716 // --------------------------------------------------------------------------
       
   717 //
       
   718 void CCCAppCommLauncherPbkCmd::SetSelectedContactL(
       
   719     const MVPbkContactLink& /*aContactLink*/,
       
   720     TBool /*aSelected*/)
       
   721 {
       
   722     // Not supported
       
   723 }
       
   724 
       
   725 
       
   726 
       
   727 // --------------------------------------------------------------------------
       
   728 // CCCAppCommLauncherPbkCmd::DynInitMenuPaneL
       
   729 // --------------------------------------------------------------------------
       
   730 //
       
   731 void CCCAppCommLauncherPbkCmd::DynInitMenuPaneL(
       
   732     TInt /*aResourceId*/,
       
   733     CEikMenuPane* /*aMenuPane*/) const
       
   734 {
       
   735     // Nothing to do
       
   736 }
       
   737 
       
   738 // --------------------------------------------------------------------------
       
   739 // CCCAppCommLauncherPbkCmd::ProcessCommandL
       
   740 // --------------------------------------------------------------------------
       
   741 //
       
   742 void CCCAppCommLauncherPbkCmd::ProcessCommandL(TInt /*aCommandId*/) const
       
   743 {
       
   744     // Nothing to do
       
   745 }
       
   746 
       
   747 // --------------------------------------------------------------------------
       
   748 // CCCAppCommLauncherPbkCmd::UpdateAfterCommandExecution
       
   749 // --------------------------------------------------------------------------
       
   750 //
       
   751 void CCCAppCommLauncherPbkCmd::UpdateAfterCommandExecution()
       
   752 {
       
   753     if( iCommand )
       
   754     {
       
   755         /// Reset command pointer, command has completed
       
   756         iCommand->ResetUiControl(*this);
       
   757         iCommand = NULL;
       
   758     }
       
   759 }
       
   760 
       
   761 // --------------------------------------------------------------------------
       
   762 // CCCAppCommLauncherPbkCmd::GetMenuFilteringFlagsL
       
   763 // --------------------------------------------------------------------------
       
   764 //
       
   765 TInt CCCAppCommLauncherPbkCmd::GetMenuFilteringFlagsL() const
       
   766 {
       
   767     TInt ret = KPbk2MenuFilteringFlagsNone;
       
   768     return ret;
       
   769 }
       
   770 
       
   771 // --------------------------------------------------------------------------
       
   772 // CCCAppCommLauncherPbkCmd::ControlStateL
       
   773 // --------------------------------------------------------------------------
       
   774 //
       
   775 CPbk2ViewState* CCCAppCommLauncherPbkCmd::ControlStateL() const
       
   776 {
       
   777     return NULL;
       
   778 }
       
   779 
       
   780 // --------------------------------------------------------------------------
       
   781 // CCCAppCommLauncherPbkCmd::RestoreControlStateL
       
   782 // --------------------------------------------------------------------------
       
   783 //
       
   784 void CCCAppCommLauncherPbkCmd::RestoreControlStateL(
       
   785     CPbk2ViewState* /*aState*/)
       
   786 {
       
   787     // Do nothing
       
   788 }
       
   789 
       
   790 // --------------------------------------------------------------------------
       
   791 // CCCAppCommLauncherPbkCmd::FindTextL
       
   792 // --------------------------------------------------------------------------
       
   793 //
       
   794 const TDesC& CCCAppCommLauncherPbkCmd::FindTextL()
       
   795 {
       
   796     // No find box in this control
       
   797     return KNullDesC;
       
   798 }
       
   799 
       
   800 // --------------------------------------------------------------------------
       
   801 // CCCAppCommLauncherPbkCmd::ResetFindL
       
   802 // --------------------------------------------------------------------------
       
   803 //
       
   804 void CCCAppCommLauncherPbkCmd::ResetFindL()
       
   805 {
       
   806     // Do nothing
       
   807 }
       
   808 
       
   809 // --------------------------------------------------------------------------
       
   810 // CCCAppCommLauncherPbkCmd::ShowThumbnail
       
   811 // --------------------------------------------------------------------------
       
   812 //
       
   813 void CCCAppCommLauncherPbkCmd::ShowThumbnail()
       
   814 {
       
   815     // Do nothing
       
   816 }
       
   817 
       
   818 // --------------------------------------------------------------------------
       
   819 // CCCAppCommLauncherPbkCmd::HideThumbnail
       
   820 // --------------------------------------------------------------------------
       
   821 //
       
   822 void CCCAppCommLauncherPbkCmd::HideThumbnail()
       
   823 {
       
   824     // Do nothing
       
   825 }
       
   826 
       
   827 // --------------------------------------------------------------------------
       
   828 // CCCAppCommLauncherPbkCmd::SetBlank
       
   829 // --------------------------------------------------------------------------
       
   830 //
       
   831 void CCCAppCommLauncherPbkCmd::SetBlank(TBool /*aBlank*/)
       
   832 {
       
   833     // This control does not support blanking
       
   834 }
       
   835 
       
   836 // --------------------------------------------------------------------------
       
   837 // CCCAppCommLauncherPbkCmd::RegisterCommand
       
   838 // --------------------------------------------------------------------------
       
   839 //
       
   840 void CCCAppCommLauncherPbkCmd::RegisterCommand(MPbk2Command* aCommand)
       
   841 {
       
   842     iCommand = aCommand;
       
   843 }
       
   844 
       
   845 // --------------------------------------------------------------------------
       
   846 // CCCAppCommLauncherPbkCmd::SetTextL
       
   847 // --------------------------------------------------------------------------
       
   848 //
       
   849 void CCCAppCommLauncherPbkCmd::SetTextL(const TDesC& /*aText*/)
       
   850 {
       
   851     // Do nothing
       
   852 }
       
   853 
       
   854 // --------------------------------------------------------------------------
       
   855 // CCCAppCommLauncherPbkCmd::ContactUiControlExtension
       
   856 // --------------------------------------------------------------------------
       
   857 //
       
   858 TAny* CCCAppCommLauncherPbkCmd::ContactUiControlExtension(TUid aExtensionUid )
       
   859 	{
       
   860      if( aExtensionUid == KMPbk2ContactUiControlExtension2Uid )
       
   861         {
       
   862 		return static_cast<MPbk2ContactUiControl2*>( this );
       
   863 		}
       
   864 
       
   865     return NULL;
       
   866     }
       
   867 
       
   868 // --------------------------------------------------------------------------
       
   869 // CCCAppCommLauncherPbkCmd::CommandItemCount
       
   870 // --------------------------------------------------------------------------
       
   871 //
       
   872 TInt CCCAppCommLauncherPbkCmd::CommandItemCount() const
       
   873 {
       
   874     return 0; // No command items.
       
   875 }
       
   876 
       
   877 // --------------------------------------------------------------------------
       
   878 // CCCAppCommLauncherPbkCmd::CommandItemAt
       
   879 // --------------------------------------------------------------------------
       
   880 //
       
   881 const MPbk2UiControlCmdItem& CCCAppCommLauncherPbkCmd::CommandItemAt(
       
   882     TInt /*aIndex*/) const
       
   883 {
       
   884     // There are no command items in this control
       
   885     __ASSERT_ALWAYS(EFalse, User::Panic(_L("Pbk2"), 4));
       
   886     MPbk2UiControlCmdItem* item = NULL; // For compiler only
       
   887     return *item; // For compiler only
       
   888 }
       
   889 
       
   890 // --------------------------------------------------------------------------
       
   891 // CCCAppCommLauncherPbkCmd::FocusedCommandItem
       
   892 // --------------------------------------------------------------------------
       
   893 //
       
   894 const MPbk2UiControlCmdItem* CCCAppCommLauncherPbkCmd::FocusedCommandItem() const
       
   895 {
       
   896     return NULL;
       
   897 }
       
   898 
       
   899 // --------------------------------------------------------------------------
       
   900 // CCCAppCommLauncherPbkCmd::DeleteCommandItemL
       
   901 // --------------------------------------------------------------------------
       
   902 //
       
   903 void CCCAppCommLauncherPbkCmd::DeleteCommandItemL(TInt /*aIndex*/)
       
   904 {
       
   905     // Do nothing
       
   906 }
       
   907 
       
   908 // --------------------------------------------------------------------------
       
   909 // CCCAppCommLauncherPbkCmd::AddCommandItemL
       
   910 // --------------------------------------------------------------------------
       
   911 //
       
   912 void CCCAppCommLauncherPbkCmd::AddCommandItemL(
       
   913     MPbk2UiControlCmdItem* /*aCommand*/, TInt /*aIndex*/)
       
   914 {
       
   915     //Do nothing, since there shouldn't be any command items in this state.
       
   916 }
       
   917 
       
   918 // --------------------------------------------------------------------------
       
   919 // CCCAppCommLauncherPbkCmd::PostCommandExecutionL
       
   920 // --------------------------------------------------------------------------
       
   921 //
       
   922 void CCCAppCommLauncherPbkCmd::PostCommandExecutionL( 
       
   923         const MPbk2Command& /*aCommand*/ )
       
   924     {
       
   925     // Async Pbk2 command has been executed. The state must be set back to
       
   926     // not running.
       
   927     iPlugin.CommandState().SetNotRunning();
       
   928     }
       
   929 
       
   930 // --------------------------------------------------------------------------
       
   931 // CCCAppCommLauncherPbkCmd::IsPbk2CommandRunning
       
   932 // --------------------------------------------------------------------------
       
   933 //
       
   934 TBool CCCAppCommLauncherPbkCmd::IsPbk2CommandRunning()
       
   935     {
       
   936     return iPlugin.CommandState().IsRunning();
       
   937     }
       
   938 
       
   939 // --------------------------------------------------------------------------
       
   940 // CCCAppCommLauncherPbkCmd::ApplicationServices
       
   941 // --------------------------------------------------------------------------
       
   942 //
       
   943 CPbk2ApplicationServices& CCCAppCommLauncherPbkCmd::ApplicationServices() const
       
   944     {
       
   945     return *iAppServices;
       
   946     }