classicui_pub/queries_api/tsrc/src/testsdkqueriesblocksmessagequerycontrol.cpp
changeset 0 2f259fa3e83a
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     1 /*
       
     2 * Copyright (c) 2002 - 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:  Test aknmessagequerycontrol.h
       
    15 *
       
    16 */
       
    17 
       
    18 //INCLUDE
       
    19 #include <aknmessagequerycontrol.h>
       
    20 #include <aknlistquerydialog.h>
       
    21 #include <testsdkqueries.rsg>
       
    22 #include <barsread.h>
       
    23 
       
    24 #include "testsdkqueries.h"
       
    25 #include "testsdkqueriescontainer.h"
       
    26 #include "testsdkaknmessagequerycontrolprotected.h"
       
    27 
       
    28 const TInt KZero = 0;
       
    29 const TInt KOne = 1;
       
    30 const TInt KTen = 10;
       
    31 
       
    32 // -----------------------------------------------------------------------------
       
    33 // CTestSDKQueries::TestMqcConstructFromResourceL
       
    34 // -----------------------------------------------------------------------------
       
    35 //
       
    36 TInt CTestSDKQueries::TestMqcConstructFromResourceL( CStifItemParser& /*aItem*/ )
       
    37     {
       
    38     TInt selectedOption( KZero );
       
    39         
       
    40     CDesCArrayFlat* mArray = new (ELeave) CDesCArrayFlat( KTen );
       
    41     CleanupStack::PushL( mArray );
       
    42      
       
    43     TBuf< KTen > palabra;
       
    44     for (TInt num = KZero; num< KTen; num++)
       
    45         {
       
    46        palabra.Format(_L("option %d"), num);
       
    47        mArray->AppendL(palabra);
       
    48         }
       
    49      
       
    50     CAknListQueryDialog* dlg = new( ELeave ) CAknListQueryDialog( &selectedOption );
       
    51     dlg->PrepareLC( R_UPDATE_QUERY_MSG_DIALOG );
       
    52     dlg->SetItemTextArray( mArray );
       
    53     dlg->SetOwnershipType( ELbmDoesNotOwnItemArray );
       
    54     
       
    55     CAknMessageQueryControl* msgBox = dlg->MessageBox();
       
    56     
       
    57     TResourceReader reader;
       
    58     CCoeEnv::Static()->CreateResourceReaderLC( reader, R_MESSAGE );
       
    59     
       
    60     msgBox->ConstructFromResourceL( reader );
       
    61     
       
    62     CleanupStack::PopAndDestroy( KOne );
       
    63     CleanupStack::PopAndDestroy( dlg );
       
    64     CleanupStack::Pop( mArray );
       
    65     return KErrNone;
       
    66     }
       
    67 
       
    68 // -----------------------------------------------------------------------------
       
    69 // CTestSDKQueries::TestMqcSetMessageTextL
       
    70 // -----------------------------------------------------------------------------
       
    71 //
       
    72 TInt CTestSDKQueries::TestMqcSetMessageTextL( CStifItemParser& aItem )
       
    73     {
       
    74     TInt err = TestMqcConstructFromResourceL( aItem );
       
    75     return err;
       
    76     }
       
    77 
       
    78 // -----------------------------------------------------------------------------
       
    79 // CTestSDKQueries::TestMqcLinkHighLightedL
       
    80 // -----------------------------------------------------------------------------
       
    81 //
       
    82 TInt CTestSDKQueries::TestMqcLinkHighLightedL( CStifItemParser& /*aItem*/ )
       
    83     {
       
    84     TInt selectedOption( KZero );
       
    85         
       
    86     CDesCArrayFlat* mArray = new (ELeave) CDesCArrayFlat( KTen );
       
    87     CleanupStack::PushL( mArray );
       
    88      
       
    89     TBuf< KTen > palabra;
       
    90     for (TInt num = KZero; num< KTen; num++)
       
    91         {
       
    92        palabra.Format(_L("option %d"), num);
       
    93        mArray->AppendL(palabra);
       
    94         }
       
    95      
       
    96     CAknListQueryDialog* dlg = new( ELeave ) CAknListQueryDialog( &selectedOption );
       
    97     dlg->PrepareLC( R_UPDATE_QUERY_MSG_DIALOG );
       
    98     dlg->SetItemTextArray( mArray );
       
    99     dlg->SetOwnershipType( ELbmDoesNotOwnItemArray );
       
   100     
       
   101     CAknMessageQueryControl* msgBox = dlg->MessageBox();
       
   102     
       
   103     TBool flag = msgBox->LinkHighLighted();
       
   104     STIF_ASSERT_FALSE( flag );
       
   105     
       
   106     CleanupStack::PopAndDestroy( dlg );
       
   107     CleanupStack::Pop( mArray );
       
   108     return KErrNone;
       
   109     }
       
   110 
       
   111 // -----------------------------------------------------------------------------
       
   112 // CTestSDKQueries::TestMqcDrawL
       
   113 // -----------------------------------------------------------------------------
       
   114 //
       
   115 TInt CTestSDKQueries::TestMqcDrawL( CStifItemParser& /*aItem*/ )
       
   116     {
       
   117     TInt selectedOption( KZero );
       
   118         
       
   119     CDesCArrayFlat* mArray = new (ELeave) CDesCArrayFlat( KTen );
       
   120     CleanupStack::PushL( mArray );
       
   121      
       
   122     TBuf< KTen > palabra;
       
   123     for (TInt num = KZero; num< KTen; num++)
       
   124         {
       
   125        palabra.Format(_L("option %d"), num);
       
   126        mArray->AppendL(palabra);
       
   127         }
       
   128      
       
   129     CAknListQueryDialog* dlg = new( ELeave ) CAknListQueryDialog( &selectedOption );
       
   130     dlg->PrepareLC( R_UPDATE_QUERY_MSG_DIALOG );
       
   131     dlg->SetItemTextArray( mArray );
       
   132     dlg->SetOwnershipType( ELbmDoesNotOwnItemArray );
       
   133     
       
   134     CTestCAknMessageQueryControl* msgBox = static_cast<CTestCAknMessageQueryControl*>( dlg->MessageBox());
       
   135 
       
   136     msgBox->Draw( iContainer->Rect() );
       
   137     
       
   138     CleanupStack::PopAndDestroy( dlg );
       
   139     CleanupStack::PopAndDestroy( mArray );
       
   140     return KErrNone;
       
   141     }
       
   142 
       
   143 //End file
       
   144 
       
   145