mpx/tsrc/public/basic/collectiontest/src/pathoptionmenu.cpp
changeset 64 92dbd2a406d9
equal deleted inserted replaced
61:3b098142db83 64:92dbd2a406d9
       
     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:  MpxCollectionTest test module.
       
    15 *
       
    16 */
       
    17 
       
    18 // INCLUDE FILES
       
    19 #include <mpxcollectionutility.h>
       
    20 #include <stiflogger.h>
       
    21 #include <mpxcollectionpath.h>
       
    22 #include "collectionbrowser.h"
       
    23 #include "pathoptionmenu.h"
       
    24 #include "pathoptionisremote.h"
       
    25 
       
    26 // MACROS
       
    27 
       
    28 // DATA TYPES
       
    29 //Option name - corresponding to each path specific API
       
    30 _LIT(KTestOptionOpenL, "OpenL");                    //0
       
    31 _LIT(KTestOptionIsRemote, "IsRemote");              //1
       
    32 
       
    33 
       
    34 // ============================ MEMBER FUNCTIONS ===============================
       
    35 
       
    36 // -----------------------------------------------------------------------------
       
    37 // CPathOptionMenu::NewL
       
    38 // Two-phased constructor.
       
    39 // -----------------------------------------------------------------------------
       
    40 //
       
    41 CPathOptionMenu* CPathOptionMenu::NewL(CConsoleMain* aConsoleMain,
       
    42                                              CTestBaseView* aParent,
       
    43                                              const TDesC& aName,
       
    44                                              CStifLogger* aLogger)
       
    45     {
       
    46     CPathOptionMenu* self = new (ELeave) CPathOptionMenu(aConsoleMain,
       
    47                                                          aParent,
       
    48                                                          aName,
       
    49                                                          aLogger);
       
    50     
       
    51     CleanupStack::PushL( self );
       
    52     self->ConstructL();
       
    53     CleanupStack::Pop();
       
    54 
       
    55     return self;
       
    56     }
       
    57 
       
    58 // -----------------------------------------------------------------------------
       
    59 // Destructor
       
    60 // -----------------------------------------------------------------------------
       
    61 CPathOptionMenu::~CPathOptionMenu()
       
    62     {
       
    63     iLogger->Log(_L("+CPathOptionMenu::~CPathOptionMenu"));
       
    64     if(iCollectionPath)
       
    65         delete iCollectionPath;
       
    66     iLogger->Log(_L("-CPathOptionMenu::~CPathOptionMenu"));
       
    67     }
       
    68 
       
    69 // -----------------------------------------------------------------------------
       
    70 // CPathOptionMenu::SetPathL
       
    71 // -----------------------------------------------------------------------------
       
    72 void CPathOptionMenu::SetPathL(CMPXCollectionPath& aPath)
       
    73     {
       
    74     iCollectionPath = CMPXCollectionPath::NewL(aPath);
       
    75     }
       
    76 
       
    77 // -----------------------------------------------------------------------------
       
    78 // From CTestBaseView
       
    79 // Initialize the view before display view
       
    80 // -----------------------------------------------------------------------------
       
    81 void CPathOptionMenu::InitializeViewL()
       
    82     {
       
    83     iLogger->Log(_L("+CPathOptionMenu::InitializeViewL"));
       
    84     //Add option name
       
    85     AddItemL(KTestOptionOpenL);             //0
       
    86     AddItemL(KTestOptionIsRemote);          //1
       
    87     iLogger->Log(_L("-CPathOptionMenu::InitializeViewL"));
       
    88     }
       
    89 
       
    90 // -----------------------------------------------------------------------------
       
    91 // From CTestBaseView
       
    92 // Cleanup the view before deactivate/destroy view
       
    93 // -----------------------------------------------------------------------------
       
    94 void CPathOptionMenu::CleanupViewL()
       
    95     {
       
    96     }
       
    97     
       
    98 // -----------------------------------------------------------------------------
       
    99 // From CTestBaseView
       
   100 // Handle number key press
       
   101 // -----------------------------------------------------------------------------
       
   102 void CPathOptionMenu::HandleNumKeyL()
       
   103     {
       
   104     TKeyCode key = LastKeyPressed();
       
   105     }
       
   106 
       
   107 // -----------------------------------------------------------------------------
       
   108 // From CTestBaseView
       
   109 // Handle left key press
       
   110 // -----------------------------------------------------------------------------
       
   111 void CPathOptionMenu::HandleLeftKeyL()
       
   112     {
       
   113     }
       
   114         
       
   115 // -----------------------------------------------------------------------------
       
   116 // From CTestBaseView
       
   117 // Handle right/enter key press
       
   118 // -----------------------------------------------------------------------------
       
   119 void CPathOptionMenu::HandleRightKeyL()
       
   120     {
       
   121     iLogger->Log(_L("+CPathOptionMenu::HandleRightKeyL"));
       
   122     switch( CurrentIndex() )
       
   123         {
       
   124         case 0:
       
   125 //            iChild = 
       
   126  //               CCollectionBrowser::NewL(iConsoleMain,
       
   127   //                                   this,
       
   128    //                                  KTxtCollectionBrowser,
       
   129     //                                 iLogger,
       
   130      //                                iCollectionPath);
       
   131             break;
       
   132         case 1:
       
   133             iChild = 
       
   134                 CPathOptionIsRemote::NewL(iConsoleMain,
       
   135                                      this,
       
   136                                      KTxtPathOptionIsRemote,
       
   137                                      iLogger,
       
   138                                      iCollectionPath);                         
       
   139             break;
       
   140         }
       
   141     NextViewL(iChild);
       
   142     iLogger->Log(_L("-CPathOptionMenu::HandleRightKeyL"));
       
   143     }
       
   144     
       
   145 // -----------------------------------------------------------------------------
       
   146 // C++ default constructor.
       
   147 // -----------------------------------------------------------------------------
       
   148 CPathOptionMenu::CPathOptionMenu(CConsoleMain* aConsoleMain,
       
   149                                        CTestBaseView* aParent,
       
   150                                        const TDesC& aName,
       
   151                                        CStifLogger* aLogger)
       
   152     : CTestMenuView(aConsoleMain, aParent, aName)
       
   153     {
       
   154     iLogger = aLogger;
       
   155     iCollectionPath = NULL;
       
   156     }
       
   157 
       
   158 // -----------------------------------------------------------------------------
       
   159 // Second phrase constructor
       
   160 // -----------------------------------------------------------------------------
       
   161 void CPathOptionMenu::ConstructL()
       
   162     {
       
   163     iLogger->Log(_L("+CPathOptionMenu::ConstructL"));
       
   164     CTestMenuView::ConstructL();
       
   165     iLogger->Log(_L("-CPathOptionMenu::ConstructL"));
       
   166     }
       
   167