コード例 #1
0
void CAknFileSettingPage::ConstructL(void)
{
    BaseConstructL();
    //listbox icons
    CAknIconArray* icons=new(ELeave)CAknIconArray(2);
    CleanupStack::PushL(icons);
    icons->ConstructFromResourceL(R_CLOCKAPP_EXTRA_SETTING_ICONS);
    FileControl()->ItemDrawer()->ColumnData()->SetIconArray(icons);
    CleanupStack::Pop(); //icons
    //listbox items
    iFiles=new(ELeave)CDesCArrayFlat(32);
    CTextListBoxModel* model=FileControl()->Model();
    model->SetItemTextArray(iFiles); //old text array deleted by owner
    model->SetOwnershipType(ELbmOwnsItemArray); //transfer ownership
    TParse parse;
    parse.SetNoWild(iFileValue,NULL,NULL);
    TPtrC name=parse.NameAndExt(),path=parse.DriveAndPath();
    TDesC* pos=&name;
    if(!BaflUtils::PathExists(iFs,path))
    {
        pos=NULL;
        iFileValue.Zero();
    }
    ReadFilesL(pos);
}
コード例 #2
0
void CAknFileSettingPage::SetFolderL(const TDesC& aFolder)
{
    TParse parse;
    TFileName file;
    TDesC* pos=NULL;
    parse.SetNoWild(iFileValue,NULL,NULL);
    if(aFolder.CompareF(KFolderUp)==0)
    {
        if(iFileValue.Length())
        {
            if(parse.PopDir()==KErrNone)
            {
                TParse parse2;
                parse2.SetNoWild(iFileValue,NULL,NULL);
                TPtrC ptr=parse2.DriveAndPath();
                file=ptr.Left(ptr.Length()-1);
                parse2.SetNoWild(file,NULL,NULL);
                file=parse2.NameAndExt();
                pos=&file;
                iFileValue=parse.DriveAndPath();
            }
            else
                iFileValue.Zero();
        }
    }
    else
    {
        iFileValue=parse.DriveAndPath();
        iFileValue.Append(aFolder);
        iFileValue.Append('\\');
    }
    ReadFilesL(pos);
}
コード例 #3
0
// ---------------------------------------------------------
// CCookieManagerServer::CheckDiskSpace
// ---------------------------------------------------------
//
TBool CCookieManagerServer::CheckDiskSpace( RFs& aFileSystem,
										   const TDesC& aFileName ) const
	{
	TInt err;

	TParse parse;
	err = parse.SetNoWild( aFileName, NULL, NULL );
	if ( err == KErrNone )
		{
		// This is in the form : drive-letter: (letter + semi-colon)
		TBuf<2> driveBuf( parse.Drive() );
		TCharF driveLetter( driveBuf[0] );
		TCharF driveALetter( 'A' );
		TDriveNumber driveNum = (TDriveNumber)( (TUint)(driveLetter) -
												(TUint)(driveALetter) );

		TBool noSpace = EFalse;
		TRAP( err, noSpace = SysUtil::DiskSpaceBelowCriticalLevelL
					( &aFileSystem, KCookieMaxFileLength, driveNum ) );
		if ( err == KErrNone && noSpace )
			{
			err = KErrDiskFull;
			}
		}

	return ( err == KErrNone ? ETrue : EFalse );
	}
