phoneuis/dialer/tsrc/public/basic/T_VideoDtmfDialer/src/T_VideoDtmfDialerBlocks.cpp
changeset 0 5f000ab63145
child 34 b68fcd923911
equal deleted inserted replaced
-1:000000000000 0:5f000ab63145
       
     1 /*
       
     2 * Copyright (c) 2002 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 CT_VideoDtmfDialer class, API testing.
       
    15 *
       
    16 */
       
    17 
       
    18 // INCLUDE FILES 
       
    19 #include <eiklabel.h> 
       
    20 #include <AknAppUi.h>
       
    21 #include <akntoolbar.h> 
       
    22 
       
    23 #include <e32svr.h>
       
    24 #include <StifParser.h>
       
    25 #include <Stiftestinterface.h>
       
    26 #include "T_VideoDtmfDialer.h"
       
    27 #include "T_VideoDtmfDialerAppView.h"
       
    28 
       
    29 #include <cdialer.h>
       
    30 #include <cvideodtmfdialer.h>
       
    31 
       
    32 
       
    33 // ============================ MEMBER FUNCTIONS ===============================
       
    34 
       
    35 // -----------------------------------------------------------------------------
       
    36 // CT_VideoDtmfDialer::Delete
       
    37 // Delete here all resources allocated and opened from test methods. 
       
    38 // Called from destructor. 
       
    39 // -----------------------------------------------------------------------------
       
    40 //
       
    41 void CT_VideoDtmfDialer::Delete() 
       
    42     {
       
    43 
       
    44     }
       
    45 
       
    46 // -----------------------------------------------------------------------------
       
    47 // CT_VideoDtmfDialer::RunMethodL
       
    48 // Run specified method. Contains also table of test mothods and their names.
       
    49 // -----------------------------------------------------------------------------
       
    50 //
       
    51 TInt CT_VideoDtmfDialer::RunMethodL( 
       
    52     CStifItemParser& aItem ) 
       
    53     {
       
    54 
       
    55     static TStifFunctionInfo const KFunctions[] =
       
    56         {  
       
    57         ENTRY( "CreateView", CT_VideoDtmfDialer::CreateViewL ),
       
    58         ENTRY( "DeleteView", CT_VideoDtmfDialer::DeleteViewL ),
       
    59         ENTRY( "CreateDialer", CT_VideoDtmfDialer::CreateDialerL),
       
    60         ENTRY( "DeleteDialer", CT_VideoDtmfDialer::DeleteDialerL),
       
    61         ENTRY( "ShowDialer", CT_VideoDtmfDialer::ShowDialerL),
       
    62         ENTRY( "CreateVideoDtmfDialer", CT_VideoDtmfDialer::CreateVideoDtmfDialerL ),
       
    63         ENTRY( "ShowVideoDtmfDialer", CT_VideoDtmfDialer::ShowVideoDtmfDialerL),
       
    64         ENTRY( "DeleteVideoDtmfDialer", CT_VideoDtmfDialer::DeleteVideoDtmfDialerL ),
       
    65         };
       
    66 
       
    67     const TInt count = sizeof( KFunctions ) / 
       
    68                         sizeof( TStifFunctionInfo );
       
    69 
       
    70     return RunInternalL( KFunctions, count, aItem );
       
    71     }
       
    72 
       
    73 // -----------------------------------------------------------------------------
       
    74 // CT_VideoDtmfDialer::CreateViewL()
       
    75 // -----------------------------------------------------------------------------
       
    76 //
       
    77 TInt CT_VideoDtmfDialer::CreateViewL(CStifItemParser& /*aItem*/)
       
    78 	{
       
    79 	CCoeControl* videoDtmfDialerControl = CT_VideoDtmfDialerAppView::NewL(
       
    80 		CEikonEnv::Static()->EikAppUi()->ClientRect() );	
       
    81 
       
    82 	CleanupStack::PushL( videoDtmfDialerControl ); 
       
    83 	CCoeEnv::Static()->AppUi()->AddToStackL( videoDtmfDialerControl );
       
    84 	CleanupStack::Pop( videoDtmfDialerControl ); 
       
    85 
       
    86     // Ownership is transferred 
       
    87     iVideoDtmfDialerControl = videoDtmfDialerControl; 
       
    88     iVideoDtmfDialerControl->MakeVisible(ETrue);
       
    89 
       
    90     return KErrNone;	
       
    91 	}
       
    92 
       
    93 // -----------------------------------------------------------------------------
       
    94 // CT_VideoDtmfDialer::DeleteViewL()
       
    95 // -----------------------------------------------------------------------------
       
    96 //
       
    97 TInt CT_VideoDtmfDialer::DeleteViewL(CStifItemParser& /*aItem*/)
       
    98 	{
       
    99 	if( iVideoDtmfDialerControl )
       
   100 		{
       
   101 	    CCoeEnv::Static()->AppUi()->RemoveFromStack( iVideoDtmfDialerControl );
       
   102 	    delete iVideoDtmfDialerControl;
       
   103 	    iVideoDtmfDialerControl = NULL; 
       
   104 		}
       
   105 
       
   106     return KErrNone;		
       
   107 	}
       
   108 
       
   109 // -----------------------------------------------------------------------------
       
   110 // CT_VideoDtmfDialer::CreateDialerL()
       
   111 // -----------------------------------------------------------------------------
       
   112 //
       
   113 TInt CT_VideoDtmfDialer::CreateDialerL(CStifItemParser& /*aItem*/)
       
   114     {
       
   115     if( iVideoDtmfDialerControl )
       
   116 	    {
       
   117 	    iDialer = CDialer::NewL( 
       
   118 	    	*iVideoDtmfDialerControl, 
       
   119 	    	CEikonEnv::Static()->EikAppUi()->ClientRect() );
       
   120 	    iNumberEntry = iDialer->NumberEntry();
       
   121 
       
   122 	    return KErrNone;
       
   123 	    }
       
   124 	else
       
   125 		{
       
   126 		return KErrGeneral; 	
       
   127 		}	
       
   128     }
       
   129 
       
   130 // -----------------------------------------------------------------------------
       
   131 // CT_VideoDtmfDialer::ShowDialerL()
       
   132 // -----------------------------------------------------------------------------
       
   133 //
       
   134 TInt CT_VideoDtmfDialer::ShowDialerL(CStifItemParser& /*aItem*/)
       
   135     {
       
   136     if( iNumberEntry )
       
   137         {
       
   138         iNumberEntry->CreateNumberEntry();
       
   139 
       
   140         static_cast<CT_VideoDtmfDialerAppView*>(iVideoDtmfDialerControl)->SetControl( iDialer );
       
   141 
       
   142         return KErrNone;
       
   143         }
       
   144     else
       
   145         {
       
   146         return KErrGeneral; 
       
   147         }
       
   148     }
       
   149 
       
   150 // -----------------------------------------------------------------------------
       
   151 // CT_VideoDtmfDialer::DeleteDialerL()
       
   152 // -----------------------------------------------------------------------------
       
   153 //
       
   154 TInt CT_VideoDtmfDialer::DeleteDialerL(CStifItemParser& /*aItem*/)
       
   155     {
       
   156     delete iDialer; 
       
   157     iDialer = NULL;     
       
   158 
       
   159     return KErrNone;
       
   160     }
       
   161     
       
   162 // -----------------------------------------------------------------------------
       
   163 // CT_VideoDtmfDialer::CreateVideoDtmfDialerL()
       
   164 // -----------------------------------------------------------------------------
       
   165 //
       
   166 TInt CT_VideoDtmfDialer::CreateVideoDtmfDialerL(CStifItemParser& /*aItem*/)
       
   167     {
       
   168     if( iVideoDtmfDialerControl )
       
   169     	{
       
   170 	    iVideoControl = new( ELeave ) CEikLabel;
       
   171 	    iVideoControl->SetBufferReserveLengthL( 10 );
       
   172 	    iVideoControl->SetTextL( _L("Video Here") ) ;
       
   173 	    iVideoControl->SetAlignment( EHCenterVCenter );
       
   174 
       
   175 	    iVideoDtmfDialer = CVideoDTMFDialer::NewL( 
       
   176 	    	*iVideoDtmfDialerControl, 
       
   177            	*iVideoControl, 
       
   178            	CEikonEnv::Static()->EikAppUi()->ClientRect() );
       
   179            
       
   180 		return KErrNone;		                                           
       
   181     	}
       
   182     else
       
   183     	{
       
   184     	return KErrGeneral; 	
       
   185     	}	    
       
   186     }
       
   187 
       
   188 // -----------------------------------------------------------------------------
       
   189 // CT_VideoDtmfDialer::ShowVideoDtmfDialerL()
       
   190 // -----------------------------------------------------------------------------
       
   191 //
       
   192 TInt CT_VideoDtmfDialer::ShowVideoDtmfDialerL(CStifItemParser& /*aItem*/)
       
   193     {
       
   194     if( iVideoDtmfDialerControl )
       
   195     	{
       
   196     	static_cast<CT_VideoDtmfDialerAppView*>(iVideoDtmfDialerControl)->SetControl( 
       
   197     	    iVideoDtmfDialer );
       
   198            
       
   199 		return KErrNone;		                                           
       
   200     	}
       
   201     else
       
   202     	{
       
   203     	return KErrGeneral; 	
       
   204     	}	    
       
   205     }
       
   206     
       
   207 // CT_VideoDtmfDialer::DeleteVideoDtmfDialerL()
       
   208 // -----------------------------------------------------------------------------
       
   209 //
       
   210 TInt CT_VideoDtmfDialer::DeleteVideoDtmfDialerL(CStifItemParser& /*aItem*/)
       
   211     {
       
   212 	delete iVideoControl; 
       
   213 	iVideoControl = NULL; 
       
   214     delete iVideoDtmfDialer;                   
       
   215     iVideoDtmfDialer = NULL;
       
   216     
       
   217     return KErrNone;
       
   218     }
       
   219 	
       
   220 
       
   221 // End of file
       
   222