phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlaunchermenuhandler.cpp
changeset 0 e686773b3f54
child 3 04ab22b956c2
equal deleted inserted replaced
-1:000000000000 0:e686773b3f54
       
     1 /*
       
     2 * Copyright (c) 2007-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:  Implementation of ccappcommlauncher menuhandler
       
    15 *
       
    16 */
       
    17 
       
    18 #include "ccappcommlauncherheaders.h"
       
    19 
       
    20 #include <mccacontactobserver.h>
       
    21 #include <mccappengine.h>
       
    22 
       
    23 using namespace AiwContactAssign;
       
    24 
       
    25 // ======== MEMBER FUNCTIONS ========
       
    26 
       
    27 // ---------------------------------------------------------------------------
       
    28 // CCCAppCommLauncherMenuHandler::NewL
       
    29 // ---------------------------------------------------------------------------
       
    30 //
       
    31 CCCAppCommLauncherMenuHandler* CCCAppCommLauncherMenuHandler::NewL(
       
    32     CCCAppCommLauncherPlugin& aPlugin )
       
    33     {
       
    34     CCA_DP(KCommLauncherLogFile, CCA_L("->CCCAppCommLauncherMenuHandler::NewL()"));
       
    35     CCCAppCommLauncherMenuHandler* self = new ( ELeave ) CCCAppCommLauncherMenuHandler( aPlugin );
       
    36     CleanupStack::PushL( self );
       
    37     self->ConstructL();
       
    38     CleanupStack::Pop( self );
       
    39     CCA_DP(KCommLauncherLogFile, CCA_L("<-CCCAppCommLauncherMenuHandler::NewL()"));
       
    40     return self;
       
    41     }
       
    42 
       
    43 // ---------------------------------------------------------------------------
       
    44 // CCCAppCommLauncherMenuHandler::~CCCAppCommLauncherMenuHandler
       
    45 // ---------------------------------------------------------------------------
       
    46 //
       
    47 CCCAppCommLauncherMenuHandler::~CCCAppCommLauncherMenuHandler()
       
    48     {
       
    49     CCA_DP(KCommLauncherLogFile, CCA_L("~CCCAppCommLauncherMenuHandler()"));
       
    50     // iView is deleted through the alfdisplay
       
    51     delete iPbkCmd;
       
    52     delete iAiwServiceHandler;
       
    53     delete iInputBlock;
       
    54     }
       
    55 
       
    56 // ---------------------------------------------------------------------------
       
    57 // CCCAppCommLauncherMenuHandler::CCCAppCommLauncherMenuHandler()
       
    58 // ---------------------------------------------------------------------------
       
    59 //
       
    60 CCCAppCommLauncherMenuHandler::CCCAppCommLauncherMenuHandler(
       
    61     CCCAppCommLauncherPlugin& aPlugin ) :
       
    62         iPlugin( aPlugin ),iInputBlock( NULL )
       
    63     {
       
    64     CCA_DP(KCommLauncherLogFile, CCA_L("CCCAppCommLauncherMenuHandler()"));
       
    65     }
       
    66 
       
    67 // ---------------------------------------------------------------------------
       
    68 // CCCAppCommLauncherMenuHandler::ConstructL
       
    69 // ---------------------------------------------------------------------------
       
    70 //
       
    71 void CCCAppCommLauncherMenuHandler::ConstructL()
       
    72     {
       
    73     CCA_DP(KCommLauncherLogFile, CCA_L("CCCAppCommLauncherMenuHandler::ConstructL()"));
       
    74     PrepareAiwMenusL();
       
    75     }
       
    76 
       
    77 // ---------------------------------------------------------------------------
       
    78 // CCCAppCommLauncherMenuHandler::PrepareAiwMenusL
       
    79 // ---------------------------------------------------------------------------
       
    80 //
       
    81 void CCCAppCommLauncherMenuHandler::PrepareAiwMenusL()
       
    82     {
       
    83     CCA_DP(KCommLauncherLogFile, CCA_L("->CCCAppCommLauncherMenuHandler::PrepareAiwMenusL()"));
       
    84 
       
    85     // Initialisation of AIW Servicehandler cannot be in
       
    86     // ConstructL, since the menus of plugin are given
       
    87     // later via ProvideApplicationResourcesL(..)
       
    88     iAiwServiceHandler = CAiwServiceHandler::NewL();
       
    89     iAiwServiceHandler->AttachL(
       
    90         R_CCACOMMLAUNCHER_AIW_SERVICE_INTERESTS );
       
    91     iAiwServiceHandler->AttachMenuL(
       
    92         R_CCACOMMLAUNCHER_MENUPANE,
       
    93         R_CCACOMMLAUNCHER_AIW_MENU_INTERESTS );
       
    94 
       
    95     CCA_DP(KCommLauncherLogFile, CCA_L("<-CCCAppCommLauncherMenuHandler::PrepareAiwMenusL()"));
       
    96     }
       
    97 
       
    98 // ---------------------------------------------------------------------------
       
    99 // CCCAppCommLauncherMenuHandler::AknInputBlockCancel
       
   100 // ---------------------------------------------------------------------------
       
   101 //
       
   102 void CCCAppCommLauncherMenuHandler::AknInputBlockCancel()
       
   103     {
       
   104     iInputBlock = NULL;
       
   105     }
       
   106 
       
   107 // ---------------------------------------------------------------------------
       
   108 // CCCAppCommLauncherMenuHandler::StopInputBlock
       
   109 // ---------------------------------------------------------------------------
       
   110 //
       
   111 void CCCAppCommLauncherMenuHandler::StopInputBlock()
       
   112     {
       
   113     // stop user input blocker
       
   114     if( iInputBlock )
       
   115         {
       
   116         iInputBlock->Cancel();
       
   117         }
       
   118     }
       
   119 
       
   120 // ---------------------------------------------------------------------------
       
   121 // CCCAppCommLauncherMenuHandler::SetContactStore
       
   122 // ---------------------------------------------------------------------------
       
   123 //
       
   124 void CCCAppCommLauncherMenuHandler::SetContactStore(
       
   125     const TCmsContactStore& aStore )
       
   126     {
       
   127     CCA_DP(KCommLauncherLogFile, CCA_L("CCCAppCommLauncherMenuHandler::SetContactStore() - %d"), (TInt)aStore );
       
   128     iContactStore = aStore;
       
   129     }
       
   130 
       
   131 // ---------------------------------------------------------------------------
       
   132 // CCCAppCommLauncherMenuHandler::DynInitMenuPaneL
       
   133 // ---------------------------------------------------------------------------
       
   134 //
       
   135 void CCCAppCommLauncherMenuHandler::DynInitMenuPaneL(
       
   136     TInt aResourceId,
       
   137     CEikMenuPane* aMenuPane )
       
   138     {
       
   139     CCA_DP(KCommLauncherLogFile, CCA_L("->CCCAppCommLauncherMenuHandler::DynInitMenuPaneL()"));
       
   140 
       
   141     if ( iAiwServiceHandler->HandleSubmenuL( *aMenuPane ))
       
   142         return;
       
   143 
       
   144     switch ( aResourceId )
       
   145         {
       
   146         case R_CCACOMMLAUNCHER_MENUPANE:
       
   147             {
       
   148             SelectDynInitMenuPaneL( aMenuPane );
       
   149 
       
   150             if ( iAiwServiceHandler->IsAiwMenu( aResourceId ))
       
   151                 {
       
   152                 
       
   153                 iAiwServiceHandler->InitializeMenuPaneL(
       
   154                     *aMenuPane, aResourceId, ECCAppCommLauncherAiwBaseCmd,
       
   155                     iAiwServiceHandler->InParamListL() );
       
   156                 }
       
   157             break;
       
   158             }
       
   159         default:
       
   160             break;
       
   161         }
       
   162 
       
   163     CCA_DP(KCommLauncherLogFile, CCA_L("<-CCCAppCommLauncherMenuHandler::DynInitMenuPaneL()"));
       
   164     }
       
   165 
       
   166 // ---------------------------------------------------------------------------
       
   167 // CCCAppCommLauncherMenuHandler::SelectDynInitMenuPaneL
       
   168 // ---------------------------------------------------------------------------
       
   169 //
       
   170 void CCCAppCommLauncherMenuHandler::SelectDynInitMenuPaneL(
       
   171     CEikMenuPane* aMenuPane )
       
   172     {
       
   173     CCA_DP(KCommLauncherLogFile, CCA_L("->CCCAppCommLauncherMenuHandler::SelectDynInitMenuPaneL()"));
       
   174 
       
   175     switch ( iContactStore )
       
   176         {
       
   177         case ECmsContactStorePbk :
       
   178             PbkContactDynInitMenuPaneL( aMenuPane );
       
   179             break;
       
   180         case ECmsContactStoreSim :
       
   181             SimContactDynInitMenuPaneL( aMenuPane );
       
   182             break;
       
   183         case ECmsContactStoreSdn :
       
   184             SdnContactDynInitMenuPaneL( aMenuPane );
       
   185             break;
       
   186         case ECmsContactStoreXsp :
       
   187             XspContactDynInitMenuPaneL( aMenuPane );
       
   188             break;
       
   189         default:
       
   190             CCA_DP(KCommLauncherLogFile, CCA_L("::DynInitMenuPaneL() - unsupported store type"));
       
   191             break;
       
   192         }
       
   193 
       
   194     CCA_DP(KCommLauncherLogFile, CCA_L("<-CCCAppCommLauncherMenuHandler::SelectDynInitMenuPaneL()"));
       
   195     }
       
   196 
       
   197 // ---------------------------------------------------------------------------
       
   198 // CCCAppCommLauncherMenuHandler::PbkContactDynInitMenuPaneL
       
   199 // ---------------------------------------------------------------------------
       
   200 //
       
   201 void CCCAppCommLauncherMenuHandler::PbkContactDynInitMenuPaneL(
       
   202     CEikMenuPane* aMenuPane )
       
   203     {
       
   204     CCA_DP(KCommLauncherLogFile, CCA_L("->CCCAppCommLauncherMenuHandler::ContactDynInitMenuPaneL()"));
       
   205 
       
   206     DynInitSelectMenuItemL( aMenuPane );
       
   207     DynInitSelectOtherMenuItemL( aMenuPane );
       
   208 
       
   209     CCA_DP(KCommLauncherLogFile, CCA_L("<-CCCAppCommLauncherMenuHandler::ContactDynInitMenuPaneL()"));
       
   210     }
       
   211 
       
   212 // ---------------------------------------------------------------------------
       
   213 // CCCAppCommLauncherMenuHandler::SimContactDynInitMenuPaneL
       
   214 // ---------------------------------------------------------------------------
       
   215 //
       
   216 void CCCAppCommLauncherMenuHandler::SimContactDynInitMenuPaneL(
       
   217     CEikMenuPane* aMenuPane )
       
   218     {
       
   219     CCA_DP(KCommLauncherLogFile, CCA_L("->CCCAppCommLauncherMenuHandler::SimContactDynInitMenuPaneL()"));
       
   220 
       
   221     DynInitSelectMenuItemL( aMenuPane );
       
   222     aMenuPane->DeleteMenuItem( ECCAppCommLauncherSelectOtherNmbCmd );
       
   223     aMenuPane->DeleteMenuItem( ECCAppCommLauncherSelectOtherAddrCmd );
       
   224     aMenuPane->DeleteMenuItem( ECCAppCommLauncherDefaultsCmd );
       
   225     aMenuPane->DeleteMenuItem( ECCAppCommLauncherVoiceTagDetailsCmd );
       
   226 
       
   227     CCA_DP(KCommLauncherLogFile, CCA_L("<-CCCAppCommLauncherMenuHandler::SimContactDynInitMenuPaneL()"));
       
   228 
       
   229     }
       
   230 
       
   231 // ---------------------------------------------------------------------------
       
   232 // CCCAppCommLauncherMenuHandler::SdnContactDynInitMenuPaneL
       
   233 // ---------------------------------------------------------------------------
       
   234 //
       
   235 void CCCAppCommLauncherMenuHandler::SdnContactDynInitMenuPaneL(
       
   236     CEikMenuPane* aMenuPane )
       
   237     {
       
   238     CCA_DP(KCommLauncherLogFile, CCA_L("->CCCAppCommLauncherMenuHandler::SdnContactDynInitMenuPaneL()"));
       
   239 
       
   240     DynInitSelectMenuItemL( aMenuPane );
       
   241     aMenuPane->DeleteMenuItem( ECCAppCommLauncherSelectOtherNmbCmd );
       
   242     aMenuPane->DeleteMenuItem( ECCAppCommLauncherSelectOtherAddrCmd );
       
   243     aMenuPane->DeleteMenuItem( KAiwCmdAssign );
       
   244     aMenuPane->DeleteMenuItem( ECCAppCommLauncherDefaultsCmd );
       
   245     aMenuPane->DeleteMenuItem( ECCAppCommLauncherVoiceTagDetailsCmd );
       
   246     aMenuPane->DeleteMenuItem( ECCAppCommLauncherDeleteCmd );
       
   247 
       
   248     CCA_DP(KCommLauncherLogFile, CCA_L("<-CCCAppCommLauncherMenuHandler::SdnContactDynInitMenuPaneL()"));
       
   249     }
       
   250 
       
   251 // ---------------------------------------------------------------------------
       
   252 // CCCAppCommLauncherMenuHandler::DynInitSelectMenuItemL
       
   253 // ---------------------------------------------------------------------------
       
   254 //
       
   255 void CCCAppCommLauncherMenuHandler::DynInitSelectMenuItemL(
       
   256     CEikMenuPane* aMenuPane )
       
   257     {
       
   258     CCA_DP(KCommLauncherLogFile, CCA_L("->CCCAppCommLauncherMenuHandler::DynInitSelectMenuItemL()"));
       
   259 
       
   260     if ( !iPlugin.Container().CommMethodsAvailable() )
       
   261         {// no comm methods available
       
   262         aMenuPane->DeleteMenuItem( ECCAppCommLauncherSelectCmd );
       
   263         // ECCAppCommLauncherDefaultsCmd is deleted in the SimContactDynInitMenuPaneL() method
       
   264         if (iContactStore != ECmsContactStoreSim)
       
   265             {
       
   266             aMenuPane->DeleteMenuItem( ECCAppCommLauncherDefaultsCmd );
       
   267             }
       
   268         }
       
   269 
       
   270     CCA_DP(KCommLauncherLogFile, CCA_L("<-CCCAppCommLauncherMenuHandler::DynInitSelectMenuItemL()"));
       
   271     }
       
   272 
       
   273 // ---------------------------------------------------------------------------
       
   274 // CCCAppCommLauncherMenuHandler::DynInitSelectOtherMenuItemL
       
   275 // ---------------------------------------------------------------------------
       
   276 //
       
   277 void CCCAppCommLauncherMenuHandler::DynInitSelectOtherMenuItemL(
       
   278     CEikMenuPane* aMenuPane )
       
   279     {
       
   280     CCA_DP(KCommLauncherLogFile, CCA_L("->CCCAppCommLauncherMenuHandler::DynInitSelectOtherMenuItemL()"));
       
   281 
       
   282     if ( iPlugin.Container().CommMethodsAvailable())
       
   283         {// comm methods available, continue..
       
   284         VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector contactAction =
       
   285             iPlugin.Container().SelectedCommunicationMethod();
       
   286         CCCAppCommLauncherContactHandler& contactHandler = iPlugin.ContactHandler();//not owned
       
   287 
       
   288         if ( contactHandler.IsItNumberAddress( contactAction ))
       
   289             {
       
   290             aMenuPane->DeleteMenuItem( ECCAppCommLauncherSelectOtherAddrCmd );
       
   291 
       
   292             if ( contactHandler.AddressAmount( contactAction ) < 2
       
   293                  || !contactHandler.HasDefaultAttribute( contactAction ))
       
   294                 {
       
   295                 aMenuPane->DeleteMenuItem( ECCAppCommLauncherSelectOtherNmbCmd );
       
   296                 }
       
   297             }
       
   298         else
       
   299             {
       
   300             aMenuPane->DeleteMenuItem( ECCAppCommLauncherSelectOtherNmbCmd );
       
   301 
       
   302             if ( contactHandler.AddressAmount( contactAction ) < 2
       
   303                  || !contactHandler.HasDefaultAttribute( contactAction ))
       
   304                 {
       
   305                 aMenuPane->DeleteMenuItem( ECCAppCommLauncherSelectOtherAddrCmd );
       
   306                 }
       
   307             }
       
   308         }
       
   309     else
       
   310         {// no comm methods available, don't show anything
       
   311         aMenuPane->DeleteMenuItem( ECCAppCommLauncherSelectOtherNmbCmd );
       
   312         aMenuPane->DeleteMenuItem( ECCAppCommLauncherSelectOtherAddrCmd );
       
   313         }
       
   314 
       
   315     CCA_DP(KCommLauncherLogFile, CCA_L("<-CCCAppCommLauncherMenuHandler::DynInitSelectOtherMenuItemL()"));
       
   316     }
       
   317 
       
   318 // ---------------------------------------------------------------------------
       
   319 // CCCAppCommLauncherMenuHandler::HandleCommandL
       
   320 // ---------------------------------------------------------------------------
       
   321 //
       
   322 void CCCAppCommLauncherMenuHandler::HandleCommandL( TInt aCommand )
       
   323     {
       
   324     CCA_DP(KCommLauncherLogFile, CCA_L("->CCCAppCommLauncherMenuHandler::HandleCommandL()"));
       
   325 
       
   326     // Check and handle the Aiw commands 1st
       
   327     TInt aiwCmd = iAiwServiceHandler->ServiceCmdByMenuCmd( aCommand );
       
   328     if( aiwCmd )
       
   329         {
       
   330         DoAiwCommandL( aCommand, aiwCmd );
       
   331         return;// aCommand should not match with non-Aiw commands, but just to be sure
       
   332         }
       
   333 
       
   334     // Then check if command is normal application command
       
   335     switch( aCommand )
       
   336         {
       
   337         case EAknSoftkeySelect:
       
   338         case ECCAppCommLauncherSelectCmd:
       
   339             DoSelectCmdL( ETrue );// use default
       
   340             break;
       
   341         case ECCAppCommLauncherSelectOtherNmbCmd:
       
   342         case ECCAppCommLauncherSelectOtherAddrCmd:
       
   343             DoSelectCmdL( EFalse );// do not use default
       
   344             break;
       
   345         case KAiwCmdAssign:// AIW service cmd for Editing
       
   346             DoEditCmdL();
       
   347             break;
       
   348         case ECCAppCommLauncherDefaultsCmd:
       
   349             DoSetDefaultCmdL();
       
   350             break;
       
   351         case ECCAppCommLauncherDeleteCmd:
       
   352             DoDeleteCmdL();
       
   353             break;
       
   354         default:
       
   355             break;
       
   356         }
       
   357 
       
   358     CCA_DP(KCommLauncherLogFile, CCA_L("<-CCCAppCommLauncherMenuHandler::HandleCommandL()"));
       
   359     }
       
   360 
       
   361 // ---------------------------------------------------------------------------
       
   362 // CCCAppCommLauncherMenuHandler::DoSelectCmdL
       
   363 // ---------------------------------------------------------------------------
       
   364 //
       
   365 void CCCAppCommLauncherMenuHandler::DoSelectCmdL( TBool aUseDefaultAddress )
       
   366     {
       
   367     CCA_DP(KCommLauncherLogFile, CCA_L("->CCCAppCommLauncherMenuHandler::DoSelectCmdL()"));
       
   368 
       
   369     if ( iPlugin.Container().SelectedCommunicationMethod()
       
   370     		== VPbkFieldTypeSelectorFactory::EFindOnMapSelector )
       
   371     	{
       
   372     	DoShowOnMapCmdL();
       
   373     	}
       
   374     else
       
   375     	{
       
   376         TPtrC fullName;
       
   377         iPlugin.ContactHandler().ContactFieldItemDataL(
       
   378             CCmsContactFieldItem::ECmsFullName, fullName );
       
   379         TUint paramFlag =
       
   380             aUseDefaultAddress ? CCAContactorService::TCSParameter::EEnableDefaults : 0;
       
   381         CCAContactorService::TCSParameter param(
       
   382             iPlugin.Container().SelectedCommunicationMethod(),
       
   383             *iPlugin.ContactHandler().ContactIdentifierLC(),//contactlinkarray
       
   384             paramFlag,
       
   385             fullName );
       
   386 
       
   387         CCAContactorService* contactorService = iPlugin.ContactorService();
       
   388         contactorService->ExecuteServiceL( param );
       
   389         CleanupStack::PopAndDestroy( 1 );// contactlinkarray
       
   390     	}
       
   391     
       
   392     CCA_DP(KCommLauncherLogFile, CCA_L("<-CCCAppCommLauncherMenuHandler::DoSelectCmdL()"));
       
   393     }
       
   394 
       
   395 // ---------------------------------------------------------------------------
       
   396 // CCCAppCommLauncherMenuHandler::DoEditCmdL
       
   397 // ---------------------------------------------------------------------------
       
   398 //
       
   399 void CCCAppCommLauncherMenuHandler::DoEditCmdL()
       
   400     {
       
   401     CCA_DP(KCommLauncherLogFile, CCA_L("->CCCAppCommLauncherMenuHandler::DoEditCmdL()"));
       
   402 
       
   403     // Avoid user input during Edit command execution
       
   404     if( iInputBlock )
       
   405         {
       
   406         iInputBlock->Cancel();
       
   407         }
       
   408 
       
   409     iInputBlock = CAknInputBlock::NewCancelHandlerLC( this );
       
   410     CleanupStack::Pop( iInputBlock );
       
   411     iInputBlock->SetCancelDelete( iInputBlock );
       
   412     CAiwGenericParamList& inParamList = iAiwServiceHandler->InParamListL();
       
   413     TInt popAndDestroyUs = 0;
       
   414 
       
   415     inParamList.AppendL(
       
   416         TAiwGenericParam(
       
   417             EGenericParamContactAssignData,
       
   418             TAiwVariant( TAiwSingleContactAssignDataV1Pckg(
       
   419                 TAiwSingleContactAssignDataV1().SetFlags( EskipInfoNotes )))));
       
   420 
       
   421     popAndDestroyUs += PackedContactLinkArrayToInParamListLC( inParamList );
       
   422 
       
   423     iAiwServiceHandler->ExecuteServiceCmdL(
       
   424         KAiwCmdAssign,
       
   425         inParamList,
       
   426         iAiwServiceHandler->OutParamListL(), NULL, this );
       
   427 
       
   428    CleanupStack::PopAndDestroy( popAndDestroyUs );
       
   429 
       
   430    CCA_DP(KCommLauncherLogFile, CCA_L("<-CCCAppCommLauncherMenuHandler::DoEditCmdL()"));
       
   431     }
       
   432 
       
   433 // ---------------------------------------------------------------------------
       
   434 // CCCAppCommLauncherMenuHandler::DoAiwCommandL
       
   435 // ---------------------------------------------------------------------------
       
   436 //
       
   437 void CCCAppCommLauncherMenuHandler::DoAiwCommandL( TInt aCmdId, TInt aServiceId )
       
   438     {
       
   439     CCA_DP(KCommLauncherLogFile, CCA_L("->CCCAppCommLauncherMenuHandler::DoAiwCommandL()"));
       
   440 
       
   441     CAiwGenericParamList& inParamList = iAiwServiceHandler->InParamListL();
       
   442     TInt popAndDestroyUs = 0;
       
   443 
       
   444     switch( aServiceId )
       
   445         {
       
   446         case KAiwCmdSindInfoView:
       
   447             popAndDestroyUs += PackedContactLinkArrayToInParamListLC( inParamList );
       
   448             break;
       
   449         default:
       
   450             break;
       
   451         }
       
   452 
       
   453     iAiwServiceHandler->ExecuteMenuCmdL(
       
   454         aCmdId,
       
   455         inParamList,
       
   456         iAiwServiceHandler->OutParamListL(), NULL, NULL );// not needed (so far)
       
   457 
       
   458    CleanupStack::PopAndDestroy( popAndDestroyUs );
       
   459 
       
   460    CCA_DP(KCommLauncherLogFile, CCA_L("<-CCCAppCommLauncherMenuHandler::DoAiwCommandL()"));
       
   461    }
       
   462 
       
   463 // ---------------------------------------------------------------------------
       
   464 // CCCAppCommLauncherMenuHandler::PackedContactLinkArrayToInParamListLC
       
   465 // ---------------------------------------------------------------------------
       
   466 //
       
   467 TInt CCCAppCommLauncherMenuHandler::PackedContactLinkArrayToInParamListLC(
       
   468     CAiwGenericParamList& aInParamList )
       
   469     {
       
   470     CCA_DP(KCommLauncherLogFile, CCA_L("->CCCAppCommLauncherMenuHandler::PrepareAiwParamListForVoiceTagLC()"));
       
   471 
       
   472     HBufC8* packedLinks = iPlugin.ContactHandler().ContactIdentifierLC();
       
   473 
       
   474     aInParamList.AppendL(
       
   475         TAiwGenericParam( EGenericParamContactLinkArray,
       
   476         TAiwVariant( *packedLinks )));
       
   477 
       
   478     CCA_DP(KCommLauncherLogFile, CCA_L("<-CCCAppCommLauncherMenuHandler::PrepareAiwParamListForVoiceTagLC()"));
       
   479     return 1;// packedLinks
       
   480     }
       
   481 
       
   482 // ---------------------------------------------------------------------------
       
   483 // CCCAppCommLauncherMenuHandler::HandleNotifyL
       
   484 // ---------------------------------------------------------------------------
       
   485 //
       
   486 TInt CCCAppCommLauncherMenuHandler::HandleNotifyL(
       
   487     TInt aCmdId,
       
   488     TInt aEventId,
       
   489     CAiwGenericParamList& aEventParamList,
       
   490     const CAiwGenericParamList& /*aInParamList*/ )
       
   491     {
       
   492     TInt returnValue = KErrNone;
       
   493     TInt index = 0;
       
   494     const TAiwGenericParam* param = aEventParamList.FindFirst(index,
       
   495         EGenericParamContactLinkArray);
       
   496     
       
   497     index = 0;
       
   498     const TAiwGenericParam* errParam = aEventParamList.FindFirst(index,
       
   499             EGenericParamError);
       
   500 
       
   501     if (param)
       
   502         {
       
   503         TPtrC8 contactLink = param->Value().AsData();
       
   504 
       
   505         // Update the CCA parameter contact data
       
   506         HBufC16* link16 = HBufC16::NewLC( contactLink.Length() );
       
   507         link16->Des().Copy( contactLink );
       
   508         iPlugin.AppEngine()->Parameter().SetContactDataL( link16->Des() );
       
   509         // Set contact data flag to EContactLink, because the parameters returned from 
       
   510         // phonebook AIW provider have conatct link but not contact id.
       
   511         iPlugin.AppEngine()->Parameter().SetContactDataFlag( MCCAParameter::EContactLink );
       
   512         CleanupStack::PopAndDestroy(1); // link16
       
   513 
       
   514         // Inform the app engine of the contact event
       
   515         iPlugin.AppEngine()->CCAppContactEventL();
       
   516 
       
   517         // Update the commlauncher the UI contact data
       
   518         iPlugin.ContactHandler().RefetchContactL();
       
   519         iPlugin.Container().ContactsChangedL();
       
   520         }
       
   521 
       
   522     if (errParam)
       
   523         {
       
   524         TInt32 err;
       
   525         errParam->Value().Get(err);
       
   526         if (err == (TInt32)KErrInUse)
       
   527             {
       
   528             CCoeEnv::Static()->HandleError(KErrInUse);
       
   529             }
       
   530         }
       
   531     
       
   532     if ( KAiwCmdAssign == aCmdId && KAiwEventQueryExit == aEventId )
       
   533         {
       
   534         // Send an exit command in order to close CCA and Phonebook2
       
   535 		CAknAppUi* appUi = static_cast<CAknAppUi*>( CCoeEnv::Static()->AppUi() );
       
   536 
       
   537 		if ( appUi )
       
   538 			{
       
   539 			appUi->ProcessCommandL( EAknCmdExit );
       
   540 			}
       
   541 
       
   542 		// allow pbk editor AIW service to close whole app chain
       
   543         returnValue = ETrue;
       
   544         }
       
   545     
       
   546     // stop user input blocker
       
   547     StopInputBlock();
       
   548     
       
   549     return returnValue;
       
   550     }
       
   551 
       
   552 // ---------------------------------------------------------------------------
       
   553 // CCCAppCommLauncherMenuHandler::DoSetDefaultCmdL
       
   554 // ---------------------------------------------------------------------------
       
   555 //
       
   556 void CCCAppCommLauncherMenuHandler::DoSetDefaultCmdL()
       
   557     {
       
   558     if( !iPbkCmd )
       
   559         iPbkCmd = CCCAppCommLauncherPbkCmd::NewL( iPlugin );
       
   560 
       
   561     iPbkCmd->ExecutePbk2CmdAssignDefaultL(
       
   562         *iPlugin.ContactHandler().ContactIdentifierLC() );
       
   563 
       
   564     CleanupStack::PopAndDestroy( 1 ); // ContactIdentifierLC
       
   565     }
       
   566 
       
   567 // ---------------------------------------------------------------------------
       
   568 // CCCAppCommLauncherMenuHandler::DoShowOnMapCmdL
       
   569 // ---------------------------------------------------------------------------
       
   570 //
       
   571 void CCCAppCommLauncherMenuHandler::DoShowOnMapCmdL()
       
   572     {
       
   573     if( !iPbkCmd )
       
   574     	{
       
   575         iPbkCmd = CCCAppCommLauncherPbkCmd::NewL( iPlugin );
       
   576     	}
       
   577         
       
   578     iPbkCmd->ExecutePbk2CmdShowMapL(
       
   579             iPlugin.ContactHandler().ContactIdentifierLC(),
       
   580             (TPbk2CommandId)EPbk2ExtensionShowOnMap );
       
   581 
       
   582     CleanupStack::PopAndDestroy( 1 ); // ContactIdentifierLC
       
   583     }
       
   584 
       
   585 // ---------------------------------------------------------------------------
       
   586 // CCCAppCommLauncherMenuHandler::DoDeleteCmdL
       
   587 // ---------------------------------------------------------------------------
       
   588 //
       
   589 void CCCAppCommLauncherMenuHandler::DoDeleteCmdL()
       
   590     {
       
   591     if( !iPbkCmd )
       
   592 	    {
       
   593         iPbkCmd = CCCAppCommLauncherPbkCmd::NewL( iPlugin );
       
   594         }
       
   595     iPbkCmd->ExecutePbk2CmdDeleteL(
       
   596         *iPlugin.ContactHandler().ContactIdentifierLC() );
       
   597 
       
   598     CleanupStack::PopAndDestroy( 1 ); // ContactIdentifierLC
       
   599     }
       
   600 
       
   601 // ---------------------------------------------------------------------------
       
   602 // CCCAppCommLauncherMenuHandler::XspContactDynInitMenuPaneL
       
   603 // ---------------------------------------------------------------------------
       
   604 //
       
   605 void CCCAppCommLauncherMenuHandler::XspContactDynInitMenuPaneL(
       
   606     CEikMenuPane* aMenuPane )
       
   607     {
       
   608     CCA_DP(KCommLauncherLogFile, CCA_L("->CCCAppCommLauncherMenuHandler::XspContactDynInitMenuPaneL()"));
       
   609 
       
   610     DynInitSelectMenuItemL( aMenuPane );
       
   611     DynInitSelectOtherMenuItemL( aMenuPane );
       
   612 
       
   613     CCA_DP(KCommLauncherLogFile, CCA_L("<-CCCAppCommLauncherMenuHandler::XspContactDynInitMenuPaneL()"));
       
   614     }
       
   615 
       
   616 
       
   617 // End of File