cellular/PsetNotesUi/Src/PsuiWaitingObs.cpp
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Thu, 19 Aug 2010 10:28:14 +0300
branchRCL_3
changeset 41 594d59766373
parent 0 ff3b6d0fd310
child 12 ae8abd0db65c
child 43 7d48bed6ce0c
permissions -rw-r--r--
Revision: 201031 Kit: 201033

/*
* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). 
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:  Handles requests for showing Call Waiting notes.
*
*/


// INCLUDE FILES
#include <Psui.rsg>
#include <PsuiContainer.h>
#include <etelsat.h>
 
#include "PsuiInternalConstants.h"
#include "PsuiNoteController.h"
#include "PsuiVariationProxy.h"

//  MEMBER FUNCTIONS
// ---------------------------------------------------------------------------
// Symbian OS two-phased Constructor.
// ---------------------------------------------------------------------------
EXPORT_C CPsuiWaitingObs* CPsuiWaitingObs::NewL( CPsuiContainer& aContainer )
    {
    CPsuiWaitingObs* self = new( ELeave ) CPsuiWaitingObs;
    CleanupStack::PushL( self );
    self->ConstructL( aContainer );
    CleanupStack::Pop( self );
    return self;
    }

// ---------------------------------------------------------------------------
// Symbian OS 2nd phase Constructor.
// ---------------------------------------------------------------------------
void CPsuiWaitingObs::ConstructL( CPsuiContainer& aContainer )
    {
    iContainer = &aContainer;
  
    CPSuiVariationProxy* variationProxy = CPSuiVariationProxy::NewL();
    CleanupStack::PushL( variationProxy );
    iCallWaitingDistinguishEnabled = variationProxy->FeatureEnabled( KCallWaitingDistiquishNotProvisioned);
    CleanupStack::PopAndDestroy( variationProxy );
    
    }

// ---------------------------------------------------------------------------
// Handles changing of call waiting.
// ---------------------------------------------------------------------------
void CPsuiWaitingObs::HandleCallWaitingChangedL
( const MPsetCallWaiting::TSetCallWaiting aSetting, const TInt /* aResult */ )
    {
    if ( aSetting == MPsetCallWaiting::EActivateCallWaiting )
        {
        CPsuiNoteController::InstanceL()->ShowNoteL( 
            EPsuiConfirmationNote, R_CW_ACTIVE_NOTE );
        }
    else if ( aSetting == MPsetCallWaiting::EDeactivateCallWaiting )
        {
        CPsuiNoteController::InstanceL()->ShowNoteL( 
            EPsuiConfirmationNote, R_CW_CANCEL_NOTE );
        }
    }  

// ---------------------------------------------------------------------------
// Sets engine contact for observer.
// ---------------------------------------------------------------------------
void CPsuiWaitingObs::SetEngineContact( MPsetCallWaiting& aEngineContact )
    {
    CPsuiNoteController::InstanceL()->SetEngineContacts( 
        &aEngineContact, NULL, NULL, NULL );
    }

// ---------------------------------------------------------------------------
// Handles requesting notes (show/hide).
// ---------------------------------------------------------------------------
void CPsuiWaitingObs::HandleCWRequestingL( TBool aOngoing, TBool aInterrupted )
    {
    if ( aInterrupted )
        {
        CPsuiNoteController::InstanceL()->RemoveNotesL();
        return;
        }
    
    if ( aOngoing )
        {
        CPsuiNoteController::InstanceL()->ShowNoteL( 
            EPsuiWaitingNote, -1 );
        }
    else
        {
        CPsuiNoteController::InstanceL()->KillStaticNoteL();
        }
    }

// ---------------------------------------------------------------------------
// Handles the get status notifications.
// ---------------------------------------------------------------------------
//
void CPsuiWaitingObs::HandleCallWaitingGetStatusL( 
    const MPsetCallWaiting::TGetCallWaitingStatus aStatus, 
    TUint8 aBsc[KPSUIMaxBscNumber] )
    {
    
   	if ( iCallWaitingDistinguishEnabled && aStatus == MPsetCallWaiting::EStatusNotProvisioned )
        {
        CPsuiNoteController::InstanceL()->ShowNoteL( 
            EPsuiConfirmationNote, R_CW_NOT_PROVISIONED_NOTE );
        }
    else if ( aStatus != MPsetCallWaiting::EStatusActive )
        {
        CPsuiNoteController::InstanceL()->ShowNoteL( 
            EPsuiConfirmationNote, R_CW_NOT_ACTIVE_NOTE );
        }
    else
        {
        if( iCallWaitingDistinguishEnabled )
        	{
        		
        	//show only "CW active" even if the bsc list is present. 
        	//This change is to fix the error ENYI-6DYFKZ
         	CPsuiNoteController::InstanceL()->ShowNoteL( EPsuiConfirmationNote, 
                R_CW_ACTIVE_NO_BSC_NOTE );
        	}
        else
        	{
        		
        	//if no bsc-list present, show only "CW active"
        	if ( aBsc[0] == KPSUINoBscGroup )
            	{
            	CPsuiNoteController::InstanceL()->ShowNoteL( EPsuiConfirmationNote, 
                R_CW_ACTIVE_NO_BSC_NOTE );
            	}
        	else
            	{
            
            	CPsuiNoteController::InstanceL()->ShowBscListL( 
                R_CW_STATUS_HEADING, 
                aBsc );
            	}
        	}
        }
    }

// ---------------------------------------------------------------------------
// This function handles errors in call waiting requests.
// ---------------------------------------------------------------------------
//
void CPsuiWaitingObs::HandleCWErrorL( TInt aReason )
    {
    if ( aReason != KErrSatControl  )
        {
        TInt errorResource(
            CPsuiNoteController::InstanceL()->SetErrorNoteResourceID( aReason ) );
            
        CPsuiNoteController::InstanceL()->ShowNoteL( EPsuiErrorNote, errorResource );
        }
    }

// End of File