コード例 #4
0
ファイル: apaproc.cpp プロジェクト: cdaffara/symbiandump-mw1
/** Writes the application identifier (derived from the application object CApaApplication) 
followed by the stream dictionary to the store and makes the stream dictionary the root stream of the
store.

Typically, the function is called by the application when it 
implements a file create or file save type operation. It is called after all 
model and UI data has been persisted. The IDs of the streams containing the 
model and UI data should have been lodged in the stream dictionary.

In effect, the function finishes off the file save or file
create type operation, leaving the file containing the store in a valid state
with the standard interface.

@param aStore  The store to which the root stream is to be written. Before
calling this function, a reference to the store must be saved by putting a
pointer onto the cleanup stack or by making it member data of a class. This
ensures that it is not orphaned in the event of this function leaving.
@param aStreamDic The stream dictionary containing the locations and associated 
UIDs of other streams in the store.
@param aApp  The application used to create the main document in the file
being written. The application identifier to be written is constructed from
this application object. */
EXPORT_C void CApaProcess::WriteRootStreamL(CPersistentStore& aStore,CStreamDictionary& aStreamDic,const CApaApplication& aApp)
	{ // this is a static method
	__SHOW_TRACE(_L("Starting CApaProcess::WriteRootStreamL(app)"));
	// get the app dll name
	TParse dllPath;
	dllPath.SetNoWild(aApp.DllName(),NULL,NULL);
	// set up an app identifier
	TApaAppIdentifier appId(aApp.AppDllUid(),dllPath.NameAndExt());
	// Write the root stream
	WriteRootStreamL(aStore,aStreamDic,appId);
	}
コード例 #5
0
void CWsShellLogon::ConstructL(RFs &)
	{
	CActiveScheduler::Add(this);
	TPtrC shellCmd;

	_LIT(KWSERVIniFileVarShellCmd,"SHELLCMD");
	WsIniFile->FindVar(KWSERVIniFileVarShellCmd,shellCmd);
	_LIT(KWSERVShellName,"SHELL");
	TPtrC startUp(KWSERVShellName);
	_LIT(KWSERVIniFileVarStartUp,"STARTUP");
	WsIniFile->FindVar(KWSERVIniFileVarStartUp,startUp);


	TParse fileName;
	_LIT(KWSERVArmShellLocationPattern,"Z:\\sys\\bin\\.EXE");
	User::LeaveIfError(fileName.SetNoWild(startUp,&KWSERVArmShellLocationPattern,NULL));
#if defined(__WINS__)
	TInt err=iShellProcess.Create(fileName.FullName(),shellCmd);
	if (err == KErrNone)
		{
		Request();
		iShellProcess.Resume();
		}
	else
		{
		// Try loading the matching DLL name instead?
		_LIT(KWSERVShellExtension,"Z:.DLL");
		User::LeaveIfError(fileName.Set(KWSERVShellExtension,&startUp,NULL));
		User::LeaveIfError(iLib.Load(fileName.FullName()));
		ShellEntryPoint libFunc=(ShellEntryPoint)iLib.Lookup(1);
		if (!libFunc)
			User::Leave(KErrGeneral);
		TBuf<256> name;
		TInt num=0;
		TInt ret=KErrNone;
		do
			{
			_LIT(KWSERVWinsShellInstanceName,"Shell%d");
			name.Format(KWSERVWinsShellInstanceName,num++);
			ret=iShellThread.Create(name,libFunc,KDefaultStackSize,&shellCmd,&iLib,NULL,KHeapSize,KMaxHeapSize,EOwnerProcess);
			} while(ret==KErrAlreadyExists);
		User::LeaveIfError(ret);
		Request();
		iShellThread.Resume();
		}
#else // not __WINS__
	User::LeaveIfError(iShell.Create(fileName.FullName(),shellCmd));
	Request();
	iShell.Resume();
#endif	
	return;

	}
