/** * Executable Entry Point * Top level always creates TRAP harness. * Calls MainL() inside the TRAP harness */ GLDEF_C TInt E32Main() { __UHEAP_MARK; CTrapCleanup* cleanup = CTrapCleanup::New(); if(cleanup == NULL) { return KErrNoMemory; } // Fix PDEF124952, set the priority EPriorityAbsoluteHigh. In this case, the timeout will // take effect even if the server executes with almost 100% CPU usage. RThread().SetPriority(EPriorityAbsoluteHigh); // End PDEF124952 // Check to see if the plugin wrapper around the GetSystemDrive is loadable // If yes, then instantiate the wrapper object and obtain the default system drive // Else, use the hardcoded default drive as c: TDriveName defaultSysDrive(KTEFLegacySysDrive); RLibrary pluginLibrary; CWrapperUtilsPlugin* plugin = TEFUtils::WrapperPluginNew(pluginLibrary); if (plugin!=NULL) { TDriveUnit driveUnit(plugin->GetSystemDrive()); defaultSysDrive.Copy(driveUnit.Name()); delete plugin; pluginLibrary.Close(); } TBool enableSysStart = ETrue; CTestExecuteIniData* iniData = NULL; TRAPD(err, iniData = CTestExecuteIniData::NewL(defaultSysDrive)); if (err == KErrNone) { // Extract all the key values within the object iniData->ExtractValuesFromIni(); iniData->GetKeyValueFromIni(KTEFSystemStarter, enableSysStart); } err = KErrNone; #if !(defined TEF_LITE) if (enableSysStart) { TRAP(err, StartSystemL()); __ASSERT_ALWAYS(!err, User::Panic(KTestExecuteName,err)); } #endif if (iniData != NULL) { delete iniData; } err = KErrNone; TRAP(err,MainL(defaultSysDrive)); __ASSERT_ALWAYS(!err, User::Panic(KTestExecuteName,err)); delete cleanup; __UHEAP_MARKEND; return KErrNone; }
// --------------------------------------------------------------------------- // CAknMemorySelectionModelMultiDrive::AddDefaultItemToLbxL // // If drive has volume label, use it. // Otherwise use drive letter for drive name. // --------------------------------------------------------------------------- // void CAknMemorySelectionModelMultiDrive::AddDefaultItemToLbxL( const TCFDDriveInfo& aDriveInfo ) { HBufC* lbxItemBuf = HBufC::NewLC( KListBoxEntryMaxLength ); TPtr itemString( lbxItemBuf->Des() ); TDriveUnit driveUnit( aDriveInfo.iDriveNumber ); // Item text is affected by layout switch( iLayout ) { case ELayoutSettingPage: { if( aDriveInfo.iVolumeLabel.Length() > 0 ) { itemString.Append( driveUnit.Name() ); itemString.Append( KSpaceChar ); itemString.Append( aDriveInfo.iVolumeLabel ); } else { itemString.Append( driveUnit.Name() ); } break; } case ELayoutPopupMenu: case ELayoutDoublePopup: { itemString.Format( KImageHeader, EIconDeviceMemory ); itemString.Append( KTabChar ); if( aDriveInfo.iVolumeLabel.Length() > 0 ) { itemString.Append( driveUnit.Name() ); itemString.Append( KSpaceChar ); itemString.Append( aDriveInfo.iVolumeLabel ); } else { itemString.Append( driveUnit.Name() ); } break; } } // Finally!: append the formatted string to listbox User::LeaveIfError( iListBoxArray.Append( lbxItemBuf ) ); CleanupStack::Pop( lbxItemBuf ); _LOG1( "[CAknMemorySelectionModelMultiDrive] Item string added to lbx array: %S", &itemString ); _LOG1( "itemString length=%d", itemString.Length() ); }
/** * Let drivers to drive. * Only one driver can drive at the same time. * @param input wrapped input * @return true when a fish has moved (switch does not count) */ bool Controls::driving(const InputProvider *input) { bool moved = false; if (!useSwitch()) { if (!useStroke()) { moved = driveUnit(input); } else { moved = true; } } return moved; }
void CTestAutoMMCReaderStep::OpenMMCCardReaderDrive() { INFO_PRINTF1(_L("Testing fix for INC040672 - MMC Card door open causes wrong mime type instead of error code")); _LIT(KValidFileName, "ValidFileName.jpg"); RFs fs; TInt ret = fs.Connect(); TEST(ret == KErrNone); RTestableApaLsSession ls; ret = ls.Connect(); TEST(ret == KErrNone); // The following steps are to reproduce the removal of MMC card // Loop through drive letters Y -> D to access a file on that drive (any filename) // Find a drive letter that returns KErrNotReady , // setup a valid filename with that drive. for (TInt drive = EDriveY; drive >= EDriveD ; drive--) { TDriveUnit driveUnit(drive); TDriveName driveName = driveUnit.Name(); TBuf<KDirLength> bufDirName(driveName); bufDirName.Append(_L("\\")); ret = fs.MkDirAll(bufDirName); if (ret == KErrNotReady) { TFileName bufValidFileName(bufDirName); bufValidFileName.Append(KValidFileName); TDataType dataType; TUid uid = KNullUid; HEAP_TEST_LS_SESSION(ls, 0, 0, ret = ls.AppForDocument(bufValidFileName, uid, dataType), NO_CLEANUP); TEST(ret == KErrNotReady); TEST(uid == KNullUid); TEST(dataType == TDataType()); break; } } TEST(ret == KErrNotReady); ls.Close(); fs.Close(); }
void CMtfTestActionSendEMsvDriveContainsStore::ExecuteActionL() { TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionSendEMsvDriveContainsStore); // input params TInt drive = ObtainValueParameterL<TInt>(TestCase(),ActionParameters().Parameter(0) ); TInt pass = ObtainValueParameterL<TInt>(TestCase(),ActionParameters().Parameter(1) ); RProxyServerSession RPSS; // Will auto start the server if not started. TInt error = RPSS.Connect(); CleanupClosePushL(RPSS); if (error!=KErrNone) { TestCase().ERR_PRINTF1(_L("CMtfTestActionSendEMsvDriveContainsStore :: Unable to start proxy server. !")); TestCase().SetTestStepResult(EFail); } else { TInt32 serverCaps; RPSS.GetServerCapabilities(serverCaps); TestCase().INFO_PRINTF2(_L("Proxy Server has capabilities: %x"), serverCaps); error = 0; TDriveUnit driveUnit(drive); error=RPSS.SendReceive(EMsvDriveContainsStore, TIpcArgs(driveUnit)); if (error >= 0) { // we're just interested in being able to make the call, so whether the // store is on the drive or not is beside the point error = KErrNone; } IPCCommandReportPassOrFailForCapsPermissions( TestCase(), KMsvServerName, error , pass ); } CleanupStack::Check(&RPSS); CleanupStack::PopAndDestroy(); // RPSS TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionSendEMsvDriveContainsStore); TestCase().ActionCompletedL(*this); }
void CLogServDatabaseMarshall::DatabaseLocateL() { // Get drive for database TDriveUnit driveUnit(static_cast<TInt>(RFs::GetSystemDrive())); TDriveName name(driveUnit.Name()); TFileName path; iFsSession.PrivatePath(path); // Ensure database path exists TParse parse; User::LeaveIfError(parse.Set(path, &name, NULL)); path = parse.FullName(); TInt error = iFsSession.MkDirAll(path); if (error != KErrAlreadyExists) User::LeaveIfError(error); path += KLogDatabaseName; iDatabaseName = path.AllocL(); }
// --------------------------------------------------------------------------- // CAknMemorySelectionModelMultiDrive::AddMMCItemToLbxL // --------------------------------------------------------------------------- // void CAknMemorySelectionModelMultiDrive::AddMMCItemToLbxL( const TCFDDriveInfo& aDriveInfo ) { HBufC* lbxItemBuf = HBufC::NewLC( KListBoxEntryMaxLength ); TPtr itemString( lbxItemBuf->Des() ); HBufC* textItemBuf = HBufC::NewLC( KListBoxEntryMaxLength ); TPtr textString( textItemBuf->Des() ); HBufC* textItemBuf2 = HBufC::NewLC( KListBoxEntryMaxLength ); TPtr textString2( textItemBuf2->Des() ); TDriveUnit driveUnit( aDriveInfo.iDriveNumber ); // Item text is affected by layout switch( iLayout ) { case ELayoutPopupMenu: { // A-column icon: switch ( aDriveInfo.iDriveStatus ) { case EDriveNotReady: { itemString.Format( KImageHeader, EIconMMCUnavailable ); break; } case EDriveLocked: { itemString.Format( KImageHeader, EIconMMCLocked ); break; } default: // Normal condition { itemString.Format( KImageHeader, EIconMMC ); break; } } itemString.Append( KTabChar ); // 1st row text: if( ( aDriveInfo.iDriveStatus == EDriveOK ) && ( aDriveInfo.iVolumeLabel.Length() > 0 ) ) { StringLoader::Format( textString2, *iLocStringArray[ ETextMMCNamed ], KIndexFirst, driveUnit.Name() ); StringLoader::Format( textString, textString2, KIndexSecond, aDriveInfo.iVolumeLabel ); } else if ( aDriveInfo.iDriveStatus == EDriveNotReady ) { //textString.Format( // *iLocStringArray[ ETextMMCUnavailable ], // driveUnit.Name() ); StringLoader::Format( textString, *iLocStringArray[ ETextMMCUnavailable ], KNoIndex, driveUnit.Name() ); } else if( aDriveInfo.iDriveStatus == EDriveLocked ) { //textString.Format( // *iLocStringArray[ ETextMMCLocked ], // driveUnit.Name() ); StringLoader::Format( textString, *iLocStringArray[ ETextMMCLocked ], KNoIndex, driveUnit.Name() ); } else { // Use default drive description //textString.Format( // *iLocStringArray[ ETextMMCDefaultName ], // driveUnit.Name() ); StringLoader::Format( textString, *iLocStringArray[ ETextMMCDefaultName ], KNoIndex, driveUnit.Name() ); } itemString.Append( textString ); break; } case ELayoutSettingPage: { // 1st row text: if( aDriveInfo.iVolumeLabel.Length() > 0 ) { // Append drive name if it has one //itemString.Format( // *iLocStringArray[ ETextMMCNamed ], // driveUnit.Name(), // aDriveInfo.iVolumeLabel // ); StringLoader::Format( textString, *iLocStringArray[ ETextMMCNamed ], KIndexFirst, driveUnit.Name() ); StringLoader::Format( itemString, textString, KIndexSecond, aDriveInfo.iVolumeLabel ); } else { //itemString.Format( // *iLocStringArray[ ETextMMCDefaultName ], // driveUnit.Name() // ); StringLoader::Format( itemString, *iLocStringArray[ ETextMMCDefaultName ], KNoIndex, driveUnit.Name() ); } break; } case ELayoutDoublePopup: { // A-column icon: if( aDriveInfo.iDriveStatus == EDriveNotReady ) { itemString.Format( KImageHeader, EIconMMCUnavailable ); } else { itemString.Format( KImageHeader, EIconMMC ); } itemString.Append( KTabChar ); // 1st row text: if( aDriveInfo.iVolumeLabel.Length() > 0 ) { StringLoader::Format( textString2, *iLocStringArray[ ETextMMCNamed ], KIndexFirst, driveUnit.Name() ); StringLoader::Format( textString, textString2, KIndexSecond, aDriveInfo.iVolumeLabel ); } else { // Use default drive description //textString.Format( // *iLocStringArray[ ETextMMCDefaultName ], // driveUnit.Name() // ); StringLoader::Format( textString, *iLocStringArray[ ETextMMCDefaultName ], KNoIndex, driveUnit.Name() ); } itemString.Append( textString ); itemString.Append( KTabChar ); // 2nd row text: switch( aDriveInfo.iDriveStatus ) { case EDriveNotReady: { itemString.Append( *iLocStringArray[ ETextMMCUnavailable ] ); break; } case EDriveLocked: { itemString.Append( *iLocStringArray[ ETextMMCLocked ] ); break; } case EDriveOK: default: { HBufC* buffer; TInt64 freeSpace = aDriveInfo.iDiskSpace; if ( freeSpace >= 0 ) { buffer = HBufC::NewLC( KListBoxEntryMaxLength ); TPtr unitStr( buffer->Des() ); AknCFDUtility::SetSecondRowTextL( freeSpace, unitStr ); } else { // Disk space is unavailable buffer = StringLoader::LoadLC( R_CFD_QTN_MEMC_SPACE_NOT_AVAILABLE, iCoeEnv); } itemString.Append( *buffer );//Free mem text CleanupStack::PopAndDestroy( buffer ); break; } } break; } } // Finally!: append the formatted string to listbox User::LeaveIfError( iListBoxArray.Append( lbxItemBuf ) ); CleanupStack::PopAndDestroy( 2 ); // textItemBuf2, textItemBuf CleanupStack::Pop( lbxItemBuf ); _LOG1( "[CAknMemorySelectionModelMultiDrive] Item string added to lbx array: %S", &itemString ); _LOG1( "itemString length=%d", itemString.Length() ); }
// -------------------------------------------------------------------------- // CAknMemorySelectionModelMultiDrive::AddInternalStorageItemToLbxL // // // -------------------------------------------------------------------------- // void CAknMemorySelectionModelMultiDrive::AddInternalStorageItemToLbxL( const TCFDDriveInfo& aDriveInfo ) { HBufC* lbxItemBuf = HBufC::NewLC( KListBoxEntryMaxLength ); TPtr itemString( lbxItemBuf->Des() ); HBufC* textItemBuf = HBufC::NewLC( KListBoxEntryMaxLength ); TPtr textString( textItemBuf->Des() ); TDriveUnit driveUnit( aDriveInfo.iDriveNumber ); // Item text is affected by layout switch( iLayout ) { case ELayoutPopupMenu: { // A-column icon: if( aDriveInfo.iDriveStatus == EDriveOK ) { itemString.Format( KImageHeader, EIconInternalMassStorage ); } else { itemString.Format( KImageHeader, EIconInternalMassStorageUnavailable ); } itemString.Append( KTabChar ); // 1st row text: if( aDriveInfo.iDriveStatus == EDriveOK ) { StringLoader::Format( textString, *iLocStringArray[ ETextInternalMassStorage ], KNoIndex, driveUnit.Name() ); } else { StringLoader::Format( textString, *iLocStringArray[ ETextInternalMassStorageUnavailable ], KNoIndex, driveUnit.Name() ); } itemString.Append( textString ); break; } case ELayoutSettingPage: { // 1st row text: StringLoader::Format( itemString, *iLocStringArray[ ETextInternalMassStorage ], KNoIndex, driveUnit.Name() ); break; } case ELayoutDoublePopup: { // A-column icon: itemString.Format( KImageHeader, EIconInternalMassStorage ); itemString.Append( KTabChar ); // 1st row text: StringLoader::Format( textString, *iLocStringArray[ ETextInternalMassStorage ], KNoIndex, driveUnit.Name() ); itemString.Append( textString ); itemString.Append( KTabChar ); // 2nd row text: if ( aDriveInfo.iDriveStatus == EDriveOK ) { HBufC* buffer; TInt64 freeSpace = aDriveInfo.iDiskSpace; if ( freeSpace >= 0 ) { buffer = HBufC::NewLC( KListBoxEntryMaxLength ); TPtr unitStr( buffer->Des() ); AknCFDUtility::SetSecondRowTextL( freeSpace, unitStr ); } else { // Disk space is unavailable buffer = StringLoader::LoadLC( R_CFD_QTN_MEMC_SPACE_NOT_AVAILABLE, iCoeEnv); } itemString.Append( *buffer );//Free mem text CleanupStack::PopAndDestroy( buffer ); } else { itemString.Append( *iLocStringArray[ ETextInternalMassStorageUnavailable ] ); } break; } } // Finally!: append the formatted string to listbox User::LeaveIfError( iListBoxArray.Append( lbxItemBuf ) ); CleanupStack::PopAndDestroy( textItemBuf ); CleanupStack::Pop( lbxItemBuf ); _LOG1( "[CAknMemorySelectionModelMultiDrive] Item string added to lbx array: %S", &itemString ); _LOG1( "itemString length=%d", itemString.Length() ); }