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