コード例 #6
0
void CAknFileSettingPage::ReadFilesL(const TDesC* aPos)
{
    TInt pos=-1;
    iFiles->Reset();
    FileControl()->Reset();
    TFileName buffer;
    if(iFileValue.Length())
    {
        buffer.Copy(KFolderIcon);
        buffer.Append(KFolderUp);
        iFiles->AppendL(buffer);
        TParse parse;
        parse.SetNoWild(iFileValue,NULL,NULL);
        CDir* list;
        User::LeaveIfError(iFs.GetDir(parse.DriveAndPath(),KEntryAttMaskSupported,ESortByName|EDirsFirst,list));
        CleanupStack::PushL(list);
        for(TInt i=0; i<list->Count(); i++)
        {
            const TDesC& name=(*list)[i].iName;
            if((*list)[i].IsDir())
            {
                buffer.Copy(KFolderIcon);
            }
            else
            {
                if(name.MatchF(KMelodyMask1)<0&&name.MatchF(KMelodyMask2)<0&&name.MatchF(KMelodyMask3)<0&&name.MatchF(KMelodyMask4)<0) continue;
                buffer.Copy(KMelodyIcon);
            }
            buffer.Append(name);
            if(aPos&&name.MatchF(*aPos)>=0) pos=iFiles->Count();
            iFiles->AppendL(buffer);
        }
        CleanupStack::PopAndDestroy(); //list
    }
    else
    {
        TDriveList drives;
        User::LeaveIfError(iFs.DriveList(drives));
        for(TInt drive=EDriveA; drive<=EDriveZ; drive++)
        {
            if(drives[drive])
            {
                buffer.Copy(KFolderIcon);
                buffer.Append(drive+'a');
                buffer.Append(':');
                iFiles->AppendL(buffer);
            }
        }
    }
    FileControl()->HandleItemAdditionL();
    if(pos!=-1) FileControl()->SetCurrentItemIndexAndDraw(pos);
    UpdateFileL();
}
コード例 #7
0
void CAknFileSettingPage::UpdateFileL(void)
{
    if(iFileValue.Length())
    {
        TPtrC item=(*iFiles)[FileControl()->CurrentItemIndex()],name=item.Mid(2);
        TParse parse;
        parse.SetNoWild(iFileValue,NULL,NULL);
        iFileValue=parse.DriveAndPath();
        iFileValue.Append(name);
    }
    CheckAndSetDataValidity();
    UpdateCbaL();
}
コード例 #8
0
void RemoveDirectoryTreeL(RFs& aFs, const TDesC& aFileName)
	{
	TParse directory;
	User::LeaveIfError(directory.SetNoWild(aFileName, NULL, NULL));
	while(!directory.IsRoot())
		{
		// try to remove this directory
		TInt err = aFs.RmDir(directory.DriveAndPath());
		if(err == KErrInUse || err == KErrAccessDenied)
			{
			break;
			}
		VerifyDeletionErrorL(err);		
		// move to deleted directory's parent
		User::LeaveIfError(directory.PopDir());
		}	
	}
コード例 #9
0
ファイル: apaproc.cpp プロジェクト: cdaffara/symbiandump-mw1
RApaApplication* CApaProcess::FindAppInListL(const TDesC& aAppFileName, TUid aUid) const
// returns pointer to a matching app, or NULL if not in list
//
	{
	__ASSERT_DEBUG(iAppList, Panic(EPanicNullPointer));

	TInt index = iAppList->Count();
	if (aUid!=KNullUid)
		{// search by UID
		while(--index >= 0)
			{
			__ASSERT_DEBUG((*iAppList)[index], Panic(EDPanicNoAppHolder));
			if ((*iAppList)[index]->AppFileUid() == aUid)
				{
				(*iAppList)[index]->ScheduleForAsyncDeletion(EFalse);
				return (*iAppList)[index]; // match found
				}
			}
		}
	else
		{// search by name as no UID has been supplied
		TParse app; 
		TParse suspect;
		User::LeaveIfError(app.Set(aAppFileName,NULL,NULL));
		while (--index>=0)
			{
			__ASSERT_DEBUG((*iAppList)[index], Panic(EDPanicNoAppHolder));
			suspect.SetNoWild((*iAppList)[index]->AppFileName(), NULL, NULL);
			if (!app.Name().CompareF(suspect.Name()))
				{
				(*iAppList)[index]->ScheduleForAsyncDeletion(EFalse);
				return (*iAppList)[index]; // match found
				}
			}
		}
		
	return NULL; // no match found
	}
