author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 06 Jul 2010 14:15:47 +0300 | |
changeset 46 | bc5a64e5bc3c |
parent 45 | 6b911d05207e |
child 50 | 377c906a8701 |
child 51 | f39ed5e045e0 |
child 56 | 5bcb308bd24d |
permissions | -rw-r--r-- |
37 | 1 |
/* |
2 |
* Copyright (c) 2009 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: Household private class. |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
#include <exception> // must be before e32base.h so uncaught_exception gets defined |
|
19 |
#include <starterclient.h> |
|
20 |
#include <telinternalpskeys.h> |
|
21 |
#include <QLocale> |
|
46
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
22 |
#include <HbTranslator> |
37 | 23 |
#include <telremotepartyinformationpskeys.h> |
24 |
#include <telinformationpskeys.h> |
|
25 |
#include <UikonInternalPSKeys.h> |
|
26 |
#include <startupdomainpskeys.h> |
|
27 |
#include <featmgr.h> // for FeatureManager |
|
28 |
#include <hbmainwindow.h> |
|
29 |
#include "phoneconstants.h" |
|
30 |
#include "cphonelogger.h" |
|
31 |
#include "cphonepubsubproxy.h" |
|
32 |
#include "cphoneuicontroller.h" |
|
33 |
#include "phoneuihousehold_p.h" |
|
34 |
#include "phoneuiqtviewadapter.h" |
|
35 |
#include "phoneuiqtview.h" |
|
36 |
#include "phoneuikeyeventadapter.h" |
|
37 |
#include "phoneuicommandadapter.h" |
|
38 |
#include "phonenotecontroller.h" |
|
39 |
#include "qtphonelog.h" |
|
40 |
#include "cphoneclearblacklist.h" |
|
41 |
#include "hbinstance.h" |
|
42 |
||
43 |
PhoneUiHouseHoldPrivate::PhoneUiHouseHoldPrivate(HbMainWindow &window) : |
|
44 |
iAppsReady (0), iStartupSignalRecoveryId (0), iLightIdleReached (EFalse), |
|
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
45 |
iOnScreenDialer (EFalse), iPhoneUIController (0), |
37 | 46 |
m_window (window) |
47 |
{ |
|
48 |
PHONE_DEBUG("phoneui - Start phoneapp"); |
|
49 |
||
50 |
TRAPD( error, ConstructL() ); |
|
51 |
qt_symbian_throwIfError(error); |
|
52 |
} |
|
53 |
||
54 |
PhoneUiHouseHoldPrivate::~PhoneUiHouseHoldPrivate() |
|
55 |
{ |
|
56 |
while (!m_translators.isEmpty()) { |
|
46
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
57 |
HbTranslator *translator = m_translators.takeFirst(); |
37 | 58 |
delete translator; |
59 |
translator = 0; |
|
60 |
} |
|
61 |
||
62 |
delete iKeyEventAdapter; |
|
63 |
delete iCommandAdapter; |
|
64 |
delete iPhoneUIController; |
|
65 |
delete iViewAdapter; |
|
66 |
} |
|
67 |
||
68 |
TInt PhoneUiHouseHoldPrivate::DoStartupSignalL( TAny* aAny ) |
|
69 |
{ |
|
70 |
PhoneUiHouseHoldPrivate* appUi = |
|
71 |
static_cast< PhoneUiHouseHoldPrivate* >( aAny ); |
|
72 |
||
73 |
return |
|
74 |
!appUi->iLightIdleReached ? |
|
75 |
appUi->DoStartupSignalIdleL() : |
|
76 |
appUi->DoStartupSignalSecurityL(); |
|
77 |
} |
|
78 |
||
79 |
TInt PhoneUiHouseHoldPrivate::DoStartupSignalIdleL() |
|
80 |
{ |
|
81 |
TBool idleReached = EFalse; |
|
82 |
||
83 |
// Check if Idle application has been started. |
|
84 |
const TInt idleUid = 0x20022F35; |
|
85 |
PHONE_DEBUG2("phoneui::DoStartupSignalIdleL() idleUID=", idleUid); |
|
86 |
||
87 |
if ( idleUid != 0 && idleUid != KErrNotFound ) |
|
88 |
{ |
|
89 |
// Idle application has already started |
|
90 |
if ( !( iAppsReady & EPhoneIdleStartedUp ) ) |
|
91 |
{ |
|
92 |
PHONE_DEBUG("phoneui::DoStartupSignalIdleL() Idle App started "); |
|
93 |
iAppsReady += EPhoneIdleStartedUp; |
|
94 |
||
95 |
// Remove Phone application from Fast Swap Window. |
|
96 |
// iPhoneViewController->SetHiddenL( ETrue ); |
|
97 |
||
98 |
// Set Idle's UID to PubSub. |
|
99 |
CPhonePubSubProxy::Instance()->ChangePropertyValue( |
|
100 |
KPSUidUikon, |
|
101 |
KUikVideoCallTopApp, |
|
102 |
idleUid ); |
|
103 |
||
104 |
// hack to make sure EPhonePhase1Ok is set - to be fixed properly |
|
105 |
idleReached = true; |
|
106 |
PHONE_DEBUG("phoneui::DoStartupSignalIdleL() Phone and Idle apps have both been started"); |
|
107 |
CPhonePubSubProxy::Instance()->ChangePropertyValue( |
|
108 |
KPSUidStartup, |
|
109 |
KPSPhonePhase1Ok, |
|
110 |
EPhonePhase1Ok ); |
|
111 |
} |
|
112 |
} |
|
113 |
||
114 |
if ( idleReached ) |
|
115 |
{ |
|
116 |
PHONE_DEBUG("phoneui::DoStartupSignalIdleL() Idle reached!"); |
|
117 |
// Now err == KErrNone and it means that |
|
118 |
// we have succeeded in signalling. |
|
119 |
CPhoneRecoverySystem::Instance()->EnablePreconditionL(); |
|
120 |
||
121 |
// Update the Phone light idle flag |
|
122 |
iLightIdleReached = ETrue; |
|
123 |
||
124 |
// Notify the UI controller that the phone is ready |
|
125 |
iPhoneUIController->HandlePhoneStartupL(); |
|
126 |
} |
|
127 |
else |
|
128 |
{ |
|
129 |
PHONE_DEBUG("phoneui::DoStartupSignalIdleL() Idle is not reached yet!"); |
|
130 |
// Idle has not been reached yet. Indicate to the recovery |
|
131 |
// system that this iteration has failed so that it will |
|
132 |
// try again at a later time. |
|
133 |
User::Leave( KErrNotReady ); |
|
134 |
} |
|
135 |
||
136 |
return KErrNone; |
|
137 |
} |
|
138 |
||
139 |
TInt PhoneUiHouseHoldPrivate::DoStartupSignalSecurityL() |
|
140 |
{ |
|
141 |
TInt err = KErrNone; |
|
142 |
return err; |
|
143 |
} |
|
144 |
||
145 |
void PhoneUiHouseHoldPrivate::HandlePropertyChangedL( |
|
146 |
const TUid& aCategory, const TUint /*aKey*/, const TInt /*aValue*/) |
|
147 |
{ |
|
148 |
PHONE_DEBUG("phoneui::HandlePropertyChangedL()"); |
|
149 |
||
150 |
if ( aCategory == KPSUidStartup ) |
|
151 |
{ |
|
152 |
||
153 |
const TInt startupState = CPhonePubSubProxy::Instance()->Value( |
|
154 |
KPSUidStartup, |
|
155 |
KPSGlobalSystemState ); |
|
156 |
||
157 |
PHONE_DEBUG2("phoneui::HandlePropertyChangedL() StartupState value=%d", startupState ); |
|
158 |
||
159 |
if ( startupState == ESwStateCriticalPhaseOK || |
|
160 |
startupState == ESwStateEmergencyCallsOnly || |
|
161 |
startupState == ESwStateNormalRfOn || |
|
162 |
startupState == ESwStateNormalRfOff || |
|
163 |
startupState == ESwStateNormalBTSap ) |
|
164 |
{ |
|
165 |
PHONE_DEBUG("phoneui::HandlePropertyChangedL() Try to update the startup signal again..." ); |
|
166 |
// Try to update the startup signal again |
|
167 |
CPhoneRecoverySystem::Instance()->RecoverNow( |
|
168 |
iStartupSignalRecoveryId, |
|
169 |
CTeleRecoverySystem::EPhonePriorityHigh ); |
|
170 |
} |
|
171 |
} |
|
172 |
} |
|
173 |
||
174 |
void PhoneUiHouseHoldPrivate::ConstructL() |
|
175 |
{ |
|
176 |
new( ELeave ) CPhoneLogger( KUidPhoneUILoggerSingleton ); |
|
177 |
FeatureManager::InitializeLibL(); |
|
178 |
||
46
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
179 |
HbTranslator *translator = new HbTranslator(QString("telephone")); |
37 | 180 |
|
46
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
181 |
if (translator) { |
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
182 |
translator->loadCommon(); |
37 | 183 |
m_translators.append(translator); |
46
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
184 |
} else { |
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
185 |
delete translator; |
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
186 |
translator = 0; |
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
187 |
} |
37 | 188 |
|
46
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
189 |
HbTranslator *translator2 = new HbTranslator(QString("telephone_cp")); |
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
190 |
if (translator2) { |
37 | 191 |
m_translators.append(translator2); |
192 |
} else { |
|
193 |
delete translator2; |
|
194 |
translator2 = 0; |
|
195 |
} |
|
196 |
||
197 |
PhoneUIQtView *view = new PhoneUIQtView(m_window); |
|
198 |
iViewAdapter = new PhoneUIQtViewAdapter(*view); |
|
199 |
iPhoneUIController = CPhoneUIController::NewL(iViewAdapter); |
|
200 |
||
201 |
m_window.addView (view); |
|
202 |
m_window.setCurrentView (view); |
|
203 |
m_window.scene ()->setFocusItem (view); |
|
204 |
iKeyEventAdapter = new PhoneUIKeyEventAdapter (*iPhoneUIController); |
|
205 |
iCommandAdapter = new PhoneUiCommandAdapter (*iPhoneUIController); |
|
206 |
QObject::connect(view, SIGNAL(dialpadIsAboutToClose()), iViewAdapter, SLOT(dialpadClosed())); |
|
207 |
QObject::connect(view, SIGNAL(keyReleased(QKeyEvent *)), iViewAdapter, SLOT(keyReleased (QKeyEvent *))); |
|
208 |
QObject::connect(view, SIGNAL(keyPressed (QKeyEvent *)), iKeyEventAdapter, SLOT(keyPressed (QKeyEvent *))); |
|
209 |
QObject::connect(view, SIGNAL(keyReleased (QKeyEvent *)), iKeyEventAdapter, SLOT(keyReleased (QKeyEvent *))); |
|
210 |
QObject::connect(view, SIGNAL(command (int)), iCommandAdapter, SLOT(handleCommand (int)), |
|
211 |
Qt::QueuedConnection); // async to enable deletion of widget during signal handling |
|
212 |
QObject::connect(view, SIGNAL(windowActivated()), iViewAdapter, SLOT(handleWindowActivated())); |
|
213 |
QObject::connect(view, SIGNAL(windowDeactivated()), iViewAdapter, SLOT(handleWindowDeactivated())); |
|
214 |
||
215 |
QObject::connect(iViewAdapter->noteController(), SIGNAL(command (int)), |
|
216 |
iCommandAdapter, SLOT(handleCommand (int))); |
|
217 |
||
218 |
// Disable default Send key functionality in application framework |
|
219 |
CAknAppUi *appUi = static_cast<CAknAppUi*>(CEikonEnv::Static()->AppUi()); |
|
220 |
appUi->SetKeyEventFlags( CAknAppUiBase::EDisableSendKeyShort | |
|
221 |
CAknAppUiBase::EDisableSendKeyLong ); |
|
222 |
||
223 |
// CLI Name. |
|
224 |
TInt err = RProperty::Define( |
|
225 |
KPSUidTelRemotePartyInformation, |
|
226 |
KTelCLIName, |
|
227 |
RProperty::EText, |
|
228 |
KPhoneReadPolicy, |
|
229 |
KPhoneWritePolicy ); |
|
230 |
||
231 |
// CLI Number. |
|
232 |
err = RProperty::Define( |
|
233 |
KPSUidTelRemotePartyInformation, |
|
234 |
KTelCLINumber, |
|
235 |
RProperty::EText, |
|
236 |
KPhoneReadPolicy, |
|
237 |
KPhoneWritePolicy ); |
|
238 |
||
239 |
// Define the top application system property |
|
240 |
err = RProperty::Define( |
|
241 |
KPSUidUikon, |
|
242 |
KUikVideoCallTopApp, |
|
243 |
RProperty::EInt, |
|
244 |
KPhoneReadPolicy, |
|
245 |
KPhoneWritePolicy ); |
|
246 |
||
247 |
||
248 |
// Startup event signalling |
|
249 |
// Define the telephony application system property |
|
250 |
||
251 |
err = RProperty::Define( |
|
252 |
KPSUidTelInformation, |
|
253 |
KTelPhoneUid, |
|
254 |
RProperty::EInt, |
|
255 |
KPhoneReadPolicy, |
|
256 |
KPhoneWritePolicy ); |
|
257 |
||
258 |
// DefineNewPSKeys: |
|
259 |
||
260 |
// UID: KPSUidTelInternalInformation: |
|
261 |
err = RProperty::Define( |
|
262 |
KPSUidTelInternalInformation, |
|
263 |
KTelRemotePartyContactInfo, |
|
264 |
RProperty::EByteArray, |
|
265 |
KPhoneReadPolicy, |
|
266 |
KPhoneWritePolicy ); |
|
267 |
||
268 |
// VT UID. |
|
269 |
err = RProperty::Define( |
|
270 |
KPSUidTelInternalInformation, |
|
271 |
KTelVideoCallUid, |
|
272 |
RProperty::EInt, |
|
273 |
KPhoneReadPolicy, |
|
274 |
KPhoneWritePolicy ); |
|
275 |
||
276 |
// TELINTERNALPSKEY CHANGE |
|
277 |
// Move to AudioHandling |
|
278 |
// UID: KPSUidTelAudioPreference |
|
279 |
// Call Audio Routing |
|
280 |
err = RProperty::Define( |
|
281 |
KPSUidTelAudioPreference, |
|
282 |
KTelAudioOutput, |
|
283 |
RProperty::EInt, |
|
284 |
KPhoneReadPolicyAlwaysPass, |
|
285 |
KPhoneWritePolicy ); |
|
286 |
||
287 |
// UID: KPSUidNEInformation |
|
288 |
err = RProperty::Define( |
|
289 |
KPSUidNEInformation, |
|
290 |
KTelNumberEntryInfo, |
|
291 |
RProperty::EInt, |
|
292 |
KPhoneReadPolicyAlwaysPass, |
|
293 |
KPhoneWritePolicy ); |
|
294 |
||
295 |
||
296 |
// Add DoStartupSignalL to the recovery system |
|
297 |
iStartupSignalRecoveryId = |
|
298 |
CPhoneRecoverySystem::Instance()->AddL( |
|
299 |
TCallBack( DoStartupSignalL, this ), |
|
300 |
CTeleRecoverySystem::EPhonePriorityHigh, |
|
301 |
CTeleRecoverySystem::EPhoneStateIdle ); |
|
302 |
||
303 |
// Call DoStartupSignalL within recovery system |
|
304 |
const TInt startupState = CPhonePubSubProxy::Instance()->Value( |
|
305 |
KPSUidStartup, |
|
306 |
KPSGlobalSystemState ); |
|
307 |
||
308 |
PHONE_DEBUG2("phoneui::main() startupState value=", startupState ); |
|
309 |
||
310 |
if ( startupState == ESwStateCriticalPhaseOK || |
|
311 |
startupState == ESwStateEmergencyCallsOnly || |
|
312 |
startupState == ESwStateNormalRfOn || |
|
313 |
startupState == ESwStateNormalRfOff || |
|
314 |
startupState == ESwStateNormalBTSap ) |
|
315 |
{ |
|
316 |
PHONE_DEBUG("phoneui::main() Notify Starter that phone is ready..."); |
|
317 |
CPhoneRecoverySystem::Instance()->RecoverNow( |
|
318 |
iStartupSignalRecoveryId, |
|
319 |
CTeleRecoverySystem::EPhonePriorityHigh ); |
|
320 |
} |
|
321 |
else |
|
322 |
{ |
|
323 |
PHONE_DEBUG("phoneui::main() Startup not ready yet. Start listening..."); |
|
324 |
CPhonePubSubProxy::Instance()->NotifyChangeL( |
|
325 |
KPSUidStartup, |
|
326 |
KPSGlobalSystemState, |
|
327 |
this ); |
|
328 |
} |
|
329 |
||
330 |
if ( err == KErrNone || err == KErrAlreadyExists ) |
|
331 |
{ |
|
332 |
// Indicate to the system that the Phone has been started |
|
333 |
CPhonePubSubProxy::Instance()->ChangePropertyValue( |
|
334 |
KPSUidTelInformation, |
|
335 |
KTelPhoneUid, |
|
336 |
KUidPhoneApplication.iUid ); |
|
337 |
} |
|
338 |
||
339 |
// Update the Apps ready flag |
|
340 |
iAppsReady += EPhoneStartedUp; |
|
341 |
||
342 |
if ( FeatureManager::FeatureSupported( KFeatureIdOnScreenDialer ) ) |
|
343 |
{ |
|
344 |
iOnScreenDialer = ETrue; |
|
345 |
} |
|
346 |
||
347 |
HbMainWindow *main = hbInstance->allMainWindows().at(0); |
|
348 |
RWindow *win = static_cast<RWindow *>(main->effectiveWinId()->DrawableWindow()); |
|
349 |
||
350 |
CEikonEnv* env = CEikonEnv::Static(); |
|
351 |
if ( env ) { |
|
352 |
env->SetSystem(ETrue); |
|
353 |
// Blacklist singleton is initialized here |
|
354 |
CPhoneClearBlacklist::CreateL( env->WsSession(), *win); |
|
355 |
} |
|
356 |
} |
|
357 |