voiceui/voiceuivoicerecognition/src/vuicnotificationobserver.cpp
author Pat Downey <patd@symbian.org>
Wed, 01 Sep 2010 12:29:17 +0100
branchRCL_3
changeset 19 e36f3802f733
parent 0 bf1d17376201
permissions -rw-r--r--
Revert incorrect RCL_3 drop: Revision: 201033 Kit: 201035

/*
* Copyright (c) 2009 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:  Implementation of CNBestListDialog
*
*/

// INCLUDE FILES
#include "vuicnotificationobserver.h"

#include <avkondomainpskeys.h>

#include "rubydebug.h"

// -----------------------------------------------------------------------------
// CNotificationObserver::NewL
// Two-phased constructor.
// -----------------------------------------------------------------------------
//
CNotificationObserver* CNotificationObserver::NewL()
    {
    CNotificationObserver* self = new (ELeave) CNotificationObserver();
    CleanupStack::PushL( self );
    self->ConstructL();
    CleanupStack::Pop( self );
    return self;
    } 

// Destructor       
CNotificationObserver::~CNotificationObserver()
    {
    RUBY_DEBUG0( "CNotificationObserver::~CNotificationObserver START" );
    
    Cancel();
    
    iNotificationState.Set( iNotificationStatus );
    
    iNotificationState.Close();
    
    RUBY_DEBUG0( "CNotificationObserver::~CNotificationObserver EXIT" );
    }

// ---------------------------------------------------------
// CNotificationObserver::DoCancel
// ---------------------------------------------------------
// 
void CNotificationObserver::DoCancel()
    {
    RUBY_DEBUG0( "CNotificationObserver::DoCancel START" );
    
    iNotificationState.Cancel();
    
    RUBY_DEBUG0( "CNotificationObserver::DoCancel EXIT" );
    }

// ---------------------------------------------------------
// CNotificationObserver::RunL
// ---------------------------------------------------------
//     
void CNotificationObserver::RunL()
    {
    RUBY_DEBUG_BLOCK( "CNotificationObserver::RunL" );
    
    TInt status = iStatus.Int();
    
    if ( status == KErrNone )
        {
        iNotificationState.Get( iNotificationStatus );
        
        if ( iNotificationStatus )
            {
            iNotificationState.Set( 0 );
            }
        }
        
    iNotificationState.Subscribe( iStatus );
    SetActive();
    }

// ---------------------------------------------------------
// CNotificationObserver::CNotificationObserver
// ---------------------------------------------------------
//              
CNotificationObserver::CNotificationObserver()
 : CActive( EPriorityStandard )
    {
    }
    
// ---------------------------------------------------------
// CNotificationObserver::ConstructL
// ---------------------------------------------------------
//           
void CNotificationObserver::ConstructL()
    {
    RUBY_DEBUG_BLOCK( "CNotificationObserver::ConstructL" );
    
    User::LeaveIfError( iNotificationState.Attach( KPSUidAvkonDomain, KAknNotificationsInIdleAllowed ) );
    CActiveScheduler::Add( this );
    
    iNotificationState.Get( iNotificationStatus );
    
    if ( iNotificationStatus )
        {
        iNotificationState.Set( 0 );
        }
    
    iNotificationState.Subscribe( iStatus );
    SetActive();
    }    

    
// End of File