コード例 #10
0
ファイル: POSIX.CPP プロジェクト: cdaffara/symbiandump-os2
GLDEF_C TInt GetFullFile(TFileName& aName, const TText16* upath, RFs& aSession)
// Use GetFullPath to establish the pathname, then add the filename onto the end
	{
	TParse path;
	TInt err = GetFullPath(path,upath,aSession,&aName);
	if (err!=KErrNone)
		return err;
	// Wildcard drive letter for searching across drives
	if (upath[0]==L'?' && upath[1]==L':')
		{
		TFindFile search(aSession);
		err=search.FindByDir(aName,path.Path());
		if (!err)
			{
			aName=search.File();
			return KErrNone;
			}
		}
	err = path.SetNoWild(path.DriveAndPath(),NULL,&aName);
	if (!err)
		aName = path.FullName();
	return err;
	}
コード例 #11
0
LOCAL_C TInt WavRecord()
	{
	// Parse the commandline and get a filename to use
	TLex l(CommandLine);
	TParse destinationName;
	if (destinationName.SetNoWild(l.NextToken(),0,0)!=KErrNone)
		{
		Test.Printf(_L("No arg, skipping\r\n"));
		return(KErrArgument);
		}
	Test.Next(_L("Record Wav file"));

	// Open the file for writing
	TInt r;
	RFile destination;
	r = destination.Replace(Fs,destinationName.FullName(),EFileWrite);
	if (r!=KErrNone)
		{
		Test.Printf(_L("Open file for write failed(%d)\n"), r);
		return(r);
		}		
	Test.Printf(_L("File opened for write\r\n"));
	
	Test.Next(_L("Preparing to record"));
	
	// Get the rate
	TLex cl(l.NextToken());
	TUint32 tmpRate;
	TSoundRate rate;
	r = cl.Val(tmpRate,EDecimal);
	if (r == KErrNone && (r=SamplesPerSecondToRate(tmpRate,rate))==KErrNone)
		{
		Test.Printf(_L("Parsed rate: %d\r\n"), tmpRate);
		RecordFormatBuf().iRate = rate;
		}
	else
		{
		Test.Printf(_L("Parse rate failed(%d)\r\n"),r);
		RecordFormatBuf().iRate = ESoundRate32000Hz;
		}

	// Get number of channels
	TLex cl_chan(l.NextToken());
	TUint32 tmpChannels;
	r = cl_chan.Val(tmpChannels,EDecimal);
	if (r == KErrNone)
		{
		Test.Printf(_L("Parsed %d channels\r\n"),tmpChannels);
		RecordFormatBuf().iChannels = tmpChannels;
		}
	else
		{
		Test.Printf(_L("Parse channels failed(%d)\r\n"), r);
		RecordFormatBuf().iChannels = 2;
		}

	RecordFormatBuf().iEncoding = ESoundEncoding16BitPCM;
	
	// Set the record buffer configuration.
	RChunk chunk;
	TTestSharedChunkBufConfig bufferConfig;
	bufferConfig.iNumBuffers=4;
	bufferConfig.iBufferSizeInBytes=RecordBufferSizeInBytes(RecordFormatBuf());
	if (RecordCapsBuf().iRequestMinSize)
		bufferConfig.iBufferSizeInBytes&=~(RecordCapsBuf().iRequestMinSize-1); 	// Keep the buffer length valid for the driver.
	bufferConfig.iFlags=0;	
	PrintBufferConf(bufferConfig,Test);
	TPckg<TTestSharedChunkBufConfig> bufferConfigBuf(bufferConfig);
	r=RxSoundDevice.SetBufferChunkCreate(bufferConfigBuf,chunk);
	if (r!=KErrNone)
		{
		Test.Printf(_L("Buffer configuration not supported(%d)\r\n"),r);
		return(r);
		}
	
	// Set the audio record configuration.
	RxSoundDevice.SetVolume(KSoundMaxVolume);
	PrintConfig(RecordFormatBuf(),Test);
	r=RxSoundDevice.SetAudioFormat(RecordFormatBuf);
	if (r!=KErrNone)
		{
		Test.Printf(_L("Format not supported\r\n"));
		return(r);
		}

	// Get length in seconds
	TLex cl_seconds(l.NextToken());
	TUint32 tmpSeconds;
	r = cl_seconds.Val(tmpSeconds,EDecimal);
	if (r == KErrNone)
		{
		Test.Printf(_L("Parsed %d seconds\r\n"),tmpSeconds);
		}
	else
		{
		Test.Printf(_L("Parse seconds failed(%d)\r\n"),r);
		tmpSeconds=10;
		}
	TInt bytesToRecord = BytesPerSecond(RecordFormatBuf())*tmpSeconds;	
		
	Test.Next(_L("Recording..."));
	
	// Lay down a file header
	WAVEheader header;
	TPtr8 headerDes((TUint8 *)&header, sizeof(struct WAVEheader), sizeof(struct WAVEheader));

	// "RIFF"
	header.ckID[0] = 'R'; header.ckID[1] = 'I';
	header.ckID[2] = 'F'; header.ckID[3] = 'F';
	// "WAVE"
	header.wave_ckID[0] = 'W'; header.wave_ckID[1] = 'A';
	header.wave_ckID[2] = 'V'; header.wave_ckID[3] = 'E';
	// "fmt "
	header.fmt_ckID[0] = 'f'; header.fmt_ckID[1] = 'm';
	header.fmt_ckID[2] = 't'; header.fmt_ckID[3] = ' ';
	// "data"
	header.data_ckID[0] = 'd'; header.data_ckID[1] = 'a';
	header.data_ckID[2] = 't'; header.data_ckID[3] = 'a';

	header.nChannels		= (TUint16)RecordFormatBuf().iChannels;
	header.nSamplesPerSec	= RateInSamplesPerSecond(RecordFormatBuf().iRate);
	header.nBitsPerSample	= 16;
	header.nBlockAlign		= TUint16((RecordFormatBuf().iChannels == 2) ? 4 : 2);
	header.formatTag		= 1;	// type 1 is PCM
	header.fmt_ckSize		= 16;
	header.nAvgBytesPerSec	= BytesPerSecond(RecordFormatBuf());
	header.data_ckSize		= bytesToRecord;
	header.ckSize			= bytesToRecord + sizeof(struct WAVEheader) - 8;

	Test.Printf(_L("Header rate:%d channels:%d tag:%d bits:%d (%d bytes/s) align %d datalen:%d fmt_ckSize:%d ckSize:%d\r\n"),
			header.nSamplesPerSec, header.nChannels, header.formatTag, header.nBitsPerSample,
			header.nAvgBytesPerSec, header.nBlockAlign, header.data_ckSize, header.fmt_ckSize, header.ckSize, sizeof(struct WAVEheader));

	r = destination.Write(headerDes);

	TRequestStatus stat;
	TInt length;
	TPtrC8 buf;

	TTime startTime;
	startTime.HomeTime();
	
	// Start off by issuing a record request.
	TTime starttime;
	starttime.HomeTime();
	TInt bytesRecorded = 0;
	RxSoundDevice.RecordData(stat,length);

	TInt pausesToDo = 10;
	pausesToDo = 0;
	FOREVER
		{
		// Wait for the outstanding record request to complete.
        User::After(6000);

		User::WaitForAnyRequest();
		if (stat==KRequestPending)
			return(KErrGeneral);

		TTime currentTime;
		currentTime.HomeTime();
		TInt64 elapsedTime = currentTime.Int64()-startTime.Int64();	// us
		TTimeIntervalMicroSecondsBuf timeRecordedBuf;
		if(RxSoundDevice.TimeRecorded(timeRecordedBuf) == KErrNone)
			{
			// Compare TimeRecorded with the actual elapsed time. They should be different, but not drift apart too badly...
			TInt32 offset = TInt32(elapsedTime - timeRecordedBuf().Int64());
			Test.Printf(_L("\telapsedTime - TimeRecorded = %d ms\n"), offset/1000);
			}		
			
		// Check whether the record request was succesful.
		TInt retOffset=stat.Int();
		if (retOffset<0)
			{
			Test.Printf(_L("Record failed(%d)\r\n"),retOffset);
			return(retOffset);
			}
		
		// Successfully recorded another buffer so write the recorded data to the record file and release the buffer.
		buf.Set((const TUint8*)(chunk.Base()+retOffset),length);
		r=destination.Write(buf);
		if (r!=KErrNone)
			{
			Test.Printf(_L("File write failed(%d)\r\n"),r);
			return(r);
			}
		r=RxSoundDevice.ReleaseBuffer(retOffset);
		if (r!=KErrNone)
			{
			Test.Printf(_L("Release buffer failed(%d)\r\n"),r);
			return(r);
			}
		
		Test.Printf(_L("Recorded %d more bytes - %d\r\n"),length,retOffset);

		if((pausesToDo > 0) && (bytesRecorded > bytesToRecord/2))
			{
			--pausesToDo;
			Test.Printf(_L("Pause\r\n"));
			RxSoundDevice.Pause();
			Test.Printf(_L("Paused, sleeping for 0.5 seconds\r\n"));
			User::After(500*1000);
            Test.Printf(_L("Resume\r\n"));
			RxSoundDevice.Resume();
			}
		
		// Check whether we have now recorded all the data. If more to record then queue a further request
		bytesRecorded+=length;
		if (bytesRecorded<bytesToRecord)
		    {
            Test.Printf(_L("RecordData\r\n"));
			RxSoundDevice.RecordData(stat,length);
		    }
		else
			break;
		}
	
	RxSoundDevice.CancelRecordData();	// Stop the driver from recording.
	
	TTime endtime;
	endtime.HomeTime();

	TInt64 elapsedTime = endtime.Int64()-starttime.Int64();	// us
	Test.Printf(_L("Delta time = %d\r\n"),I64LOW(elapsedTime));
	Test.Printf(_L("Seconds in buffer: %d (%d)\r\n"), bytesRecorded / header.nAvgBytesPerSec, (bytesRecorded / header.nAvgBytesPerSec)*1000000);

	if (I64LOW(elapsedTime) <= (bytesRecorded / header.nAvgBytesPerSec)*1000000)
		{
		Test.Printf(_L("Time travelling; record took less time than it should have done\r\n"));
		return(KErrGeneral);
		}
	
	chunk.Close();
	destination.Close();

	Test.Printf(_L("Record finished\r\n"));
	return(KErrNone);
	}
