voiceui/voiceuivoicerecognition/src/vuicvoicerecogdialog.cpp
branchRCL_3
changeset 19 e36f3802f733
parent 0 bf1d17376201
equal deleted inserted replaced
18:cad71a31b7fc 19:e36f3802f733
       
     1 /*
       
     2 * Copyright (c) 2004-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:  The Voice Recognition dialog for clients
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include <coemain.h>
       
    21 #include <apgcli.h>
       
    22 #include <apgtask.h>
       
    23 #include <apacmdln.h>
       
    24 
       
    25 #include "vuicvoicerecogdialog.h"
       
    26 
       
    27 #include "rubydebug.h"
       
    28 
       
    29 
       
    30 // ================= MEMBER FUNCTIONS =======================
       
    31 
       
    32 // -----------------------------------------------------------------------------
       
    33 // CVoiceRecognitionDialog::CVoiceRecognitionDialog
       
    34 // C++ default constructor can NOT contain any code, that
       
    35 // might leave.
       
    36 // -----------------------------------------------------------------------------
       
    37 //
       
    38 EXPORT_C CVoiceRecognitionDialog::CVoiceRecognitionDialog()
       
    39     {
       
    40     RUBY_DEBUG0( "CVoiceRecognitionDialog::CVoiceRecognitionDialog" );
       
    41     // Nothing
       
    42     }
       
    43 
       
    44 // Destructor
       
    45 EXPORT_C CVoiceRecognitionDialog::~CVoiceRecognitionDialog()
       
    46     {
       
    47     RUBY_DEBUG0( "CVoiceRecognitionDialog::~CVoiceRecognitionDialog START" );
       
    48         
       
    49     RUBY_DEBUG0( "CVoiceRecognitionDialog::~CVoiceRecognitionDialog EXIT" );
       
    50     }
       
    51 
       
    52 
       
    53 // ---------------------------------------------------------
       
    54 // CVoiceRecognitionDialog::ExecuteLD
       
    55 // ---------------------------------------------------------
       
    56 //
       
    57 EXPORT_C TInt CVoiceRecognitionDialog::ExecuteLD()
       
    58     {
       
    59     RUBY_DEBUG_BLOCK( "CVoiceRecognitionDialog::ExecuteLD" );
       
    60     
       
    61     TUid uid = { 0x101F8543 };
       
    62 
       
    63     TApaTaskList apaTaskList( CCoeEnv::Static()->WsSession() );
       
    64     TApaTask apaTask = apaTaskList.FindApp( uid );
       
    65     
       
    66     if ( apaTask.Exists() )
       
    67         {
       
    68         apaTask.BringToForeground();
       
    69         }
       
    70     else
       
    71         {
       
    72         RApaLsSession apaLsSession;
       
    73         User::LeaveIfError( apaLsSession.Connect() );
       
    74         
       
    75         TApaAppInfo appInfo;
       
    76         User::LeaveIfError( apaLsSession.GetAppInfo( appInfo, uid ) );
       
    77         
       
    78         TFileName appName = appInfo.iFullName;
       
    79         CApaCommandLine* apaCommandLine = CApaCommandLine::NewLC();
       
    80 
       
    81         apaCommandLine->SetExecutableNameL( appName );
       
    82         apaCommandLine->SetCommandL( EApaCommandRun );
       
    83         User::LeaveIfError ( apaLsSession.StartApp( *apaCommandLine ) );
       
    84         CleanupStack::PopAndDestroy( apaCommandLine );
       
    85     
       
    86         apaLsSession.Close();
       
    87         }
       
    88         
       
    89     delete this;
       
    90 
       
    91     return KErrNone;
       
    92     }
       
    93 
       
    94 // ---------------------------------------------------------
       
    95 // CVoiceRecognitionDialog::Cancel
       
    96 // ---------------------------------------------------------
       
    97 //
       
    98 EXPORT_C void CVoiceRecognitionDialog::Cancel()
       
    99     {
       
   100     RUBY_DEBUG0( "CVoiceRecognitionDialog::Cancel START" );
       
   101     
       
   102     delete this;
       
   103     
       
   104     RUBY_DEBUG0( "CVoiceRecognitionDialog::Cancel EXIT" );
       
   105     }
       
   106