void CContextMediaArrayImpl::PostEvent(CCMPost* aParent, CCMPost* aChild, TEvent aEvent) { CALLSTACKITEM_N(_CL("CContextMediaArrayImpl"), _CL("PostEvent")); if (aParent != iParentPost) return; if (aEvent==EChildAdded) { iPostIdArray->AppendL(aChild->iPostId()); iPostArray->AppendL(0); iObserver.PostEvent(aParent, aChild, aEvent); } if (aEvent==EPlaceholderFilled) { TInt i; for (i=0; i<iPostIdArray->Count();i++) { if (iPostIdArray->At(i) == aChild->iPostId()) { CC_TRAPD(ignore, iStorage.Release(iPostArray->At(i), 0)); iPostArray->At(i) = 0; iObserver.PostEvent(aParent, aChild, aEvent); return; } } } if (aEvent==EPostHidden) { ReadFromStorage(); iObserver.PostEvent(aParent, aChild, aEvent); } if (aEvent==EPostVisible) { ReadFromStorage(); iObserver.PostEvent(aParent, aChild, aEvent); } if (aEvent==EPostUpdated) { iObserver.PostEvent(aParent, aChild, aEvent); } if ((aEvent==EThumbnailLoaded) || (aEvent==EUnreadChanged)) { iObserver.PostEvent(aParent, aChild, aEvent); } if (aEvent==ELastPostChanged) { iObserver.PostEvent(aParent, aChild, aEvent); } //do nothing for: // EMediaLoaded, // EErrorUpdated, }
TUint32 CIkev2NatT::CheckPeerNotifysL(const CArrayFixFlat<TNotifPayloadIkev2*>& aNotifys, const TInetAddr& aLocalAddr, const TInetAddr& aRemoteAddr, TUint16 aPort, const TDesC8& aInitiatorSpi, const TDesC8& aResponderSpi, TBool& aSupported) { // // Check does there exists NAT_DETECTION_SOURCE_IP and NAT_DETECTION_DESTINATION_IP // Notify payload. If found compare payload data to local end NAT // traversal data as follows: // -- NAT_DETECTION_SOURCE_IP Notifys are examined against local Notify // payload iDstIdentiy data: If no match found // ==> Peer is behind NAT // -- NAT_DETECTION_DESTINATION_IP Notify is examined against local Notify // payload iSrcIdentiy data: If no match found // ==> Local end behind NAT // aSupported = EFalse; TInt Count = aNotifys.Count(); CIkev2NatT* RefObj = CIkev2NatT::NewL(aLocalAddr, aRemoteAddr, aPort, aInitiatorSpi, aResponderSpi); TNotifPayloadIkev2* PeerNotify; TUint32 PeerLth; TBool SrcMatch = EFalse; TBool DstMatch = EFalse; TUint32 NatFlags = 0; TInt i = 0; while ( i < Count ) { PeerNotify = aNotifys.At(i); if ( (PeerNotify->GetMsgType() == NAT_DETECTION_SOURCE_IP) && !SrcMatch ) { NatFlags |= REMOTE_END_NAT; PeerLth = TPayloadIkev2::Cast(PeerNotify)->GetLength() - (TUint32)(PeerNotify->Size() + PeerNotify->GetSPISize()); const TPtrC8 peerNotify(PeerNotify->NotifData(), PeerLth); if ( RefObj->DestinNofify().Compare(peerNotify) == 0) { SrcMatch = ETrue; NatFlags &= ~REMOTE_END_NAT; } } else if ( (PeerNotify->GetMsgType() == NAT_DETECTION_DESTINATION_IP) && !DstMatch ) { aSupported = ETrue; NatFlags |= LOCAL_END_NAT; PeerLth = TPayloadIkev2::Cast(PeerNotify)->GetLength() - (TUint32)(PeerNotify->Size() + PeerNotify->GetSPISize()); const TPtrC8 peerNotify(PeerNotify->NotifData(), PeerLth); if ( RefObj->SourceNofify().Compare(peerNotify) == 0 ) { DstMatch = ETrue; NatFlags &= ~LOCAL_END_NAT; } } i ++; } delete RefObj; return NatFlags; }
CCMPost* CContextMediaArrayImpl::GetPostAt(TInt aIndex) { CALLSTACKITEM_N(_CL("CContextMediaArrayImpl"), _CL("GetPostAt")); if (aIndex<0) return 0; if ((iItem!=ENone) && (aIndex==0)) return 0; if (iOrder==CPostStorage::EDescending) { aIndex=MdcaCount()-aIndex-1; } if (!iPostArray->At(aIndex)) { iPostArray->At(aIndex)=iStorage.GetByPostIdL(0, iPostIdArray->At(aIndex)); } return iPostArray->At(aIndex); }
LOCAL_C void CloseArrayOfCallObjects(TAny* aCallArray) /** Close and delete the call object array. */ { CArrayFixFlat<RMobileCall>* callArray = reinterpret_cast<CArrayFixFlat<RMobileCall>*>(aCallArray); TInt count = callArray->Count(); for (TInt i=count-1; i>=0; --i) { callArray->At(i).Close(); } delete callArray; callArray = NULL; }
// --------------------------------------------------------------------------- // CAknDiscreetPopupDrawer::WrapTitleTextL // Wraps long text to two lines. // --------------------------------------------------------------------------- // void CAknDiscreetPopupDrawer::WrapTitleTextL() { CArrayFixFlat<TInt>* lineWidths = new ( ELeave ) CArrayFixFlat<TInt>( KMaxNumOfLines ); CleanupStack::PushL( lineWidths ); CArrayFixFlat<TPtrC>* wrappedArray = new ( ELeave ) CArrayFixFlat<TPtrC>( KMaxNumOfLines ); CleanupStack::PushL( wrappedArray ); for ( TInt i = 0; i < KMaxNumOfLines; i++ ) { lineWidths->AppendL( iTitleTextData.iTextRect.Width() ); } HBufC* visualBuffer = HBufC::NewLC( iTitleText->Length() + KMaxNumOfLines * KAknBidiExtraSpacePerLine ); *visualBuffer = *iTitleText; TPtr ptr( visualBuffer->Des() ); AknBidiTextUtils::ConvertToVisualAndWrapToArrayL( ptr, *lineWidths, *iTitleTextData.iTextFont, *wrappedArray, ETrue ); if ( wrappedArray->Count() && wrappedArray->At( 1 ) != KNullDesC ) { delete iTitleText; iTitleText = NULL; delete iBodyText; iBodyText = NULL; iTitleText = wrappedArray->At( 0 ).AllocL(); iBodyText = wrappedArray->At( 1 ).AllocL(); } CleanupStack::PopAndDestroy( visualBuffer ); CleanupStack::PopAndDestroy( wrappedArray ); CleanupStack::PopAndDestroy( lineWidths ); }
/*! \brief Returns names and identifiers of supported languages in a phone. Language names are localized according the language's native presentation. Language ID's returned by this functions may be used as language parameter for changeLanguage(int language) function. Language IDs and names are OS specific and may vary across the platforms and releases. \attention Symbian specific API \deprecated HbLanguageUtil::supportedLanguages() is deprecated. Please use HbLocaleUtil::supportedLanguages() instead. \return Symbian - localized names and integer identifiers of languages supported in a device \return other platforms - empty QHash */ QHash<int, QString> HbLanguageUtil::supportedLanguages() { #if defined(Q_OS_SYMBIAN) QHash<int, QString> languages; QTranslator translator; QString path = "c:"; path += QString(TRANSLATOR_PATH); if (!translator.load(path)) { path = "z:"; path += QString(TRANSLATOR_PATH); if (!translator.load(path)) { return languages; } } QCoreApplication::installTranslator(&translator); QHash<int, QString> hashLanguageNames = readLanguageList(); CArrayFixFlat<TInt>* systemEpocLanguageCodes = 0; TInt error = SysLangUtil::GetInstalledLanguages( systemEpocLanguageCodes ); if ( error != KErrNone ) { delete systemEpocLanguageCodes; return languages; } for (int i = 0; i < systemEpocLanguageCodes->Count(); ++i) { int code = systemEpocLanguageCodes->At(i); QString id = QString(LANGUAGE_ID_PREFIX); id += QString::number(code); QString locName = hbTrId(id.toAscii().constData()); if (locName.isEmpty() || locName == id) { locName = hashLanguageNames.value(code); } languages.insert(code, locName); } delete systemEpocLanguageCodes; return languages; #else QHash<int, QString> dummy; return dummy; #endif }
void CHuiRasterizedTextMesh::DoBuildL(TInt aRasterizeFlags) { if(iUsingPreRasterizedMesh) { return; } TSize extents(0, 0); HUI_DEBUG(_L("CHuiRasterizedTextMesh::BuildL() - Updating rasterized text.")); // This is never NULL during BuildL(). const TDesC& text = *Text(); // Retrieve the text style used when rasterizing this text mesh. THuiTextStyle* textStyle = CHuiStatic::Env().TextStyleManager().TextStyle(iTextStyleId); // Retrieve the CFont object used when rasterizing this text mesh. CFont* font = textStyle->Font().NearestFontL(iTextMeshScale); // Maximum width of a text line in pixels. TInt maxWidth = MaxLineWidth(); TInt startIndex = 0; TInt index = 0; TInt lineCount = 0; CArrayFixFlat<TPtrC>* linePtrs = new (ELeave) CArrayFixFlat<TPtrC>(KLineArrayGranularity); CleanupStack::PushL(linePtrs); while(startIndex < text.Length()) { /// @todo What is the Symbian way to determine line break chars? #define HUI_IS_LINE_BREAK(aChar) (aChar == '\n') // Find the next logical line. while(index < text.Length() && !HUI_IS_LINE_BREAK(text[index])) { index++; } TPtrC logicalLine = text.Mid(startIndex, index - startIndex); ++index; // Skip the line break. startIndex = index; switch(LineMode()) { case ELineModeTruncate: { ++lineCount; // there's always one line created per logical line HBufC* buf = logicalLine.AllocLC(); TPtr ptr = buf->Des(); // truncate line CHuiStatic::ConvertToVisualAndClipL(ptr, *font, maxWidth, maxWidth); // create the line entry if not already existing if (aRasterizeFlags != ERasterizeNone) { if (iLines.Count() < lineCount) { SRasterizedLine line; line.iTexture = NULL; line.iGap = 0; iLines.AppendL(line); if (iPictographInterface) { SRasterizedLine pictographline; pictographline.iTexture = NULL; pictographline.iGap = 0; iPictographLines.AppendL(pictographline); } } TInt currentLine = lineCount-1; if (aRasterizeFlags & ERasterizeText) { // rasterize a single line (updates texture in iLines[0].iTexture) RasterizeLineL(ptr, iLines[currentLine]); } if (aRasterizeFlags & ERasterizePictographs && iPictographInterface) { // Rasterize pictographs if needed RasterizePictographLineL(ptr, font, iPictographLines[currentLine]); } // Get extents from the texture we just created CHuiTexture* tex = iLines[currentLine].iTexture; extents.iHeight += iLines[currentLine].iGap; if(tex) { extents.iWidth = Max(extents.iWidth, tex->Size().iWidth); extents.iHeight += tex->Size().iHeight; } } else { // Don't rasterise or create textures, just get the extents of this text. TSize lineExtents = textStyle->LineExtentsL(ptr); extents.iWidth = Max(extents.iWidth, lineExtents.iWidth); extents.iHeight += lineExtents.iHeight; } CleanupStack::PopAndDestroy(buf); break; } case ELineModeWrap: { // wrap lines to array HBufC* buf = CHuiStatic::ConvertToVisualAndWrapToArrayL( logicalLine, maxWidth, *font, *linePtrs); CleanupStack::PushL(buf); // one line may create several wrapped lines lineCount += linePtrs->Count(); if (aRasterizeFlags != ERasterizeNone) { // create new entries.. while (iLines.Count() < lineCount) { SRasterizedLine line; line.iTexture = NULL; line.iGap = 0; iLines.AppendL(line); if (iPictographInterface) { SRasterizedLine pictographline; pictographline.iTexture = NULL; pictographline.iGap = 0; iPictographLines.AppendL(pictographline); } } // Do rasterisation if we want to render to texture. for(TInt i = 0; i < linePtrs->Count(); ++i) { TInt currentLine = (lineCount - linePtrs->Count()) + i; if (aRasterizeFlags & ERasterizeText) { // rasterize a single line (updates texture in iLines[i].iTexture) RasterizeLineL(linePtrs->At(i), iLines[currentLine]); } if (aRasterizeFlags & ERasterizePictographs && iPictographInterface) { // Rasterize pictographs if needed RasterizePictographLineL(linePtrs->At(i), font, iPictographLines[currentLine]); } // Get extents from the texture we just created CHuiTexture* tex = iLines[i].iTexture; extents.iHeight += iLines[i].iGap; if(tex) { extents.iWidth = Max(extents.iWidth, tex->Size().iWidth); extents.iHeight += tex->Size().iHeight; } TBool moreAvailable = (currentLine + 1 < MaxLineCount()); if (!moreAvailable) { // Maximum number of lines reached. break; } } } else { // Don't rasterise or create textures, just get the extents of this text. for(TInt i = 0; i < linePtrs->Count(); ++i) { TSize lineExtents = textStyle->LineExtentsL(linePtrs->At(i)); extents.iWidth = Max(extents.iWidth, lineExtents.iWidth); extents.iHeight += lineExtents.iHeight; } } linePtrs->Reset(); CleanupStack::PopAndDestroy(buf); break; } default: break; } // If we have reached the maximum number of lines, stop building. if(IsMaxLineCountReached()) { break; } } HUI_DEBUG(_L("CHuiRasterizedTextMesh::BuildL() - Finished rasterizing text.")); CleanupStack::PopAndDestroy(linePtrs); linePtrs = 0; if (iPictographBitmap) { iPictographBitmap->Resize(TSize(0, 0)); } HUI_DEBUG(_L("CHuiRasterizedTextMesh::BuildL() - Updating text extents..")); // The extents of the mesh depend on how many lines there are. SetExtents(extents); HUI_DEBUG(_L("CHuiRasterizedTextMesh::BuildL() - Done!")); }
TBool Ikev2MobIke::ProcessNotifysL(CIkev2Negotiation* aNegotiation, const CArrayFixFlat<TNotifPayloadIkev2*>& aNotifys, TBool aRequest, TInt aExchange) { __ASSERT_DEBUG(aNegotiation, User::Invariant()); if ( !aNegotiation->iHdr.iIkeData->iUseMobIke ) { return EFalse; } TInt MsgType; TNotifPayloadIkev2* Payload; TPtrC8 Cookie2(NULL,0); TBool NatDetection = EFalse; TBool Status = EFalse; TInt Count = aNotifys.Count(); TInt i = 0; while ( i < Count ) { Payload = aNotifys.At(i); MsgType = (TInt)Payload->GetMsgType(); // // Process possible MOBIKE Notify messages // switch ( MsgType ) { case MOBIKE_SUPPORTED: // // Remote end supports MOBIKE protocol // aNegotiation->iHdr.iMobikeUsed = ETrue; aNegotiation->iHdr.iFloatedPort = ETrue; // Floated port used for now aNegotiation->iHdr.iDestinAddr.SetPort(FLOATED_IKE_PORT); break; case ADDITIONAL_IPV4_ADDRESS: case ADDITIONAL_IPV6_ADDRESS: // // Additional IP addresses Notify // if ( aNegotiation->iHdr.iMobikeUsed && (aExchange == INFORMATIONAL) ) { Status = ETrue; } break; case UPDATE_SA_ADDRESS: // // Peer informs about the IP address change // if ( aNegotiation->iHdr.iMobikeUsed && aRequest && (aExchange == INFORMATIONAL) ) { aNegotiation->iIkeV2PlugInSession.RemoteAddrChanged(&aNegotiation->iHdr, aNegotiation->iHdr.iDestinAddr); Status = ETrue; } break; case COOKIE2: // // Peer informs about the IP address change // if ( aNegotiation->iHdr.iMobikeUsed && aRequest && (aExchange == INFORMATIONAL) ) { Cookie2.Set(Payload->NotifData(), Payload->NotifDataLength()); Status = ETrue; } break; case NAT_PREVENTION: // // NAT Prevention Notify // if ( aNegotiation->iHdr.iMobikeUsed ) { if ( aExchange == INFORMATIONAL ) Status = ETrue; } break; case UNACCPETABLE_ADDRESSES: case NAT_PREVENTED: if ( aNegotiation->iHdr.iMobikeUsed ) { if ( aExchange == INFORMATIONAL ) Status = ETrue; } break; case NAT_DETECTION_SOURCE_IP: case NAT_DETECTION_DESTINATION_IP: if ( aNegotiation->iHdr.iMobikeUsed && (aExchange == INFORMATIONAL)) { NatDetection = ETrue; Status = ETrue; } break; default: break; } i ++; } if ( Status && aRequest && (aExchange == INFORMATIONAL) ) { // // Build informational response to MOBIKE request // CIkeV2Message* ikeMsg = CIkeV2Message::NewL(aNegotiation->iHdr.SpiI(), aNegotiation->iHdr.SpiR(), INFORMATIONAL, aNegotiation->iHdr.iInitiator, ETrue, aNegotiation->iHdr.ExpectedRequestId(), aNegotiation->iDebug); ikeMsg->AppendEncryptedPayloadL(aNegotiation->iHdr.iCipherBlkLth); if ( Cookie2.Ptr() ) { // // Peer is using COOKIE2. Return COOKIE2 payload data as such // ikeMsg->AppendNotifyPayloadL(IKEV2_PROTOCOL, KZeroDesc, COOKIE, Cookie2); } if ( NatDetection ) { // // Peer is using NAT_DETECTION_*_IP payloads. Build corresponding response // TBool NatDetectOk; TInetAddr DummyIp; DummyIp.SetAddress(KInetAddrNone); // 0.0.0.0 TUint32 NATFlags = CIkev2NatT::CheckPeerNotifysL(aNotifys, DummyIp, aNegotiation->iHdr.iDestinAddr, FLOATED_IKE_PORT, ikeMsg->InitiatorSpi(), ikeMsg->ResponderSpi(), NatDetectOk); if ( NatDetectOk ) { aNegotiation->iHdr.iNATFlags = NATFlags; aNegotiation->GetNatStatus(NatDetectOk, aNegotiation->iHdr.iDestinAddr); } CIkev2NatT* NatNotify = CIkev2NatT::NewL(DummyIp, aNegotiation->iHdr.iDestinAddr, FLOATED_IKE_PORT, ikeMsg->InitiatorSpi(), ikeMsg->ResponderSpi()); CleanupStack::PushL(NatNotify); ikeMsg->AppendNotifyPayloadL(IKEV2_PROTOCOL, KZeroDesc, NAT_DETECTION_SOURCE_IP, NatNotify->SourceNofify()); ikeMsg->AppendNotifyPayloadL(IKEV2_PROTOCOL, KZeroDesc, NAT_DETECTION_DESTINATION_IP, NatNotify->DestinNofify()); CleanupStack::PopAndDestroy(NatNotify); } aNegotiation->SendIkeMsgL(ikeMsg); aNegotiation->iIkeV2PlugInSession.UpdateIkev2SAL(&aNegotiation->iHdr, NULL); if ( (aNegotiation->iState != KStateIkeInfoRequest) && (aNegotiation->iState != KStateIkeDeleteRequest) && (aNegotiation->iState != KStateIkeDeleteResponse) ) aNegotiation->iState = KStateIkeSaCompleted; } // // else // Currently there is no need to examine any MOBIKE Notify payloads // present in Informational response // return Status; }
TInt CTelephonyFunctions::GetCallInfoL(TDes8& aCallSelect, TDes8& aCallInfo, TDes8& aRemoteInfo) /** Get the current call information. */ { CTelephony::TCallSelectionV1& CallSelectionV1 = reinterpret_cast<CTelephony::TCallSelectionV1&> ( const_cast<TUint8&> ( *aCallSelect.Ptr() ) ); if(CallSelectionV1.iLine != CTelephony::EVoiceLine) { return KErrAccessDenied; } if(IsFlightModeOn()) { return KErrAccessDenied; } CTelephony::TCallInfoV1& CallInfoV1 = reinterpret_cast<CTelephony::TCallInfoV1&> ( const_cast<TUint8&> ( *aCallInfo.Ptr() ) ); CTelephony::TRemotePartyInfoV1& RemotePartyInfoV1 = reinterpret_cast<CTelephony::TRemotePartyInfoV1&> ( const_cast<TUint8&> ( *aRemoteInfo.Ptr() ) ); TPtr8* callInfoPkgPtr; RMobileCall::TMobileCallInfoV1* callInfoObjPtr; if(iTsyVersion == KNoMultimodeTsy) { return KErrNotSupported; } else if(iTsyVersion==KETelExtMultimodeV1 || iTsyVersion==KETelExtMultimodeV2) { RMobileCall::TMobileCallInfoV1* callInfoV1 = new(ELeave) RMobileCall::TMobileCallInfoV1; CleanupStack::PushL(callInfoV1); RMobileCall::TMobileCallInfoV1Pckg* callInfoV1Pckg = new(ELeave) RMobileCall::TMobileCallInfoV1Pckg(*callInfoV1); CleanupStack::PushL(callInfoV1Pckg); callInfoPkgPtr = callInfoV1Pckg; callInfoObjPtr = callInfoV1; } else //TSY v3 { RMobileCall::TMobileCallInfoV3* callInfoV3 = new(ELeave) RMobileCall::TMobileCallInfoV3; CleanupStack::PushL(callInfoV3); RMobileCall::TMobileCallInfoV3Pckg* callInfoV3Pckg = new(ELeave) RMobileCall::TMobileCallInfoV3Pckg(*callInfoV3); CleanupStack::PushL(callInfoV3Pckg); callInfoPkgPtr = callInfoV3Pckg; callInfoObjPtr = callInfoV3; } TInt numOfCalls=0; User::LeaveIfError(iLineVoice.EnumerateCall(numOfCalls)); if (numOfCalls==0) { User::Leave(KErrNotFound); } CArrayFixFlat<RMobileCall>* tempCallArray = new (ELeave) CArrayFixFlat<RMobileCall>(numOfCalls); CleanupStack::PushL(TCleanupItem(CloseArrayOfCallObjects, tempCallArray)); TInt i; RLine::TCallInfo callinfo; RMobileCall::TMobileCallStatus callStatus; TBool callFound=EFalse; for(i=0; i<numOfCalls; i++) { User::LeaveIfError(iLineVoice.GetCallInfo(i,callinfo)); RMobileCall tempCall; tempCallArray->AppendL(tempCall); User::LeaveIfError(tempCallArray->At(i).OpenExistingCall(iLineVoice,callinfo.iCallName)); User::LeaveIfError(tempCallArray->At(i).GetMobileCallStatus(callStatus)); if((callStatus==RMobileCall::EStatusConnected) && (CallSelectionV1.iSelect==CTelephony::EActiveCall)) { User::LeaveIfError(tempCallArray->At(i).GetMobileCallInfo(*callInfoPkgPtr)); callFound=ETrue; break; } else if((callStatus==RMobileCall::EStatusHold) && (CallSelectionV1.iSelect==CTelephony::EHeldCall)) { User::LeaveIfError(tempCallArray->At(i).GetMobileCallInfo(*callInfoPkgPtr)); callFound=ETrue; break; } else if(((callStatus==RMobileCall::EStatusDialling) || (callStatus==RMobileCall::EStatusRinging) || (callStatus==RMobileCall::EStatusAnswering) || (callStatus==RMobileCall::EStatusConnecting) || (callStatus==RMobileCall::EStatusReconnectPending) || (callStatus==RMobileCall::EStatusDisconnecting) || (callStatus==RMobileCall::EStatusDisconnectingWithInband) || (callStatus==RMobileCall::EStatusTransferring) || (callStatus==RMobileCall:: EStatusTransferAlerting) ) && (CallSelectionV1.iSelect==CTelephony::EInProgressCall)) { User::LeaveIfError(tempCallArray->At(i).GetMobileCallInfo(*callInfoPkgPtr)); callFound=ETrue; break; } } CleanupStack::PopAndDestroy(tempCallArray); //tempCallArray if(!callFound) { CleanupStack::PopAndDestroy(2); //(callInfoV1Pckg or callInfoV3Pckg) AND (callInfoV1 or callInfoV3) return KErrNotFound; } GetCallStatus(callInfoObjPtr->iStatus, CallInfoV1.iStatus); if (callInfoObjPtr->iValid & RMobileCall::KCallSecurity) { if(callInfoObjPtr->ExtensionId() == KETelExtMultimodeV3) { RMobileCall::TMobileCallInfoV3* callInfoV3Ptr = reinterpret_cast<RMobileCall::TMobileCallInfoV3*>(callInfoObjPtr); switch(callInfoV3Ptr->iSecurity) { case RMobilePhone::ECipheringGSM: CallInfoV1.iSecurity = CTelephony::ECipheringGSM; break; case RMobilePhone::ECipheringWCDMA: CallInfoV1.iSecurity = CTelephony::ECipheringWCDMA; break; case RMobilePhone::ECipheringOff: default: CallInfoV1.iSecurity = CTelephony::ECipheringOff; break; } } else CallInfoV1.iSecurity = CTelephony::ECipheringOff; } else { CallInfoV1.iSecurity = CTelephony::TPhoneNetworkSecurity(); } if (callInfoObjPtr->iValid & RMobileCall::KCallStartTime) { CallInfoV1.iStartTime = callInfoObjPtr->iStartTime; } else { CallInfoV1.iStartTime = TDateTime(); } if (callInfoObjPtr->iValid & RMobileCall::KCallDuration) { CallInfoV1.iDuration = callInfoObjPtr->iDuration; } else { CallInfoV1.iDuration = 0; } if (callInfoObjPtr->iValid & RMobileCall::KCallExitCode) { CallInfoV1.iExitCode = callInfoObjPtr->iExitCode; } else { CallInfoV1.iExitCode = 0; } if (callInfoObjPtr->iValid & RMobileCall::KCallDialledParty) { CopyTelAddress(callInfoObjPtr->iDialledParty, CallInfoV1.iDialledParty); } else { CallInfoV1.iDialledParty = CTelephony::TTelAddress(); } //see whether we have an existing handle on the call CallInfoV1.iCallId = -1; RMobileCall* poolCall=NULL; RMobileCall::TMobileCallInfoV1 poolCallInfoV1; RMobileCall::TMobileCallInfoV1Pckg poolCallInfoV1Pckg(poolCallInfoV1); TInt err; for(int k=0;k<CTelephony::EISVMaxNumOfCalls;k++) { //get RMobileCall object if((poolCall = Call((CTelephony::TCallId)k)) != NULL) { //get call name err = poolCall->GetMobileCallInfo(poolCallInfoV1Pckg); if(err ==KErrNone) { //compare call names if(poolCallInfoV1.iCallName.MatchF(callinfo.iCallName)==0) { CallInfoV1.iCallId = k; break; } } } } //fill TRemotePartyInfoV1 RMobileCall::TMobileCallRemotePartyInfoV1& mobileRemoteParty = callInfoObjPtr->iRemoteParty; switch(mobileRemoteParty.iRemoteIdStatus) { case RMobileCall::ERemoteIdentityAvailable: RemotePartyInfoV1.iRemoteIdStatus = CTelephony::ERemoteIdentityAvailable; break; case RMobileCall::ERemoteIdentitySuppressed: RemotePartyInfoV1.iRemoteIdStatus = CTelephony::ERemoteIdentitySuppressed; break; case RMobileCall::ERemoteIdentityUnknown: default: RemotePartyInfoV1.iRemoteIdStatus = CTelephony::ERemoteIdentityUnknown; break; } RemotePartyInfoV1.iCallingName.Copy(mobileRemoteParty.iCallingName); CopyTelAddress(mobileRemoteParty.iRemoteNumber, RemotePartyInfoV1.iRemoteNumber); switch(mobileRemoteParty.iDirection) { case RMobileCall::EMobileOriginated: RemotePartyInfoV1.iDirection = CTelephony::EMobileOriginated; break; case RMobileCall::EMobileTerminated: RemotePartyInfoV1.iDirection = CTelephony::EMobileTerminated; break; case RMobileCall::EDirectionUnknown: default: RemotePartyInfoV1.iDirection = CTelephony::EDirectionUnknown; break; } CleanupStack::PopAndDestroy(2); //(callInfoV1Pckg or callInfoV3Pckg) AND (callInfoV1 or callInfoV3) return KErrNone; }
// Each test step must supply a implementation for doTestStepL enum TVerdict CTestAppLoaderEndTask::doTestStepL( void ) { // Printing to the console and log file INFO_PRINTF1(_L("TEST-> END TASK")); TPtrC program; if ( !GetStringFromConfig(ConfigSection(), KProgram, program) ) { ERR_PRINTF2(KErrMissingParameter, &KProgram()); SetTestStepResult(EFail); } else { RApaLsSession apaLsSession; User::LeaveIfError(apaLsSession.Connect()); CleanupClosePushL(apaLsSession); User::LeaveIfError(apaLsSession.GetAllApps()); RWsSession ws; User::LeaveIfError(ws.Connect()); CleanupClosePushL(ws); TInt numWindowGroups = ws.NumWindowGroups(); CArrayFixFlat<TInt>* windowGroupList = new(ELeave) CArrayFixFlat<TInt>(numWindowGroups); CleanupStack::PushL(windowGroupList); // Populate array with current group list ids User::LeaveIfError(ws.WindowGroupList(windowGroupList)); CApaWindowGroupName* windowGroupName = CApaWindowGroupName::NewLC(ws); /* Note: we use windowGroupList->Count() instead of numWindowGroups, as in the middle of the * update the list could change in length (or worse, be reduced) thus producing an out of bounds * error if numWindowGroups were used */ TBool searching=ETrue; for ( TInt i=0; (i<windowGroupList->Count()) && searching; ++i ) { TInt wgId = windowGroupList->At(i); windowGroupName->ConstructFromWgIdL(wgId); TUid appUid = windowGroupName->AppUid(); TApaAppInfo appInfo; HBufC* appCaption = NULL; // Some applications, like midlets, may not provide any info if (apaLsSession.GetAppInfo(appInfo, appUid) == KErrNone) { appCaption = appInfo.iCaption.AllocL(); } else { appCaption = windowGroupName->Caption().AllocL(); } CleanupStack::PushL(appCaption); // Only list 'visible' applications if ( appCaption->Length() ) { TPtrC caption=*appCaption; INFO_PRINTF2(KLogTask, &caption); if ( program.CompareC(caption)==0 ) { searching=EFalse; TApaTask task(ws); task.SetWgId(wgId); if (task.Exists()) { task.EndTask(); } else { ERR_PRINTF2(KErrTaskNotFound, &program); SetTestStepResult(EFail); } } } CleanupStack::Pop(1, appCaption); // taskEntry, appCaption } if ( searching ) { ERR_PRINTF2(KErrTaskNotFound, &program); SetTestStepResult(EFail); } CleanupStack::PopAndDestroy(4, &apaLsSession); // windowGroupName, windowGroupList } // test steps return a result return TestStepResult(); }
void DoBuildL(CAlfTextStyle* aTextStyle) { ResetLines(); TSize extents(0, 0); const TDesC& text = iVisual->Text(); // Retrieve the CFont object used when rasterizing this text mesh. CFont* font = aTextStyle->Font()->NearestFontL(1.0); // In wrapping mode, let the mesh know how much space there is // for drawing into. TInt maxWidth = iMaxWidth; //KMaxTInt; TInt lineCount = 0; // awkward, just to avoid warning CArrayFixFlat<TPtrC>* linePtrs = 0; HBufC* buf = 0; switch(iVisual->Wrapping()) { case CAlfTextVisual::ELineWrapManual: { lineCount = 1; for (TInt i = text.Length()-2;i>=0;i--) // linebreak as last character is ignored { if (text[i]=='\n') // not elegant but keeps the compatibility lineCount++; } if (lineCount > 1) { TInt lineStart = 0; TInt breakpos = 0; TInt remaining = text.Length(); while(lineCount) { for (TInt i = lineStart; i<remaining ;i++) { if (text[i]=='\n') // not elegant but keeps the compatibility { breakpos = i; break; } } if (breakpos < lineStart) // not found { breakpos = remaining-1; } HBufC* buf = text.Mid(lineStart,breakpos-lineStart).AllocLC(); // todo.. is extra space required for bidi lineStart = breakpos+1; TPtr ptr = buf->Des(); // truncate line AknBidiTextUtils::ConvertToVisualAndClipL(ptr, *font, maxWidth, maxWidth); // create the line entry if not already existing SRasterizedLine line; line.iTexture = NULL; line.iGap = 0; iLines.AppendL(line); TInt index = iLines.Count()-1; // rasterize a single line (updates texture in iLines[0].iTexture) RasterizeLineL(ptr, iLines[index], aTextStyle); // Get extents from the texture we just created CAlfTexture* tex = iLines[index].iTexture; extents.iHeight += iLines[index].iGap; if(tex) { extents.iWidth = Max(extents.iWidth, tex->Size().iWidth); extents.iHeight += tex->Size().iHeight; } CleanupStack::PopAndDestroy(buf); lineCount--; } break; } } // fall through with single line case CAlfTextVisual::ELineWrapTruncate: { lineCount = 1; // there's always one line created per logical line HBufC* buf = text.AllocLC(); // todo.. is extra space required for bidi TPtr ptr = buf->Des(); // truncate line AknBidiTextUtils::ConvertToVisualAndClipL(ptr, *font, maxWidth, maxWidth); // create the line entry if not already existing SRasterizedLine line; line.iTexture = NULL; line.iGap = 0; iLines.AppendL(line); // rasterize a single line (updates texture in iLines[0].iTexture) RasterizeLineL(ptr, iLines[0], aTextStyle); // Get extents from the texture we just created CAlfTexture* tex = iLines[0].iTexture; extents.iHeight += iLines[0].iGap; if(tex) { extents.iWidth = Max(extents.iWidth, tex->Size().iWidth); extents.iHeight += tex->Size().iHeight; } CleanupStack::PopAndDestroy(buf); break; } case CAlfTextVisual::ELineWrapBreak: { // wrap lines to array linePtrs = new (ELeave) CArrayFixFlat<TPtrC>(KLineArrayGranularity); CleanupStack::PushL(linePtrs); buf = AknBidiTextUtils::ConvertToVisualAndWrapToArrayL( text, maxWidth, *font, *linePtrs); CleanupStack::PushL(buf); // Do rasterisation for(TInt i = 0; i < linePtrs->Count();i++) { SRasterizedLine line; line.iTexture = NULL; line.iGap = 0; iLines.AppendL(line); // rasterize a single line (updates texture in iLines[i].iTexture) RasterizeLineL(linePtrs->At(i), iLines[i], aTextStyle); CAlfTexture* tex = iLines[i].iTexture; extents.iHeight += iLines[i].iGap; if(tex) { extents.iWidth = Max(extents.iWidth, tex->Size().iWidth); extents.iHeight += tex->Size().iHeight; } if (i == iVisual->MaxLineCount()-1) { // Maximum number of lines reached. break; } } CleanupStack::PopAndDestroy(buf); CleanupStack::PopAndDestroy(linePtrs); break; } default: break; } // Extents needs to be updated in order to make alignment // work properly. iExtents = extents; UpdateDescriptorL(); }
TPtrC16 CContextMediaArrayImpl::MdcaPoint(TInt aIndex) const { CALLSTACKITEM_N(_CL("CContextMediaArrayImpl"), _CL("MdcaPoint")); if (aIndex>iPostArray->Count()) { User::Leave(KErrArgument); } if (!iStandAlone) { // ----- case first item in list --------- if (aIndex == 0) { if (iItem == EUseVCode) { iBuf->Des().Zero(); iBuf->Des().AppendFormat(_L("%d\t"), KUseCodeIconIndex); iBuf->Des().Append(*iUseCode); iBuf->Des().Append(_L("\t\t\t")); return iBuf->Des(); } else if (iItem == EAddReply) { iBuf->Des().Zero(); if (iPostArray->Count()==0) { iBuf->Des().AppendFormat(_L("%d\t"), KReplyIconIndex); iBuf->Des().Append(*iFirstPost); iBuf->Des().Append(_L("\t\t\t")); } else { iBuf->Des().AppendFormat(_L("%d\t"), KReplyIconIndex); iBuf->Des().Append(*iAddReply); iBuf->Des().Append(_L("\t\t\t")); } return iBuf->Des(); } } } // ---- normal case -------------------- if (iOrder==CPostStorage::EDescending) { aIndex=MdcaCount()-aIndex-1; } if (iPostArray->At(aIndex) == 0) { iPostArray->At(aIndex) = iStorage.GetByPostIdL(0, iPostIdArray->At(aIndex)); } iBuf->Des().Zero(); const CCMPost * aPost = (*iPostArray)[aIndex]; if (!iStandAlone) { TInt iconidx=aPost->GetThumbnailIndex(); if (iconidx<0) iconidx=KUnknownIconIndex; if (aPost->iBodyText->Value().Compare(*iLoading) == 0) { iconidx = KUnknownIconIndex; } else if (aPost->iBodyText->Value().Compare(*iError)==0) { iconidx=KErrorIconIndex; } // First Line of the list box: icon_id, title, nb_unread iBuf->Des().AppendFormat(_L("%d\t"), iconidx); } // Loading indicator for thread ... TInt64 id = iPostIdArray->At(aIndex); TBool loading = ( (iNode == CPostStorage::RootId()) && ( (iNetwork.GetFetchStatus(id)==MNetworkStatus::EConnecting) || (iNetwork.GetFetchStatus(id)==MNetworkStatus::EFetching) ) ); if (loading) { if (aPost->iBodyText->Value().Length() == 0) { iBuf->Des().Append(*iNoTitle); } else { iBuf->Des().Append(aPost->iBodyText->Value().Left(15)); } TTime now; now=GetTime(); TInt sec = now.DateTime().Second(); TInt dots = 6; TInt nb_dots = sec - ( dots*int(sec/dots)); for (int i=0; i<=nb_dots; i++) { iBuf->Des().Append(_L(".")); } iObserver.PostEvent(0, 0, EPostUpdated); } else { if (aPost->iBodyText->Value().Length() == 0) { iBuf->Des().Append(*iNoTitle); } else { iBuf->Des().Append(aPost->iBodyText->Value().Left(40)); } } iBuf->Des().Append(_L("\t")); TInt unread = aPost->iUnreadCounter(); if (unread>0) { iBuf->Des().AppendNum(unread ); } if (! iStandAlone) { iBuf->Des().Append(_L("\t")); // Second and third Lines of the listbox if (aPost->iSender.iName().Compare(_L("?")) == 0) { iBuf->Des().Append(_L(" \t \t \t")); } else { if (iNode==CPostStorage::RootId()) { // second line iBuf->Des().Append(*iFirstBy); iBuf->Des().Append(_L(" ")); iBuf->Des().Append(aPost->iSender.iName()); iBuf->Des().Append(_L(",\t")); TBuf<5> time; GetTimeString(aPost->iTimeStamp(), time); iBuf->Des().Append(time); //third line if (aPost->LastPostAuthor().Length()==0) { iBuf->Des().Append(_L("\t\t")); } else { iBuf->Des().Append(_L("\t")); iBuf->Des().Append(*iLastBy); iBuf->Des().Append(_L(" ")); iBuf->Des().Append(aPost->LastPostAuthor()); iBuf->Des().Append(_L(",\t")); GetTimeString(aPost->LastPostDate(), time); iBuf->Des().Append(time); } } else { // second line iBuf->Des().Append(*iBy); iBuf->Des().Append(_L(" ")); iBuf->Des().Append(aPost->iSender.iName()); iBuf->Des().Append(_L(",\t")); TBuf<5> time; GetTimeString(aPost->iTimeStamp(), time); iBuf->Des().Append(time); // third line iBuf->Des().Append(_L("\t\t")); } } } #ifdef __WINS__ RDebug::Print(iBuf->Des()); #endif return iBuf->Des(); }
/* ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- */ TBool CMainContainer::HandlePopUpMenuSelectionL(TInt& aCommand) { TBool ret(EFalse); TBool isEnable(EFalse),isDisable(EFalse),isRemove(EFalse),isaPreview(EFalse); ShowMenuItemsL(isEnable,isDisable,isRemove,isaPreview); if(!isRemove && !isaPreview){ ret = ETrue; aCommand = EProfModify; }else{ TBuf<100> hjelpper; CAknSinglePopupMenuStyleListBox* list = new(ELeave) CAknSinglePopupMenuStyleListBox; CleanupStack::PushL(list); CAknPopupList* popupList = CAknPopupList::NewL(list,R_AVKON_SOFTKEYS_OK_CANCEL); CleanupStack::PushL(popupList); list->ConstructL(popupList, CEikListBox::ELeftDownInViewRect); list->CreateScrollBarFrameL(ETrue); list->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff,CEikScrollBarFrame::EAuto); CArrayFixFlat<TInt>* cmdArray = new (ELeave) CArrayFixFlat<TInt>(5); CleanupStack::PushL(cmdArray); CDesCArrayFlat* Array = new (ELeave) CDesCArrayFlat(5); CleanupStack::PushL(Array); if(isEnable){ StringLoader::Load(hjelpper,R_CMD_ENABLE); Array->AppendL(hjelpper); cmdArray->AppendL(EProfEnable); }else if(isDisable){ StringLoader::Load(hjelpper,R_CMD_DISABLE); Array->AppendL(hjelpper); cmdArray->AppendL(EProfDisable); } if(isaPreview && !iDimPreview){ StringLoader::Load(hjelpper,R_CMD_MODIFY); Array->AppendL(hjelpper); cmdArray->AppendL(EProfModify); StringLoader::Load(hjelpper,R_CMD_PREVIEW); Array->AppendL(hjelpper); cmdArray->AppendL(EProfTest); } if(isRemove){ StringLoader::Load(hjelpper,R_CMD_DELETE); Array->AppendL(hjelpper); cmdArray->AppendL(EProfRemove); } list->Model()->SetItemTextArray(Array); CleanupStack::Pop();//Array list->Model()->SetOwnershipType(ELbmOwnsItemArray); if (popupList->ExecuteLD()) { TInt Selected = list->CurrentItemIndex(); if(Selected >= 0 && Selected < cmdArray->Count()) { ret = ETrue; aCommand = cmdArray->At(Selected); } } CleanupStack::PopAndDestroy(1); // cmdArray CleanupStack::Pop(); // popuplist CleanupStack::PopAndDestroy(1); // list } return ret; }