コード例 #12
0
ファイル: main.cpp プロジェクト: kuailexs/symbiandump-os1
TInt ParseCommandLine()
	{
	TBuf<256> c;
	User::CommandLine(c);

	// Get exe name
	TLex l(c);
	if(SourceName.SetNoWild(l.NextToken(),0,&KDefaultSourcePath)!=KErrNone)
		return KErrArgument;

	// Get capability
	TLex cl(l.NextToken());
	if(cl.Val((TInt64&)Capability,EHex)!=KErrNone)
		return KErrArgument;

	// Mask out unsupported capabilities
	TCapabilitySet all;
	all.SetAllSupported();
	((TCapabilitySet&)Capability).Intersection(all);

	// We always update capabilities in the headers
	CapabilitySet = ETrue;

	// Get options
	SecureIdSet = EFalse;
	VendorIdSet = EFalse;
	TPtrC nextToken;
	for (;;)
		{
		nextToken.Set(l.NextToken());
		if (nextToken == KSIDOption)
			{
			// SID specified
			nextToken.Set(l.NextToken());
			if (nextToken == KNullDesC)
				return KErrArgument;				
			TLex sl(nextToken);
			if(sl.Val(SecureId.iId,EHex)!=KErrNone)
				return KErrArgument;
			SecureIdSet = ETrue;
			}
		else if (nextToken == KVIDOption)
			{
			// VID specified
			nextToken.Set(l.NextToken());
			if (nextToken == KNullDesC)
				return KErrArgument;				
			TLex sl(nextToken);
			if(sl.Val(VendorId.iId,EHex)!=KErrNone)
				return KErrArgument;
			VendorIdSet = ETrue;
			}
		else
			break;
		}
				
	// Get target path
	TPtrC s(SourceName.NameAndExt());
	TBuf<sizeof(KDefaultDestinationPath)> defaultDestinationPath(KDefaultDestinationPath);
	defaultDestinationPath[0] = (TUint8) RFs::GetSystemDriveChar();
	
	if(DestinationName.SetNoWild(nextToken,&s,&defaultDestinationPath)!=KErrNone)
		return KErrArgument;

	// Check we used all the arguments
	if (l.NextToken() != KNullDesC)
		return KErrArgument;

	return KErrNone;
	}
