voiceui/voiceuivoicerecognition/src/vuicfoldobserver.cpp
branchRCL_3
changeset 23 e36f3802f733
parent 0 bf1d17376201
equal deleted inserted replaced
22:cad71a31b7fc 23:e36f3802f733
       
     1 /*
       
     2 * Copyright (c) 2007 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:  
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include <hwrmdomainpskeys.h>
       
    21 
       
    22 #include "vuimvoicerecogdialogcallback.h"
       
    23 
       
    24 #include "vuicfoldobserver.h"
       
    25 
       
    26 #include "rubydebug.h"
       
    27 
       
    28 // -----------------------------------------------------------------------------
       
    29 // CFoldObserver::NewL
       
    30 // Two-phased constructor.
       
    31 // -----------------------------------------------------------------------------
       
    32 //
       
    33 CFoldObserver* CFoldObserver::NewL( MVoiceRecognitionDialogCallback* aCallback )
       
    34     {
       
    35     CFoldObserver* self = new (ELeave) CFoldObserver( aCallback );
       
    36     CleanupStack::PushL( self );
       
    37     self->ConstructL();
       
    38     CleanupStack::Pop( self );
       
    39     return self;
       
    40     } 
       
    41 
       
    42 // Destructor       
       
    43 CFoldObserver::~CFoldObserver()
       
    44     {
       
    45     RUBY_DEBUG0( "CFoldObserver::~CFoldObserver START" );
       
    46     
       
    47     Cancel();
       
    48     iFoldEvent.Close();
       
    49     
       
    50     RUBY_DEBUG0( "CFoldObserver::~CFoldObserver EXIT" );
       
    51     }
       
    52 
       
    53 // ---------------------------------------------------------
       
    54 // CFoldObserver::DoCancel
       
    55 // ---------------------------------------------------------
       
    56 // 
       
    57 void CFoldObserver::DoCancel()
       
    58     {
       
    59     RUBY_DEBUG0( "CFoldObserver::DoCancel START" );
       
    60     
       
    61     iFoldEvent.Cancel();
       
    62     
       
    63     RUBY_DEBUG0( "CFoldObserver::DoCancel EXIT" );
       
    64     }
       
    65 
       
    66 // ---------------------------------------------------------
       
    67 // CFoldObserver::RunL
       
    68 // ---------------------------------------------------------
       
    69 //     
       
    70 void CFoldObserver::RunL()
       
    71     {
       
    72     RUBY_DEBUG_BLOCK( "CFoldObserver::RunL" );
       
    73     
       
    74     TInt status = iStatus.Int();
       
    75     
       
    76     iFoldEvent.Subscribe( iStatus );
       
    77     SetActive();
       
    78     
       
    79     if ( status == KErrNone )
       
    80         {
       
    81         TInt newFoldStatus;
       
    82         iFoldEvent.Get( newFoldStatus );
       
    83         
       
    84         if ( newFoldStatus == EPSHWRMFlipClosed && newFoldStatus != iFoldStatus )
       
    85             {
       
    86             iCallback->DialogDismissed();
       
    87             }
       
    88         iFoldStatus = newFoldStatus;
       
    89         }
       
    90     }
       
    91 
       
    92 // ---------------------------------------------------------
       
    93 // CFoldObserver::CFoldObserver
       
    94 // ---------------------------------------------------------
       
    95 //              
       
    96 CFoldObserver::CFoldObserver( MVoiceRecognitionDialogCallback* aCallback )
       
    97  : CActive( EPriorityStandard ), iCallback( aCallback )
       
    98     {
       
    99     }
       
   100     
       
   101 // ---------------------------------------------------------
       
   102 // CFoldObserver::ConstructL
       
   103 // ---------------------------------------------------------
       
   104 //           
       
   105 void CFoldObserver::ConstructL()
       
   106     {
       
   107     RUBY_DEBUG_BLOCK( "CFoldObserver::ConstructL" );
       
   108     
       
   109     User::LeaveIfError( iFoldEvent.Attach( KPSUidHWRM, KHWRMFlipStatus ) );
       
   110     CActiveScheduler::Add( this );
       
   111     
       
   112     iFoldEvent.Get( iFoldStatus );
       
   113     
       
   114     iFoldEvent.Subscribe( iStatus );
       
   115     SetActive();
       
   116     }    
       
   117 
       
   118     
       
   119 // End of File
       
   120