diff -r cad71a31b7fc -r e36f3802f733 voiceui/voiceuivoicerecognition/src/vuicnotificationobserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voiceui/voiceuivoicerecognition/src/vuicnotificationobserver.cpp Wed Sep 01 12:29:17 2010 +0100 @@ -0,0 +1,123 @@ +/* +* 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 + +#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 +