|
1 /* |
|
2 * Copyright (c) 2005-2006 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: This file contains methods which implements methods for |
|
15 * interfacing with call UI component for making a phonecall |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 // INCLUDE FILES |
|
25 #include <AiwServiceHandler.h> // AIW |
|
26 #include <AiwCommon.hrh> // AIW |
|
27 #include <CPhCltEmergencyCall.h> |
|
28 #include "landmarks.hrh" // AIW |
|
29 #include <coemain.h> |
|
30 #include "clmkcallcmd.h" |
|
31 #include <aiwdialdata.h> |
|
32 |
|
33 //============================ MEMBER FUNCTIONS =============================== |
|
34 |
|
35 // ----------------------------------------------------------------------------- |
|
36 // CLmkCallCmd::CLmkCallCmd |
|
37 // C++ default constructor can NOT contain any code, that |
|
38 // might leave. |
|
39 // ----------------------------------------------------------------------------- |
|
40 // |
|
41 CLmkCallCmd::CLmkCallCmd() |
|
42 { |
|
43 } |
|
44 |
|
45 // ---------------------------------------------------- |
|
46 // CLmkCallCmd::ConstructL() |
|
47 // ---------------------------------------------------- |
|
48 // |
|
49 void CLmkCallCmd::ConstructL( ) |
|
50 { |
|
51 iAiwCallServiceHandler = CAiwServiceHandler::NewL(); |
|
52 iEmergencyCall = CPhCltEmergencyCall::NewL(this); |
|
53 } |
|
54 |
|
55 // ----------------------------------------------------------------------------- |
|
56 // CLmkCallCmd::NewL |
|
57 // Two-phased constructor. |
|
58 // ----------------------------------------------------------------------------- |
|
59 // |
|
60 EXPORT_C CLmkCallCmd* CLmkCallCmd::NewL() |
|
61 { |
|
62 CLmkCallCmd* self = |
|
63 new( ELeave ) CLmkCallCmd; |
|
64 CleanupStack::PushL( self ); |
|
65 self->ConstructL(); |
|
66 CleanupStack::Pop(); |
|
67 return self; |
|
68 } |
|
69 |
|
70 // ---------------------------------------------------- |
|
71 // CLmkCallCmd::~CLmkCallCmd() |
|
72 // ---------------------------------------------------- |
|
73 // |
|
74 CLmkCallCmd::~CLmkCallCmd() |
|
75 { |
|
76 delete iAiwCallServiceHandler; |
|
77 delete iEmergencyCall; |
|
78 } |
|
79 |
|
80 // ---------------------------------------------------- |
|
81 // CLmkCallCmd::AttachMenuPaneL() |
|
82 // ---------------------------------------------------- |
|
83 // |
|
84 void CLmkCallCmd::AttachMenuPaneL(TInt aMenuResourceId, TInt aInterestResourceId) |
|
85 { |
|
86 // Attach the wanted menu with wanted interest to AIW. |
|
87 iAiwCallServiceHandler->AttachMenuL( aMenuResourceId, aInterestResourceId ); |
|
88 } |
|
89 |
|
90 // ---------------------------------------------------- |
|
91 // CLmkCallCmd::AttachInterestL() |
|
92 // ---------------------------------------------------- |
|
93 // |
|
94 void CLmkCallCmd::AttachInterestL ( RCriteriaArray& aInterestId ) |
|
95 { |
|
96 // For using non-menu services |
|
97 iAiwCallServiceHandler->AttachL( aInterestId ); |
|
98 } |
|
99 |
|
100 // ---------------------------------------------------- |
|
101 // CLmkCallCmd::AttachInterestL() |
|
102 // ---------------------------------------------------- |
|
103 // |
|
104 void CLmkCallCmd::AttachInterestL ( TInt aInterestId ) |
|
105 { |
|
106 // For using non-menu services |
|
107 iAiwCallServiceHandler->AttachL( aInterestId ); |
|
108 } |
|
109 // CLmkCallCmd::InitializeMenuPaneL() |
|
110 // ---------------------------------------------------- |
|
111 // |
|
112 void CLmkCallCmd::InitializeMenuPaneL( |
|
113 CEikMenuPane& aMenuPane, |
|
114 TInt aMenuResourceId, |
|
115 TInt aBaseMenuCmdId) |
|
116 { |
|
117 //AIW service menu initialization |
|
118 iAiwCallServiceHandler->InitializeMenuPaneL( |
|
119 aMenuPane, |
|
120 aMenuResourceId, |
|
121 aBaseMenuCmdId, // Must not overlap with the other menu ids! |
|
122 iAiwCallServiceHandler->InParamListL() ); |
|
123 } |
|
124 |
|
125 // ----------------------------------------------------------------------------- |
|
126 // CLmkCallCmd::ExecuteAIWCallCmdL() |
|
127 // ----------------------------------------------------------------------------- |
|
128 // |
|
129 void CLmkCallCmd::ExecuteAIWCallCmdL( TInt aCommandId, TDesC& aPhoneNum ) |
|
130 { |
|
131 //first give a chance to emergency call |
|
132 if(!HandleEmergencyCallL(aPhoneNum)) |
|
133 { |
|
134 //number is not an emergency number, call normal. |
|
135 HandleNormalCallL( aCommandId,aPhoneNum ); |
|
136 } |
|
137 } |
|
138 // ---------------------------------------------------------------------------- |
|
139 // CLmkCallCmd::HandleEmergencyDialL |
|
140 // ---------------------------------------------------------------------------- |
|
141 // |
|
142 void CLmkCallCmd::HandleEmergencyDialL( const TInt /*aStatus */) |
|
143 { |
|
144 // TODO: Show some note to user if there is error? |
|
145 // belongs to MPhCltEmergencyCallObserver interface |
|
146 } |
|
147 // ----------------------------------------------------------------------------- |
|
148 // CLmkCallCmd::HandleEmergencyCall |
|
149 // ----------------------------------------------------------------------------- |
|
150 // |
|
151 TBool CLmkCallCmd::HandleEmergencyCallL( TDesC& aPhoneNum ) |
|
152 { |
|
153 TBool isEmerNum = EFalse; |
|
154 iEmergencyCall->IsEmergencyPhoneNumber(aPhoneNum,isEmerNum); |
|
155 if( isEmerNum) |
|
156 { |
|
157 iEmergencyCall->DialEmergencyCallL(aPhoneNum); |
|
158 } |
|
159 return isEmerNum; |
|
160 } |
|
161 // ----------------------------------------------------------------------------- |
|
162 // CLmkCallCmd::HandleNormalCall |
|
163 // ----------------------------------------------------------------------------- |
|
164 // |
|
165 void CLmkCallCmd::HandleNormalCallL( TInt aCommandId, TDesC& aPhoneNum ) |
|
166 { |
|
167 // Set basic dial data |
|
168 CAiwDialData* dialData = CAiwDialData::NewLC(); |
|
169 dialData->SetPhoneNumberL( aPhoneNum ); |
|
170 dialData->SetWindowGroup( AIWDialData::KAiwGoToIdle ); |
|
171 CAiwGenericParamList& paramList = iAiwCallServiceHandler->InParamListL(); |
|
172 dialData->FillInParamListL( paramList ); |
|
173 CleanupStack::PopAndDestroy(); |
|
174 |
|
175 if ( ELmkCmdCall == aCommandId ) |
|
176 {// invoked from 'sendkey' |
|
177 iAiwCallServiceHandler->ExecuteServiceCmdL( |
|
178 KAiwCmdCall, |
|
179 paramList, |
|
180 iAiwCallServiceHandler->OutParamListL(), |
|
181 0, |
|
182 NULL ); |
|
183 } |
|
184 else // invoked from 'menu' |
|
185 { |
|
186 iAiwCallServiceHandler->ExecuteMenuCmdL( |
|
187 aCommandId, |
|
188 paramList, |
|
189 iAiwCallServiceHandler->OutParamListL(), |
|
190 0, // No options used. |
|
191 NULL); // No need for callback |
|
192 } |
|
193 } |
|
194 |
|
195 // ----------------------------------------------------------------------------- |
|
196 // CLmkCallCmd::ServiceCmdByMenuCmd |
|
197 // ----------------------------------------------------------------------------- |
|
198 // |
|
199 TInt CLmkCallCmd::ServiceCmdByMenuCmd( TInt aMenuCmd ) |
|
200 { |
|
201 return iAiwCallServiceHandler->ServiceCmdByMenuCmd( aMenuCmd ); |
|
202 } |
|
203 // End of File |