コード例 #13
0
ファイル: puttyappui.cpp プロジェクト: 0x0all/s2putty
// Second-phase constructor
void CPuttyAppUi::ConstructL() {
#ifdef PUTTY_S60V3
    #ifdef PUTTY_SYM3
        BaseConstructL(CAknAppUi::EAknEnableSkin | EAknTouchCompatible | EAknSingleClickCompatible);
    #else
        BaseConstructL(CAknAppUi::EAknEnableSkin);
    #endif
#else
    BaseConstructL();
#endif

    // Determine profile, data and font directories based on the executable
    // installation location. The files are on the same drive as the
    // executable, except if the exe is in ROM (z:), in which case profiles and
    // data use c:.
    TFileName name;
    name = RProcess().FileName();
    TParse parsa;
    parsa.SetNoWild(name, NULL, NULL);
    TUint drive = parsa.Drive()[0];

    // Font directory -- "<drv>:\resource\puttyfonts\"
    iFontDirectory.Format(KFontDirFormat, drive);

    // Fix drive for profiles and data
    if ( (drive == 'z') || (drive == 'Z') ) {
        drive = 'c';
    }

    // Data directory -- "<drv>:\private\<SID>\data\"
    // If the data directory doesn't exist, create it and attempt to migrate
    // host keys from a previous installation
    iDataDirectory.Format(KDataDirFormat, drive, RProcess().SecureId().iId);
    RFs &fs = CEikonEnv::Static()->FsSession();
    if ( !BaflUtils::FolderExists(fs, iDataDirectory) ) {
        BaflUtils::EnsurePathExistsL(fs, iDataDirectory);
        if ( BaflUtils::FileExists(fs, KOldHostKeysFile) ) {
            name = iDataDirectory;
            name.Append(KNewHostKeysFile);
            BaflUtils::CopyFile(fs, KOldHostKeysFile, name);
        }
    }

    // Profile directory -- "<drv>:\private\<SID>\profiles\"
    // If the profile directory doesn't exist, create it and attempt to migrate
    // default settings from a previous installation
    iProfileDirectory.Format(KProfileDirFormat, drive,
                             RProcess().SecureId().iId);
    if ( !BaflUtils::FolderExists(fs, iProfileDirectory) ) {
        BaflUtils::EnsurePathExistsL(fs, iProfileDirectory);
        if ( BaflUtils::FileExists(fs, KOldSettingsFile) ) {
            name = iProfileDirectory;
            name.Append(KNewDefaultProfileFile);
            BaflUtils::CopyFile(fs, KOldSettingsFile, name);
        }
    }

    // Create navi pane
    iNaviPane = (CAknNavigationControlContainer*)
        (StatusPane()->ControlL(TUid::Uid(EEikStatusPaneUidNavi)));

    // Build a list of available fonts
    iFonts = new CDesC16ArrayFlat(8);
    CDir *dir;
    User::LeaveIfError(
        CEikonEnv::Static()->FsSession().GetDir(iFontDirectory,
                                                KEntryAttNormal,
                                                ESortByName, dir));
    CleanupStack::PushL(dir);
    for ( TInt i = 0; i < dir->Count(); i++ ) {
        parsa.SetNoWild((*dir)[i].iName, NULL, NULL);
        iFonts->AppendL(parsa.Name());
    }
    CleanupStack::PopAndDestroy(); //dir    

    // Build views
    iProfileListView = CProfileListView::NewL();
    AddViewL(iProfileListView);
    iProfileEditView = CProfileEditView::NewL();
    AddViewL(iProfileEditView);
    iTerminalView = CTerminalView::NewL();
    AddViewL(iTerminalView);

    // Start from the profile list view.
    SetDefaultViewL(*iProfileListView);
}