vtuis/videotelui/src/features/dialer/cvtuidialercontainer.cpp
branchRCL_3
changeset 26 590f6f022902
parent 25 779871d1e4f4
equal deleted inserted replaced
25:779871d1e4f4 26:590f6f022902
    25 #include    <layoutmetadata.cdl.h>
    25 #include    <layoutmetadata.cdl.h>
    26 #include    <featmgr.h>
    26 #include    <featmgr.h>
    27 #include    <AknsBasicBackgroundControlContext.h>
    27 #include    <AknsBasicBackgroundControlContext.h>
    28 #include    <akntoolbar.h>
    28 #include    <akntoolbar.h>
    29 
    29 
       
    30 #include    <videotelui.rsg>
    30 #include    "VtUiUtility.h"
    31 #include    "VtUiUtility.h"
    31 #include    "VtUiLayout.h"
    32 #include    "VtUiLayout.h"
    32 #include    "mvtuicomponentmanager.h"
    33 #include    "mvtuicomponentmanager.h"
    33 #include    "cvtuidialercontainer.h"
    34 #include    "cvtuidialercontainer.h"
    34 #include    "cvtuidialervideocontrol.h"
    35 #include    "cvtuidialervideocontrol.h"
    88 // ---------------------------------------------------------------------------
    89 // ---------------------------------------------------------------------------
    89 //
    90 //
    90 CVtUiDialerContainer::~CVtUiDialerContainer()
    91 CVtUiDialerContainer::~CVtUiDialerContainer()
    91     {
    92     {
    92     __VTPRINTENTER( "DialContainer.~" )
    93     __VTPRINTENTER( "DialContainer.~" )
       
    94     delete iEmergency;
       
    95     iServer.Close();    
       
    96         
    93     delete iAsyncDeactivate;
    97     delete iAsyncDeactivate;
    94     delete iVideoControl;
    98     delete iVideoControl;
    95     delete iDialer;
    99     delete iDialer;
    96     delete iSKModifier;
   100     delete iSKModifier;
    97     delete iInputBuffer;
   101     delete iInputBuffer;
   358     CreateWindowL();
   362     CreateWindowL();
   359     DrawableWindow()->SetPointerGrab( ETrue );
   363     DrawableWindow()->SetPointerGrab( ETrue );
   360     SetExtent( TPoint(), TSize() );
   364     SetExtent( TPoint(), TSize() );
   361     ActivateL();
   365     ActivateL();
   362     MakeVisible( EFalse );
   366     MakeVisible( EFalse );
   363     iInputBuffer = CVtUiDTMFBuffer::NewL( *iCoeEnv );
   367     iInputBuffer = CVtUiDTMFBuffer::NewL( *iCoeEnv, this );
   364     iVideoControl = CVtUiDialerVideoControl::NewL( aBitmapManager );
   368     iVideoControl = CVtUiDialerVideoControl::NewL( aBitmapManager );
   365     iDialer = CVideoDTMFDialer::NewL( *this, *iVideoControl, DialerRect() );
   369     iDialer = CVideoDTMFDialer::NewL( *this, *iVideoControl, DialerRect() );
   366     
   370     
   367     iSKModifier = CVtUiDialerSKModifier::NewL( *iFeatureManager );
   371     iSKModifier = CVtUiDialerSKModifier::NewL( *iFeatureManager );
   368     // Disable fading when using DP (eliminates nasty color error)
   372     // Disable fading when using DP (eliminates nasty color error)
   370         {
   374         {
   371         Window().SetNonFading( ETrue );
   375         Window().SetNonFading( ETrue );
   372         }
   376         }
   373     iAsyncDeactivate = new ( ELeave ) CAsyncCallBack(
   377     iAsyncDeactivate = new ( ELeave ) CAsyncCallBack(
   374         TCallBack( ASyncDoDeactivate, this ), CActive::EPriorityLow );
   378         TCallBack( ASyncDoDeactivate, this ), CActive::EPriorityLow );
       
   379     
       
   380     // PhClt initialization
       
   381     User::LeaveIfError( iServer.Connect() );
       
   382     iEmergency = CPhCltEmergencyCall::NewL( this );
   375     __VTPRINTEXIT( "DialContainer.ConstructL" )
   383     __VTPRINTEXIT( "DialContainer.ConstructL" )
   376     }
   384     }
   377 
   385 
   378 // ---------------------------------------------------------------------------
   386 // ---------------------------------------------------------------------------
   379 // CVtUiDialerContainer::RegisterComponentL
   387 // CVtUiDialerContainer::RegisterComponentL
   502 // ---------------------------------------------------------------------------
   510 // ---------------------------------------------------------------------------
   503 // CVtUiDialerContainer::MopSupplyObject
   511 // CVtUiDialerContainer::MopSupplyObject
   504 // ---------------------------------------------------------------------------
   512 // ---------------------------------------------------------------------------
   505 //
   513 //
   506 TTypeUid::Ptr CVtUiDialerContainer::MopSupplyObject( TTypeUid aId )
   514 TTypeUid::Ptr CVtUiDialerContainer::MopSupplyObject( TTypeUid aId )
   507  {
   515     {
   508      __VTPRINTENTER( "CVtUiDialerContainer.MopSupplyObject" )
   516      __VTPRINTENTER( "CVtUiDialerContainer.MopSupplyObject" )
   509  // Required during rendering of the background skin in Draw()
   517     // Required during rendering of the background skin in Draw()
   510  if (aId.iUid == MAknsControlContext::ETypeId)
   518     if (aId.iUid == MAknsControlContext::ETypeId)
   511      {
   519         {
   512       __VTPRINTEXIT( "CVtUiDialerContainer.MopSupplyObject.1" )
   520         __VTPRINTEXIT( "CVtUiDialerContainer.MopSupplyObject.1" )
   513      return MAknsControlContext::SupplyMopObject( aId, iBgContext );
   521         return MAknsControlContext::SupplyMopObject( aId, iBgContext );
   514      }
   522         }
   515     __VTPRINTEXIT( "CVtUiDialerContainer.MopSupplyObject.2" )
   523     __VTPRINTEXIT( "CVtUiDialerContainer.MopSupplyObject.2" )
   516  return CCoeControl::MopSupplyObject( aId );
   524     return CCoeControl::MopSupplyObject( aId );
   517  }
   525     }
   518 
   526 
   519 // ---------------------------------------------------------------------------
   527 // ---------------------------------------------------------------------------
   520 // CVtUiDialerContainer::ASyncDoDeactivate
   528 // CVtUiDialerContainer::ASyncDoDeactivate
   521 // ---------------------------------------------------------------------------
   529 // ---------------------------------------------------------------------------
   522 //
   530 //
   531     self->iCoeEnv->WsSession().SendEventToWindowGroup(
   539     self->iCoeEnv->WsSession().SendEventToWindowGroup(
   532         self->Window().WindowGroupId(), renderingEvent );
   540         self->Window().WindowGroupId(), renderingEvent );
   533     __VTPRINTEXIT( "DialContainer.ASyncDoDeactivate" )
   541     __VTPRINTEXIT( "DialContainer.ASyncDoDeactivate" )
   534     return KErrNone;
   542     return KErrNone;
   535     }
   543     }
       
   544 
       
   545 // -----------------------------------------------------------------------------
       
   546 // CVtUiDialerContainer::HandleEmergencyDialL
       
   547 // -----------------------------------------------------------------------------
       
   548 //
       
   549 void CVtUiDialerContainer::HandleEmergencyDialL(
       
   550     const TInt )
       
   551     {
       
   552     __VTPRINTENTER( "CVtUiDialerContainer.HandleEmergencyDialL" )
       
   553     // do nothing
       
   554     __VTPRINTEXIT( "CVtUiDialerContainer.HandleEmergencyDialL" )
       
   555     }
       
   556 
       
   557 // -----------------------------------------------------------------------------
       
   558 // CVtUiDialerContainer::NotifyDTMFBufferChanged
       
   559 // -----------------------------------------------------------------------------
       
   560 //
       
   561 void CVtUiDialerContainer::NotifyDTMFBufferChangedL()
       
   562     {
       
   563     __VTPRINTENTER( "CVtUiDialerContainer.NotifyDTMFBufferChanged" )
       
   564     CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current();
       
   565     
       
   566     // Get the buffer
       
   567     TBuf<KVtUiDTMFBufferSize> dtmfBuffer;
       
   568     GetContents( dtmfBuffer );
       
   569     
       
   570     // If buffer is empty
       
   571     if ( !dtmfBuffer.Length() )
       
   572         {
       
   573         __VTPRINT( DEBUG_GEN, "CVtUiDialerContainer.NotifyDTMFBufferChanged, buffer is emtpy")
       
   574         cba->SetCommandSetL( R_VIDEOTELUI_SOFTKEYS_EMPTY_DIALEREXIT );
       
   575         }
       
   576     else
       
   577         {
       
   578         // First we have to see if current buffer is a EC number
       
   579         AknTextUtils::ConvertDigitsTo( dtmfBuffer, EDigitTypeWestern );
       
   580         if ( !iEmergency )
       
   581             {
       
   582             iEmergency = CPhCltEmergencyCall::NewL( this );
       
   583             }
       
   584         TBool isEmergencyNumber = EFalse;
       
   585         const TInt err =
       
   586             iEmergency->FindEmergencyPhoneNumber( dtmfBuffer, isEmergencyNumber );
       
   587         
       
   588         __VTPRINT3( DEBUG_GEN, 
       
   589                 "CVtUiDialerContainer.NotifyDTMFBufferChanged, err=%d, isEC=%d",
       
   590                 err, isEmergencyNumber )
       
   591         
       
   592         // No error and It's EC number
       
   593         if ( err == KErrNone && isEmergencyNumber )
       
   594             {
       
   595             __VTPRINT( DEBUG_GEN, "CVtUiDialerContainer.NotifyDTMFBufferChanged, is EC")
       
   596             // change CBA to 'EC-Back'
       
   597             cba->SetCommandSetL( R_VIDEOTELUI_SOFTKEYS_EMERGCALL_DIALEREXIT );
       
   598             }
       
   599         // Error happened, but it's EC number
       
   600         else if ( err != KErrNone && isEmergencyNumber )
       
   601             {
       
   602             __VTPRINT( DEBUG_GEN, "CVtUiDialerContainer.NotifyDTMFBufferChanged, err happened")
       
   603             cba->SetCommandSetL( R_VIDEOTELUI_SOFTKEYS_EMPTY_DIALEREXIT );
       
   604             }
       
   605         else // not EC number and we don't care about the error
       
   606             {
       
   607             __VTPRINT( DEBUG_GEN, "CVtUiDialerContainer.NotifyDTMFBufferChanged, not EC")
       
   608             // change CBA to digitl we have on hand
       
   609             // but at the moment we dont need this, so comment it out
       
   610             //cba->SetCommandL( EAknSoftkeyEmpty, dtmfBuffer );
       
   611             }
       
   612         }
       
   613     cba->DrawNow();
       
   614     __VTPRINTEXIT( "CVtUiDialerContainer.NotifyDTMFBufferChanged" )
       
   615     }