19
|
1 |
/*
|
|
2 |
* Copyright (c) 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 is an implementation class for checking which
|
|
15 |
* application or profile needs to be activated and then
|
|
16 |
* starts it.
|
|
17 |
*
|
|
18 |
*/
|
|
19 |
|
|
20 |
|
|
21 |
// INCLUDE FILES
|
|
22 |
#include "appcontroller.h"
|
|
23 |
#include <vcexecutorapp.rsg>
|
|
24 |
#include "appcontroller.hrh"
|
|
25 |
#include "appcontrollerconstants.h"
|
|
26 |
#include <aknlists.h>
|
|
27 |
#include <aknPopup.h>
|
|
28 |
#include <apgtask.h> //TApaTask, TApaTaskList
|
|
29 |
#include <apacmdln.h> //CApaCommandLine
|
|
30 |
#include <w32std.h> // RWsSession
|
|
31 |
#include <e32svr.h>
|
|
32 |
#include <StringLoader.h>
|
|
33 |
#include <f32file.h>
|
|
34 |
#include <badesca.h>
|
|
35 |
#include <bautils.h>
|
|
36 |
#include <barsc.h>
|
|
37 |
#include <e32def.h>
|
|
38 |
|
|
39 |
#include <PSVariables.h>
|
|
40 |
#include "appcontrollerpropertyhandler.h"
|
|
41 |
#include <ctsydomainpskeys.h>
|
|
42 |
|
|
43 |
#include <startupdomainpskeys.h>
|
|
44 |
|
|
45 |
#include <centralrepository.h>
|
|
46 |
|
|
47 |
|
|
48 |
#include <CoreApplicationUIsSDKCRKeys.h>
|
|
49 |
|
|
50 |
#include <aknnotewrappers.h>
|
|
51 |
#include <featmgr.h>
|
|
52 |
#include <bldvariant.hrh>
|
|
53 |
#include <AknQueryDialog.h>
|
|
54 |
|
|
55 |
#include <sendui.h> //CreateAndSendMessageL()
|
|
56 |
#include <TSendingCapabilities.h>
|
|
57 |
#include <SendUiConsts.h>
|
|
58 |
|
|
59 |
#include <MsgArrays.h>
|
|
60 |
|
|
61 |
#include <coemain.h>
|
|
62 |
|
|
63 |
// Profile Engine API
|
|
64 |
#include <Profile.hrh>
|
|
65 |
|
|
66 |
#include <AknNotifierController.h>
|
|
67 |
#include <AknGlobalConfirmationQuery.h> // Confirmation query.
|
|
68 |
#include "appcontrolleractiveobject.h" // CAppControllerActiveObject.
|
|
69 |
#include <AknGlobalNote.h> // Information note
|
|
70 |
#include <data_caging_path_literals.hrh> // KDC_RESOURCE_FILES_DIR
|
|
71 |
|
|
72 |
#include "rubydebug.h"
|
|
73 |
|
|
74 |
|
|
75 |
#include <aiwdialdata.h>
|
|
76 |
#include <AiwDialDataTypes.h>
|
|
77 |
#include <AiwServiceHandler.h>
|
|
78 |
#include <gslauncher.h>
|
|
79 |
|
|
80 |
|
|
81 |
// Cover UI start
|
|
82 |
#include "secondarydisplay/appcontrollersecondarydisplayapi.h"
|
|
83 |
#include "SecondaryDisplay/SecondaryDisplaySysApAPI.h"
|
|
84 |
// Cover UI end
|
|
85 |
|
|
86 |
const TUid KAppManagerUid = { 0x10283321 }; // Control Panel Application Manager UID
|
|
87 |
const TUid KVoiceCommandUid = { 0x10282C40 }; // Control Panel Voice Command UID
|
|
88 |
|
|
89 |
// ================= MEMBER FUNCTIONS =======================
|
|
90 |
|
|
91 |
// C++ default constructor can NOT contain any code, that
|
|
92 |
// might leave.
|
|
93 |
//
|
|
94 |
CVCApplicationControllerImpl::CVCApplicationControllerImpl() : iResourceFileOffset( 0 )
|
|
95 |
{
|
|
96 |
}
|
|
97 |
|
|
98 |
// Destructor
|
|
99 |
CVCApplicationControllerImpl::~CVCApplicationControllerImpl()
|
|
100 |
{
|
|
101 |
if( iApaLsSession )
|
|
102 |
{
|
|
103 |
iApaLsSession->Close();
|
|
104 |
delete iApaLsSession;
|
|
105 |
}
|
|
106 |
|
|
107 |
|
|
108 |
delete iPropertyHandler;
|
|
109 |
delete iMsgTypes;
|
|
110 |
|
|
111 |
if (iSendUi)
|
|
112 |
{
|
|
113 |
delete iSendUi;
|
|
114 |
}
|
|
115 |
|
|
116 |
// Delete active object.
|
|
117 |
if ( iActiveObject )
|
|
118 |
{
|
|
119 |
iActiveObject->Cancel();
|
|
120 |
delete iActiveObject;
|
|
121 |
}
|
|
122 |
|
|
123 |
if (iProfileEngine)
|
|
124 |
{
|
|
125 |
iProfileEngine->Release();
|
|
126 |
iProfileEngine = NULL;
|
|
127 |
}
|
|
128 |
|
|
129 |
delete iGlobalConfQuery;
|
|
130 |
|
|
131 |
delete iQueryDialog;
|
|
132 |
|
|
133 |
if ( iCoeEnv && iEikonEnv->EikAppUi() )
|
|
134 |
{
|
|
135 |
iEikonEnv->EikAppUi()->RemoveFromStack( this );
|
|
136 |
}
|
|
137 |
|
|
138 |
FeatureManager::UnInitializeLib();
|
|
139 |
}
|
|
140 |
|
|
141 |
// ---------------------------------------------------------
|
|
142 |
// CVCApplicationControllerImpl::ConstructL
|
|
143 |
// Symbian 2nd phase constructor
|
|
144 |
// ---------------------------------------------------------
|
|
145 |
//
|
|
146 |
void CVCApplicationControllerImpl::ConstructL()
|
|
147 |
{
|
|
148 |
RUBY_DEBUG_BLOCKL( "CVCApplicationControllerImpl::ConstructL" );
|
|
149 |
|
|
150 |
// Sets up TLS, must be done before FeatureManager is used.
|
|
151 |
FeatureManager::InitializeLibL();
|
|
152 |
|
|
153 |
iPropertyHandler = CAppControllerPropertyHandler::NewL(
|
|
154 |
KPSUidCtsyCallInformation, KCTsyCallState, this);
|
|
155 |
|
|
156 |
// Create active object to handle note request statuses.
|
|
157 |
iActiveObject = new (ELeave) CAppControllerActiveObject( *this );
|
|
158 |
|
|
159 |
iGlobalConfQuery = CAknGlobalConfirmationQuery::NewL();
|
|
160 |
}
|
|
161 |
|
|
162 |
// ----------------------------------------------------------------
|
|
163 |
// CVCApplicationControllerImpl* CVCApplicationControllerImpl::NewL
|
|
164 |
// Two-phased constructor.
|
|
165 |
// ----------------------------------------------------------------
|
|
166 |
//
|
|
167 |
CVCApplicationControllerImpl* CVCApplicationControllerImpl::NewL()
|
|
168 |
{
|
|
169 |
CVCApplicationControllerImpl* self= new (ELeave) CVCApplicationControllerImpl();
|
|
170 |
CleanupStack::PushL(self);
|
|
171 |
self->ConstructL();
|
|
172 |
CleanupStack::Pop();
|
|
173 |
return self;
|
|
174 |
}
|
|
175 |
|
|
176 |
// ---------------------------------------------------------
|
|
177 |
// CVCApplicationControllerImpl::ExecuteCommandL
|
|
178 |
// Checks the Id and diverts the application or profile
|
|
179 |
// to the right launching engine.
|
|
180 |
// ---------------------------------------------------------
|
|
181 |
//
|
|
182 |
TInt CVCApplicationControllerImpl::ExecuteCommandL( TUint aCommandId,
|
|
183 |
const TDesC& /*aParameters*/ )
|
|
184 |
{
|
|
185 |
RUBY_DEBUG_BLOCKL( "CVCApplicationControllerImpl::ExecuteCommandL" );
|
|
186 |
|
|
187 |
TInt err = KErrNone;
|
|
188 |
|
|
189 |
// The method we're about to launch is an application, recognized by it's first name.
|
|
190 |
if( aCommandId < KFirstProfileValue )
|
|
191 |
{
|
|
192 |
err = DoExecuteCommandL( aCommandId, KNullDesC() );
|
|
193 |
}
|
|
194 |
// The method we're about to launch is a profile, recognized by it's first name
|
|
195 |
else if( ( aCommandId >= KFirstProfileValue) && ( aCommandId < KSecondProfileValue) )
|
|
196 |
{
|
|
197 |
aCommandId -= KProfileValue;
|
|
198 |
ProfileEngL( aCommandId );
|
|
199 |
}
|
|
200 |
// The method we're about to launch is a profile, recognized by it's second name
|
|
201 |
else if ( ( aCommandId >= KSecondProfileValue ) )
|
|
202 |
{
|
|
203 |
aCommandId -= KFirstProfileValue;
|
|
204 |
ProfileEngL( aCommandId );
|
|
205 |
}
|
|
206 |
else
|
|
207 |
{
|
|
208 |
// Id does not match.
|
|
209 |
RUBY_DEBUG1( "CVCApplicationControllerImpl::ExecuteCommandL: command id %d not found", aCommandId );
|
|
210 |
User::Leave( KErrArgument );
|
|
211 |
}
|
|
212 |
|
|
213 |
return err;
|
|
214 |
}
|
|
215 |
|
|
216 |
// ---------------------------------------------------------
|
|
217 |
// CVCApplicationControllerImpl::DoExecuteCommandL
|
|
218 |
// Checks the Id and diverts the application or profile
|
|
219 |
// to the right launching engine.
|
|
220 |
// ---------------------------------------------------------
|
|
221 |
//
|
|
222 |
TInt CVCApplicationControllerImpl::DoExecuteCommandL( TUint aCommandId, const TDesC& /*aParameters*/ )
|
|
223 |
{
|
|
224 |
RUBY_DEBUG_BLOCKL( "CVCApplicationControllerImpl::DoExecuteCommandL" );
|
|
225 |
|
|
226 |
RUBY_DEBUG1( "CVCApplicationControllerImpl::DoExecuteCommandL. executing command with id %d", aCommandId );
|
|
227 |
|
|
228 |
iCallStatus = EFalse;
|
|
229 |
TInt err = KErrNone;
|
|
230 |
CGSLauncher* gsLauncher( NULL );
|
|
231 |
TUid zeroUid = {0};
|
|
232 |
// Check which app needs to be activated
|
|
233 |
switch( aCommandId )
|
|
234 |
{
|
|
235 |
case EAppVoiceMail:
|
|
236 |
|
|
237 |
err = VmbxEngL();
|
|
238 |
break;
|
|
239 |
#ifdef __BT
|
|
240 |
case EAppBluetooth:
|
|
241 |
|
|
242 |
err = BTEngL();
|
|
243 |
break;
|
|
244 |
#endif
|
|
245 |
case EAppWriteMessage:
|
|
246 |
|
|
247 |
ActivateMessageL( EEditorTypeNewMessage );
|
|
248 |
break;
|
|
249 |
|
|
250 |
case EAppWriteEmail:
|
|
251 |
|
|
252 |
ActivateMessageL( EEditorTypeNewEmail );
|
|
253 |
break;
|
|
254 |
|
|
255 |
case EAppWritePostcard:
|
|
256 |
|
|
257 |
ActivateMessageL( EEditorTypePostcard );
|
|
258 |
break;
|
|
259 |
|
|
260 |
case EAppApplicationManagerCPView:
|
|
261 |
gsLauncher = CGSLauncher::NewLC();
|
|
262 |
gsLauncher->LaunchGSViewL( KAppManagerUid, zeroUid, KNullDesC8 );
|
|
263 |
CleanupStack::PopAndDestroy( gsLauncher );
|
|
264 |
break;
|
|
265 |
|
|
266 |
case EAppVoiceCommandCPView:
|
|
267 |
gsLauncher = CGSLauncher::NewLC();
|
|
268 |
gsLauncher->LaunchGSViewL( KVoiceCommandUid, zeroUid, KNullDesC8 );
|
|
269 |
CleanupStack::PopAndDestroy( gsLauncher );
|
|
270 |
break;
|
|
271 |
|
|
272 |
default:
|
|
273 |
err = KErrNotSupported;
|
|
274 |
break;
|
|
275 |
}
|
|
276 |
|
|
277 |
// Check if it's profile
|
|
278 |
if ( err == KErrNotSupported && aCommandId >= KProfileIdsStart )
|
|
279 |
{
|
|
280 |
ProfileEngL( aCommandId );
|
|
281 |
}
|
|
282 |
|
|
283 |
return err;
|
|
284 |
}
|
|
285 |
|
|
286 |
// ---------------------------------------------------------
|
|
287 |
// CVCApplicationControllerImpl::ProfileEngL
|
|
288 |
// Check which profile user wants to activate and do it.
|
|
289 |
// ---------------------------------------------------------
|
|
290 |
//
|
|
291 |
void CVCApplicationControllerImpl::ProfileEngL( TUint aCommandId )
|
|
292 |
{
|
|
293 |
RUBY_DEBUG_BLOCKL( "CVCApplicationControllerImpl::ProfileEngL" );
|
|
294 |
|
|
295 |
// cut the VAS DB value from aCommandId so we can activate the profile.
|
|
296 |
iProfileId = 0;
|
|
297 |
iProfileId = aCommandId -= KProfileValue;
|
|
298 |
|
|
299 |
RUBY_DEBUG1( "CVCApplicationControllerImpl::ProfileEngL: Trying to activate profile id: %d", iProfileId );
|
|
300 |
|
|
301 |
// Create profile engine
|
|
302 |
iProfileEngine = CreateProfileEngineL();
|
|
303 |
|
|
304 |
// If Off-line profile is supported
|
|
305 |
if( ( FeatureManager::FeatureSupported( KFeatureIdOfflineMode ) ) &&
|
|
306 |
// and active profile is Off-line
|
|
307 |
( iProfileEngine->ActiveProfileId() == EProfileOffLineId ) &&
|
|
308 |
// and currently focused profile is not Off-line
|
|
309 |
( iProfileId != EProfileOffLineId ) )
|
|
310 |
{
|
|
311 |
// We are changing from Off-line to a normal profile.
|
|
312 |
// Check if SIM card exists or not
|
|
313 |
TInt simCStatus( ESimNotPresent );
|
|
314 |
|
|
315 |
RProperty simStatus;
|
|
316 |
User::LeaveIfError(
|
|
317 |
simStatus.Attach( KPSUidStartup, KPSSimStatus ) );
|
|
318 |
User::LeaveIfError( simStatus.Get( simCStatus ) );
|
|
319 |
simStatus.Close();
|
|
320 |
|
|
321 |
if( simCStatus == ESimNotPresent )
|
|
322 |
{
|
|
323 |
// SIM card does not exist.
|
|
324 |
// Show an information note and exit from method.
|
|
325 |
HBufC* infoText = StringLoader::LoadLC( R_TEXT_INSERT_SIM );
|
|
326 |
CAknInformationNote* note =
|
|
327 |
new( ELeave ) CAknInformationNote( ETrue );
|
|
328 |
// Cover UI start
|
|
329 |
if ( FeatureManager::FeatureSupported( KFeatureIdCoverDisplay ) )
|
|
330 |
{
|
|
331 |
// Initializes cover support
|
|
332 |
note->PublishDialogL( SecondaryDisplay::ECmdShowInsertSimNote,
|
|
333 |
SecondaryDisplay::KCatSysAp );
|
|
334 |
}
|
|
335 |
// Cover UI end
|
|
336 |
|
|
337 |
note->ExecuteLD( *infoText );
|
|
338 |
CleanupStack::PopAndDestroy( infoText );
|
|
339 |
return;
|
|
340 |
}
|
|
341 |
else
|
|
342 |
{
|
|
343 |
iState = EQueryDialog;
|
|
344 |
|
|
345 |
if ( iCoeEnv && iEikonEnv->EikAppUi() )
|
|
346 |
{
|
|
347 |
iEikonEnv->EikAppUi()->AddToStackL( this, ECoeStackPriorityAlert );
|
|
348 |
}
|
|
349 |
|
|
350 |
iQueryDialog = CAknQueryDialog::NewL();
|
|
351 |
// Cover UI start
|
|
352 |
if ( FeatureManager::FeatureSupported( KFeatureIdCoverDisplay ) )
|
|
353 |
{
|
|
354 |
// Initializes cover support
|
|
355 |
iQueryDialog->PublishDialogL(
|
|
356 |
SecondaryDisplay::ECmdShowLeaveOfflineProfileQuery,
|
|
357 |
SecondaryDisplay::KCatAppController );
|
|
358 |
}
|
|
359 |
// Cover UI end
|
|
360 |
|
|
361 |
TInt result = iQueryDialog->ExecuteLD( R_LEAVE_OFFLINE_PROFILE_CONFIRMATION_QUERY );
|
|
362 |
|
|
363 |
iQueryDialog = NULL;
|
|
364 |
if ( iCoeEnv && iEikonEnv->EikAppUi() )
|
|
365 |
{
|
|
366 |
iEikonEnv->EikAppUi()->RemoveFromStack( this );
|
|
367 |
}
|
|
368 |
|
|
369 |
if ( !result )
|
|
370 |
{
|
|
371 |
// SIM card exists.
|
|
372 |
// User replied that he/she doesn't want to activate RF.
|
|
373 |
// Exit from method, do not activate the selected profile.
|
|
374 |
|
|
375 |
return;
|
|
376 |
}
|
|
377 |
}
|
|
378 |
}
|
|
379 |
iProfileEngine->SetActiveProfileL( iProfileId );
|
|
380 |
}
|
|
381 |
|
|
382 |
// ---------------------------------------------------------
|
|
383 |
// CVCApplicationControllerImpl::VmbxEngL()
|
|
384 |
// Get the Voice mailbox number and make the call.
|
|
385 |
// ---------------------------------------------------------
|
|
386 |
//
|
|
387 |
TInt CVCApplicationControllerImpl::VmbxEngL()
|
|
388 |
{
|
|
389 |
RUBY_DEBUG_BLOCK( "CVCApplicationControllerImpl::VmbxEngL" );
|
|
390 |
|
|
391 |
iState = EVoiceMail;
|
|
392 |
|
|
393 |
TBuf<KVmbxMaxNumberLength> iNumber;
|
|
394 |
|
|
395 |
|
|
396 |
// existing ETel connection should be used in Open() where available
|
|
397 |
User::LeaveIfError( iVmbx.Open() );
|
|
398 |
|
|
399 |
// Get vmbx number, active ALS line used as default
|
|
400 |
TInt err = iVmbx.GetVmbxNumber( iNumber );
|
|
401 |
|
|
402 |
|
|
403 |
if( err != KErrNone && err != KErrNotFound )
|
|
404 |
{
|
|
405 |
User::Leave( err );
|
|
406 |
}
|
|
407 |
|
|
408 |
// If not found, query the user to enter it
|
|
409 |
if (err == KErrNotFound)
|
|
410 |
{
|
|
411 |
RUBY_DEBUG0( "Querying voice mailbox number" );
|
|
412 |
if ( iVmbx.QueryNumberL(EVmbxNotDefinedQuery, iNumber) )
|
|
413 |
{
|
|
414 |
if( iNumber.Length() )
|
|
415 |
{
|
|
416 |
RUBY_DEBUG0( "CVCApplicationControllerImpl::VmbxEngL: calling voice mailbox number" );
|
|
417 |
DialVmbxL( iNumber );
|
|
418 |
}
|
|
419 |
else
|
|
420 |
{
|
|
421 |
// User entered incorrect number of nothing
|
|
422 |
// This is handled by the vmbx engine.
|
|
423 |
}
|
|
424 |
}
|
|
425 |
else
|
|
426 |
{
|
|
427 |
// User pressed cancel
|
|
428 |
}
|
|
429 |
}
|
|
430 |
// vmbx number was found so just make the call.
|
|
431 |
else if (!err && iNumber.Length())
|
|
432 |
{
|
|
433 |
RUBY_DEBUG0( "CVCApplicationControllerImpl::VmbxEngL: calling voice mailbox number" );
|
|
434 |
DialVmbxL( iNumber );
|
|
435 |
}
|
|
436 |
|
|
437 |
iVmbx.Close();
|
|
438 |
|
|
439 |
return err;
|
|
440 |
}
|
|
441 |
|
|
442 |
// ---------------------------------------------------------
|
|
443 |
// CVCApplicationControllerImpl::DialVmbxL
|
|
444 |
// Does the call to voice mailbox number
|
|
445 |
// ---------------------------------------------------------
|
|
446 |
//
|
|
447 |
void CVCApplicationControllerImpl::DialVmbxL( const TDesC& aNumber )
|
|
448 |
{
|
|
449 |
|
|
450 |
CAiwServiceHandler* serviceHandler = CAiwServiceHandler::NewLC();
|
|
451 |
|
|
452 |
// Create AIW interest
|
|
453 |
RCriteriaArray interest;
|
|
454 |
CleanupClosePushL( interest ); // cleanup stack 2
|
|
455 |
CAiwCriteriaItem* criteria = CAiwCriteriaItem::NewLC(
|
|
456 |
KAiwCmdCall, KAiwCmdCall,
|
|
457 |
_L8( "*" ) ); // cleanup stack 3
|
|
458 |
TUid base;
|
|
459 |
base.iUid = KAiwClassBase;
|
|
460 |
criteria->SetServiceClass( base );
|
|
461 |
User::LeaveIfError( interest.Append( criteria ) );
|
|
462 |
|
|
463 |
// attach to AIW interest
|
|
464 |
serviceHandler->AttachL( interest );
|
|
465 |
|
|
466 |
CAiwDialData* dialData = CAiwDialData::NewLC();
|
|
467 |
dialData->SetPhoneNumberL( aNumber );
|
|
468 |
|
|
469 |
dialData->SetCallType( CAiwDialData::EAIWForcedCS );
|
|
470 |
|
|
471 |
CAiwGenericParamList& paramList = serviceHandler->InParamListL();
|
|
472 |
dialData->FillInParamListL(paramList);
|
|
473 |
|
|
474 |
serviceHandler->ExecuteServiceCmdL( KAiwCmdCall,
|
|
475 |
paramList,
|
|
476 |
serviceHandler->OutParamListL(),
|
|
477 |
0,
|
|
478 |
this );
|
|
479 |
|
|
480 |
iWait.Start();
|
|
481 |
|
|
482 |
CleanupStack::PopAndDestroy( dialData );
|
|
483 |
CleanupStack::PopAndDestroy( criteria );
|
|
484 |
CleanupStack::PopAndDestroy( &interest );
|
|
485 |
CleanupStack::PopAndDestroy( serviceHandler );
|
|
486 |
|
|
487 |
}
|
|
488 |
|
|
489 |
// ---------------------------------------------------------
|
|
490 |
// CVCApplicationControllerImpl::BTEngL()
|
|
491 |
// Check if BT is on/off and change it.
|
|
492 |
// ---------------------------------------------------------
|
|
493 |
//
|
|
494 |
#ifdef __BT
|
|
495 |
TInt CVCApplicationControllerImpl::BTEngL()
|
|
496 |
{
|
|
497 |
RUBY_DEBUG_BLOCKL( "CVCApplicationControllerImpl::BTEngL" );
|
|
498 |
|
|
499 |
TInt err = KErrNone;
|
|
500 |
|
|
501 |
TBTPowerStateValue powerState = EBTPowerOff;
|
|
502 |
CBTEngSettings* mcm = CBTEngSettings::NewLC(NULL); // No callbacks from this environment
|
|
503 |
|
|
504 |
// Getter for BT MCM power mode
|
|
505 |
// returns power mode via powerState reference
|
|
506 |
err = mcm->GetPowerState( powerState );
|
|
507 |
|
|
508 |
if( ( powerState == EBTPowerOff ) && ( !err ) ) // Power is OFF
|
|
509 |
{
|
|
510 |
TInt offlineModeOff( 0 ); // possible values are 0 and 1
|
|
511 |
TInt activationEnabled( 0 ); // possible values are 0 and 1
|
|
512 |
|
|
513 |
// Check whether local Bluetooth name is defined
|
|
514 |
TBuf<KBTMaxNameLength> btName;
|
|
515 |
mcm->GetLocalName( btName );
|
|
516 |
if ( btName.Length() <= 0 )
|
|
517 |
{
|
|
518 |
// Activate Bluetooth UI
|
|
519 |
ActivateAppL( KUidAppBtUi );
|
|
520 |
}
|
|
521 |
else
|
|
522 |
{
|
|
523 |
// Checks whether off-line mode is on and whether Bluetooth can be
|
|
524 |
// activated in off-line mode
|
|
525 |
GetOfflineModeFlagsL( offlineModeOff, activationEnabled );
|
|
526 |
|
|
527 |
if ( !offlineModeOff )
|
|
528 |
{
|
|
529 |
// Choose user interaction
|
|
530 |
if ( activationEnabled )
|
|
531 |
{
|
|
532 |
iState = EQueryDialog;
|
|
533 |
|
|
534 |
if ( iCoeEnv && iEikonEnv->EikAppUi() )
|
|
535 |
{
|
|
536 |
iEikonEnv->EikAppUi()->AddToStackL( this, ECoeStackPriorityAlert );
|
|
537 |
}
|
|
538 |
|
|
539 |
// Create and show query
|
|
540 |
//
|
|
541 |
iQueryDialog = CAknQueryDialog::NewL(CAknQueryDialog::ENoTone);
|
|
542 |
// Cover UI start
|
|
543 |
if ( FeatureManager::FeatureSupported( KFeatureIdCoverDisplay ) )
|
|
544 |
{
|
|
545 |
// Initializes cover support
|
|
546 |
iQueryDialog->PublishDialogL(
|
|
547 |
SecondaryDisplay::ECmdShowOfflineBtActivationQuery,
|
|
548 |
SecondaryDisplay::KCatAppController );
|
|
549 |
}
|
|
550 |
// Cover UI end
|
|
551 |
TInt result = iQueryDialog->ExecuteLD(R_BT_ACTIVATE_IN_OFFLINE_QUERY);
|
|
552 |
|
|
553 |
iQueryDialog = NULL;
|
|
554 |
if ( iCoeEnv && iEikonEnv->EikAppUi() )
|
|
555 |
{
|
|
556 |
iEikonEnv->EikAppUi()->RemoveFromStack( this );
|
|
557 |
}
|
|
558 |
|
|
559 |
if ( result )
|
|
560 |
{
|
|
561 |
err = mcm->SetPowerState( EBTPowerOn ); // Set power on
|
|
562 |
}
|
|
563 |
}
|
|
564 |
else
|
|
565 |
{
|
|
566 |
HBufC* stringHolder = StringLoader::LoadLC( R_BT_OFFLINE_DISABLED );
|
|
567 |
CAknInformationNote* note = new (ELeave) CAknInformationNote();
|
|
568 |
// Cover UI start
|
|
569 |
if ( FeatureManager::FeatureSupported( KFeatureIdCoverDisplay ) )
|
|
570 |
{
|
|
571 |
// Initializes cover support
|
|
572 |
note->PublishDialogL( SecondaryDisplay::ECmdShowBtDisabledOfflineNote,
|
|
573 |
SecondaryDisplay::KCatAppController );
|
|
574 |
}
|
|
575 |
// Cover UI end
|
|
576 |
|
|
577 |
note->ExecuteLD( *stringHolder );
|
|
578 |
CleanupStack::PopAndDestroy(); //stringHolder
|
|
579 |
}
|
|
580 |
}
|
|
581 |
else
|
|
582 |
{
|
|
583 |
// Offline mode is off
|
|
584 |
//
|
|
585 |
if ( activationEnabled )
|
|
586 |
{
|
|
587 |
err = mcm->SetPowerState( EBTPowerOn ); // Set power on
|
|
588 |
}
|
|
589 |
}
|
|
590 |
}
|
|
591 |
}
|
|
592 |
else if(( powerState == EBTPowerOn ) && ( !err )) // Power is ON
|
|
593 |
{
|
|
594 |
err = mcm->SetPowerState( EBTPowerOff ); // Set power off
|
|
595 |
}
|
|
596 |
|
|
597 |
CleanupStack::PopAndDestroy( mcm );
|
|
598 |
|
|
599 |
if ( err != KErrNone )
|
|
600 |
{
|
|
601 |
HBufC* text = StringLoader::LoadLC(R_BT_GENERAL_ERROR);
|
|
602 |
CAknErrorNote* dlg = new (ELeave) CAknErrorNote(ETrue);
|
|
603 |
// Cover UI start
|
|
604 |
if ( FeatureManager::FeatureSupported( KFeatureIdCoverDisplay ) )
|
|
605 |
{
|
|
606 |
// Initializes cover support
|
|
607 |
dlg->PublishDialogL( SecondaryDisplay::ECmdShowBtGeneralErrorNote,
|
|
608 |
SecondaryDisplay::KCatAppController );
|
|
609 |
}
|
|
610 |
// Cover UI end
|
|
611 |
|
|
612 |
dlg->ExecuteLD(*text);
|
|
613 |
CleanupStack::PopAndDestroy(); // text
|
|
614 |
}
|
|
615 |
return err;
|
|
616 |
}
|
|
617 |
|
|
618 |
#endif // __BT
|
|
619 |
|
|
620 |
// ----------------------------------------------------------
|
|
621 |
// CVCApplicationControllerImpl::GetOfflineModeFlagsL
|
|
622 |
// ----------------------------------------------------------
|
|
623 |
//
|
|
624 |
void CVCApplicationControllerImpl::GetOfflineModeFlagsL( TInt& aOfflineModeOff,
|
|
625 |
TInt& aBTActivationEnabled ) const
|
|
626 |
{
|
|
627 |
RUBY_DEBUG_BLOCKL( "CVCApplicationControllerImpl::GetOfflineModeFlagsL" );
|
|
628 |
|
|
629 |
// Connecting and initialization:
|
|
630 |
CRepository* repository = CRepository::NewL(KCRUidCoreApplicationUIs);
|
|
631 |
|
|
632 |
// Offline mode on?
|
|
633 |
repository->Get( KCoreAppUIsNetworkConnectionAllowed, aOfflineModeOff );
|
|
634 |
|
|
635 |
RUBY_DEBUG1( "CVCApplicationControllerImpl::GetOfflineModeFlagsL: offline status %d", aOfflineModeOff );
|
|
636 |
|
|
637 |
// Closing connection:
|
|
638 |
delete repository;
|
|
639 |
|
|
640 |
// BT Activation enabled?
|
|
641 |
|
|
642 |
CRepository* repository2 = CRepository::NewL( KCRUidBluetoothEngine );
|
|
643 |
|
|
644 |
repository2->Get(KBTEnabledInOffline, aBTActivationEnabled);
|
|
645 |
|
|
646 |
RUBY_DEBUG1( "CVCApplicationControllerImpl::GetOfflineModeFlagsL: activation allowed %d", aBTActivationEnabled );
|
|
647 |
|
|
648 |
// Closing connection:
|
|
649 |
delete repository2;
|
|
650 |
}
|
|
651 |
|
|
652 |
// ----------------------------------------------------------
|
|
653 |
// CVCApplicationControllerImpl::GetSimcardMode
|
|
654 |
// ----------------------------------------------------------
|
|
655 |
//
|
|
656 |
void CVCApplicationControllerImpl::GetSIMCardMode( TInt& aSIMCardMode ) const
|
|
657 |
{
|
|
658 |
RUBY_DEBUG_BLOCKL( "CVCApplicationControllerImpl::GetSIMCardMode" );
|
|
659 |
|
|
660 |
// We are changing from Off-line to a normal profile.
|
|
661 |
// Check if SIM card exists or not
|
|
662 |
aSIMCardMode = ESimNotPresent;
|
|
663 |
|
|
664 |
RProperty simStatus;
|
|
665 |
simStatus.Attach( KPSUidStartup, KPSSimStatus );
|
|
666 |
simStatus.Get( aSIMCardMode );
|
|
667 |
simStatus.Close();
|
|
668 |
}
|
|
669 |
|
|
670 |
// ---------------------------------------------------------------------------
|
|
671 |
// CVCApplicationControllerImpl::ActivateMessageL
|
|
672 |
// ---------------------------------------------------------------------------
|
|
673 |
TInt CVCApplicationControllerImpl::ActivateMessageL(TEditorType aType)
|
|
674 |
{
|
|
675 |
RUBY_DEBUG_BLOCKL( "CVCApplicationControllerImpl::ActivateMessageL" );
|
|
676 |
|
|
677 |
TInt err = KErrNone;
|
|
678 |
TUid mtmType = KNullUid;
|
|
679 |
|
|
680 |
switch( aType )
|
|
681 |
{
|
|
682 |
case EEditorTypeNewMessage:
|
|
683 |
mtmType.iUid = KSenduiMtmUniMessageUidValue ;
|
|
684 |
break;
|
|
685 |
case EEditorTypeNewEmail:
|
|
686 |
mtmType.iUid = KSenduiMtmSmtpUidValue;
|
|
687 |
break;
|
|
688 |
case EEditorTypePostcard:
|
|
689 |
mtmType.iUid = KSenduiMtmPostcardUidValue;
|
|
690 |
break;
|
|
691 |
default:
|
|
692 |
err = KErrNotFound;
|
|
693 |
break;
|
|
694 |
}
|
|
695 |
if (!err)
|
|
696 |
{
|
|
697 |
MHandlesSendAppUi().CreateAndSendMessageL( mtmType,
|
|
698 |
NULL,
|
|
699 |
KNullUid,
|
|
700 |
EFalse );
|
|
701 |
}
|
|
702 |
return err;
|
|
703 |
}
|
|
704 |
|
|
705 |
// ---------------------------------------------------------------------------
|
|
706 |
// CVCApplicationControllerImpl::MHandlesSendAppUi()
|
|
707 |
// Returns send ui instance.
|
|
708 |
// ---------------------------------------------------------------------------
|
|
709 |
CSendUi& CVCApplicationControllerImpl::MHandlesSendAppUi()
|
|
710 |
{
|
|
711 |
if ( !iSendUi )
|
|
712 |
{
|
|
713 |
TRAPD( error, iSendUi = CSendUi::NewL() );
|
|
714 |
if ( error != KErrNone )
|
|
715 |
{
|
|
716 |
iSendUi = NULL;
|
|
717 |
}
|
|
718 |
}
|
|
719 |
return *iSendUi;
|
|
720 |
}
|
|
721 |
|
|
722 |
// ----------------------------------------------------
|
|
723 |
// CVCApplicationControllerImpl::HandleCurrentCallStatusChange
|
|
724 |
// Handle call status change event.
|
|
725 |
// ----------------------------------------------------
|
|
726 |
//
|
|
727 |
void CVCApplicationControllerImpl::HandleCurrentCallStatusChange()
|
|
728 |
{
|
|
729 |
switch( iPropertyHandler->Value() )
|
|
730 |
{
|
|
731 |
case EPSCTsyCallStateNone:
|
|
732 |
case EPSCTsyCallStateAlerting:
|
|
733 |
case EPSCTsyCallStateRinging:
|
|
734 |
{
|
|
735 |
switch (iState)
|
|
736 |
{
|
|
737 |
case EVoiceMail:
|
|
738 |
{
|
|
739 |
iCallStatus = ETrue;
|
|
740 |
// Cancel the menu
|
|
741 |
iVmbx.Close();
|
|
742 |
|
|
743 |
break;
|
|
744 |
}
|
|
745 |
case ENewMessage:
|
|
746 |
{
|
|
747 |
iCallStatus = ETrue;
|
|
748 |
// Cancel the menu
|
|
749 |
Cancel();
|
|
750 |
if (iCoeEnv && iEikonEnv->EikAppUi())
|
|
751 |
{
|
|
752 |
iEikonEnv->EikAppUi()->RemoveFromStack(this);
|
|
753 |
}
|
|
754 |
break;
|
|
755 |
}
|
|
756 |
case EQueryDialog:
|
|
757 |
{
|
|
758 |
iCallStatus = ETrue;
|
|
759 |
|
|
760 |
DismissQueryDialog();
|
|
761 |
|
|
762 |
break;
|
|
763 |
}
|
|
764 |
default:
|
|
765 |
// Pass
|
|
766 |
break;
|
|
767 |
}
|
|
768 |
break;
|
|
769 |
}
|
|
770 |
|
|
771 |
default:
|
|
772 |
{
|
|
773 |
// pass
|
|
774 |
break;
|
|
775 |
}
|
|
776 |
}
|
|
777 |
}
|
|
778 |
|
|
779 |
// ---------------------------------------------------------
|
|
780 |
// CVCApplicationControllerImpl::Cancel
|
|
781 |
// ---------------------------------------------------------
|
|
782 |
//
|
|
783 |
void CVCApplicationControllerImpl::Cancel()
|
|
784 |
{
|
|
785 |
// Cancel the menu
|
|
786 |
if ( iPopupList )
|
|
787 |
{
|
|
788 |
iPopupList->CancelPopup();
|
|
789 |
iPopupList = NULL;
|
|
790 |
}
|
|
791 |
}
|
|
792 |
|
|
793 |
// ---------------------------------------------------------
|
|
794 |
// CVCApplicationControllerImpl::OfferKeyEventL
|
|
795 |
// ---------------------------------------------------------
|
|
796 |
//
|
|
797 |
TKeyResponse CVCApplicationControllerImpl::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType)
|
|
798 |
{
|
|
799 |
RUBY_DEBUG_BLOCKL( "CVCApplicationControllerImpl::OfferKeyEventL" );
|
|
800 |
|
|
801 |
TKeyResponse keyEvent( EKeyWasNotConsumed );
|
|
802 |
|
|
803 |
if ( aType == EEventKey && ( aKeyEvent.iScanCode == EStdKeyNo ||
|
|
804 |
aKeyEvent.iScanCode == EStdKeyApplication0 ) )
|
|
805 |
{
|
|
806 |
switch ( iState )
|
|
807 |
{
|
|
808 |
case EVoiceMail:
|
|
809 |
iVmbx.Close();
|
|
810 |
keyEvent = EKeyWasConsumed;
|
|
811 |
break;
|
|
812 |
|
|
813 |
case ENewMessage:
|
|
814 |
Cancel();
|
|
815 |
|
|
816 |
if ( iCoeEnv && iEikonEnv->EikAppUi() )
|
|
817 |
{
|
|
818 |
iEikonEnv->EikAppUi()->RemoveFromStack( this );
|
|
819 |
}
|
|
820 |
keyEvent = EKeyWasConsumed;
|
|
821 |
break;
|
|
822 |
|
|
823 |
case EQueryDialog:
|
|
824 |
DismissQueryDialog();
|
|
825 |
|
|
826 |
keyEvent = EKeyWasConsumed;
|
|
827 |
break;
|
|
828 |
|
|
829 |
default:
|
|
830 |
break;
|
|
831 |
}
|
|
832 |
}
|
|
833 |
|
|
834 |
return keyEvent;
|
|
835 |
}
|
|
836 |
|
|
837 |
// ---------------------------------------------------------
|
|
838 |
// CVCApplicationControllerImpl::HandleNotifyL
|
|
839 |
// ---------------------------------------------------------
|
|
840 |
//
|
|
841 |
TInt CVCApplicationControllerImpl::HandleNotifyL( TInt aCmdId, TInt /*aEventId*/,
|
|
842 |
CAiwGenericParamList& /*aEventParamList*/,
|
|
843 |
const CAiwGenericParamList& /*aInParamList*/ )
|
|
844 |
{
|
|
845 |
RUBY_DEBUG_BLOCKL( "CVCApplicationControllerImpl::HandleNotifyL" );
|
|
846 |
|
|
847 |
if ( aCmdId == KAiwCmdCall )
|
|
848 |
{
|
|
849 |
if ( iWait.IsStarted() )
|
|
850 |
{
|
|
851 |
iWait.AsyncStop();
|
|
852 |
}
|
|
853 |
}
|
|
854 |
|
|
855 |
return KErrNone;
|
|
856 |
}
|
|
857 |
|
|
858 |
// ---------------------------------------------------------
|
|
859 |
// CVCApplicationControllerImpl::HandleActiveObjectStatus
|
|
860 |
// ---------------------------------------------------------
|
|
861 |
//
|
|
862 |
void CVCApplicationControllerImpl::HandleActiveObjectStatus(TInt aStatus)
|
|
863 |
{
|
|
864 |
RUBY_DEBUG1( "CVCApplicationControllerImpl::HandleActiveObjectStatus() aStatus = %d", aStatus);
|
|
865 |
|
|
866 |
// Cancel active object and note.
|
|
867 |
iActiveObject->Cancel();
|
|
868 |
iGlobalConfQuery->CancelConfirmationQuery();
|
|
869 |
|
|
870 |
// Check that user pressed softkey YES
|
|
871 |
if ( (aStatus == EAknSoftkeyYes ||
|
|
872 |
aStatus == EAknSoftkeySelect ||
|
|
873 |
aStatus == EAknSoftkeyOk) &&
|
|
874 |
iProfileEngine )
|
|
875 |
{
|
|
876 |
TRAP_IGNORE( iProfileEngine->SetActiveProfileL( iProfileId ) );
|
|
877 |
}
|
|
878 |
}
|
|
879 |
|
|
880 |
// ----------------------------------------------------------------------------
|
|
881 |
// CVCApplicationControllerImpl::CreateConnectionL
|
|
882 |
// Connects to RApaLsSession.
|
|
883 |
// ----------------------------------------------------------------------------
|
|
884 |
//
|
|
885 |
void CVCApplicationControllerImpl::CreateApaConnectionL()
|
|
886 |
{
|
|
887 |
iApaLsSession = new RApaLsSession();
|
|
888 |
|
|
889 |
if ( !iApaLsSession->Handle() )
|
|
890 |
{
|
|
891 |
User::LeaveIfError( iApaLsSession->Connect() );
|
|
892 |
}
|
|
893 |
}
|
|
894 |
|
|
895 |
// ----------------------------------------------------------------------------
|
|
896 |
// CVCApplicationControllerImpl::ActivateAppL
|
|
897 |
// Used to launch applications. Checks whether an instance of the launched
|
|
898 |
// application is already running.
|
|
899 |
// ----------------------------------------------------------------------------
|
|
900 |
//
|
|
901 |
void CVCApplicationControllerImpl::ActivateAppL( const TUid aUid,
|
|
902 |
TBool aMultipleInstances )
|
|
903 |
{
|
|
904 |
CreateApaConnectionL();
|
|
905 |
|
|
906 |
if ( aMultipleInstances )
|
|
907 |
{
|
|
908 |
ActivateAppInstanceL( aUid );
|
|
909 |
}
|
|
910 |
else
|
|
911 |
{
|
|
912 |
// Session to window server
|
|
913 |
RWsSession wsSession;
|
|
914 |
User::LeaveIfError( wsSession.Connect() );
|
|
915 |
CleanupClosePushL( wsSession );
|
|
916 |
|
|
917 |
TApaTaskList apaTaskList( wsSession );
|
|
918 |
TApaTask apaTask = apaTaskList.FindApp( aUid );
|
|
919 |
if ( apaTask.Exists() )
|
|
920 |
{
|
|
921 |
// Already running, close application
|
|
922 |
apaTask.EndTask();
|
|
923 |
}
|
|
924 |
ActivateAppInstanceL( aUid );
|
|
925 |
|
|
926 |
CleanupStack::PopAndDestroy( &wsSession );
|
|
927 |
}
|
|
928 |
}
|
|
929 |
|
|
930 |
// ----------------------------------------------------------------------------
|
|
931 |
// CVCApplicationControllerImpl::ActivateAppInstanceL
|
|
932 |
// Activates an instance of an application.
|
|
933 |
// ----------------------------------------------------------------------------
|
|
934 |
//
|
|
935 |
void CVCApplicationControllerImpl::ActivateAppInstanceL( const TUid aUid )
|
|
936 |
{
|
|
937 |
TApaAppInfo appInfo;
|
|
938 |
User::LeaveIfError( iApaLsSession->GetAppInfo( appInfo, aUid ) );
|
|
939 |
TFileName appName = appInfo.iFullName;
|
|
940 |
CApaCommandLine* apaCommandLine = CApaCommandLine::NewLC();
|
|
941 |
|
|
942 |
apaCommandLine->SetExecutableNameL( appName );
|
|
943 |
apaCommandLine->SetCommandL( EApaCommandRun );
|
|
944 |
|
|
945 |
User::LeaveIfError ( iApaLsSession->StartApp( *apaCommandLine ) );
|
|
946 |
CleanupStack::PopAndDestroy( apaCommandLine );
|
|
947 |
}
|
|
948 |
|
|
949 |
// ----------------------------------------------------------------------------
|
|
950 |
// CVCApplicationControllerImpl::DismissQueryDialog
|
|
951 |
// Closes query dialog
|
|
952 |
// ----------------------------------------------------------------------------
|
|
953 |
//
|
|
954 |
void CVCApplicationControllerImpl::DismissQueryDialog()
|
|
955 |
{
|
|
956 |
if ( iQueryDialog )
|
|
957 |
{
|
|
958 |
iQueryDialog->MakeLeftSoftkeyVisible( EFalse );
|
|
959 |
TRAP_IGNORE( iQueryDialog->DismissQueryL() );
|
|
960 |
}
|
|
961 |
}
|
|
962 |
|
|
963 |
// End of File
|