void CMsvIndexContext::DoStoreConfigL() { // we only want to store the config file if it has changed, // we also don't care about UniqueIDs for the internal drive if(iConfig.iDebug!=iConfig.iDebugAsLoaded || iConfig.iDrive!=iConfig.iDriveAsLoaded || (iConfig.iDrive!=iServer.FileSession().GetSystemDrive() && iConfig.iUniqueID!=iConfig.iUniqueIDAsLoaded)) { TChar driveChar= iServer.FileSession().GetSystemDriveChar(); TBuf<2> systemDrive; systemDrive.Append(driveChar); systemDrive.Append(KDriveDelimiter); TPath pathName(systemDrive); pathName.Append(KServerINIFile); CDictionaryFileStore *store=CDictionaryFileStore::OpenLC(iServer.FileSession(),pathName,KNullUid); RDictionaryWriteStream stream; stream.AssignLC(*store, KUidMsvMessageDriveStream); stream.WriteUint8L(KMsvMessageDriveStreamVersionNumber); // version number stream << iConfig.iDrive.Name(); stream.WriteUint32L(iConfig.iUniqueID); stream.WriteInt8L(iConfig.iDebug); stream.CommitL(); store->CommitL(); CleanupStack::PopAndDestroy(2,store); // stream, store } }
//DEF074278: Java VM requires more command line testArguments. void Defect_DEF074278_Part2() { TBuf<180> testArguments(_L("one two three four five six seven eight nine ten eleven twelve thirteen fourteen fifteen sixteen seventeen eighteen nineteen twenty twenty-one twenty-two twenty-three twenty-four ")); TBuf<210> inputArguments; TUint testArgNo = 25; int argc=0; char** argv=0; char** envp=0; TheTest.Printf(_L("Retrieving the arguments passed in from T_UCRT0P1\n")); __crt0(argc,argv,envp); // get args & environment from somewhere //Get all the arguments into a descriptor, beginning at pos 1, as pos 0 contains //the T_UCRT0P2 exe path and name. for (TInt i=1; i < argc; i++) { char *str=argv[i]; while(*str) inputArguments.Append((TChar)*str++); inputArguments.Append(' '); } //tests all the arguments were passed to the new process correctly. TheTest.Printf(_L("Checking all arguements were passed to the new process correctly... ")); TEST(testArguments == inputArguments ); TEST2(testArgNo, argc); exit(0); }
////////////////////////////////////////////////////////////////////////// //From MHandleEventObserver ////////////////////////////////////////////////////////////////////////// void CSearchLocalResultView::HandleResponseEvent(TInt aEvent,TInt aType) { if(aEvent==EHttpNoError) { this->iSearchList->SetEdwinVisible(ETrue); iSearchList->InitListBox(); RemoveAndDeleteControl(iDialog); if(iLocalSearch->GetCount()==0) { this->InitDialog(iMainEngine.GetDesById(ETurkeyTextRes_ListNull)); } else { iSearchList->SetEdwinVisible(EFalse); for(TInt i=0;i<iLocalSearch->GetCount();i++) { const CFbsBitmap* icon = NULL; const CFbsBitmap* iconMask = NULL; icon = iMainEngine.GetBitmapFactory().GetFileTypeIcon(GetCurType()); iconMask = iMainEngine.GetBitmapFactory().GetFileTypeIconMask(GetCurType()); iSearchList->AppendListItem(iLocalSearch->GetOneItemName(i),icon,iconMask); } TBuf<50> titleBuf; titleBuf.Zero(); titleBuf.Append(*iTitle); titleBuf.Append(_L("[")); titleBuf.AppendNum(iLocalSearch->GetCount()); titleBuf.Append(_L("]")); iTitleBar->SetTextL(titleBuf); iSearchList->ListBoxDraw(); } } }
/** Begin the start-up test case. Opening the database is synchcronous as is the first part of creating the remote view. The second part (where the view is populated with contacts) is asynchronous and finishes when CStartUp::HandleContactViewEvent is called. CStartUp::RunL then just cleans up once the test case is finished. */ void CStartUp::DoTestL(const TDesC& aDbName, TViewType aViewType, TInt& aNumMsToGet20ItemsFromView) { iViewType = aViewType; iNumMsToGet20ItemsFromViewPtr = &aNumMsToGet20ItemsFromView; _LIT(KRemoteContactViewText, "\n[Remote Contacts view]\n"); _LIT(KRemoteGroupViewText, "\n[Remote Groups view]\n"); TBuf<32> buf; if (iViewType == ERemoteContactsView) { buf.Append(KRemoteContactViewText); } else { buf.Append(KRemoteGroupViewText); } iTest.Printf(buf); // open database OpenDatabaseL(aDbName); // create view CreateRemoteViewL(); CActiveScheduler::Start(); }
// ----------------------------------------------------------------------------- // COMASuplWapListener::PrintHex // // ----------------------------------------------------------------------------- // void COMASuplWapListener::PrintHex(const TDesC8& aBuffer,TInt aLine) { TBuf<256> buffer; TBuf<2> buff; _LIT16(KFormat1,"%02x"); TInt len = aBuffer.Length(); //The buffer is usually larger than what can be logged in a single line in the log file. As such this should only attempt // to log 27 hex blocks to each log line. const TInt KNumberOfBlocks = 27; TInt blockNumber = KNumberOfBlocks; for(TInt i = 0 ; i <len; i++) { //Check to see if the buffer should be logged and then emptied if(i == blockNumber) { //Trace the buffer as it currently is iTrace->Trace(buffer, KTraceFileName, aLine); //Reset the buffer for the next log line buffer.Zero(); blockNumber += KNumberOfBlocks; } buff.Zero(); buff.Format(KFormat1,aBuffer[i]); buffer.Append(buff); buffer.Append(_L(" ")); } iTrace->Trace(buffer, KTraceFileName, aLine); }
void CPolicyTest::RunTestL(TRequestStatus& aStatus) { HBufC* hptr16; hptr16 = CnvUtfConverter::ConvertToUnicodeFromUtf8L(*iNameInfo); RDebug::Print(KFormat,hptr16); delete hptr16; TDriveUnit sysDrive (RFs::GetSystemDrive()); TDriveName sysDriveName (sysDrive.Name()); TBuf<128> passScriptFile (sysDriveName); passScriptFile.Append(KPassScriptPath); TBuf<128> failScriptFile (sysDriveName); failScriptFile.Append(KFailScriptPath); TPtrC script = (iTestState == ETestPass) ? passScriptFile : failScriptFile; (iTestState == ETestPass) ? RDebug::RawPrint(KPassTestRunning) : RDebug::RawPrint(KFailTestRunning); TBuf<128> logTmpFile (sysDriveName); logTmpFile.Append(KLogTmpPath); iFs.Delete(logTmpFile); // ignore errors TBuf<128> commandLine; commandLine.AppendFormat(_L("%S %S"), &script, &logTmpFile); StartProcessL(iTestExeTmpNewPath, commandLine, aStatus); }
TInt CFileSelectDialog::Show() { _LOG(_L("CFileSelectDialog::Show()")); TInt sel=0; CDesCArray* itemList = new (ELeave) CDesCArrayFlat(3); if (iCurrentPath.Compare(_L(""))!=0){if (iType==EFolder){iArray->InsertL(0,_L("Select folder"));}iArray->InsertL(0,_L("..."));} _LOGDATA(_L("Length of array: %d"),iArray->Count()); for (TInt i=0;i<iArray->Count();i++) { TBuf<255> ItemTxt; ItemTxt.Copy(_L("0\t")); ItemTxt.Append(iArray->MdcaPoint(i)); ItemTxt.Append(_L("\t\t")); itemList->AppendL(ItemTxt); _LOGDATA(_L("Item: %S"),&iArray->MdcaPoint(i)); } _LOG(_L("Will create dialog")); SetItemTextArray(itemList); ListBox()->HandleItemAdditionL(); Layout(); ListBox()->SetCurrentItemIndex(0); ListBox()->DrawNow(); DrawDeferred(); }
void CTestViewControl::Draw(const TRect& /*aRect*/) const { CWindowGc& gc = SystemGc(); gc.SetBrushStyle(CGraphicsContext::ESolidBrush); gc.SetBrushColor(KRgbDitheredLightGray); gc.DrawRect(Rect()); gc.UseFont(iEikonEnv->TitleFont()); TInt yPos = KYStart; TInt xPos = KXStart; gc.DrawText(APP_TEXT,TPoint(xPos,yPos)); yPos+=30; TBuf<256> viewNameBuf; viewNameBuf.Append(_L("View ")); TBuf<16> numBuf; numBuf.Num((TInt)iViewId.iViewUid.iUid); viewNameBuf.Append(numBuf); gc.DrawText(viewNameBuf,TPoint(xPos,yPos)); }
// --------------------------------------------------------------------------- // CGSSensorPluginContainer::AppendListItem // --------------------------------------------------------------------------- // void CGSSensorPluginContainer::AppendListItemL( const TInt aPos, const TDesC16& aFirstLabel, const TDesC16& aSecondLabel ) { TBuf<KGSBufSize128> itemText; _LIT( KSpaceAndTab, " \t" ); _LIT( KTab, "\t" ); // The format is: " \tFirstLabel\tSecondLabel\t0\t0" // First, append space and tab itemText.Append( KSpaceAndTab ); itemText.Append( aFirstLabel ); itemText.Append( KTab ); itemText.Append( KTab ); // Currently this is used only to show sensors active status (on/off) itemText.Append( aSecondLabel ); // No need to add last tabs if ( ( KErrNotFound != aPos ) && ( aPos <= iListBoxTextArray->Count() ) ) { iListBoxTextArray->InsertL( aPos, itemText ); } else { iListBoxTextArray->AppendL( itemText ); } }
/** @SYMTestCaseID SYSLIB-BAFL-CT-1390 @SYMTestCaseDesc Tests BaflUtils::PersistScreenCalibration @SYMTestPriority Medium @SYMTestActions Deletes screen calibration file, calls PersistScreenCalibration() and checks that file now exists @SYMTestExpectedResults Test must not fail @SYMREQ REQ0000 */ void Defect_DEF068052L() { TheTest.Next (_L (" @SYMTestCaseID:SYSLIB-BAFL-CT-1390 Defect_DEF068052L ")); __UHEAP_MARK; User::LeaveIfError (TheFs.Connect ()); ::CleanupClosePushL (TheFs); const TInt KDriveLength = 2; const TInt KScreenPathLength = 26; const TInt KScreenPathLengthTemp = 30; _LIT (KDriveColon, ":"); _LIT (KScreen, "\\System\\Data\\Screen.DAT"); _LIT (KScreenTemp, "\\System\\Data\\ScreenTemp.DAT"); // Find the system drive TDriveNumber systemDrive = TheFs.GetSystemDrive(); // Set up a full file path name incorporating the system drive // (for example if system drive is EDriveC pathname will be: // C:\System\Data\Screen.DAT) TBuf<KDriveLength+KScreenPathLength> screenFilePath; screenFilePath.Append(systemDrive + 'A'); screenFilePath.Append(KDriveColon); screenFilePath.Append(KScreen); // Set up a full file path name to make a copy of the screen.dat // file. TBuf<KDriveLength+KScreenPathLengthTemp> screenFilePathTemp; screenFilePathTemp.Append(systemDrive + 'A'); screenFilePathTemp.Append(KDriveColon); screenFilePathTemp.Append(KScreenTemp); // Make a copy of the screen.dat file (if it exists) BaflUtils::CopyFile(TheFs, screenFilePath, screenFilePathTemp); // Delete the Screen.DAT file (if it exists) BaflUtils::DeleteFile(TheFs, screenFilePath); // Saving Screen settings - call API to write the screen // calibration to file TDigitizerCalibration calib; BaflUtils::PersistScreenCalibration(calib); // Check if screen.dat file now exists TBool exists = BaflUtils::FileExists(TheFs, screenFilePath); TheTest(exists); TheTest.Printf(_L("Screen settings were saved in %S\n"), &screenFilePath); // Cleaning up, restore files to original state User::LeaveIfError(BaflUtils::DeleteFile(TheFs, screenFilePath)); BaflUtils::CopyFile(TheFs, screenFilePathTemp, screenFilePath); BaflUtils::DeleteFile(TheFs, screenFilePathTemp); CleanupStack::PopAndDestroy (&::TheFs); __UHEAP_MARKEND; }
void CTestHarness::TestFontHugeCharacters(TTypefaceSupport& aSupport, TInt aPointSize, TBool aItalic) { TBuf<50> testInfo; testInfo.Append(_L("Testing huge characters: ")); TBuf<10> num; num.Num(aPointSize); testInfo.Append(num); iStep->INFO_PRINTF1(testInfo); TFontSpec fs; fs.iTypeface = aSupport.iTypeface; fs.iHeight = aPointSize * 20; if (aItalic) fs.iFontStyle.SetPosture(EPostureItalic); iTestFont = NULL; TInt error = iDev->GetNearestFontToDesignHeightInTwips((CFont*&)iTestFont,fs); if (error) User::Panic(_L("Could not create font"),error); if (!iTestFont->IsOpenFont()) { iDev->ReleaseFont(iTestFont); iTestFont = NULL; return; } PrintMetrics(); DrawHugeCharacters(); iDev->ReleaseFont(iTestFont); }
void CContextbookContainer::show_presence_details_current() { CALLSTACKITEM(_L("CContextbookContainer::show_presence_details_current")); TInt current_index = get_current_idx(); if (current_index < 0) return; contact * c = book->GetContact(current_index); if (c == NULL || c->presence == NULL) return; TBuf<128> name; if (c->last_name) name.Append(*(c->last_name)); if (c->last_name && c->last_name->Length()>0 && c->first_name && c->first_name->Length()>0) { name.Append(_L(" ")); } if (c->first_name) name.Append(*(c->first_name)); if (iLog) { iLog->write_time(); iLog->write_to_output(_L("Checking presence details of ")); iLog->write_to_output(name); iLog->write_nl(); } ((CContextbookAppUi *)(iEikonEnv->AppUi()))->DisplayPresenceDetailsL(name, (book->GetContact(current_index))->presence); }
void CWordStyleGallery::AppendL(TInt aIndex) { TBuf<100> name; name = (*iStyleNameList)[aIndex]; // // truncate name if necessary CColumnListBoxData* columnData = ListBox()->ItemDrawer()->ColumnData(); TInt columnWidth = columnData->ColumnWidthPixel(0); const CFont* columnFont = columnData->ColumnFont(0); if (columnFont->TextWidthInPixels(name) > columnWidth) TextUtils::ClipToFit(name, *columnFont, columnWidth); // TChar key = iData.iNormalStyleHotKey; if (name != iNormalName) { CParagraphStyle* pp = iData.iStyleList.PtrByName(name)->iStyle; TInt index = iData.iStyleList.IndexByPtr(pp); key = iData.iHotKeyList[index]; } if (key > 0) { name.Append(KColumnListSeparator); name.Append(KColumnListSeparator); // one for empty spacer column name.Append(iHotKey); name.Append(key); name.Append(KColumnListSeparator); } iStyleNameKeyList->AppendL(name); }
void CTestCalInterimApiInstanceSuiteServer::StartAlarmAlertServer() { // Start the Alarm Server TBuf<256> buffer; buffer.Append('p'); buffer.Append('p'); buffer.Append(EKeyEscape); RProcess alarmServer; // Create the Connection to the alarm alert server alarmServer.Create(KConsoleAlarmAlertServerImg, buffer, serverUid); TRequestStatus stat; alarmServer.Rendezvous(stat); if (stat != KRequestPending) { alarmServer.Kill(0); } else { alarmServer.Resume(); } User::WaitForRequest(stat); TInt result = stat.Int(); if(result != KErrNone && result != KErrAlreadyExists) { User::LeaveIfError(result); } }
TInt CopyDataFile::CopyToPublicL(TDesC& aFileName) { TInt ret=KErrNone; RFs iRFs; User::LeaveIfError(iRFs.Connect()); CFileMan* fileMan=CFileMan::NewL(iRFs); //get the sid and convert it to hex TSecureId sid = RProcess().SecureId(); TBuf<20> hex; hex.Num(sid, EHex); hex.Append(_L("\\")); //generate the target path - C:\\ShellPublic\\$SID TBuf<128> path(_L("C:\\ShellPub\\")); path.Append(hex); //create the target directory TBuf<128> file (path); ret=iRFs.MkDir(path); if(ret==KErrNone || ret==KErrAlreadyExists) { //generate the absolute path of the target file file.Append(aFileName); //copy the file ret=fileMan->Copy(aFileName, file); } iRFs.Close(); delete fileMan; return ret; }
void CSettings::ConstructL(const TDesC& SettingName) { _LIT(db_base, "SETTINGS"); TBuf<100> db; db.Append(db_base); db.Append(SettingName); TFileName oldfilen, newfilen; oldfilen.Format(_L("%S%S.db"), &AppDir(), &db_base); newfilen.Format(_L("%S%S.db"), &AppDir(), &db); if (BaflUtils::FileExists(Fs(), oldfilen)) { User::LeaveIfError(Fs().Rename(oldfilen, newfilen)); } iListeners=CGenericIntMap::NewL(); iListeners->SetDeletor(ListDeletor); if (!iReadOnly) { iDb=CDb::NewL(AppContext(), db, EFileRead|EFileWrite|EFileShareAny ); } else { iDb=CDb::NewL(AppContext(), db, EFileRead|EFileShareAny ); } iDesStore=CSingleColDb<TDesC, TDes>::NewL(AppContext(), iDb->Db(), _L("DES")); iDes8Store=CSingleColDb<TDesC8, TDes8>::NewL(AppContext(), iDb->Db(), _L("DES8")); iIntStore=CSingleColDb<TInt>::NewL(AppContext(), iDb->Db(), _L("INT")); iTimeStore=CSingleColDb<TTime>::NewL(AppContext(), iDb->Db(), _L("TIME")); }
void CPolicyTest::SetTestSecurityInfoL(TInt aSecureId, TInt aVendorId, TUint aCapSet, TRequestStatus& aStatus) { // Remove excluded capabilities for (TInt i = 0 ; i < ECapability_Limit ; ++i) { if (iExcludedCaps.HasCapability(static_cast<TCapability>(i))) { aCapSet &= ~ (1 << i); } } TBuf<128> commandLine; commandLine.AppendFormat(_L("%S %08x "), iTestExe, aCapSet); if (aSecureId) { commandLine.AppendFormat(_L("-SID %08x "), aSecureId); } if (aVendorId) { commandLine.AppendFormat(_L("-VID %08x "), aVendorId); } // commandLine.Append(KTestExeTmpPath); iTestExeTmpNewPath = KTestPath; iTestExeTmpNewPath.Append(*iTestExe); commandLine.Append(iTestExeTmpNewPath); TBuf<128> isetcapTmpNewPath1; //stores the value of commandline TBuf<128> isetcapTmpNewPath; //stores the value of KsetCapexe2 isetcapTmpNewPath = KSetCapExe2; isetcapTmpNewPath1= commandLine; isetcapTmpNewPath.Append(isetcapTmpNewPath1); RDebug::RawPrint(isetcapTmpNewPath); StartProcessL(KSetCapExe, commandLine, aStatus); }
// ---------------------------------------------------------------------------- // CBluetoothEngine::SetLIAC // ---------------------------------------------------------------------------- void CBluetoothEngine::SetLIAC(TBool aState) { TInt err = KErrNone; // Set LIAC for the system err = iProperty.Set(KPropertyUidBluetoothControlCategory, KPropertyKeyBluetoothSetLimitedDiscoverableStatus, aState); TBuf<KEighty> myMessage; myMessage.Zero(); if (KErrNone == err) { if (aState) { myMessage.Append(KLIACOn); } else { myMessage.Append(KLIACOff); } iLIAC = aState; iDeviceDiscoverer->SetLIAC(iLIAC); } else { myMessage.AppendFormat(KLIACError, err); } TRAP( err, ShowMessageL( myMessage, ETrue )); }
void CFileSelectDialog::ScanDir() { _LOG(_L("0")); TInt i=0; CDir* results=NULL; TFindFile findFiles(iFs); TBuf<5> mask(_L("*")); findFiles.FindWildByDir(mask,iCurrentPath,results); if (results==NULL){return;} _LOG(_L("2")); for (i=0;i<results->Count();i++) { _LOGDATA(_L("3 %d"),i); if (((TEntry)(*results)[i]).IsDir()) { TBuf<255> buf; buf.Copy(_L("[")); buf.Append(((TEntry)(*results)[i]).iName); buf.Append(_L("]")); iArray->AppendL(buf);} } if (iType!=EFolder) { for (i=0;i<results->Count();i++) { _LOGDATA(_L("4 %d"),i); if ((!((TEntry)(*results)[i]).IsDir())&&((TEntry)(*results)[i]).iName.Match(iMask)!=KErrNotFound) {iArray->AppendL(((TEntry)(*results)[i]).iName);} } } _LOG(_L("Exit from ScanDir")); }
// Set data to the listbox. void CMessageListBox::SetData() { iListbox->HandleItemRemovalL(); SetIconsArray(); CDesCArrayFlat* listItems = new (ELeave) CDesCArrayFlat(2); CleanupStack::PushL(listItems); TBuf<KArrayItemMaxLength> item; _LIT(KTab, "\t"); item.Copy(_L("0")); item.Append(KTab); item.Append(*iEikonEnv->AllocReadResourceL(R_TAB_INBOX)); listItems->AppendL(item); item.Copy(_L("1")); item.Append(KTab); item.Append(*iEikonEnv->AllocReadResourceL(R_TAB_SENTITEMS)); listItems->AppendL(item); CleanupStack::Pop(listItems); CTextListBoxModel* model = iListbox->Model(); model->SetItemTextArray(listItems); // Set ListBox model responsible for deleting the listItems array model->SetOwnershipType(ELbmOwnsItemArray); iListbox->HandleItemAdditionL(); DrawDeferred(); }
/* * Search test cases by the index of the array of test case group, overloaded version for basic unitary cases. * @param aIdx the test case index in search * @param aBasicUnitaryTestCaseGroup the input test group, should always be gBasicUnitaryTestCases[] * @param aTestCaseFound contains params of the test case found by the test case Id. * @return KErrNone if only one test case on the id is found * KErrNotFound if no test case is found */ TInt SearchTestCaseByArrayIdx(TUint aIdx, const TTestCaseUnitaryBasic aBasicUnitaryTestCaseGroup[], TTestParamAll& aTestCaseFound, TBool aIsWithDLL=EFalse) { if (aBasicUnitaryTestCaseGroup[aIdx].iBasic.iTestCaseID != 0) { aTestCaseFound.iTestCaseID = aBasicUnitaryTestCaseGroup[aIdx].iBasic.iTestCaseID; aTestCaseFound.iAPI = aBasicUnitaryTestCaseGroup[aIdx].iBasic.iAPI; aTestCaseFound.iSrcDrvChar = aBasicUnitaryTestCaseGroup[aIdx].iSrcPrsBasic.iDrvChar; aTestCaseFound.iSrcCmdPath.Copy(aBasicUnitaryTestCaseGroup[aIdx].iSrcPrsBasic.iCmdPath); aTestCaseFound.iSrcPrsPath.Copy(aBasicUnitaryTestCaseGroup[aIdx].iSrcPrsBasic.iPrsPath); aTestCaseFound.iSrcPrsFiles = aBasicUnitaryTestCaseGroup[aIdx].iSrcPrsBasic.iPrsFiles; aTestCaseFound.iIsWithDLL = aIsWithDLL; // To make every test case uniquely indentified for interOP // update the test case id and its path correspondingly TBuf<15> tempName = _L("_"); if(aTestCaseFound.iIsWithDLL) tempName.Append(_L("DLL")); else tempName.Append(_L("NDLL")); TInt idx = aTestCaseFound.iSrcCmdPath.Find(_L("\\Src\\")); aTestCaseFound.iSrcCmdPath.Insert(idx, tempName); aTestCaseFound.iSrcPrsPath.Insert(idx, tempName); } else return KErrNotFound; return KErrNone; }
void CJournalFile::ConstructL(const TDesC& aFileName) { DEBUG_PRINTF2(_L("CJournalFile::ConstructL() - aFileName %S"), &aFileName); iJournalFileName = aFileName; TChar drive; User::LeaveIfError(iFs.DriveToChar(iDrive, drive)); TBuf<2> driveSpec; driveSpec.Append(drive); driveSpec.Append(KDriveDelimiter); iTreeRoot = CIntegrityTreeNode::NewL(driveSpec); // read any existing entries from this journal TRAPD(err, ReadL()); if(err != KErrNone) { DEBUG_PRINTF2(_L("CJournalFile::ConstructL() - CJournalFile::ReadL() has left with error %d"), err); // if necessary create the path if(err == KErrPathNotFound) { User::LeaveIfError(iFs.MkDirAll(iJournalFileName)); } else if (err != KErrNotFound) { DEBUG_PRINTF2(_L("CJournalFile::ConstructL() - Leaving with error %d"), err); User::Leave(err); } } // now prepare for writing PrepareToWriteL(); }
// ----------------------------------------------------------------------------- // CClientInstallerApplication::CreateDocumentL() // Creates CApaDocument object // ----------------------------------------------------------------------------- // CApaDocument* CClientInstallerApplication::CreateDocumentL() { TBuf<256> str; _LIT(KFilePrefix,"FILE:"); _LIT(KCDrive,"C:"); _LIT(Kcheck, "\\system\\apps\\ClientInstaller\\welcome.html"); // Construct the check for the C drive str.Copy(KCDrive); str.Append(Kcheck); if ( FileExists(str) ) { // The specified file exists, so start the browser to view it. str.Copy(KFilePrefix); str.Append(KCDrive); str.Append(Kcheck); StartBrowser(str); } // Create an ClientInstaller document, and return a pointer to it return (static_cast<CApaDocument*> ( CClientInstallerDocument::NewL( *this ) ) ); }
LOCAL_C void privatefalseIDRFstest() // // // { pritestfalseidname=KPrivateFalseID; pritestfalseidname[0]=(TText)('A' + gTheDriveNum); mkdirname.Zero(); mkdirname.Append(pritestfalseidname); mkdirname.Append(KMkDirSub); r=TheFs.MkDirAll(mkdirname); test_Value(r, r == KErrPermissionDenied); r=TheFs.RmDir(mkdirname); test_Value(r, r == KErrPermissionDenied); r=TheFs.SetSubst(pritestfalseidname,EDriveP); test_Value(r, r == KErrPermissionDenied); TheFs.NotifyChange(ENotifyAll,aStat2,pritestfalseidname); test(aStat2==KErrPermissionDenied); pritestfile=KPrivateFalseID; pritestfile[0]=(TText)('A' + gTheDriveNum); pritestfile1=pritestfile; pritestfile.Append(KFilePri2); pritestfile1.Append(KFilePri3); oldName=KOldFile; oldName[0]=(TText)gDriveToTest; r=TheFs.GetShortName(pritestfile, shortfilename); test_Value(r, r == KErrPermissionDenied); r=TheFs.GetLongName(pritestfile1, longfilename); test_Value(r, r == KErrPermissionDenied); r=file1.Create(TheFs,oldName,EFileWrite); test_Value(r, r == KErrNone || r==KErrAlreadyExists); file1.Close(); r=TheFs.Replace(oldName,pritestfile); test_Value(r, r == KErrPermissionDenied); r=TheFs.Rename(pritestfile,pritestfile1); test_Value(r, r == KErrPermissionDenied); r=TheFs.Entry(pritestfile1,entry); test_Value(r, r == KErrPermissionDenied); r=TheFs.SetEntry(pritestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly); test_Value(r, r == KErrPermissionDenied); r=TheFs.Delete(pritestfile1); test_Value(r, r == KErrPermissionDenied); }
void CMdSServer::CheckInitSriptL() { RFs fs; User::LeaveIfError( fs.Connect() ); CleanupClosePushL( fs ); TBuf<KMaxFileName> privatePath; TBuf<KMaxFileName> schema; TBuf<KMaxFileName> defaultImportProfile; TBuf<KMaxFileName> backupRegistration; RFileReadStream tmpFile; fs.PrivatePath( privatePath ); schema.Copy( privatePath ); schema.Append( KSchema ); defaultImportProfile.Copy( privatePath ); defaultImportProfile.Append( KDefaultImportProfile ); backupRegistration.Copy( privatePath ); backupRegistration.Append( KBackupRegistration ); CFileMan* fileMan = CFileMan::NewL( fs ); CleanupStack::PushL( fileMan ); CheckAndInitializeFileL( fs, schema, KSchemaPath(), tmpFile, fileMan ); CheckAndInitializeFileL( fs, defaultImportProfile, KDefaultImportProfilePath(), tmpFile, fileMan ); CheckAndInitializeFileL( fs, backupRegistration, KBackupRegistrationPath(), tmpFile, fileMan ); CleanupStack::PopAndDestroy( 2 ); //fileman, fs }
LOCAL_C void privateRFiletest() // // // { r=TheFs.SetSessionPath(pritestname); test_Value(r, r == KErrPermissionDenied); r=file1.Temp(TheFs,pritestname,fromTemp,EFileWrite); test_Value(r, r == KErrPermissionDenied); TBuf<25> prifilename; prifilename.Append(pritestname); prifilename.Append(KFileSys); r=file1.Create(TheFs,prifilename,EFileWrite); test_Value(r, r == KErrPermissionDenied); r=file1.Open(TheFs,prifilename,EFileWrite); test_Value(r, r == KErrPermissionDenied); r=file1.Open(TheFs,prifilename,EFileRead); test_Value(r, r == KErrPermissionDenied); r=file1.Replace(TheFs,prifilename,EFileWrite); test_Value(r, r == KErrPermissionDenied); }
// Set data to the listbox. void CPhotoModeListBox::SetData() { iListbox->HandleItemRemovalL(); SetIconsArray(); CDesCArrayFlat* listItems = new (ELeave) CDesCArrayFlat(2); CleanupStack::PushL(listItems); TBuf<KArrayItemMaxLength> item; _LIT(KTab, "\t"); item.Copy(_L("0")); item.Append(KTab); item.Append(_L("Phone")); listItems->AppendL(item); item.Copy(_L("1")); item.Append(KTab); item.Append(_L("Memory")); listItems->AppendL(item); CleanupStack::Pop(listItems); CTextListBoxModel* model = iListbox->Model(); model->SetItemTextArray(listItems); // Set ListBox model responsible for deleting the listItems array model->SetOwnershipType(ELbmOwnsItemArray); iListbox->HandleItemAdditionL(); DrawDeferred(); }
TInt CopyDataFile::CopyToPrivateL(TDesC& aFileName) { TInt ret=KErrNone; RFs iRFs; User::LeaveIfError(iRFs.Connect()); CFileMan* fileMan=CFileMan::NewL(iRFs); //get the sid and convert it to hex TSecureId sid = RProcess().SecureId(); TBuf<20> hex; hex.Num(sid, EHex); hex.Append(_L("\\")); //generate the source path - C:\\ShellPublic\\$SID TBuf<128> path(_L("C:\\ShellPub\\")); path.Append(hex);//make the source directory path //generate the absolute path of the source file TBuf<128> file (path); file.Append(aFileName); //copy to process private directory ret=fileMan->Copy(file, _L(".")); iRFs.Close(); delete fileMan; return ret; }
TInt CTestUtils::OpenMainLogL() { _LIT(KDisplayLogFile,"Log File %S\n"); TParse loglocation; TFileName logfile; TInt err=ResolveLogFile(KNullDesC, loglocation); if(err!=KErrNone) { TChar driveChar=RFs::GetSystemDriveChar(); TBuf<2> systemDrive; systemDrive.Append(driveChar); systemDrive.Append(KDriveDelimiter); TPath pathName(systemDrive) ; pathName.Append(KMsvTestFileDefaultOutputBase); iFs.MkDirAll(pathName); err=ResolveLogFile(KNullDesC, loglocation); } User::LeaveIfError(err); logfile.Copy(loglocation.FullName()); logfile.Delete(logfile.Length()-1,1); AppendVariantName(logfile); iRTest.Printf(KDisplayLogFile, &logfile); iFs.MkDirAll(logfile); iLogBuf=HBufC::NewL(KMaxLogLineLength); iLogBuf8=HBufC8::NewL(KMaxLogLineLength); return(iFile.Replace(iFs,logfile,EFileWrite|EFileShareAny)); }
// --------------------------------------------------------------------------- // Cplaylistenginetest::CMPXPlaylistEngineInternalizePlaylistLRFile // ?implementation_description // (other items were commented in a header). // --------------------------------------------------------------------------- // TInt Cplaylistenginetest::CMPXPlaylistEngineInternalizePlaylistLRFile( CStifItemParser& aItem ) { TInt err=KErrNone; iLog->Log(_L("Cplaylistenginetest::CMPXPlaylistEngineInternalizePlaylistLRFile")); TPtrC string; while ( aItem.GetNextString( string ) == KErrNone ) { TBuf<120> KPlaylistDir; KPlaylistDir.Append(Kplaylistenginetest_testPath); KPlaylistDir.Append(string); RFs fs; User::LeaveIfError(fs.Connect()); CDir* entryList(NULL); // User::LeaveIfError( // fs.GetDir(KPlaylistDir, KEntryAttNormal, KEntryAttNormal, entryList)); User::LeaveIfError( fs.GetDir(KPlaylistDir, KEntryAttMaskSupported, ESortByName|EDirsFirst, entryList)); CleanupStack::PushL(entryList); RFile playlistFile; User::LeaveIfError(playlistFile.Open(fs, KPlaylistDir, EFileRead )); iPlaylistEngine->PlaylistPluginHandler().SelectPlaylistPluginL(playlistFile); TRAP(err, iPlaylistEngine->InternalizePlaylistL(playlistFile)); CleanupStack::PopAndDestroy(entryList); playlistFile.Close(); fs.Close(); } iLog->Log(_L("Cplaylistenginetest::InternalizePlaylistL returned: %d"), err); return err; }