diff -r c76ea6caa649 -r b276843a15ba mpx/tsrc/public/basic/collectiontest/src/pathoptionmenu.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/tsrc/public/basic/collectiontest/src/pathoptionmenu.cpp Tue Sep 21 11:25:55 2010 -0500 @@ -0,0 +1,167 @@ +/* +* Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: MpxCollectionTest test module. +* +*/ + +// INCLUDE FILES +#include +#include +#include +#include "collectionbrowser.h" +#include "pathoptionmenu.h" +#include "pathoptionisremote.h" + +// MACROS + +// DATA TYPES +//Option name - corresponding to each path specific API +_LIT(KTestOptionOpenL, "OpenL"); //0 +_LIT(KTestOptionIsRemote, "IsRemote"); //1 + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CPathOptionMenu::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CPathOptionMenu* CPathOptionMenu::NewL(CConsoleMain* aConsoleMain, + CTestBaseView* aParent, + const TDesC& aName, + CStifLogger* aLogger) + { + CPathOptionMenu* self = new (ELeave) CPathOptionMenu(aConsoleMain, + aParent, + aName, + aLogger); + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + + return self; + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +CPathOptionMenu::~CPathOptionMenu() + { + iLogger->Log(_L("+CPathOptionMenu::~CPathOptionMenu")); + if(iCollectionPath) + delete iCollectionPath; + iLogger->Log(_L("-CPathOptionMenu::~CPathOptionMenu")); + } + +// ----------------------------------------------------------------------------- +// CPathOptionMenu::SetPathL +// ----------------------------------------------------------------------------- +void CPathOptionMenu::SetPathL(CMPXCollectionPath& aPath) + { + iCollectionPath = CMPXCollectionPath::NewL(aPath); + } + +// ----------------------------------------------------------------------------- +// From CTestBaseView +// Initialize the view before display view +// ----------------------------------------------------------------------------- +void CPathOptionMenu::InitializeViewL() + { + iLogger->Log(_L("+CPathOptionMenu::InitializeViewL")); + //Add option name + AddItemL(KTestOptionOpenL); //0 + AddItemL(KTestOptionIsRemote); //1 + iLogger->Log(_L("-CPathOptionMenu::InitializeViewL")); + } + +// ----------------------------------------------------------------------------- +// From CTestBaseView +// Cleanup the view before deactivate/destroy view +// ----------------------------------------------------------------------------- +void CPathOptionMenu::CleanupViewL() + { + } + +// ----------------------------------------------------------------------------- +// From CTestBaseView +// Handle number key press +// ----------------------------------------------------------------------------- +void CPathOptionMenu::HandleNumKeyL() + { + TKeyCode key = LastKeyPressed(); + } + +// ----------------------------------------------------------------------------- +// From CTestBaseView +// Handle left key press +// ----------------------------------------------------------------------------- +void CPathOptionMenu::HandleLeftKeyL() + { + } + +// ----------------------------------------------------------------------------- +// From CTestBaseView +// Handle right/enter key press +// ----------------------------------------------------------------------------- +void CPathOptionMenu::HandleRightKeyL() + { + iLogger->Log(_L("+CPathOptionMenu::HandleRightKeyL")); + switch( CurrentIndex() ) + { + case 0: +// iChild = + // CCollectionBrowser::NewL(iConsoleMain, + // this, + // KTxtCollectionBrowser, + // iLogger, + // iCollectionPath); + break; + case 1: + iChild = + CPathOptionIsRemote::NewL(iConsoleMain, + this, + KTxtPathOptionIsRemote, + iLogger, + iCollectionPath); + break; + } + NextViewL(iChild); + iLogger->Log(_L("-CPathOptionMenu::HandleRightKeyL")); + } + +// ----------------------------------------------------------------------------- +// C++ default constructor. +// ----------------------------------------------------------------------------- +CPathOptionMenu::CPathOptionMenu(CConsoleMain* aConsoleMain, + CTestBaseView* aParent, + const TDesC& aName, + CStifLogger* aLogger) + : CTestMenuView(aConsoleMain, aParent, aName) + { + iLogger = aLogger; + iCollectionPath = NULL; + } + +// ----------------------------------------------------------------------------- +// Second phrase constructor +// ----------------------------------------------------------------------------- +void CPathOptionMenu::ConstructL() + { + iLogger->Log(_L("+CPathOptionMenu::ConstructL")); + CTestMenuView::ConstructL(); + iLogger->Log(_L("-CPathOptionMenu::ConstructL")); + } +