uiservicetab/vimpstcmdprocess/src/cvimpstcmdcca.cpp
branchRCL_3
changeset 28 3104fc151679
parent 27 2b7283837edb
child 29 9a48e301e94b
equal deleted inserted replaced
27:2b7283837edb 28:3104fc151679
     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:  implementation for CVIMPSTCmdCCA
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 
       
    21 
       
    22 #include "vimpstcmd.hrh"
       
    23 #include "mvimpstcmdobserver.h"
       
    24 #include "cvimpstcmdcca.h"
       
    25 #include "mvimpstengine.h"
       
    26 #include "mvimpstprocessarray.h"
       
    27 
       
    28 #include <MVPbkContactLink.h> 
       
    29 
       
    30 #include <e32def.h>
       
    31 #include <e32property.h>
       
    32 #include <imconnectionproviderconsts.h>
       
    33 #include "tvimpstconsts.h"
       
    34 #include "vimpstdetailsviewpluginuids.hrh"
       
    35 
       
    36 #include "uiservicetabtracer.h"
       
    37 
       
    38 // Constants
       
    39 
       
    40 // --------------------------------------------------------------------------
       
    41 // CVIMPSTCmdCCA::CVIMPSTCmdCCA
       
    42 // --------------------------------------------------------------------------
       
    43 //
       
    44 CVIMPSTCmdCCA::CVIMPSTCmdCCA( 
       
    45         const TInt aCommandId,
       
    46             TInt& aIndex, 
       
    47             MCCAConnection* aConnection,
       
    48             MVIMPSTProcessArray& mArrayProcess,
       
    49             MVIMPSTEngine& aEngine ) :            
       
    50     iCommandId( aCommandId ),
       
    51     iIndex(aIndex),
       
    52     iConnection(aConnection),
       
    53     iArrayProcess(mArrayProcess),
       
    54     iEngine( aEngine)
       
    55     {
       
    56     }
       
    57 
       
    58 // --------------------------------------------------------------------------
       
    59 // CVIMPSTCmdCCA::~CVIMPSTCmdCCA
       
    60 // --------------------------------------------------------------------------
       
    61 //
       
    62 CVIMPSTCmdCCA::~CVIMPSTCmdCCA()
       
    63     {   
       
    64     }
       
    65 
       
    66 // --------------------------------------------------------------------------
       
    67 // CVIMPSTCmdCCA::NewL
       
    68 // --------------------------------------------------------------------------
       
    69 //
       
    70 CVIMPSTCmdCCA* CVIMPSTCmdCCA::NewL( 
       
    71         const TInt aCommandId,TInt& aIndex,
       
    72         MCCAConnection* aConnection,
       
    73         	MVIMPSTProcessArray& aArrayProcess,
       
    74         MVIMPSTEngine& aEngine )
       
    75     {
       
    76 	 TRACER_AUTO;
       
    77     CVIMPSTCmdCCA* self = new (ELeave ) CVIMPSTCmdCCA( aCommandId,aIndex,aConnection,aArrayProcess, aEngine );
       
    78     self->ConstructL(); //use contsurctL if necessary
       
    79     return self;
       
    80     }
       
    81 // --------------------------------------------------------------------------
       
    82 // CVIMPSTCmdCCA::ConstructL
       
    83 // --------------------------------------------------------------------------
       
    84 //
       
    85 void CVIMPSTCmdCCA::ConstructL()
       
    86     {
       
    87     RProperty::Define(KMeCoPropertyUid, KMeCoXSPDetailsServiceIdKey, RProperty::EInt,
       
    88                           ECapabilityReadUserData ,ECapabilityWriteUserData); 
       
    89  
       
    90     }
       
    91 
       
    92 // --------------------------------------------------------------------------
       
    93 // CVIMPSTCmdCCA::ExecuteLD
       
    94 // --------------------------------------------------------------------------
       
    95 //
       
    96 void CVIMPSTCmdCCA::ExecuteLD()
       
    97     {
       
    98     TRACER_AUTO;
       
    99    	
       
   100     //push to the cleanupstack
       
   101     CleanupStack::PushL( this );    
       
   102   	
       
   103 	LaunchCcaL();
       
   104     if(iObserver)
       
   105 	    {
       
   106 	    iObserver->CommandFinishedL(*this);
       
   107 	    }
       
   108 		
       
   109 	CleanupStack::PopAndDestroy();	
       
   110 		
       
   111     }
       
   112 
       
   113 
       
   114 // --------------------------------------------------------------------------
       
   115 // CVIMPSTCmdCCA::AddObserver
       
   116 // --------------------------------------------------------------------------
       
   117 //
       
   118 void CVIMPSTCmdCCA::AddObserver( MVIMPSTCmdObserver& aObserver )
       
   119     {
       
   120     // store the observer to notify the command completion
       
   121     iObserver = &aObserver;
       
   122     }
       
   123 
       
   124 
       
   125 // --------------------------------------------------------------------------
       
   126 // CVIMPSTCmdCCA::CommandId
       
   127 // --------------------------------------------------------------------------
       
   128 //
       
   129 TInt CVIMPSTCmdCCA::CommandId() const
       
   130 	{
       
   131 	return iCommandId;	
       
   132 	}
       
   133 
       
   134 // --------------------------------------------------------------------------
       
   135 // CVIMPSTCmdCCA::Result
       
   136 // --------------------------------------------------------------------------
       
   137 //
       
   138 TInt CVIMPSTCmdCCA::Result() const
       
   139 	{
       
   140 	//return valid data regd the command operation
       
   141 	return KErrNone;
       
   142 	}
       
   143 
       
   144 // --------------------------------------------------------------------------
       
   145 // CVIMPSTCmdCCA::LaunchCcaL
       
   146 // --------------------------------------------------------------------------
       
   147 //
       
   148 void CVIMPSTCmdCCA::LaunchCcaL()
       
   149 	{   
       
   150 	TRACER_AUTO;
       
   151 	if ( iParameter )
       
   152 		{
       
   153 		iParameter->Close();
       
   154 		iParameter = NULL;
       
   155 		}
       
   156 
       
   157 	// The lifetime of this cmd object is too short to hold
       
   158 	// iParameterRef, caller of this must own it    
       
   159 	iParameter = TCCAFactory::NewParameterL();
       
   160 	iParameter->SetConnectionFlag(MCCAParameter::ENormal);
       
   161 	iParameter->SetContactDataFlag(MCCAParameter::EContactLink);
       
   162 	
       
   163 	TUid uid( TUid::Null() );
       
   164 	uid.iUid = KVIMPSTDetailsViewPluginImplmentationUid + iEngine.ServiceId(); // service details view implementation uid
       
   165 	iParameter->SetLaunchedViewUid( uid );
       
   166 	
       
   167 	RProperty::Set(KMeCoPropertyUid, KMeCoXSPDetailsServiceIdKey, iEngine.ServiceId() ); 
       
   168 	 
       
   169 	MVPbkContactLink* link = iArrayProcess.ContactLink( iIndex )->CloneLC();  
       
   170 	if (link)
       
   171 		{
       
   172 		HBufC8* link8 = link->PackLC(); 
       
   173 		HBufC16* link16 = HBufC16::NewLC( link8->Length() );
       
   174 		link16->Des().Copy( *link8);
       
   175 		iParameter->SetContactDataL(link16->Des());
       
   176 		CleanupStack::PopAndDestroy(3); 
       
   177 		}
       
   178 	// Sync call
       
   179 	iConnection->LaunchApplicationL(*iParameter);            
       
   180 	          
       
   181 	}
       
   182 // End of File