author | hgs |
Fri, 09 Jul 2010 15:40:55 +0300 | |
changeset 50 | 377c906a8701 |
parent 46 | bc5a64e5bc3c |
child 65 | 2a5d4ab426d3 |
permissions | -rw-r--r-- |
37 | 1 |
/* |
2 |
* Copyright (c) 2005-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 of CPhoneSingleAndAlerting class. |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
// INCLUDES |
|
20 |
#include <pevirtualengine.h> |
|
21 |
#include <cpephonemodelif.h> |
|
22 |
#include "cphonesingleandalerting.h" |
|
23 |
#include "tphonecmdparamboolean.h" |
|
24 |
#include "mphonestatemachine.h" |
|
25 |
#include "tphonecmdparamboolean.h" |
|
26 |
#include "tphonecmdparaminteger.h" |
|
27 |
#include "tphonecmdparamcallheaderdata.h" |
|
28 |
#include "tphonecmdparamglobalnote.h" |
|
29 |
#include "tphonecmdparamcallstatedata.h" |
|
30 |
#include "phoneviewcommanddefinitions.h" |
|
31 |
#include "phoneui.hrh" |
|
32 |
#include "cphonemainresourceresolver.h" |
|
33 |
#include "phonerssbase.h" |
|
34 |
#include "phonestatedefinitionsgsm.h" |
|
35 |
#include "phonelogger.h" |
|
36 |
||
37 |
// ================= MEMBER FUNCTIONS ======================= |
|
38 |
||
39 |
// C++ default constructor can NOT contain any code, that |
|
40 |
// might leave. |
|
41 |
// |
|
42 |
CPhoneSingleAndAlerting::CPhoneSingleAndAlerting( |
|
43 |
MPhoneStateMachine* aStateMachine, |
|
44 |
MPhoneViewCommandHandle* aViewCommandHandle, |
|
45 |
MPhoneCustomization* aPhoneCustomization ) : |
|
46 |
CPhoneAlerting( aStateMachine, aViewCommandHandle, aPhoneCustomization ) |
|
47 |
{ |
|
48 |
} |
|
49 |
||
50 |
// ----------------------------------------------------------- |
|
51 |
// CPhoneSingleAndAlerting::~CPhoneSingleAndAlerting() |
|
52 |
// Destructor |
|
53 |
// (other items were commented in a header). |
|
54 |
// ----------------------------------------------------------- |
|
55 |
// |
|
56 |
CPhoneSingleAndAlerting::~CPhoneSingleAndAlerting() |
|
57 |
{ |
|
58 |
} |
|
59 |
||
60 |
// ----------------------------------------------------------- |
|
61 |
// CPhoneSingleAndAlerting::ConstructL() |
|
62 |
// Constructor |
|
63 |
// (other items were commented in a header). |
|
64 |
// ----------------------------------------------------------- |
|
65 |
// |
|
66 |
void CPhoneSingleAndAlerting::ConstructL() |
|
67 |
{ |
|
68 |
CPhoneAlerting::ConstructL(); |
|
69 |
} |
|
70 |
||
71 |
// ----------------------------------------------------------- |
|
72 |
// CPhoneSingleAndAlerting::NewL() |
|
73 |
// Constructor |
|
74 |
// (other items were commented in a header). |
|
75 |
// ----------------------------------------------------------- |
|
76 |
// |
|
77 |
CPhoneSingleAndAlerting* CPhoneSingleAndAlerting::NewL( |
|
78 |
MPhoneStateMachine* aStateMachine, |
|
79 |
MPhoneViewCommandHandle* aViewCommandHandle, |
|
80 |
MPhoneCustomization* aPhoneCustomization ) |
|
81 |
{ |
|
82 |
CPhoneSingleAndAlerting* self = new( ELeave ) CPhoneSingleAndAlerting( |
|
83 |
aStateMachine, aViewCommandHandle, aPhoneCustomization ); |
|
84 |
||
85 |
CleanupStack::PushL( self ); |
|
86 |
self->ConstructL(); |
|
87 |
CleanupStack::Pop( self ); |
|
88 |
||
89 |
return self; |
|
90 |
} |
|
91 |
||
92 |
// ----------------------------------------------------------- |
|
93 |
// CPhoneSingleAndAlerting::HandlePhoneEngineMessageL |
|
94 |
// ----------------------------------------------------------- |
|
95 |
// |
|
96 |
void CPhoneSingleAndAlerting::HandlePhoneEngineMessageL( |
|
97 |
const TInt aMessage, |
|
98 |
TInt aCallId ) |
|
99 |
{ |
|
100 |
__LOGMETHODSTARTEND( EPhoneUIStates, |
|
101 |
"CPhoneSingleAndAlerting::HandlePhoneEngineMessageL()"); |
|
102 |
switch ( aMessage ) |
|
103 |
{ |
|
104 |
case MEngineMonitor::EPEMessageConnected: |
|
105 |
HandleConnectedL( aCallId ); |
|
106 |
break; |
|
107 |
||
108 |
case MEngineMonitor::EPEMessageIdle: |
|
109 |
HandleIdleL( aCallId ); |
|
110 |
break; |
|
111 |
||
112 |
default: |
|
113 |
CPhoneAlerting::HandlePhoneEngineMessageL( aMessage, aCallId ); |
|
114 |
break; |
|
115 |
} |
|
116 |
} |
|
117 |
||
118 |
// -------------------------------------------------------------- |
|
119 |
// CPhoneSingleAndAlerting::HandleKeyMessageL |
|
120 |
// -------------------------------------------------------------- |
|
121 |
// |
|
122 |
void CPhoneSingleAndAlerting::HandleKeyMessageL( |
|
123 |
TPhoneKeyEventMessages aMessage, |
|
124 |
TKeyCode aCode ) |
|
125 |
{ |
|
126 |
__LOGMETHODSTARTEND( EPhoneUIStates, |
|
127 |
"CPhoneSingleAndAlerting::HandleKeyMessageL()"); |
|
128 |
switch ( aCode ) |
|
129 |
{ |
|
130 |
// send-key |
|
131 |
case EKeyYes: |
|
132 |
if ( CPhoneState::IsNumberEntryUsedL() ) |
|
133 |
{ |
|
134 |
// send a manual control sequence |
|
135 |
CPhoneState::CallFromNumberEntryL(); |
|
136 |
} |
|
137 |
else |
|
138 |
{ |
|
139 |
// Show not allowed note |
|
140 |
CPhoneState::SendGlobalErrorNoteL( |
|
46
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
141 |
EPhoneNoteTextNotAllowed, ETrue ); |
37 | 142 |
} |
143 |
break; |
|
144 |
||
145 |
// end-key |
|
146 |
case EKeyNo: |
|
147 |
if ( aMessage == EPhoneKeyLongPress ) |
|
148 |
{ |
|
149 |
iStateMachine->SendPhoneEngineMessage( |
|
150 |
CPEPhoneModelIF::EPEMessageTerminateAllConnections ); |
|
151 |
} |
|
152 |
else |
|
153 |
{ |
|
154 |
DisconnectOutgoingCallL(); |
|
155 |
} |
|
156 |
||
157 |
if ( CPhoneState::IsNumberEntryUsedL() ) |
|
158 |
{ |
|
159 |
// Remove number entry from screen |
|
160 |
iViewCommandHandle->ExecuteCommandL( |
|
161 |
EPhoneViewRemoveNumberEntry ); |
|
162 |
// Do state-specific operation when number entry is cleared |
|
163 |
HandleNumberEntryClearedL(); |
|
164 |
} |
|
165 |
break; |
|
166 |
||
167 |
default: |
|
168 |
// do base operation |
|
169 |
CPhoneAlerting::HandleKeyMessageL( aMessage, aCode ); |
|
170 |
break; |
|
171 |
} |
|
172 |
} |
|
173 |
||
174 |
// ----------------------------------------------------------- |
|
175 |
// CPhoneSingleAndAlerting::HandleConnectedL |
|
176 |
// ----------------------------------------------------------- |
|
177 |
// |
|
178 |
void CPhoneSingleAndAlerting::HandleConnectedL( TInt aCallId ) |
|
179 |
{ |
|
180 |
__LOGMETHODSTARTEND( EPhoneUIStates, |
|
181 |
"CPhoneSingleAndAlerting::HandleConnectedL()"); |
|
182 |
||
183 |
// Find the alerting call |
|
184 |
TPhoneCmdParamCallStateData callStateData; |
|
185 |
callStateData.SetCallState( EPEStateConnecting ); |
|
186 |
iViewCommandHandle->HandleCommandL( |
|
187 |
EPhoneViewGetCallIdByState, &callStateData ); |
|
188 |
||
189 |
if( callStateData.CallId() == aCallId ) |
|
190 |
{ |
|
191 |
// Keep Phone in the foreground |
|
192 |
TPhoneCmdParamBoolean booleanParam; |
|
193 |
booleanParam.SetBoolean( EFalse ); |
|
194 |
iViewCommandHandle->ExecuteCommandL( |
|
195 |
EPhoneViewSetNeedToSendToBackgroundStatus, &booleanParam ); |
|
196 |
||
197 |
CPhoneState::BeginUiUpdateLC(); |
|
198 |
||
199 |
// Show bubble |
|
200 |
TPhoneCmdParamCallHeaderData callHeaderParam; |
|
201 |
callHeaderParam.SetCallState( EPEStateConnected ); |
|
202 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewUpdateBubble, aCallId, |
|
203 |
&callHeaderParam ); |
|
204 |
||
205 |
CPhoneState::SetTouchPaneButtons( EPhoneTwoSinglesButtons ); |
|
206 |
CPhoneState::EndUiUpdate(); |
|
207 |
||
208 |
// Set Hold flag to view |
|
209 |
TPhoneCmdParamBoolean holdFlag; |
|
210 |
holdFlag.SetBoolean( EFalse ); |
|
211 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewSetHoldFlag, &holdFlag ); |
|
212 |
||
213 |
||
214 |
// Set Two singles softkeys |
|
215 |
UpdateCbaL( EPhoneCallHandlingNewCallSwapCBA ); |
|
216 |
||
217 |
// Go to two singles state |
|
218 |
iStateMachine->ChangeState( EPhoneStateTwoSingles ); |
|
219 |
} |
|
220 |
else |
|
221 |
{ |
|
222 |
// Show bubble |
|
223 |
TPhoneCmdParamCallHeaderData callHeaderParam; |
|
224 |
callHeaderParam.SetCallState( EPEStateConnected ); |
|
225 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewUpdateBubble, aCallId, |
|
226 |
&callHeaderParam ); |
|
227 |
||
228 |
TPhoneCmdParamBoolean holdFlag; |
|
229 |
holdFlag.SetBoolean( EFalse ); |
|
230 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewSetHoldFlag, &holdFlag ); |
|
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
231 |
} |
37 | 232 |
} |
233 |
// ----------------------------------------------------------- |
|
234 |
// CPhoneSingleAndAlerting::HandleIdleL |
|
235 |
// ----------------------------------------------------------- |
|
236 |
// |
|
237 |
void CPhoneSingleAndAlerting::HandleIdleL( TInt aCallId ) |
|
238 |
{ |
|
239 |
__LOGMETHODSTARTEND( EPhoneUIStates, |
|
240 |
"CPhoneSingleAndAlerting::HandleIdleL()"); |
|
241 |
||
242 |
BeginUiUpdateLC(); |
|
243 |
||
244 |
// Remove call |
|
245 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveCallHeader, aCallId ); |
|
246 |
||
247 |
if ( !TopAppIsDisplayedL() ) |
|
248 |
{ |
|
249 |
// Continue displaying current app but set up the |
|
250 |
// idle screen in the background |
|
251 |
SetupIdleScreenInBackgroundL(); |
|
252 |
} |
|
253 |
||
254 |
TPhoneCmdParamInteger countParam; |
|
255 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewGetCountOfActiveCalls, &countParam); |
|
256 |
||
257 |
if ( countParam.Integer() ) |
|
258 |
{ |
|
259 |
SetTouchPaneButtons( EPhoneIncallButtons ); |
|
260 |
// Set Hold flag to view |
|
261 |
TPhoneCmdParamBoolean holdFlag; |
|
262 |
holdFlag.SetBoolean( ETrue ); |
|
263 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewSetHoldFlag, &holdFlag ); |
|
264 |
UpdateCbaL( EPhoneCallHandlingInCallCBA ); |
|
265 |
iStateMachine->ChangeState( EPhoneStateSingle ); |
|
266 |
} |
|
267 |
else |
|
268 |
{ |
|
269 |
// Display call termination note, if necessary |
|
270 |
DisplayCallTerminationNoteL(); |
|
271 |
SetTouchPaneButtons( EPhoneCallSetupButtons ); |
|
272 |
UpdateCbaL( EPhoneCallHandlingInCallCBA ); |
|
273 |
iStateMachine->ChangeState( EPhoneStateAlerting ); |
|
274 |
} |
|
275 |
||
276 |
EndUiUpdate(); |
|
277 |
} |
|
278 |
||
279 |
// ----------------------------------------------------------- |
|
280 |
// CPhoneSingleAndAlerting::UpdateInCallCbaL |
|
281 |
// ----------------------------------------------------------- |
|
282 |
// |
|
283 |
void CPhoneSingleAndAlerting::UpdateInCallCbaL() |
|
284 |
{ |
|
285 |
__LOGMETHODSTARTEND(EPhoneControl, "CPhoneSingleAndAlerting::UpdateInCallCbaL() "); |
|
286 |
UpdateCbaL( EPhoneCallHandlingInCallCBA ); |
|
287 |
} |
|
288 |
||
289 |
||
290 |
// End of File |