TBool LaunchWapBrowserUtil::LaunchWapBrowser(const TDesC& aUrl) { #if defined NAV2_CLIENT_SERIES60_V2 || defined NAV2_CLIENT_SERIES60_V3 TInt urlLen = aUrl.Length(); HBufC* fixedUrl; if (KFourHttpString().Compare(aUrl.Left(KFourHttpString().Length()))) { /* Not 4 http:// at the beginning. */ if (KHttpString().Compare(aUrl.Left(KHttpString().Length()))) { /* Not http:// at the beginning. */ urlLen += KFourHttpString().Length() + 1; fixedUrl = HBufC::NewLC(urlLen); fixedUrl->Des().Copy(KFourHttpString); } else { urlLen += KFourString().Length() + 1; fixedUrl = HBufC::NewLC(urlLen); fixedUrl->Des().Copy(KFourString); } fixedUrl->Des().Append(aUrl); } else { fixedUrl = aUrl.AllocLC(); } RApaLsSession aApaLsSession; TUid id( KPhoneUidWmlBrowser ); TApaTaskList taskList( CEikonEnv::Static()->WsSession() ); TApaTask task = taskList.FindApp( id ); if ( task.Exists() ) { HBufC8* param8 = HBufC8::NewLC( fixedUrl->Length() ); param8->Des().Append( *fixedUrl ); task.SendMessage( TUid::Uid( 0 ), *param8 ); // UID is not used CleanupStack::PopAndDestroy( param8 ); } else { if ( !aApaLsSession.Handle() ) { User::LeaveIfError( aApaLsSession.Connect() ); } TThreadId thread; User::LeaveIfError( aApaLsSession.StartDocument( *fixedUrl, KPhoneUidWmlBrowser, thread ) ); } CleanupStack::PopAndDestroy(fixedUrl); aApaLsSession.Close(); #elif defined NAV2_CLIENT_SERIES60_V1 return EFalse; #else # error This code not implemented! #endif return ETrue; }
void CParsedFieldCollection::GetTBoolL(const TDesC& aDes, TBool& aBool) const { __ASSERT_DEBUG(aDes.Length() > 0 ,User::Panic(KIACP,EIacpEmptyBuffer)); if ((aDes.Left(1).CompareF(KIacpLowerT)==0) || (aDes.Left(1).CompareF(KIacpLowerY)==0)) aBool= ETrue; else if ((aDes.Left(1).CompareF(KIacpLowerF)==0) || (aDes.Left(1).CompareF(KIacpLowerN)==0)) aBool= EFalse; else User::Leave(KIacpErrRightToken); }
/** Set the drive on which to store the attachment */ EXPORT_C void CAgnAttachmentFile::SetDriveL(const TDesC& aDrive) { if ( ! iFileName || iFileName->Length() <= KMaxDriveName) { SetFileNameL(aDrive.Left(KMaxDriveName)); } else { if (iFileName->Left(1) != aDrive.Left(1)) { TPtr ptr(iFileName->Des()); ptr.Replace(0, aDrive.Length(), aDrive); } } }
/** Utility method used to construct physical path for a given file name @param aPhysicalFileName in/out paramter; file name to which physical path will be append @param aSecuredFileName secured file name */ void CPplContactsFile::GetPhysicalPathL(TDes& aPhysicalFileName, const TDesC& aSecuredFileName) { const TUint16 KDriveDelimiter = ':'; // Check for the drive delimiter. __ASSERT_ALWAYS(aSecuredFileName.Length() > 2 && aSecuredFileName[1] == KDriveDelimiter, User::Leave(KErrBadName)); // Check for malformed file name (path included explicitly). __ASSERT_ALWAYS(aSecuredFileName.Locate('\\') == KErrNotFound, User::Leave(KErrBadName)); // Get the private path from the file session. const TInt KMaxPrivatePathLength = 32; TBuf<KMaxPrivatePathLength> privatePath; LocalFsL(); iLocalFs.PrivatePath(privatePath); aPhysicalFileName = aSecuredFileName.Left(KDriveNameWidth); // Set current drive. iDatabaseDrive = aPhysicalFileName; aPhysicalFileName.Append(privatePath); // Make sure private path exists. TInt err = iLocalFs.MkDirAll(aPhysicalFileName); if (err != KErrNone && err != KErrAlreadyExists) { User::Leave(err); } }
TInt RConsoleProxy::DoConnect(TServerParams* aParams, const TDesC& aThreadNameBase, TInt aStackSize, TInt aHeapMinSize, TInt aHeapMaxSize, RServer2& aServer, RThread& aServerThread) { TName threadName; RThread server; TInt threadId = 0; _LIT(KThreadIdFmt, "%08x"); TInt err; do { threadName = aThreadNameBase.Left(threadName.MaxLength()-8); threadName.AppendFormat(KThreadIdFmt, threadId); err = server.Create(threadName, &ServerThreadFunction, aStackSize, aHeapMinSize, aHeapMaxSize, aParams); ++threadId; } while (err==KErrAlreadyExists); if (err!=KErrNone) return err; TRequestStatus rendezvous; server.Rendezvous(rendezvous); if (rendezvous == KRequestPending) { server.Resume(); } User::WaitForRequest(rendezvous); err = rendezvous.Int(); if (server.ExitType() != EExitPending && err >= 0) err = KErrDied; if (err==KErrNone) { err = Connect(aParams->iServer); } aServer = aParams->iServer; aServerThread = server; return err; }
// ----------------------------------------------------------------------------- // CProfileExtraTonesImpl::SetClockAlarmToneL // // (other items were commented in a header). // ----------------------------------------------------------------------------- // void CProfileExtraTonesImpl::SetClockAlarmToneL( const TDesC& aClockAlarmTone ) { HBufC* tmp = aClockAlarmTone.Left( KMaxFileName ).AllocL(); delete iClockAlarmTone; iClockAlarmTone = tmp; }
// ----------------------------------------------------------------------------- // Implements checking if a given MIME type is supported or not // ----------------------------------------------------------------------------- // TBool CAknsWallpaperPlugin::IsMimeTypeSupportedL(const TDesC& aMimeTypeString) { // Check for a type separator in the string TInt pos = aMimeTypeString.Find(KAknsWallpaperPluginSeparator); // Leave if no separator was found.. the MIME // standard requires it if (pos == KErrNotFound) { User::Leave(KErrArgument); } // Copy the full Mime type string (needed for uppercase) HBufC* fullBuf = aMimeTypeString.AllocLC(); TPtr fullString = fullBuf->Des(); fullString.UpperCase(); // Construct the compare string TPtrC compareString(aMimeTypeString.Left(pos)); // Perform the comparison TBool ret = EFalse; // Mime type case: IMAGE/* except IMAGE/X-OTA-BITMAP if (compareString.CompareF(KAknsWallpaperPluginMimeTypeImage) == 0 && !(fullString.CompareF(KAknsWallpaperPluginMimeTypeOTABitmap) == 0)) { ret = ETrue; } CleanupStack::PopAndDestroy(fullBuf); return ret; }
EXPORT_C void TConsoleLine::Replace(TInt aFrom, const TDesC& aDes) { // a) Hide the cursor. // b) Move the cursor to aFrom. // c) Overwrite chars up to iBufPos. // d) Insert remaining chars (if any). // e) Make the cursor visible again. aFrom += iPromptLength; ASSERT(iBufPos >= aFrom); iConsole.SetCursorVisible(EFalse); iConsole.SetCursorPosAbs(iConsole.PosFrom(iStartPos, aFrom)); const TInt desLength = aDes.Length(); const TInt numOverwriteChars = iBufPos - aFrom; TInt lengthAdjust = 0; if (numOverwriteChars > 0) { iBuf.Replace(aFrom, numOverwriteChars, aDes.Left(numOverwriteChars)); if (desLength < numOverwriteChars) { lengthAdjust = numOverwriteChars - desLength; iBuf.AppendFill(' ', lengthAdjust); iBufPos -= lengthAdjust; } } const TInt numInsertChars = desLength - numOverwriteChars; if (numInsertChars > 0) { iBuf.Insert(iBufPos, aDes.Mid(numOverwriteChars)); iBufPos += numInsertChars; } iConsole.Write(iBuf.Mid(aFrom)); iBuf.SetLength(iBuf.Length() - lengthAdjust); iConsole.SetCursorPosAbs(iConsole.PosFrom(iStartPos, aFrom + aDes.Length())); iConsole.SetCursorVisible(ETrue); }
TBool CT_DataRGavdp::ConvertSEIDs(TDesC &aSEIDsStr, RArray<TUint>& aSEIDs) { TBool ret = ETrue; TLex lex(aSEIDsStr); TInt tempSEID; if (lex.Val(tempSEID) == KErrNone) { aSEIDs.Append(tempSEID); } else { TInt location = aSEIDsStr.Match(_L("*,*")); if( location != KErrNotFound ) { //Converting Left part of the data TPtrC tempStr = aSEIDsStr.Left(location); ret = ConvertSEIDs(tempStr, aSEIDs); if(ret) { //Converting right data can be with another "," tempStr.Set(aSEIDsStr.Mid(location + 1)); ret = ConvertSEIDs(tempStr, aSEIDs); } } else { ret = EFalse; } } return ret; }
// --------------------------------------------------------- // CPosLmLocalDatabaseManager::DatabaseDrive // // (other items were commented in a header). // --------------------------------------------------------- // TChar CPosLmLocalDatabaseManager::DatabaseDrive( const TDesC& aDatabaseUri) { TChar sysDriveChar = RFs::GetSystemDriveChar(); // if protocol delimiter present, // verify that URI starts with "file://" TInt offset = aDatabaseUri.Find(KProtocolDelimiter); if (offset != KErrNotFound && aDatabaseUri.Left(offset) != KFileProtocol) { // wrong protocol return 0; } // adjust offset depending on whether or not protocol is present offset = offset == KErrNotFound ? 0 : KFileProtocol().Length() + KProtocolDelimiter().Length(); if (aDatabaseUri.Length() < offset + KDriveAndDelimiterLength) { return 0; } // if second character is ":", return first character // otherwise return default drive if (aDatabaseUri[offset + 1] == KDriveDelimiter) { return TChar(aDatabaseUri[offset]).GetUpperCase(); } return sysDriveChar; }
// ----------------------------------------------------------------------------- // CProfileExtraTonesImpl::SetIMMessageAlertToneL // // (other items were commented in a header). // ----------------------------------------------------------------------------- // void CProfileExtraTonesImpl::SetIMMessageAlertToneL( const TDesC& aIMMessageAlertTone ) { HBufC* tmp = aIMMessageAlertTone.Left( KMaxFileName ).AllocL(); delete iIMMessageAlertTone; iIMMessageAlertTone = tmp; }
//---------------------------------------------------------------------------- // PhSrvDebugInfo::Print //---------------------------------------------------------------------------- // void PhSrvDebugInfo::Print(TInt/* aArea*/,const TDesC& aText ) { // LOG TO FILE #ifdef __PHSRV_DEBUG_WRITE_LOG__ TBuf8<128> toFile; CnvUtfConverter::ConvertFromUnicodeToUtf8( toFile, aText.Left(126) ); toFile.Append( KPhSrvDebugEOF ); PhSrvDebugInfo::CPhSrvDebugData* data = NULL; if( !data ) { data = CreateData(); } if( data ) { data->CreateFile(); data->WriteFile( toFile ); } #endif // __PHSRV_DEBUG_WRITE_LOG__ #ifdef __PHSRV_PRINT_DEBUG_INFO__ RDebug::Print( aText ); #endif // __PHSRV_PRINT_DEBUG_INFO__ // } // } }
int TcpipComm::Open(CConsoleBase *cons, TDes &name, TDesC &destination, TRequestStatus &st) { int r; TInetAddr addr; TPtrC servername; int port = 0; if((r = iServ.Connect()) != KErrNone) return r; if((r = iSock.Open(iServ,KAfInet,KSockStream,KProtocolInetTcp)) != KErrNone) return r; ////////////// // Parse the destination, which is of the form ip.adress:port for(r = 0; r < destination.Length(); r++) if(destination[r] == ':') break; servername.Set(destination.Left(r)); // Wont include ':' TLex parser(destination.Mid(r+1)); parser.Val(port); addr.SetPort(port); if(addr.Input(servername) != KErrNone) // Its a real hostname, wont resolv return 1; iSock.Connect(addr, st); TPckgBuf<int> one(1); iSock.SetOpt(KSoTcpNoDelay, KSolInetTcp, one); return 0; }
TInt CFileOperate::WriteFileL(const TDesC& aFileName) { int pos = aFileName.LocateReverse( '\\'); if (pos!=KErrNotFound) { TPtrC dirName = aFileName.Left(pos+1); CCoeEnv::Static()->FsSession().MkDirAll(dirName); } RFile file; TInt err = file.Replace(CCoeEnv::Static()->FsSession(), aFileName, EFileWrite); CleanupClosePushL(file); if (KErrNone != err) { CleanupStack::PopAndDestroy(1); // file return err; } RFileWriteStream outputFileStream(file); CleanupClosePushL(outputFileStream); iNotifier->FileWriteData(outputFileStream); CleanupStack::PopAndDestroy(2); // outputFileStream, file return KErrNone; }
TBool CTupleStoreImpl::FirstL(TTupleType aTupleType, const TTupleName& aTupleName, const TDesC& aSubName, TBool aExact) { CALLSTACKITEM_N(_CL("CTupleStoreImpl"), _CL("FirstL")); iCurrentSearchMode=ETuple; iCurrentSearchType=aTupleType; iCurrentSearchTuple=aTupleName; iCurrentSearchSubName=aSubName; TDbSeekMultiKey<4> rk; rk.Add(aTupleType); if (aTupleName.iModule!=KBBAnyUid) { rk.Add((TInt)aTupleName.iModule.iUid); if (aTupleName.iId != KBBAnyId) { rk.Add(aTupleName.iId); if (aSubName.Length()>0 || aExact) { rk.Add(aSubName.Left(iSubNameIndexLength)); } } } SwitchIndexL(EIndexTuple); TBool ret=EFalse; ret=iTable.SeekL(rk); if (!ret) return EFalse; TPartialMatch m=MatchesL(aTupleType, aTupleName, aSubName); while (m==EMatchPartial) { if (!iTable.NextL()) return EFalse; m=MatchesL(aTupleType, aTupleName, aSubName); } if (m>EMatchPartial) return ETrue; return EFalse; }
// ----------------------------------------------------------------------------- // CProfileExtraTonesImpl::SetEmailAlertToneL // // (other items were commented in a header). // ----------------------------------------------------------------------------- // void CProfileExtraTonesImpl::SetEmailAlertToneL( const TDesC& aEmailAlertTone ) { HBufC* tmp = aEmailAlertTone.Left( KMaxFileName ).AllocL(); delete iEmailAlertTone; iEmailAlertTone = tmp; }
// ----------------------------------------------------------------------------- // CProfileExtraTonesImpl::SetVideoCallRingingToneL // // (other items were commented in a header). // ----------------------------------------------------------------------------- // void CProfileExtraTonesImpl::SetVideoCallRingingToneL( const TDesC& aRingingTone ) { HBufC* tmp = aRingingTone.Left( KMaxFileName ).AllocL(); delete iVideoCallRingingTone; iVideoCallRingingTone = tmp; }
// ----------------------------------------------------------------------------- // CProfileExtraTonesImpl::SetReminderToneL // // (other items were commented in a header). // ----------------------------------------------------------------------------- // void CProfileExtraTonesImpl::SetReminderToneL( const TDesC& aReminderTone ) { HBufC* tmp = aReminderTone.Left( KMaxFileName ).AllocL(); delete iReminderTone; iReminderTone = tmp; }
void CTangImageDataWriter::SaveDataToFile(const TDesC& aFileName) { GenerateElementsData(); int pos = aFileName.LocateReverse( '\\'); if (pos!=KErrNotFound) { TPtrC dirName = aFileName.Left(pos+1); CCoeEnv::Static()->FsSession().MkDirAll(dirName); } RFile file; TInt err = file.Replace(CCoeEnv::Static()->FsSession(), aFileName, EFileWrite); CleanupClosePushL(file); if (KErrNone != err) { CleanupStack::PopAndDestroy(1); // file return; } RFileWriteStream outputFileStream(file); CleanupClosePushL(outputFileStream); outputFileStream.WriteL(iRequestXml->Des()); CleanupStack::PopAndDestroy(2); // outputFileStream, file }
/* ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- */ void CFakeSMSSender::AppendPDUDataL(TMsvId aEntryId, const TDesC& aRecipient,TBool aUnicodeMsg,const TDesC& aBody) { CMsvEntry* entry = iMsvSession->GetEntryL(aEntryId); CleanupStack::PushL(entry); CMsvStore* srore= entry->EditStoreL(); CleanupStack::PushL(srore); if(srore) { CSmsBuffer* smsBuffer = CSmsBuffer::NewL(); CSmsMessage* smsMsg = CSmsMessage::NewL(iFsSession,CSmsPDU::ESmsDeliver, smsBuffer); CleanupStack::PushL(smsMsg); smsMsg->SetTime(entry->Entry().iDate); if(aRecipient.Length() > 20) smsMsg->SetToFromAddressL(aRecipient.Left(20)); else smsMsg->SetToFromAddressL(aRecipient); smsBuffer->InsertL(0,aBody); CSmsDeliver& DSMSPDU = STATIC_CAST(CSmsDeliver&,smsMsg->SmsPDU()); DSMSPDU.SetMoreMessagesToSend(EFalse); DSMSPDU.SetReplyPath(EFalse); DSMSPDU.SetStatusReportIndication(EFalse); TInt Hours(0x20); DSMSPDU.SetServiceCenterTimeStamp(entry->Entry().iDate,Hours); DSMSPDU.SetTextCompressed(EFalse); DSMSPDU.SetPIDType(TSmsProtocolIdentifier::ESmsPIDShortMessageType); //DSMSPDU.SetTextCompressed(TBool aCompressed); //DSMSPDU.SetAlphabet(TSmsDataCodingScheme::TSmsAlphabet aAlphabet); CSmsHeader* MyHeader = CSmsHeader::NewL(smsMsg); CleanupStack::Pop(1);//smsMsg CleanupStack::PushL(MyHeader); CSmsSettings* MySetting = CSmsSettings::NewL(); CleanupStack::PushL(MySetting); if(aUnicodeMsg) MySetting->SetCharacterSet(TSmsDataCodingScheme::ESmsAlphabetUCS2); else MySetting->SetCharacterSet(TSmsDataCodingScheme::ESmsAlphabet7Bit); //MySetting->StoreL(*srore);//InternalizeL MyHeader->SetSmsSettingsL(*MySetting); MyHeader->StoreL(*srore); srore->CommitL(); CleanupStack::PopAndDestroy(2);//MySetting,MyHeader, } CleanupStack::PopAndDestroy(2);//entry,srore }
TUint CTupleStoreImpl::PutL(TTupleType aTupleType, const TTupleName& aTupleName, const TDesC& aSubName, const TComponentName& aComponent, const TDesC8& aSerializedData, TBBPriority aPriority, TBool aReplace, const TTime& aLeaseExpires, TBool aKeepExisting) { CALLSTACKITEM_N(_CL("CTupleStoreImpl"), _CL("PutL")); if (aTupleName.iModule.iUid == KBBAnyUidValue || aTupleName.iId == KBBAnyId || aComponent.iModule.iUid == KBBAnyUidValue || aComponent.iId == KBBAnyId) User::Leave(KErrArgument); TUint ret; { TAutomaticTransactionHolder ath(*this); TBool exists=SeekNameL(aTupleType, aTupleName, aSubName); if (exists && aKeepExisting) { UpdateL(); iTable.SetColL(ELeaseExpires, aLeaseExpires); MDBStore::PutL(); return 0; } else if (exists && aReplace) { UpdateL(); } else { InsertL(); iTable.SetColL(ETupleType, aTupleType); iTable.SetColL(ENameModule, aTupleName.iModule.iUid); iTable.SetColL(ENameId, aTupleName.iId); iTable.SetColL(ENameSubName1, aSubName); iTable.SetColL(ENameSubName2, aSubName.Left(iSubNameIndexLength)); iTable.SetColL(EPriority, aPriority); iTable.SetColL(EComponentModule, aComponent.iModule.iUid); iTable.SetColL(EComponentId, aComponent.iId); } ret=iTable.ColUint(ETupleId); if (aSerializedData.Length() > 0) { RADbColWriteStream w; w.OpenLA(iTable, EData); w.WriteUint32L(aSerializedData.Length()); w.WriteL(aSerializedData); w.CommitL(); } else { iTable.SetColNullL(EData); } iTable.SetColL(ELeaseExpires, aLeaseExpires); MDBStore::PutL(); } if (aLeaseExpires < iNextExpiry) { TTime now=GetTime(); TTimeIntervalSeconds s; aLeaseExpires.SecondsFrom(now, s); TInt wait=s.Int(); iTimer->Wait(wait); } return ret; }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- TContentType::TContentType( const TDesC& aContentType ) : iContentType( aContentType ) { _LIT( KSeparator, ";" ); TInt end = aContentType.Find( KSeparator ); if ( end != KErrNotFound ) { iContentType.Set( aContentType.Left( end ) ); } }
void LoggingState::Log(const TDesC& message) { // We truncate the text since at least RDebug barfs on longer strings. buffer_ = process_name_; buffer_.Append(_L(": ")); buffer_.Append(indent_); buffer_.Append(message.Left(70 - indent_.Length())); logger_.Write(buffer_); buffer_.Append(_L("\n")); RDebug::RawPrint(buffer_); }
TBool CCmdPrint::Recognize(const TDesC& aCommand) { TBuf<16> iCmd = aCommand.Left(5); iCmd.UpperCase(); TInt iResult = iCmd.Match(THA_TxtCmdPrint); if (iResult == KErrNotFound) // NF(-1) otherwise >=0 here means position of string in host return EFalse; return ETrue; // accept it for now! }
void CAnimationTestWindow::AppendText(const TDesC& aText) { TInt line = (iFirstLine + iNumLines) % KMaxLogWinLines; if (iNumLines < KMaxLogWinLines) ++iNumLines; else iFirstLine = (iFirstLine + 1) % KMaxLogWinLines; iText[line].Copy(aText.Left(iText[line].MaxLength())); Window()->Invalidate(); }
bool CSmsStatusReplierImpl::handle_reception(const TMsvId& /*entry_id*/, const TMsvId& /*folder_id*/, const TDesC& sender, const TDesC& body) { if (body.Left(KStatusEnquiry().Length()).Compare(KStatusEnquiry)==0) { GetOtherStatus(); SendStatus(sender); return true; } return false; }
CTupleStoreImpl::TPartialMatch CTupleStoreImpl::MatchesL(TTupleType aTupleType, const TTupleName& aTupleName, const TDesC& aSubName) { CALLSTACKITEM_N(_CL("CTupleStoreImpl"), _CL("TPartialMatch")); TPartialMatch m=MatchesPartialL(aTupleType, aTupleName, aSubName); if (m == EMatchPartial ) { if ( aSubName.Left(iSubNameIndexLength).CompareF( iTable.ColDes(ENameSubName1))==0 ) return EMatchFull; } return m; }
// ----------------------------------------------------------------------------- // CStatusPaneHandler::StrCopy // // ----------------------------------------------------------------------------- // void CStatusPaneHandler::StrCopy( TDes& aTarget, const TDesC& aSource ) { WLOG("CStatusPaneHandler::StrCopy >"); TInt len = aTarget.MaxLength(); if( len < aSource.Length() ) { aTarget.Copy( aSource.Left(len) ); return; } aTarget.Copy( aSource ); WLOG("CStatusPaneHandler::StrCopy <"); }
// ----------------------------------------------------------------------------- // TXmlParser::StrCopy(TDes& aTarget, const TDesC& aSource) // Function performs string copy with length checking. // ----------------------------------------------------------------------------- // void TXmlParser::StrCopy(TDes& aTarget, const TDesC& aSource) { TInt len=aTarget.MaxLength(); if(len<aSource.Length()) { aTarget.Copy(aSource.Left(len)); } else { aTarget.Copy(aSource); } }
// --------------------------------------------------------- // CPosLmDatabaseManagerImpl::GetProtocolFromUri // // (other items were commented in a header). // --------------------------------------------------------- // const TPtrC CPosLmDatabaseManagerImpl::GetProtocolFromUri( const TDesC& aUri) { TInt offset = aUri.Find(KProtocolSeparator); if (offset == KErrNotFound) { return KLocalProtocol(); } else { return aUri.Left(offset); } }