void AppendInterfaceProperties(TDes& aDes, const SCdlInterface& aInterface) { aDes.AppendFormat(_L("%S\nUid: 0x%08x\nMajorVer: %d\nMinorVer: %d\nFlags: 0x%08x\nAPI size: %d\nEng major: %d\nEng minor: %d"), aInterface.iName, aInterface.iUid, aInterface.iMajorVer, aInterface.iMinorVer, aInterface.iFlags, aInterface.iApiSize, aInterface.iMajorEngVer, aInterface.iMinorEngVer ); }
/* * ActiveCall() detects if there's a connected call. Only in that case aNumber is meaningfull; and only * in that case, if aNumber.Length() == 0, then aNumber is a private number. */ TBool CPhoneCallMonitor::ActiveCall(TDes& aNumber) { CTelephony::TRemotePartyInfoV1 remInfoUse; CTelephony::TCallInfoV1 callInfoUse; CTelephony::TCallSelectionV1 callSelectionUse; // we are interested only voice lines callSelectionUse.iLine = CTelephony::EVoiceLine; // and calls that are currently connected callSelectionUse.iSelect = CTelephony::EActiveCall; //EHeldCall, EInProgressCall CTelephony::TRemotePartyInfoV1Pckg remParty(remInfoUse); CTelephony::TCallInfoV1Pckg callInfo(callInfoUse); CTelephony::TCallSelectionV1Pckg callSelection(callSelectionUse); // TCallRemoteIdentityStatus::ERemoteIdentityUnknown, ERemoteIdentityAvailable, ERemoteIdentitySuppressed if(iTelephony->GetCallInfo(callSelection,callInfo,remParty) == KErrNone) { if(remInfoUse.iDirection == CTelephony::EMobileOriginated) //outgoing call { aNumber.Copy(callInfoUse.iDialledParty.iTelNumber); } else //incoming call { if(remInfoUse.iRemoteIdStatus == CTelephony::ERemoteIdentityAvailable) { aNumber.Copy(remInfoUse.iRemoteNumber.iTelNumber); } else // private number { aNumber.Zero(); } } return ETrue; } return EFalse; }
EXPORT_C TInt TFsPluginRequest::FileName(TDes& aName) { //Special handling required for directories. switch(Function()) { case EFsDirOpen: case EFsSetEntry: { aName.Copy(Request()->Src().FullName()); break; } case EFsDirReadOne: case EFsDirReadPacked: case EFsDirSubClose: { //Get the name from CDirCB::iName CDirCB* dir = (CDirCB*) ScratchValue(); __ASSERT_ALWAYS(dir!= NULL, Fault(EPluginOpError)); TName name = dir->Name(); if(name.Size() == 0) { return KErrNotFound; } aName.Copy(name); break; } default: { CFileShare* share; TInt err = ShareFromClientHandle(share); if(err != KErrNone || share == NULL) return(err); NameFromShare(*share, aName); } } return KErrNone; }
void GetTimeString(TTime t, TDes& aBuf) { TBuf<5> time; TTime now; now=GetTime(); if ((now.DateTime().Year()==t.DateTime().Year()) && (now.DateTime().Month()==t.DateTime().Month()) && (now.DateTime().Day()==t.DateTime().Day()) ) { t.FormatL(time, _L("%F%H:%T")); } else { t.FormatL(time, _L("%F%D/%M")); } aBuf.Copy(time); }
TBool TAzenqosEngineUtils::AskTestDescription(TInt rscid, TDes& descr) { //descr.Zero(); CAknTextQueryDialog* cldlg; cldlg = new (ELeave) CAknTextQueryDialog(descr); cldlg->PrepareLC( rscid ); if(!(cldlg->RunLD())) { return EFalse; } descr.TrimAll(); if(descr.Length()==0) { _LIT(emsg,"Test description not entered"); CAknErrorNote* informationNote = new (ELeave) CAknErrorNote(ETrue); informationNote->ExecuteLD(emsg); return EFalse; } return ETrue; }
/** Utility function for obtaining info on file close requests. @param aRequest File close request @param aPath The path of the file @return KErrNone */ LOCAL_C TInt FileCloseVars(CFsRequest* aRequest, TDes& aFileName) { __ASSERT_ALWAYS(aRequest->Operation()->Function()==EFsFileSubClose,Fault(EBaseRequestMessage)); const TDes* fileName=(TDes*) I64HIGH(aRequest->ScratchValue64()); if(fileName == NULL) return(KErrBadName); aFileName = _L("?:"); aFileName[0] = TText('A' + aRequest->DriveNumber()); aFileName.Append(*fileName); return(KErrNone); }
TInt CSecMgrStore::GetScriptFile(TDes& aFile, TExecutableID aExecID) { TInt ret(GetScriptPath (aFile)); if ( (KErrNone==ret) || (KErrAlreadyExists==ret)) { if ( KAnonymousScript!=aExecID) { HBufC *fSuffix = HBufC::NewLC(KMaxName); TPtr fSuffixPtr(fSuffix->Des()); fSuffixPtr.Num (aExecID); aFile.Append (fSuffixPtr); aFile.Append (KDatExtn); CleanupStack::PopAndDestroy (fSuffix); } } if ( KErrAlreadyExists==ret) ret=KErrNone; return ret; }
EXPORT_C void TextUtils::ClipToFit(TDes& aBuffer,const CFont& aFont,TInt aMaxWidthInPixels,TChar aAlternativeEnd) /** Clips text to fit into a maximum width. If the text is too wide to fit in the width when displayed in aFont, it is truncated and the specified character (by default, a horizontal ellipsis) is appended to it. @param aBuffer A buffer containing the text to clip. @param aFont The font. @param aMaxWidthInPixels The maximum width in pixels. @param aAlternativeEnd The Unicode character to append to the buffer if truncated. By default, this is the horizontal ellipsis. */ { TInt textWidth=aFont.TextWidthInPixels(aBuffer); if (textWidth<=aMaxWidthInPixels) return; TBuf<1> ellipse; ellipse.Append(aAlternativeEnd); TInt extraWidth=aFont.TextWidthInPixels(ellipse); TInt cutOff=aFont.TextCount(aBuffer,aMaxWidthInPixels-extraWidth); aBuffer.SetLength(cutOff); aBuffer.Append(ellipse); }
// --------------------------------------------------------------------------- // If aDevExt contains a valid friendly name, the friendly name will be displayed; // Otherwise, if the given name from the parameter of a notifier request is valid, // the given name will be displayed; // Otherwise, If aDevExt contains a valid device name, the name will be displayed; // Otherwise, the a name will be created by this function. // --------------------------------------------------------------------------- // void TBTNotifUtil::GetDeviceUiNameL( TDes& aNameBuf, const CBtDevExtension* aDevExt, const TDesC& aNameInParam, const TBTDevAddr& aAddr) { CBtDevExtension* tempDev( NULL ); TPtrC namePtr; if ( aDevExt && aDevExt->Device().IsValidFriendlyName() && aDevExt->Device().FriendlyName().Length() != 0 ) { // We always use the friendly name regardless of // the device-name of the device is available or not. namePtr.Set( aDevExt->Device().FriendlyName() ); } else { // this will take care of name formating. Either the // name from iNameInParam or the address will be // the alias: tempDev = CBtDevExtension::NewLC( aAddr, aNameInParam ); namePtr.Set( tempDev->Alias() ); } // Make sure no overflow: if ( aNameBuf.MaxLength() < namePtr.Length() ) { aNameBuf.Copy( namePtr.Left( aNameBuf.MaxLength() ) ); } else { aNameBuf.Copy( namePtr ); } if ( tempDev ) { CleanupStack::PopAndDestroy( tempDev ); } }
void CSCOMOAdapterDb::PrepareLuidQuery(TInt aLuid, TDes& aSqlQuery) { aSqlQuery.Copy(_L("SELECT * FROM ")); aSqlQuery.Append(KTableAMMgmtObject); aSqlQuery.Append(_L(" WHERE ")); aSqlQuery.Append(NCol2); aSqlQuery.Append(_L(" = ")); aSqlQuery.AppendNum(aLuid); }
void GetAppPath(TDes& aAppPath) { #if defined ( EKA2 ) User::LeaveIfError(CEikonEnv::Static()->FsSession().PrivatePath(aAppPath)); // insert the drive to the private path TParsePtrC parse((CEikonEnv::Static()->EikAppUi()->Application())->AppFullName()); aAppPath.Insert(0, parse.Drive()); #else CompleteWithAppPath(aAppPath); #endif #ifdef __WINS__ aAppPath[0] = 'c'; #endif }
/** The method parses aFileName argument and constructs the full database file name (including the path) there. The full file name will be constructed in aFileName input/output argument. @param aDbFileName Input/Output. Database file name will be constructed there. @param aSysDrivePrivatePath SQL server private path on the system drive. @param aDrive Output parameter. The drive number. @leave KErrBadName Missing file name. @panic SqlDb 7 In _DEBUG mode - no drive in the final file path. @internalComponent */ static void DoFullFileNameL(TDes& aDbFileName, const TDesC& aSysDrivePrivatePath, TDriveNumber& aDrive) { TParse parse; __SQLLEAVE_IF_ERROR2(parse.Set(aDbFileName, &aSysDrivePrivatePath, NULL)); if(!parse.NamePresent()) { __SQLLEAVE2(KErrBadName); } aDbFileName.Copy(parse.FullName()); TPtrC driveName = parse.Drive(); __ASSERT_DEBUG(driveName.Length() > 0, __SQLPANIC2(ESqlPanicInternalError)); TInt driveNumber = -1; __SQLLEAVE_IF_ERROR2(RFs::CharToDrive(driveName[0], driveNumber)); aDrive = static_cast <TDriveNumber> (driveNumber); }
/** Copy a maximum of KTextFieldMinimalLength characters from aSrc to aDest. @param aSrc Source text buffer. @param aDest Destination text buffer. @return ETrue if copy was successfull, EFalse otherwise. */ TBool TCntPersistenceUtility::CopyMinFieldText(TPtrC aSrc,TDes& aDest) { TBool ret(EFalse); if(aSrc.Length() > 0) { TInt length = aSrc.Length(); if (length>KTextFieldMinimalLength) { length=KTextFieldMinimalLength; } aDest.Copy(aSrc.Left(length)); ret = ETrue; } return ret; }
void DegAndMinutesToGeo(const TDesC& aMin, TDes& aInto, TInt aSign) { aInto.Zero(); if (aMin.Compare(_L("0000.0000"))==0 || aMin.Compare(_L("00000.0000"))==0 || aMin.Length()<3) { return; } TInt decpos=aMin.Locate('.'); if (decpos==KErrNotFound || decpos<3) return; TReal deg, min; { TLex lex(aMin.Left(decpos-2)); if (lex.Val(deg)!=KErrNone) { return; } } { TLex lex(aMin.Mid(decpos-2)); if (lex.Val(min)!=KErrNone) { return; } if (deg==TReal(0) && min==TReal(0)) return; min/=TReal(60); } deg+=min; if (deg > TReal(180)) return; deg*=aSign; TRealFormat fmt; fmt.iTriLen=0; fmt.iPoint='.'; fmt.iPlaces=8; fmt.iType=KRealFormatCalculator; aInto.Num(deg, fmt); }
TInt CSecMgrStore::GetConfigFile(TDes& aConfigFile) { TInt ret(KErrNone); aConfigFile.Append (KCDrive); HBufC *privateDir = HBufC::NewLC(KMaxName); TPtr ptr(privateDir->Des()); ret = iFsSession.PrivatePath (ptr); if ( KErrNone==ret) { aConfigFile.Append (ptr); ret = iFsSession.MkDirAll (ptr); if ( KErrAlreadyExists==ret) ret=KErrNone; aConfigFile.Append (KConfigFile); } CleanupStack::PopAndDestroy (privateDir); return ret; }
TInt CTestAgentDrmContent::GetStringAttribute(TInt aAttribute, TDes& aValue) { TInt err = KErrNone; switch(aAttribute) { // the content object case ContentAccess::EMimeType: aValue.Copy(*iContentMimeType); break; default: err = KErrCANotSupported; break; }; return err; }
/* ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- */ void CYuccaNavi::GetTextL(TDes& aText) { if(iNaviDecorator) { if(iNaviDecorator->DecoratedControl()) { CAknNaviLabel* Tmp = STATIC_CAST(CAknNaviLabel*, iNaviDecorator->DecoratedControl()); const TDesC* Texksti = Tmp->Text(); if(Texksti) { aText.Copy(*Texksti); } } }
EXPORT_C void CTestUtils::AppendText(const TDesC& aToken, TDes& aTxt, TInt aMaxTokenLength) { TInt totalLen = aTxt.Length() + aMaxTokenLength; aTxt.Append(aToken); aTxt.TrimRight(); if (aTxt.Length() < totalLen) { aTxt.AppendFill(' ', totalLen - aTxt.Length()); } aTxt.SetLength(totalLen); }
// ========================================================================== // METHOD: Constructor // // DESIGN: // ========================================================================== CLogFileHandler::CLogFileHandler( RFs& aFs, TDes& aFormatBuffer, TDes8& aOutputBuffer, const TDesC& aDirectoryName, const TDesC& aFileName ) : iFs( aFs ), iFormatBuffer( aFormatBuffer ), iFormatBuffer8( const_cast<TUint8*>(reinterpret_cast<const TUint8*>(aFormatBuffer.Ptr())), 0, aFormatBuffer.MaxLength()*2 ), iOutputBuffer( aOutputBuffer ), iDirectoryName( aDirectoryName ), iFileName( aFileName ), iTryToOpenFile( ETrue ), iFileIsOpen( EFalse ), iFirstTime( ETrue ) { } // END CLogFileHandler
//Get DSC database name void CDscDatabase::GetDatabaseNameL(TDes& aDatabaseName) { RFs fs; CleanupClosePushL(fs); User::LeaveIfError(fs.Connect()); // retrieve system drive TDriveNumber driveNumber = fs.GetSystemDrive(); // convert to char TChar driveChar; User::LeaveIfError(RFs::DriveToChar(driveNumber, driveChar)); aDatabaseName.Format(KDatabaseName, (TUint)driveChar); CleanupStack::PopAndDestroy(&fs); }
// --------------------------------------------------------------------------- // CMmPacketContextList::GenerateNewContextName // This function generates new proxy id and context name. // (other items were commented in a header). // --------------------------------------------------------------------------- // TInt CMmPacketContextList::GenerateNewContextName( TDes& aNewName, //name of the context TUint8& aProxyId ) //proxy id of the context { TInt ret( KErrOverflow ); // Find first free proxy id from the list for ( TInt i = 0; i < KMmMaxNumberOfContexts; i++ ) { if ( iProxyIdList[i].iIsFree ) { // Set proxy id to the iChannelId aProxyId = ( TUint8 )iProxyIdList[i].iChannelId; aNewName.Zero(); TInfoName contextName; do { contextName.Zero(); // Make sure number to add is between 100 and 255 (TUint8) if ( 100 > iIndividualNameForContext ) { iIndividualNameForContext = 100; } contextName.AppendNum( ( TInt )iIndividualNameForContext++ ); // Internally created context name _LIT( KContextNameInt, "Int_" ); contextName.Append( KContextNameInt ); contextName.AppendNum( ( TInt )aProxyId ); } while ( NULL != CMmPacketContextList::PacketContextByName( &contextName ) ); aNewName = contextName; // Proxy id selected, set ret to KErrNone ret = KErrNone; i = KMmMaxNumberOfContexts; } } return ret; }
/* ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- */ void CSMSSender::PopulateMessageL(TMsvEntry& aMsvEntry,TDes& aDescription,TDes& aDetails) { ASSERT(iMtm); // We get the message body from Mtm and insert a bodytext CRichText& mtmBody = iMtm->Body(); mtmBody.Reset(); mtmBody.InsertL(0, iMessage); // insert our msg tag as the body text if(iDescription) { if(iDescription->Des().Length() > 30) aDescription.Copy(iDescription->Des().Left(30)); else aDescription.Copy(iDescription->Des()); } else { if(iMessage.Length() > 30) aDescription.Copy(iMessage.Left(30)); else aDescription.Copy(iMessage); } if(iDetails) { if(iDetails->Des().Length() > 30) aDetails.Copy(iDetails->Des().Left(30)); else aDetails.Copy(iDetails->Des()); } else { if(iRecipients.Length() > 30) aDetails.Copy(iRecipients.Left(30)); else aDetails.Copy(iRecipients); } aMsvEntry.SetInPreparation(EFalse); aMsvEntry.SetScheduled(EFalse); aMsvEntry.iDate.UniversalTime(); aMsvEntry.SetSendingState(KMsvSendStateWaiting); }
// ----------------------------------------------------------------------------- // RPhCltUssd::StartSAT // // Starts SAT interaction. // ----------------------------------------------------------------------------- // void RPhCltUssd::StartSAT( TRequestStatus& aStatus , TDes& aReceiveMessage, TPckg< TUint >& aShowNotesAndDcs ) { __ASSERT_ALWAYS( SubSessionHandle() , User::Panic( KPhClientPanicCategory , KErrBadHandle ) ); SendReceive( EPhoneServerUSSDSubSessionStartSAT, TIpcArgs( &aShowNotesAndDcs, aReceiveMessage.MaxLength(), &aReceiveMessage ), aStatus ); }
inline void CVicinityFeedContainer::GetDistance(TUint aDistance, TDes &aText) { isab::DistancePrintingPolicy::DistanceMode mode = isab::DistancePrintingPolicy::DistanceMode(iView->GetDistanceMode()); // Get the formated string with the correct metrics unit char* tmp = isab:: DistancePrintingPolicy::convertDistance(aDistance, mode, isab::DistancePrintingPolicy::Round); if (tmp) { WFTextUtil::char2TDes(aText, tmp); delete[] tmp; } else { aText.Copy(_L(" ")); } }
void CHttpCacheManager::GetOperatorCacheConfigL( CRepository& aRepository, TBool& aOpCacheEnabled, TInt& aOpCacheSize, TDes& aOpCacheFolder ) { // Operator Cache aOpCacheEnabled = FeatureManager::FeatureSupported(KFeatureIdOperatorCache); if( aOpCacheEnabled ) { TInt tempOpCacheSize; if( aRepository.Get(KOperatorCacheSize, tempOpCacheSize) == KErrNone ) aOpCacheSize = tempOpCacheSize; // op cache folder TFileName tempOpCacheFolder; if( aRepository.Get(KOperatorCacheFolder, tempOpCacheFolder) == KErrNone ) aOpCacheFolder.Copy( tempOpCacheFolder ); } HttpCacheUtil::EnsureTrailingSlash( aOpCacheFolder ); }
/* ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- */ void CMainContainer::GetValuesL(CDictionaryFileStore* aDStore,TInt aUID,TDes& aValue) { aValue.Zero(); if(aDStore == NULL) return; TUid FileUid = {0x10}; FileUid.iUid = aUID; if(aDStore->IsPresentL(FileUid)) { RDictionaryReadStream in; in.OpenLC(*aDStore,FileUid); in >> aValue; CleanupStack::PopAndDestroy(1);// in }
// --------------------------------------------------------------------------- // CAppMngr2Log::SetLogActionTextColumnL() // --------------------------------------------------------------------------- // void CAppMngr2Log::SetLogActionTextColumnL( TDes& aListboxLine, const SwiUI::TLogTaskAction& aAction ) { TBuf<KInstActionTextLength> action; switch( aAction ) { case SwiUI::ELogTaskActionInstall: iEikEnv.ReadResourceL( action, R_INST_INSTALL_EVENT ); break; case SwiUI::ELogTaskActionUninstall: iEikEnv.ReadResourceL( action, R_INST_REMOVE_EVENT ); break; // no action for R_INST_PARTIAL_INSTALL_EVENT, not supported default: break; } aListboxLine.Append( action ); }
/* if no length is specified, the whole string is converted */ int ConvertUTF8ToUnicode(const unsigned char* aText, TDes& aDesc, int aLength) { if ( aText == NULL ) { return 0; } /* create a UTF8 descriptor from the character data */ int descLength = ( aLength > 0 ) ? aLength : strlen( (const char*)aText ); TPtrC8 UTFBuf(NULL, 0); /* Set the buffer again. Peter says that the constructors do not work */ UTFBuf.Set( aText, descLength); /* do the conversion */ int numleft = CnvUtfConverter::ConvertToUnicodeFromUtf8(aDesc, UTFBuf); /* calculate and return the actual number of characters converted */ return(aDesc.Length() - numleft); }
/* ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- */ void CImeiSettings::GetDataL(TDes8& aType,TDes8& aData,TDes& aExtension,TInt& aId) { aId = iId; aData.Zero(); if(iListBox) { iListBox->StoreSettingsL(); TFileName Hjelpper; Hjelpper.Copy(iListBox->iType); Hjelpper.Append(_L("/")); Hjelpper.Append(iListBox->iTypeId); aType.Copy(Hjelpper); aExtension.Copy(iListBox->iExtension); } }
void CHttpCacheManager::GetVSSCacheConfigL( CRepository& aRepository, TBool& aVSSCacheEnabled, TInt& aVssCacheSize, TDes& aVssCacheFolder ) { // VSS Cache TInt VSScacheEnabled(0); TInt err = aRepository.Get(KPhoneSpecificCacheEnabled, VSScacheEnabled); aVSSCacheEnabled = VSScacheEnabled; if ( err == KErrNone && aVSSCacheEnabled ) { TInt tempVSSCacheSize; if( aRepository.Get(KPhoneSpecificCacheSize, tempVSSCacheSize) == KErrNone ) aVssCacheSize = tempVSSCacheSize; TFileName tempVSScacheFolder; if( aRepository.Get(KPhoneSpecificCacheFolder, tempVSScacheFolder) == KErrNone ) aVssCacheFolder.Copy( tempVSScacheFolder ); } HttpCacheUtil::EnsureTrailingSlash( aVssCacheFolder ); }