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