classicui_pub/common_file_dialogs_api/tsrc/src/testsdkcfdcontrol.cpp
branchGCC_SURGE
changeset 44 484cb5040995
parent 32 512f698a535d
parent 40 7165f928e888
equal deleted inserted replaced
32:512f698a535d 44:484cb5040995
     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 CAknMemorySelectionSettingPage.h
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 // [INCLUDE FILES]
       
    20 
       
    21 #include <eikenv.h>
       
    22 #include <aknappui.h> 
       
    23 #include <testsdkcfd.rsg>
       
    24 
       
    25 #include "testsdkcfdcontrol.h"
       
    26 
       
    27 // CONSTS
       
    28 const TInt KBufSize = 32;
       
    29 
       
    30 // ============================ MEMBER FUNCTIONS ===============================
       
    31 
       
    32 
       
    33 // -----------------------------------------------------------------------------
       
    34 // CTestControl::NewL
       
    35 // -----------------------------------------------------------------------------
       
    36 //
       
    37 CTestControl* CTestControl::NewL()
       
    38     {
       
    39     CTestControl* self = new (ELeave) CTestControl;
       
    40     CleanupStack::PushL(self);
       
    41     self->ConstructL();
       
    42     CleanupStack::Pop(self);
       
    43     return self;
       
    44     }
       
    45 
       
    46 // -----------------------------------------------------------------------------
       
    47 // CTestControl::~CTestControl
       
    48 // -----------------------------------------------------------------------------
       
    49 //
       
    50 CTestControl::~CTestControl(){}
       
    51 
       
    52 // -----------------------------------------------------------------------------
       
    53 // CTestControl::CTestControl
       
    54 // -----------------------------------------------------------------------------
       
    55 //
       
    56 CTestControl::CTestControl(){};
       
    57 
       
    58 // -----------------------------------------------------------------------------
       
    59 // CTestControl::ConstructL
       
    60 // -----------------------------------------------------------------------------
       
    61 //
       
    62 void CTestControl::ConstructL()
       
    63     {
       
    64     CreateWindowL();
       
    65     //add controls
       
    66     SetRect(CEikonEnv::Static()->EikAppUi()->ClientRect());
       
    67     ActivateL();
       
    68     }
       
    69 
       
    70 // -----------------------------------------------------------------------------
       
    71 // CTestControl::OfferKeyEventL
       
    72 // -----------------------------------------------------------------------------
       
    73 //
       
    74 TKeyResponse CTestControl::OfferKeyEventL(const TKeyEvent& /*aKeyEvent*/,
       
    75         TEventCode /*aType*/)
       
    76     {
       
    77     return EKeyWasConsumed;
       
    78     }
       
    79 
       
    80 // -----------------------------------------------------------------------------
       
    81 // CTestControl::Draw
       
    82 // -----------------------------------------------------------------------------
       
    83 //
       
    84 void CTestControl::Draw(const TRect& /*aRect*/) const
       
    85     {
       
    86     }
       
    87 
       
    88 // -----------------------------------------------------------------------------
       
    89 // CTestControl::CountComponentControls
       
    90 // -----------------------------------------------------------------------------
       
    91 //
       
    92 TInt CTestControl::CountComponentControls() const
       
    93     {
       
    94     return 0;
       
    95     }
       
    96 
       
    97 // -----------------------------------------------------------------------------
       
    98 // CTestControl::ComponentControl
       
    99 // -----------------------------------------------------------------------------
       
   100 //
       
   101 CCoeControl* CTestControl::ComponentControl(TInt /*aIndex*/) const
       
   102     {
       
   103     return NULL;
       
   104 
       
   105     }
       
   106 
       
   107 // -----------------------------------------------------------------------------
       
   108 // CTestControl::SizeChanged
       
   109 // -----------------------------------------------------------------------------
       
   110 //
       
   111 void CTestControl::SizeChanged()
       
   112     {
       
   113     }
       
   114 
       
   115 // -----------------------------------------------------------------------------
       
   116 // CTestControl::TestSettingPageRunLDL
       
   117 // -----------------------------------------------------------------------------
       
   118 //
       
   119 TInt CTestControl::TestSettingPageRunLDL(CStifItemParser& aItem)
       
   120     {
       
   121     TInt num = 0;
       
   122     TBool backvalue = EFalse;
       
   123     CAknMemorySelectionDialog::TMemory memorytype = CAknMemorySelectionDialog::EMemoryCard;
       
   124     TInt err = aItem.GetNextInt(num);
       
   125     if (err != KErrNone)
       
   126         return err;
       
   127     switch (num)
       
   128         {
       
   129         case 1:
       
   130             {
       
   131             backvalue = CAknMemorySelectionSettingPage::RunDlgLD(memorytype, this);
       
   132             break;
       
   133             }
       
   134         case 2:
       
   135             {
       
   136             TBuf<KBufSize> tempbuf(_L("Example"));
       
   137             backvalue = CAknMemorySelectionSettingPage::RunDlgLD(memorytype, tempbuf, NULL);
       
   138             break;
       
   139             }
       
   140         case 3:
       
   141             {
       
   142             backvalue = CAknMemorySelectionSettingPage::RunDlgLD(memorytype, 
       
   143                     R_TEST_MEMORY_SELECTION_DIALOG, NULL, NULL, NULL);
       
   144             break;
       
   145             }
       
   146         default:
       
   147             return KErrNotSupported;
       
   148         }
       
   149     if (backvalue)
       
   150         {
       
   151         //press key arrowup before playing dlg
       
   152         CAknMemorySelectionDialog::EPhoneMemory == memorytype? err = 0 : err = KErrUnknown;
       
   153         }
       
   154     else
       
   155         {
       
   156         CAknMemorySelectionDialog::EMemoryCard == memorytype? err = 0 : err = KErrUnknown;
       
   157         }
       
   158     return err;
       
   159     }
       
   160 
       
   161 // -----------------------------------------------------------------------------
       
   162 // CTestControl::OkToExitL
       
   163 // -----------------------------------------------------------------------------
       
   164 //
       
   165 TBool CTestControl::OkToExitL( CAknMemorySelectionDialog::TMemory /*aMemory*/ )
       
   166     {
       
   167     // it is only for testing, no used
       
   168     return ETrue;
       
   169     }
       
   170 // End of file