author | hgs |
Fri, 03 Sep 2010 13:33:36 +0300 | |
changeset 65 | 2a5d4ab426d3 |
parent 50 | 377c906a8701 |
child 74 | d1c62c765e48 |
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 |
{ |
|
65 | 130 |
case EKeyYes: // send-key |
37 | 131 |
if ( CPhoneState::IsNumberEntryUsedL() ) |
132 |
{ |
|
65 | 133 |
CallFromNumberEntryL(); |
37 | 134 |
} |
135 |
else |
|
136 |
{ |
|
137 |
CPhoneState::SendGlobalErrorNoteL( |
|
46
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
138 |
EPhoneNoteTextNotAllowed, ETrue ); |
37 | 139 |
} |
140 |
break; |
|
65 | 141 |
|
142 |
case EKeyNo: // end-key |
|
37 | 143 |
if ( aMessage == EPhoneKeyLongPress ) |
144 |
{ |
|
145 |
iStateMachine->SendPhoneEngineMessage( |
|
146 |
CPEPhoneModelIF::EPEMessageTerminateAllConnections ); |
|
147 |
} |
|
148 |
else |
|
149 |
{ |
|
65 | 150 |
DisconnectOutgoingCallL(); |
37 | 151 |
} |
152 |
||
65 | 153 |
if ( IsNumberEntryUsedL() ) |
37 | 154 |
{ |
155 |
iViewCommandHandle->ExecuteCommandL( |
|
156 |
EPhoneViewRemoveNumberEntry ); |
|
157 |
// Do state-specific operation when number entry is cleared |
|
158 |
HandleNumberEntryClearedL(); |
|
159 |
} |
|
160 |
break; |
|
161 |
||
162 |
default: |
|
163 |
CPhoneAlerting::HandleKeyMessageL( aMessage, aCode ); |
|
164 |
break; |
|
165 |
} |
|
166 |
} |
|
167 |
||
168 |
// ----------------------------------------------------------- |
|
169 |
// CPhoneSingleAndAlerting::HandleConnectedL |
|
170 |
// ----------------------------------------------------------- |
|
171 |
// |
|
172 |
void CPhoneSingleAndAlerting::HandleConnectedL( TInt aCallId ) |
|
173 |
{ |
|
174 |
__LOGMETHODSTARTEND( EPhoneUIStates, |
|
175 |
"CPhoneSingleAndAlerting::HandleConnectedL()"); |
|
176 |
TPhoneCmdParamCallStateData callStateData; |
|
65 | 177 |
callStateData.SetCallState( EPEStateConnecting ); |
37 | 178 |
iViewCommandHandle->HandleCommandL( |
179 |
EPhoneViewGetCallIdByState, &callStateData ); |
|
180 |
||
181 |
if( callStateData.CallId() == aCallId ) |
|
65 | 182 |
{ |
37 | 183 |
TPhoneCmdParamBoolean booleanParam; |
184 |
booleanParam.SetBoolean( EFalse ); |
|
185 |
iViewCommandHandle->ExecuteCommandL( |
|
186 |
EPhoneViewSetNeedToSendToBackgroundStatus, &booleanParam ); |
|
187 |
||
65 | 188 |
BeginUiUpdateLC(); |
189 |
||
37 | 190 |
TPhoneCmdParamCallHeaderData callHeaderParam; |
191 |
callHeaderParam.SetCallState( EPEStateConnected ); |
|
192 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewUpdateBubble, aCallId, |
|
193 |
&callHeaderParam ); |
|
194 |
||
65 | 195 |
SetTouchPaneButtons( EPhoneTwoSinglesButtons ); |
196 |
EndUiUpdate(); |
|
197 |
||
37 | 198 |
TPhoneCmdParamBoolean holdFlag; |
199 |
holdFlag.SetBoolean( EFalse ); |
|
65 | 200 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewSetHoldFlag, &holdFlag ); |
37 | 201 |
|
202 |
UpdateCbaL( EPhoneCallHandlingNewCallSwapCBA ); |
|
203 |
iStateMachine->ChangeState( EPhoneStateTwoSingles ); |
|
204 |
} |
|
205 |
else |
|
206 |
{ |
|
207 |
TPhoneCmdParamCallHeaderData callHeaderParam; |
|
208 |
callHeaderParam.SetCallState( EPEStateConnected ); |
|
209 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewUpdateBubble, aCallId, |
|
210 |
&callHeaderParam ); |
|
211 |
||
212 |
TPhoneCmdParamBoolean holdFlag; |
|
213 |
holdFlag.SetBoolean( EFalse ); |
|
214 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewSetHoldFlag, &holdFlag ); |
|
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
215 |
} |
37 | 216 |
} |
217 |
// ----------------------------------------------------------- |
|
218 |
// CPhoneSingleAndAlerting::HandleIdleL |
|
219 |
// ----------------------------------------------------------- |
|
220 |
// |
|
221 |
void CPhoneSingleAndAlerting::HandleIdleL( TInt aCallId ) |
|
222 |
{ |
|
223 |
__LOGMETHODSTARTEND( EPhoneUIStates, |
|
224 |
"CPhoneSingleAndAlerting::HandleIdleL()"); |
|
225 |
BeginUiUpdateLC(); |
|
226 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveCallHeader, aCallId ); |
|
227 |
||
228 |
if ( !TopAppIsDisplayedL() ) |
|
229 |
{ |
|
230 |
// Continue displaying current app but set up the |
|
231 |
// idle screen in the background |
|
232 |
SetupIdleScreenInBackgroundL(); |
|
233 |
} |
|
234 |
||
235 |
TPhoneCmdParamInteger countParam; |
|
236 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewGetCountOfActiveCalls, &countParam); |
|
237 |
||
238 |
if ( countParam.Integer() ) |
|
239 |
{ |
|
65 | 240 |
SetTouchPaneButtons( EPhoneIncallButtons ); |
37 | 241 |
TPhoneCmdParamBoolean holdFlag; |
242 |
holdFlag.SetBoolean( ETrue ); |
|
243 |
iViewCommandHandle->ExecuteCommandL( EPhoneViewSetHoldFlag, &holdFlag ); |
|
244 |
UpdateCbaL( EPhoneCallHandlingInCallCBA ); |
|
245 |
iStateMachine->ChangeState( EPhoneStateSingle ); |
|
246 |
} |
|
247 |
else |
|
248 |
{ |
|
249 |
DisplayCallTerminationNoteL(); |
|
250 |
SetTouchPaneButtons( EPhoneCallSetupButtons ); |
|
251 |
UpdateCbaL( EPhoneCallHandlingInCallCBA ); |
|
252 |
iStateMachine->ChangeState( EPhoneStateAlerting ); |
|
253 |
} |
|
254 |
EndUiUpdate(); |
|
255 |
} |
|
256 |
||
257 |
// ----------------------------------------------------------- |
|
258 |
// CPhoneSingleAndAlerting::UpdateInCallCbaL |
|
259 |
// ----------------------------------------------------------- |
|
260 |
// |
|
261 |
void CPhoneSingleAndAlerting::UpdateInCallCbaL() |
|
262 |
{ |
|
263 |
__LOGMETHODSTARTEND(EPhoneControl, "CPhoneSingleAndAlerting::UpdateInCallCbaL() "); |
|
264 |
UpdateCbaL( EPhoneCallHandlingInCallCBA ); |
|
265 |
} |
|
266 |
||
267 |
// End of File |