diff -r 558113899881 -r 75713bee6484 uifw/AvKon/tsrc/bc/S60_SDK3.0/bctestcmdlg/src/bctestfileseldlg.cpp --- a/uifw/AvKon/tsrc/bc/S60_SDK3.0/bctestcmdlg/src/bctestfileseldlg.cpp Mon May 03 12:45:33 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,245 +0,0 @@ -/* -* Copyright (c) 2006 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: test case -* -*/ - - -#include -#include -#include -#include - -#include "BCTestFileSelDlg.h" -#include "BCTestCmDlg.hrh" -#include "streamlogger.h" - -// ======== MEMBER FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// Symbian 2nd static Constructor -// --------------------------------------------------------------------------- -// -CBCTestFileSelDlg* CBCTestFileSelDlg::NewL() - { - CBCTestFileSelDlg* self = new( ELeave ) CBCTestFileSelDlg(); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - -// --------------------------------------------------------------------------- -// C++ default constructor -// --------------------------------------------------------------------------- -// -CBCTestFileSelDlg::CBCTestFileSelDlg():iDlg(0) - { - } - -// --------------------------------------------------------------------------- -// Destructor -// --------------------------------------------------------------------------- -// -CBCTestFileSelDlg::~CBCTestFileSelDlg() - { - delete iDlg; - } - -// --------------------------------------------------------------------------- -// Symbian 2nd Constructor -// --------------------------------------------------------------------------- -// -void CBCTestFileSelDlg::ConstructL() - { - BuildScriptL(); - } - -// --------------------------------------------------------------------------- -// CBCTestFileSelDlg::BuildScriptL -// --------------------------------------------------------------------------- -// -void CBCTestFileSelDlg::BuildScriptL() - { - AddTestL( DELAY(1), TEND); - - // Add script as your need. - for(int i=0; iExecuteL( rootFileName ); - TFileName msg; - msg.Format( _L("User hit: %d, selected file: "), returnValue ); - msg.Append( rootFileName ); - msg.ZeroTerminate(); - AssertTrueL(ETrue, msg); - } - -void CBCTestFileSelDlg::TestCreateL(TInt aResID) - { - _LIT( KRootPath, "C:\\Data\\" ); - TFileName rootFileName( KRootPath ); - - iDlg = CAknFileSelectionDialog::NewL( ECFDDialogTypeSelect, aResID ); - AssertNotNullL(iDlg, _L("file sel dialog create with Res ID")); - TInt returnValue = iDlg->ExecuteL( rootFileName ); - TFileName msg; - msg.Format(_L("User hit: %d, selected file: "), returnValue ); - msg.Append( rootFileName ); - msg.ZeroTerminate(); - AssertTrueL(ETrue, msg); - } - -void CBCTestFileSelDlg::TestQuickCreateL() - { - TFileName filename; - TFileName folder(_L("C:\\Data\\")); - AssertTrueL(!CAknFileSelectionDialog::RunDlgLD(filename, folder), - _L("Quick create, User hit Cancle")); - } - -void CBCTestFileSelDlg::TestQuickCreateL(const TDesC &aTitle) - { - TFileName filename; - TFileName folder(_L("C:\\Data\\")); - AssertTrueL(!CAknFileSelectionDialog::RunDlgLD(filename, folder, aTitle), - _L("Quick create, User hit Cancle")); - } - -void CBCTestFileSelDlg::TestQuickCreateL(TInt aResID) - { - TFileName filename; - TFileName folder(_L("C:\\Data\\")); - AssertTrueL(!CAknFileSelectionDialog::RunDlgLD(filename, folder, aResID), - _L("Quick create, User hit Cancle")); - } - -void CBCTestFileSelDlg::SetupL() - { - } - - -void CBCTestFileSelDlg::TestSettingsL() -{ - iDlg = CAknFileSelectionDialog::NewL( ECFDDialogTypeSelect ); - iDlg->SetDefaultFolderL(_L("C:\\")); - AssertTrueL(ETrue, _L("default folder set")); - - iDlg->SetTitleL(_L("a title")); - AssertTrueL(ETrue, _L("title set")); - - iDlg->SetLeftSoftkeyFileL(_L("left fkey")); - AssertTrueL(ETrue, _L("left soft key file set")); - - iDlg->SetLeftSoftkeyFolderL(_L("left dkey")); - AssertTrueL(ETrue, _L("left soft key folder set")); - - iDlg->SetRightSoftkeyRootFolderL(_L("right root")); - AssertTrueL(ETrue, _L("right soft key root set")); - - iDlg->SetRightSoftkeySubfolderL(_L("right sdir")); - AssertTrueL(ETrue, _L("right soft key sub folder set")); - - //Add fileter and set Observer - struct MonkObserver: public MAknFileSelectionObserver{ - TBool OkToExitL( const TDesC& /*aDriveAndPath*/, const TEntry& /*aEntry*/ ){ - return ETrue; - } - } monkObserver; - - iDlg->SetObserver(&monkObserver); - AssertTrueL(ETrue, _L("Observer set")); - - struct MonkFilter: public MAknFileFilter{ - TBool Accept( const TDesC& /*aDriveAndPath*/, const TEntry& /*aEntry*/ ) const{ - return ETrue; - } - }; - - iDlg->AddFilterL(new (ELeave) MonkFilter); //problems, should be push into stack - AssertTrueL(ETrue, _L("Filter add")); - - TFileName filename; - iDlg->ExecuteL(filename); -}