author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 14 Sep 2010 20:54:53 +0300 | |
branch | RCL_3 |
changeset 21 | 9da50d567e3c |
parent 20 | f4a778e096c2 |
permissions | -rw-r--r-- |
20 | 1 |
/* |
2 |
* Copyright (c) 2004 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: Call Vmbx for softnotification. |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
||
20 |
||
21 |
||
22 |
// INCLUDE FILES |
|
23 |
#include <avkon.hrh> |
|
24 |
#include <bldvariant.hrh> |
|
25 |
#include <AiwCommon.hrh> |
|
26 |
||
21
9da50d567e3c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
20
diff
changeset
|
27 |
#include <speeddial.rsg> |
20 | 28 |
|
29 |
#include <vmnumber.h> |
|
30 |
#include <AknQueryDialog.h> |
|
31 |
#include <aknnotedialog.h> |
|
32 |
#include <StringLoader.h> |
|
33 |
// needed just to get localized error message |
|
34 |
#include <AknGlobalNote.h> |
|
35 |
#include <ConeResLoader.h> |
|
36 |
#include <errorres.rsg> |
|
37 |
||
38 |
#include "SpdiaAppUi.h" |
|
39 |
#include "speeddialprivate.h" |
|
40 |
#include "SpdiaBaseView.h" |
|
41 |
#include <aknlayoutscalable_apps.cdl.h> |
|
42 |
#include <layoutmetadata.cdl.h> |
|
43 |
#include <e32base.h> |
|
44 |
#include "SpdiaCallingVmbxView_voip.h" |
|
45 |
#include "SpdiaCallingVmbxContainer.h" |
|
46 |
||
47 |
#include <featmgr.h> |
|
48 |
#include <settingsinternalcrkeys.h> |
|
49 |
#include <centralrepository.h> |
|
50 |
||
51 |
//_LIT8( KSpdiaCustomMesg, "outside" ); |
|
52 |
const TInt KVoIPOFF = 0; |
|
53 |
||
54 |
// ========================= MEMBER FUNCTIONS ================================ |
|
55 |
||
56 |
// --------------------------------------------------------------------------- |
|
57 |
// CSpdVmbxAsync::NewLC |
|
58 |
// Symbian two-phased constructor |
|
59 |
// --------------------------------------------------------------------------- |
|
60 |
CSpdVmbxAsync* CSpdVmbxAsync::NewL(CSpdiaCallingVmbxView* aSpdiaCallingVmbxView) |
|
61 |
{ |
|
62 |
CSpdVmbxAsync* self = new(ELeave) CSpdVmbxAsync(aSpdiaCallingVmbxView); |
|
63 |
CleanupStack::PushL(self); |
|
64 |
self->ConstructL(); |
|
65 |
CleanupStack::Pop(); // self |
|
66 |
return self; |
|
67 |
} |
|
68 |
||
69 |
// --------------------------------------------------------------------------- |
|
70 |
// CSpdVmbxAsync::CSpdVmbxAsync |
|
71 |
// C++ constructor |
|
72 |
// --------------------------------------------------------------------------- |
|
73 |
CSpdVmbxAsync::CSpdVmbxAsync(CSpdiaCallingVmbxView* aSpdiaCallingVmbxView):CActive(CActive::EPriorityLow) |
|
74 |
{ |
|
75 |
iSpdiaCallingVmbxView =aSpdiaCallingVmbxView; |
|
76 |
CActiveScheduler::Add(this); |
|
77 |
} |
|
78 |
// --------------------------------------------------------------------------- |
|
79 |
// CSpdVmbxAsync::SetVmbxActiveL |
|
80 |
// Sets Active objects |
|
81 |
// --------------------------------------------------------------------------- |
|
82 |
void CSpdVmbxAsync::SetVmbxActiveL() |
|
83 |
{ |
|
84 |
SetActive(); |
|
85 |
TRequestStatus* status = &iStatus; |
|
86 |
User::RequestComplete(status,KErrNone); |
|
87 |
} |
|
88 |
||
89 |
// --------------------------------------------------------------------------- |
|
90 |
// CSpdVmbxAsync::ConstructL |
|
91 |
// Symbian two-phased constructor |
|
92 |
// --------------------------------------------------------------------------- |
|
93 |
void CSpdVmbxAsync::ConstructL() |
|
94 |
{ |
|
95 |
} |
|
96 |
||
97 |
// --------------------------------------------------------------------------- |
|
98 |
// CSpdVmbxAsync::~CSpdVmbxAsync |
|
99 |
// Destructor |
|
100 |
// --------------------------------------------------------------------------- |
|
101 |
CSpdVmbxAsync::~CSpdVmbxAsync() |
|
102 |
{ |
|
103 |
Cancel(); |
|
104 |
} |
|
105 |
||
106 |
// --------------------------------------------------------------------------- |
|
107 |
// CSpdVmbxAsync::DoCancel() |
|
108 |
// Cancels any outstanding requests |
|
109 |
// --------------------------------------------------------------------------- |
|
110 |
void CSpdVmbxAsync::DoCancel() |
|
111 |
{ |
|
112 |
//Cancel(); |
|
113 |
} |
|
114 |
||
115 |
// --------------------------------------------------------------------------- |
|
116 |
// CSpdiaCallingVmbxView::ExitSpdApp |
|
117 |
// Exits speed dial Application |
|
118 |
// --------------------------------------------------------------------------- |
|
119 |
void CSpdiaCallingVmbxView::ExitSpdApp() |
|
120 |
{ |
|
121 |
iAppUi->RunAppShutter(); |
|
122 |
} |
|
123 |
||
124 |
// --------------------------------------------------------------------------- |
|
125 |
// CSpdiaCallingVmbxView::DispalyVmbxDialogL |
|
126 |
// Displays VMBX text quary dialog |
|
127 |
// --------------------------------------------------------------------------- |
|
128 |
void CSpdiaCallingVmbxView::DispalyVmbxDialogL() |
|
129 |
{ |
|
130 |
||
131 |
//***********Start****************** Code to Support Alternate Line Handling(ALS). |
|
132 |
||
133 |
TPhCltTelephoneNumber vmbxNumber; |
|
134 |
RVmbxNumber vmbx; |
|
135 |
TBuf< KVmbxMaxAddressLength > vmbxAddress; |
|
136 |
||
137 |
||
138 |
//TBool call = iContainer->iControl->VoiceMailL( vmbxNumber ); |
|
139 |
CleanupClosePushL(vmbx); // Close() will called if a leave happens. |
|
140 |
||
141 |
if (vmbx.Open() != KErrNone) |
|
142 |
{ |
|
143 |
User::Leave(KLeaveWithoutAlert); //No vmbx available, so nothing we can do |
|
144 |
} |
|
145 |
||
146 |
TInt err1 = vmbx.GetVmbxNumber( vmbxNumber ); |
|
147 |
TInt err2 = vmbx.GetVideoMbxNumber(vmbxNumber ); |
|
148 |
TInt type(0); |
|
149 |
||
150 |
if ( ( err1 == KErrNotFound || err1 == KErrNotSupported ) && |
|
151 |
( err2 == KErrNotFound || err2 == KErrNotSupported )) |
|
152 |
{ |
|
153 |
type = vmbx.SelectTypeL( EVmbxDefine ); |
|
154 |
} |
|
155 |
else |
|
156 |
{ |
|
157 |
type = vmbx.SelectTypeL( EVmbxCall ); |
|
158 |
} |
|
159 |
||
160 |
if( type == EVmbxIP ) |
|
161 |
{ |
|
162 |
TInt err( vmbx.GetVmbxAddressL( vmbxAddress ) ); |
|
163 |
if( err == KErrNotFound ) |
|
164 |
{ |
|
165 |
vmbxAddress.Zero(); |
|
166 |
if( !vmbx.QueryAddressL( EVmbxNotDefinedQuery, vmbxAddress ) ) |
|
167 |
{ |
|
168 |
User::Leave(KLeaveWithoutAlert); |
|
169 |
} |
|
170 |
} |
|
171 |
} |
|
172 |
else if( type == EVmbxVideo ) |
|
173 |
{ |
|
174 |
// Check if the message corresponds to active line |
|
175 |
TInt lineInUse(0); |
|
176 |
User::LeaveIfError(vmbx.GetAlsLine(lineInUse)); |
|
177 |
if ( lineInUse != iCustomMessageId.iUid ) |
|
178 |
{ |
|
179 |
if ( DoWeCallToDifferentLineL() == EFalse ) |
|
180 |
{ |
|
181 |
User::Leave(KLeaveWithoutAlert); //return; |
|
182 |
} |
|
183 |
} |
|
184 |
TInt err(vmbx.GetVideoMbxNumber(vmbxNumber, (TVmbxNumberEntry)iCustomMessageId.iUid)); |
|
185 |
if( err == KErrNotFound ) //!= KErrNone ) |
|
186 |
{ vmbxNumber.Zero(); |
|
187 |
if( !vmbx.QueryVideoMbxNumberL( EVmbxNotDefinedQuery, vmbxNumber ) ) //vmbxNumber: the result value of an accepted query |
|
188 |
{ |
|
189 |
User::Leave(KLeaveWithoutAlert); //User did not provide a vmbxNumberEntry, so no number to call |
|
190 |
} |
|
191 |
} |
|
192 |
} |
|
193 |
else if(type ==EVmbx) |
|
194 |
{ |
|
195 |
// Check if the message corresponds to active line |
|
196 |
TInt lineInUse(0); |
|
197 |
User::LeaveIfError(vmbx.GetAlsLine(lineInUse)); //Gets currently active line number (1 or 2) |
|
198 |
// 1. If a different line is active than in soft note, check do we change line. If not, then there's |
|
199 |
// no need to continue as the voice mail is available on line, we are not going to switch to. |
|
200 |
if ( lineInUse != iCustomMessageId.iUid ) |
|
201 |
{ |
|
202 |
if ( DoWeCallToDifferentLineL() == EFalse ) |
|
203 |
{ |
|
204 |
User::Leave(KLeaveWithoutAlert); //return; |
|
205 |
} |
|
206 |
} |
|
207 |
||
208 |
TInt err(vmbx.GetVmbxNumber(vmbxNumber, (TVmbxNumberEntry)iCustomMessageId.iUid)); // Line number provided by soft note |
|
209 |
||
210 |
if( err == KErrNotFound ) //!= KErrNone ) |
|
211 |
{ |
|
212 |
vmbxNumber.Zero(); |
|
213 |
//Let's put a query on the screen to try to request for a voice mailbox number directly from user. |
|
214 |
if( !vmbx.QueryNumberL( EVmbxNotDefinedQuery, vmbxNumber ) ) //vmbxNumber: the result value of an accepted query |
|
215 |
{ |
|
216 |
User::Leave(KLeaveWithoutAlert); //User did not provide a vmbxNumberEntry, so no number to call |
|
217 |
} |
|
218 |
} |
|
219 |
} |
|
220 |
||
221 |
CleanupStack::PopAndDestroy(); // vmbx.Close() |
|
222 |
||
223 |
if( type == EVmbxIP ) |
|
224 |
{ |
|
225 |
if ( FeatureManager::FeatureSupported( KFeatureIdCommonVoip ) ) |
|
226 |
{ |
|
227 |
AddressCallL( vmbxAddress ); |
|
228 |
} |
|
229 |
} |
|
230 |
else if( type == EVmbxVideo ) |
|
231 |
{ |
|
232 |
NumberCallL( vmbxNumber, CAiwDialData::EAIWForcedVideo ); |
|
233 |
} |
|
234 |
else if(type ==EVmbx) |
|
235 |
{ |
|
236 |
// The type change to EAIWForcedCS for VOIP change. |
|
237 |
NumberCallL( vmbxNumber, CAiwDialData::EAIWForcedCS ); |
|
238 |
} |
|
239 |
||
240 |
||
241 |
//***********End****************** Code to Support Alternate Line Handling(ALS). |
|
242 |
||
243 |
} |
|
244 |
||
245 |
// --------------------------------------------------------------------------- |
|
246 |
// CSpdVmbxAsync::RunL() |
|
247 |
// Respond to an Asynchronous event |
|
248 |
// --------------------------------------------------------------------------- |
|
249 |
void CSpdVmbxAsync::RunL() |
|
250 |
{ |
|
251 |
if ( iStatus == KErrNone ) |
|
252 |
{ |
|
253 |
TInt err=0; |
|
254 |
TRAP( err, iSpdiaCallingVmbxView->DispalyVmbxDialogL() ); |
|
255 |
} |
|
256 |
||
257 |
if ( iSpdiaCallingVmbxView->GetSureToExit() ) |
|
258 |
{ |
|
259 |
iSpdiaCallingVmbxView->ExitSpdApp(); |
|
260 |
} |
|
261 |
else |
|
262 |
{ |
|
263 |
iSpdiaCallingVmbxView->SetSureToExit( ETrue ); |
|
264 |
} |
|
265 |
} |
|
266 |
||
267 |
// --------------------------------------------------------------------------- |
|
268 |
// CSpdiaCallingVmbxView::NewLC |
|
269 |
// Symbian two-phased constructor |
|
270 |
// --------------------------------------------------------------------------- |
|
271 |
CSpdiaCallingVmbxView* CSpdiaCallingVmbxView::NewLC() |
|
272 |
{ |
|
273 |
CSpdiaCallingVmbxView* self = new( ELeave ) CSpdiaCallingVmbxView; |
|
274 |
CleanupStack::PushL( self ); |
|
275 |
self->ConstructL(); |
|
276 |
return self; |
|
277 |
} |
|
278 |
||
279 |
// --------------------------------------------------------------------------- |
|
280 |
// CSpdiaCallingVmbxView::CSpdiaCallingVmbxView |
|
281 |
// C++ constructor |
|
282 |
// --------------------------------------------------------------------------- |
|
283 |
CSpdiaCallingVmbxView::CSpdiaCallingVmbxView() |
|
284 |
{ |
|
285 |
iAppUi = static_cast<CSpdiaAppUi*> ( AppUi() ); |
|
286 |
} |
|
287 |
||
288 |
// --------------------------------------------------------------------------- |
|
289 |
// CSpdiaCallingVmbxView::~CSpdiaCallingVmbxView |
|
290 |
// Destructor |
|
291 |
// --------------------------------------------------------------------------- |
|
292 |
CSpdiaCallingVmbxView::~CSpdiaCallingVmbxView() |
|
293 |
{ |
|
294 |
if ( FeatureManager::FeatureSupported( KFeatureIdCommonVoip ) ) |
|
295 |
{ |
|
296 |
if ( iVoIPVariationNotifier ) |
|
297 |
{ |
|
298 |
iVoIPVariationNotifier->StopListening(); |
|
299 |
delete iVoIPVariationNotifier; |
|
300 |
iVoIPVariationNotifier = NULL; |
|
301 |
} |
|
302 |
||
303 |
if ( iVoIPVariation ) |
|
304 |
{ |
|
305 |
delete iVoIPVariation; |
|
306 |
iVoIPVariation = NULL; |
|
307 |
} |
|
308 |
} |
|
309 |
||
310 |
if ( iContainer ) |
|
311 |
{ |
|
312 |
iAppUi->RemoveFromViewStack( *this, iContainer ); |
|
313 |
delete iContainer; |
|
314 |
} |
|
315 |
if(iSpdVmbxAsync) |
|
316 |
delete iSpdVmbxAsync; |
|
317 |
iContainer = NULL; |
|
318 |
||
319 |
delete iServiceHandler; |
|
320 |
FeatureManager::UnInitializeLib(); |
|
321 |
} |
|
322 |
||
323 |
// --------------------------------------------------------------------------- |
|
324 |
// CSpdiaCallingVmbxView::ConstructL |
|
325 |
// Symbian two-phased constructor |
|
326 |
// --------------------------------------------------------------------------- |
|
327 |
void CSpdiaCallingVmbxView::ConstructL() |
|
328 |
{ |
|
329 |
BaseConstructL( R_SPDIA_CALLING_VMBX_VIEW ); |
|
330 |
CSpdiaBaseView::ConstructL(); |
|
331 |
CEikonEnv::Static()->AppUiFactory()->StatusPane()->SwitchLayoutL( R_AVKON_STATUS_PANE_LAYOUT_EMPTY ); |
|
332 |
// Create the AIWFW object and specifiy the criteria items. |
|
333 |
iServiceHandler =CAiwServiceHandler::NewL(); |
|
334 |
iServiceHandler->AttachL(R_SPDIAL_APP_INTEREST); |
|
335 |
FeatureManager::InitializeLibL(); |
|
336 |
TInt VoIPSupported( 0 ); |
|
337 |
||
338 |
if ( FeatureManager::FeatureSupported(KFeatureIdCommonVoip) ) |
|
339 |
{ |
|
340 |
iVoIPVariation = CRepository::NewL( KCRUidTelephonySettings ); |
|
341 |
iVoIPVariation->Get( KDynamicVoIP, VoIPSupported ); |
|
342 |
||
343 |
iVoIPVariationNotifier = CCenRepNotifyHandler::NewL( *this, *iVoIPVariation, |
|
344 |
CCenRepNotifyHandler::EIntKey, KDynamicVoIP ); |
|
345 |
iVoIPVariationNotifier->StartListeningL(); |
|
346 |
} |
|
347 |
||
348 |
iVoIPSupported = KVoIPOFF != VoIPSupported && |
|
349 |
FeatureManager::FeatureSupported( KFeatureIdCommonVoip ); |
|
350 |
iSureToExit = ETrue; |
|
351 |
} |
|
352 |
||
353 |
// --------------------------------------------------------------------------- |
|
354 |
// CSpdiaCallingVmbxView::Id |
|
355 |
// Returns view's ID. |
|
356 |
// --------------------------------------------------------------------------- |
|
357 |
TUid CSpdiaCallingVmbxView::Id() const |
|
358 |
{ |
|
359 |
return KCallingVmbxViewId; |
|
360 |
} |
|
361 |
||
362 |
// --------------------------------------------------------------------------- |
|
363 |
// CSpdiaCallingVmbxView::HandleDialL |
|
364 |
// From phoneClient |
|
365 |
// --------------------------------------------------------------------------- |
|
366 |
void CSpdiaCallingVmbxView::HandleDialL(const TInt /*iStatus*/ ) |
|
367 |
{ |
|
368 |
HandleCommandL( EEikCmdExit ); |
|
369 |
} |
|
370 |
||
371 |
// --------------------------------------------------------------------------- |
|
372 |
// CSpdiaCallingVmbxView::NumberCallL |
|
373 |
// Call Phone client |
|
374 |
// --------------------------------------------------------------------------- |
|
375 |
void CSpdiaCallingVmbxView::NumberCallL( const TDesC& aNumber ) |
|
376 |
{ |
|
377 |
CAiwDialDataExt *dialData = CAiwDialDataExt::NewLC(); |
|
378 |
dialData->SetPhoneNumberL(aNumber); |
|
379 |
// The type change to EAIWForcedCS for VOIP change. |
|
380 |
dialData->SetCallType( CAiwDialData::EAIWForcedCS ); |
|
381 |
dialData->SetWindowGroup(iEikonEnv->RootWin().Identifier()); |
|
382 |
dialData->SetShowNumber(ETrue); |
|
383 |
CAiwGenericParamList& paramList = iServiceHandler->InParamListL(); |
|
384 |
dialData->FillInParamListL(paramList); |
|
385 |
||
386 |
iServiceHandler->ExecuteServiceCmdL( KAiwCmdCall, |
|
387 |
paramList, |
|
388 |
iServiceHandler->OutParamListL(), |
|
389 |
0, |
|
390 |
NULL ); //Callback is NULL as no dial results wanted. |
|
391 |
CleanupStack::PopAndDestroy(dialData); |
|
392 |
} |
|
393 |
// --------------------------------------------------------------------------- |
|
394 |
// CSpdiaCallingVmbxView::NumberCallL |
|
395 |
// Call Phone client |
|
396 |
// --------------------------------------------------------------------------- |
|
397 |
||
398 |
void CSpdiaCallingVmbxView:: NumberCallL( const TDesC& aNumber, |
|
399 |
CAiwDialData::TCallType aCallType ) |
|
400 |
{ |
|
401 |
CAiwDialDataExt *dialData = CAiwDialDataExt::NewLC(); |
|
402 |
dialData->SetPhoneNumberL(aNumber); |
|
403 |
dialData->SetCallType(aCallType); |
|
404 |
dialData->SetWindowGroup(iEikonEnv->RootWin().Identifier()); |
|
405 |
dialData->SetShowNumber(ETrue); |
|
406 |
CAiwGenericParamList& paramList = iServiceHandler->InParamListL(); |
|
407 |
dialData->FillInParamListL(paramList); |
|
408 |
||
409 |
||
410 |
iServiceHandler->ExecuteServiceCmdL( KAiwCmdCall, |
|
411 |
paramList, |
|
412 |
iServiceHandler->OutParamListL(), |
|
413 |
0, |
|
414 |
NULL ); //Callback is NULL as no dial results wanted. |
|
415 |
||
416 |
CleanupStack::PopAndDestroy(dialData); |
|
417 |
} |
|
418 |
||
419 |
// --------------------------------------------------------------------------- |
|
420 |
// CSpdiaCallingVmbxView::DoActivateL |
|
421 |
// Activates this view. |
|
422 |
// --------------------------------------------------------------------------- |
|
423 |
void CSpdiaCallingVmbxView::DoActivateL( const TVwsViewId& aPrevViewId, |
|
424 |
TUid aCustomMessageId, |
|
425 |
const TDesC8& aCustomMessage ) |
|
426 |
{ |
|
427 |
||
428 |
ASSERT(iContainer == NULL); |
|
429 |
if ( !iContainer ) |
|
430 |
iContainer = CSpdiaCallingVmbxContainer::NewL(); |
|
431 |
iAppUi->AddToStackL( *this, iContainer ); |
|
432 |
CEikonEnv::Static()->AppUiFactory()->StatusPane()->SwitchLayoutL( R_AVKON_STATUS_PANE_LAYOUT_EMPTY ); |
|
433 |
// Show status pane before showing vmbx dialog |
|
434 |
TRect origRect = iContainer->iControl->Rect(); |
|
435 |
TRect newRect( origRect ); |
|
436 |
TInt statusPaneHeight ; |
|
437 |
TRect mainPaneRect ; |
|
438 |
TRect statusPaneRect; |
|
439 |
if( AknLayoutUtils::ScalableLayoutInterfaceAvailable() ) |
|
440 |
{ |
|
441 |
if (Layout_Meta_Data::IsLandscapeOrientation()) |
|
442 |
{ |
|
443 |
AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane,mainPaneRect); |
|
444 |
iContainer->iControl->SetRect( mainPaneRect ); |
|
445 |
} |
|
446 |
else |
|
447 |
{ |
|
448 |
AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EStatusPane,statusPaneRect); |
|
449 |
statusPaneHeight = statusPaneRect.Height(); |
|
450 |
newRect.iTl.iY = statusPaneHeight; // height of the status pane |
|
451 |
iContainer->iControl->SetRect( newRect ); |
|
452 |
} |
|
453 |
} |
|
454 |
||
455 |
else |
|
456 |
{ |
|
457 |
||
458 |
TAknWindowLineLayout statusPaneL = |
|
459 |
AKN_LAYOUT_WINDOW_status_pane( origRect, 0 ); |
|
460 |
TAknLayoutRect layout; |
|
461 |
layout.LayoutRect(origRect,statusPaneL); |
|
462 |
statusPaneHeight = layout.Rect().Height(); |
|
463 |
newRect.iTl.iY = statusPaneHeight; // height of the status pane |
|
464 |
iContainer->iControl->SetRect( newRect ); |
|
465 |
} |
|
466 |
||
467 |
iPrevViewId.iAppUid =aPrevViewId.iAppUid; |
|
468 |
iPrevViewId.iViewUid=aPrevViewId.iViewUid; |
|
469 |
||
470 |
iCustomMessageId.iUid = aCustomMessageId.iUid; |
|
471 |
iCustomMessage.Copy(aCustomMessage); |
|
472 |
||
473 |
if ( !iSpdVmbxAsync ) |
|
474 |
{ |
|
475 |
iSpdVmbxAsync = CSpdVmbxAsync::NewL( this ); |
|
476 |
iSureToExit = ETrue; |
|
477 |
} |
|
478 |
else |
|
479 |
{ |
|
480 |
iSureToExit = EFalse; |
|
481 |
iSpdVmbxAsync->Cancel(); |
|
482 |
} |
|
483 |
iSpdVmbxAsync->SetVmbxActiveL(); |
|
484 |
} |
|
485 |
||
486 |
// --------------------------------------------------------------------------- |
|
487 |
// CSpdiaCallingVmbxView::DoWeCallToDifferentLine |
|
488 |
// |
|
489 |
// --------------------------------------------------------------------------- |
|
490 |
||
491 |
TBool CSpdiaCallingVmbxView::DoWeCallToDifferentLineL() |
|
492 |
{ |
|
493 |
TBool okToCall = EFalse; |
|
494 |
||
495 |
//Let's read the needed resource first |
|
496 |
RConeResourceLoader resourceLoader(*iCoeEnv); |
|
497 |
CleanupClosePushL(resourceLoader); |
|
498 |
CAknQueryDialog* queryDlg = CAknQueryDialog::NewL(); |
|
499 |
||
500 |
//Do we change to the other line |
|
501 |
||
502 |
if( queryDlg->ExecuteLD( R_SPDIA_ALS_CONFIRMATION_QUERY ) ) |
|
503 |
{ |
|
504 |
RSSSettings settings; |
|
505 |
CleanupClosePushL( settings ); |
|
506 |
User::LeaveIfError( settings.Open() ); |
|
507 |
||
508 |
if(IsLineBlocked(settings)) |
|
509 |
{ |
|
510 |
//Line is blocked. Not allowed to change the active line |
|
511 |
||
512 |
HBufC* string = NULL; |
|
513 |
TPtrC ptr; |
|
514 |
string = StringLoader::LoadLC( R_SPDIA_LINE_BLOCKING_NOTE_TEXT ); |
|
515 |
ptr.Set( *string ); |
|
516 |
CAknNoteDialog* dlg = new ( ELeave ) CAknNoteDialog(); |
|
517 |
dlg->PrepareLC( R_SPDIA_ERROR_NOTE ); |
|
518 |
dlg->SetTextL( ptr );//KNullDesC ); |
|
519 |
dlg->RunDlgLD( CAknNoteDialog::ELongTimeout,CAknNoteDialog::EErrorTone ); |
|
520 |
CleanupStack::PopAndDestroy(); //string |
|
521 |
okToCall = EFalse; |
|
522 |
} |
|
523 |
else |
|
524 |
{ |
|
525 |
okToCall = ToggleLine(settings); //Line not blokced, let's try to change the line |
|
526 |
} |
|
527 |
CleanupStack::PopAndDestroy(); //Close settings |
|
528 |
} |
|
529 |
CleanupStack::PopAndDestroy(); //Close resourceLoader |
|
530 |
return okToCall; |
|
531 |
} |
|
532 |
||
533 |
// --------------------------------------------------------------------------- |
|
534 |
// CSpdiaCallingVmbxView::ToggleLine |
|
535 |
// |
|
536 |
// --------------------------------------------------------------------------- |
|
537 |
TBool CSpdiaCallingVmbxView::ToggleLine(RSSSettings& aSettings) |
|
538 |
{ |
|
539 |
TInt oldValue( ESSSettingsAlsNotSupported ); |
|
540 |
TInt newValue( ESSSettingsAlsNotSupported ); |
|
541 |
||
542 |
if ( aSettings.Get( ESSSettingsAls, oldValue ) != KErrNone ) |
|
543 |
{ |
|
544 |
return EFalse; |
|
545 |
} |
|
546 |
||
547 |
switch ( oldValue ) |
|
548 |
{ |
|
549 |
case ESSSettingsAlsPrimary: |
|
550 |
newValue = ESSSettingsAlsAlternate; |
|
551 |
break; |
|
552 |
||
553 |
case ESSSettingsAlsAlternate: |
|
554 |
newValue = ESSSettingsAlsPrimary; |
|
555 |
break; |
|
556 |
||
557 |
case ESSSettingsAlsNotSupported: |
|
558 |
default: |
|
559 |
{ |
|
560 |
return EFalse; |
|
561 |
} |
|
562 |
// break; |
|
563 |
} |
|
564 |
||
565 |
if ( aSettings.Set( ESSSettingsAls, newValue ) != KErrNone ) |
|
566 |
{ |
|
567 |
return EFalse; |
|
568 |
} |
|
569 |
||
570 |
return ETrue; |
|
571 |
||
572 |
} |
|
573 |
||
574 |
||
575 |
// --------------------------------------------------------------------------- |
|
576 |
// CSpdiaCallingVmbxView::IsLineBlockedL |
|
577 |
// |
|
578 |
// --------------------------------------------------------------------------- |
|
579 |
TBool CSpdiaCallingVmbxView::IsLineBlocked(RSSSettings& aSettings) |
|
580 |
{ |
|
581 |
TInt value = ESSSettingsAlsBlockingNotSupported; |
|
582 |
TInt err = aSettings.Get( ESSSettingsAlsBlocking, value ); |
|
583 |
||
584 |
if ( err == KErrNotSupported ) |
|
585 |
{ |
|
586 |
return EFalse; //Als not supported, so no need to care for blocking |
|
587 |
} |
|
588 |
else if ( err == KErrNone ) |
|
589 |
{ |
|
590 |
if ( value == ESSSettingsAlsBlockingNotSupported || |
|
591 |
value == ESSSettingsAlsBlockingOff ) |
|
592 |
{ |
|
593 |
return EFalse; //Als not blocked |
|
594 |
} |
|
595 |
} |
|
596 |
||
597 |
return ETrue; //Line is blocked. Not allowed to change active line |
|
598 |
} |
|
599 |
||
600 |
// --------------------------------------------------------------------------- |
|
601 |
// CSpdiaCallingVmbxView::DoDeactivate |
|
602 |
// Deactivates this view. |
|
603 |
// --------------------------------------------------------------------------- |
|
604 |
void CSpdiaCallingVmbxView::DoDeactivate() |
|
605 |
{ |
|
606 |
if ( iContainer ) |
|
607 |
{ |
|
608 |
iAppUi->RemoveFromStack( iContainer ); |
|
609 |
delete iContainer; |
|
610 |
iContainer = NULL; |
|
611 |
} |
|
612 |
} |
|
613 |
||
614 |
// --------------------------------------------------------------------------- |
|
615 |
// CSpdiaCallingVmbxView::HandleForegroundEventL |
|
616 |
// Foreground and background events. |
|
617 |
// --------------------------------------------------------------------------- |
|
618 |
void CSpdiaCallingVmbxView::HandleForegroundEventL( TBool /*aForeground*/ ) |
|
619 |
{ |
|
620 |
} |
|
621 |
||
622 |
// --------------------------------------------------------------------------- |
|
623 |
// CSpdiaCallingVmbxView::AddressCallL |
|
624 |
// Call Phone client |
|
625 |
// --------------------------------------------------------------------------- |
|
626 |
void CSpdiaCallingVmbxView::AddressCallL( const TDesC& aAddress ) |
|
627 |
{ |
|
628 |
if ( iVoIPSupported ) |
|
629 |
{ |
|
630 |
||
631 |
CAiwDialDataExt *dialData = CAiwDialDataExt::NewLC(); |
|
632 |
dialData->SetPhoneNumberL(aAddress); |
|
633 |
dialData->SetCallType(CAiwDialData::EAIWVoiP); |
|
634 |
dialData->SetWindowGroup(iEikonEnv->RootWin().Identifier()); |
|
635 |
dialData->SetShowNumber(ETrue); |
|
636 |
CAiwGenericParamList& paramList = iServiceHandler->InParamListL(); |
|
637 |
dialData->FillInParamListL(paramList); |
|
638 |
||
639 |
||
640 |
iServiceHandler->ExecuteServiceCmdL( KAiwCmdCall, |
|
641 |
paramList, |
|
642 |
iServiceHandler->OutParamListL(), |
|
643 |
0, |
|
644 |
NULL ); //Callback is NULL as no dial results wanted. |
|
645 |
} |
|
646 |
} |
|
647 |
||
648 |
// ---------------------------------------------------- |
|
649 |
// CSpdiaCallingVmbxView::HandleNotifyInt |
|
650 |
// ---------------------------------------------------- |
|
651 |
// |
|
652 |
void CSpdiaCallingVmbxView::HandleNotifyInt( |
|
653 |
const TUint32 aID, |
|
654 |
const TInt aNewValue ) |
|
655 |
{ |
|
656 |
if ( KDynamicVoIP == aID ) |
|
657 |
{ |
|
658 |
iVoIPSupported = KVoIPOFF != aNewValue && |
|
659 |
FeatureManager::FeatureSupported( KFeatureIdCommonVoip ); |
|
660 |
} |
|
661 |
} |
|
662 |
||
663 |
/** |
|
664 |
* set the AO exit flag; |
|
665 |
*/ |
|
666 |
void CSpdiaCallingVmbxView::SetSureToExit( TBool aValue ) |
|
667 |
{ |
|
668 |
iSureToExit = aValue; |
|
669 |
} |
|
670 |
/** |
|
671 |
* get the AO exit flag; |
|
672 |
*/ |
|
673 |
TBool CSpdiaCallingVmbxView::GetSureToExit() |
|
674 |
{ |
|
675 |
return iSureToExit; |
|
676 |
} |
|
677 |
||
678 |
// end of file |