vtuis/videotelui/src/CVtUiAllowVideoDialog.cpp
branchRCL_3
changeset 35 779871d1e4f4
equal deleted inserted replaced
34:f15ac8e65a02 35:779871d1e4f4
       
     1 /*
       
     2 * Copyright (c) 2004 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:  Implementation of the CVtUiAllowVideoDialog class.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include    "CVtUiAllowVideoDialog.h"
       
    22 #include    <StringLoader.h>
       
    23 #include    <videotelui.rsg>
       
    24 
       
    25 // CONSTANTS
       
    26 
       
    27 // Timeout for allow video query.
       
    28 const TInt KVtUiAllowVideoDialogTimeout = 5000000;
       
    29 
       
    30 // ============================ MEMBER FUNCTIONS ===============================
       
    31 
       
    32 // -----------------------------------------------------------------------------
       
    33 // CVtUiAllowVideoDialog::CVtUiAllowVideoDialog
       
    34 // -----------------------------------------------------------------------------
       
    35 //
       
    36 CVtUiAllowVideoDialog::CVtUiAllowVideoDialog(
       
    37         CEikDialog** aSelfPtr,
       
    38         const TTone& aTone )
       
    39     : CAknQueryDialog( aTone ),
       
    40       iSelfPtr( aSelfPtr )
       
    41     {
       
    42     }
       
    43 
       
    44 // -----------------------------------------------------------------------------
       
    45 // CVtUiAllowVideoDialog::~CVtUiAllowVideoDialog
       
    46 // -----------------------------------------------------------------------------
       
    47 //
       
    48 CVtUiAllowVideoDialog::~CVtUiAllowVideoDialog()
       
    49     {
       
    50     if ( iSelfPtr )
       
    51         {
       
    52         *iSelfPtr = NULL;
       
    53         iSelfPtr = NULL;
       
    54         }
       
    55 
       
    56     if ( iRequestStatus )
       
    57         {
       
    58         User::RequestComplete( iRequestStatus, KErrNone );
       
    59         iRequestStatus = NULL;
       
    60         }
       
    61 
       
    62     delete iQueryTimer;
       
    63     }
       
    64 
       
    65 // -----------------------------------------------------------------------------
       
    66 // CVtUiAllowVideoDialog::ExecuteDialogLD
       
    67 // -----------------------------------------------------------------------------
       
    68 //
       
    69 void CVtUiAllowVideoDialog::ExecuteDialogLD(
       
    70         TRequestStatus& aStatus )
       
    71     {
       
    72     aStatus = KRequestPending;
       
    73 
       
    74     HBufC* prompt = StringLoader::LoadLC( R_VIDEOTELUI_QTN_SEND_VIDEO_IMAGE );
       
    75 
       
    76     PrepareLC( R_VIDEOTELUI_ALLOW_VIDEO_QUERY );
       
    77     SetPromptL( *prompt );
       
    78     RunLD();
       
    79 
       
    80     CleanupStack::PopAndDestroy( prompt );
       
    81     iRequestStatus = &aStatus;
       
    82     }
       
    83 
       
    84 // -----------------------------------------------------------------------------
       
    85 // CVtUiAllowVideoDialog::PostLayoutDynInitL
       
    86 // -----------------------------------------------------------------------------
       
    87 //
       
    88 void CVtUiAllowVideoDialog::PostLayoutDynInitL()
       
    89     {
       
    90     CAknQueryDialog::PostLayoutDynInitL();
       
    91 
       
    92     iQueryTimer = CPeriodic::NewL( CActive::EPriorityStandard );
       
    93     iQueryTimer->Start(
       
    94         KVtUiAllowVideoDialogTimeout,
       
    95         KVtUiAllowVideoDialogTimeout,
       
    96         TCallBack( DoDismissDialogTimeoutL, this ) );
       
    97     }
       
    98 
       
    99 // -----------------------------------------------------------------------------
       
   100 // CVtUiAllowVideoDialog::OkToExitL
       
   101 // -----------------------------------------------------------------------------
       
   102 //
       
   103 TBool CVtUiAllowVideoDialog::OkToExitL( TInt aCommand )
       
   104     {
       
   105     const TBool exit = 
       
   106         CAknQueryDialog::OkToExitL( aCommand );
       
   107 
       
   108     if ( exit )
       
   109         {
       
   110         CVtUiAllowVideoDialog::TResult result =
       
   111             CVtUiAllowVideoDialog::EQueryCanceled;
       
   112 
       
   113         switch ( aCommand )
       
   114             {
       
   115             case EAknSoftkeyOk:
       
   116             case EAknSoftkeyYes:
       
   117                 result = CVtUiAllowVideoDialog::EUserAllowed;
       
   118                 break;
       
   119 
       
   120             case EAknSoftkeyNo:
       
   121                 result = CVtUiAllowVideoDialog::EUserDenied;
       
   122                 break;
       
   123 
       
   124             default:
       
   125                 break;
       
   126             }
       
   127 
       
   128         if ( iRequestStatus )
       
   129             {
       
   130             User::RequestComplete( iRequestStatus, result );
       
   131             iRequestStatus = NULL;
       
   132             }
       
   133         }
       
   134 
       
   135     return exit;
       
   136     }
       
   137 
       
   138 // -----------------------------------------------------------------------------
       
   139 // CVtUiAllowVideoDialog::DoDismissDialogTimeoutL
       
   140 // -----------------------------------------------------------------------------
       
   141 //
       
   142 TInt CVtUiAllowVideoDialog::DoDismissDialogTimeoutL( TAny* aAny )
       
   143     {
       
   144     CVtUiAllowVideoDialog* self =
       
   145         static_cast< CVtUiAllowVideoDialog* >( aAny );
       
   146 
       
   147     TRequestStatus* status = self->iRequestStatus;
       
   148     self->iRequestStatus = NULL;
       
   149     
       
   150     delete self;    
       
   151 
       
   152     User::RequestComplete( 
       
   153         status,
       
   154         CVtUiAllowVideoDialog::EQueryDismissedTimeout );
       
   155 
       
   156     return KErrNone;
       
   157     }
       
   158 
       
   159 //  End of File