// ----------------------------------------------------------------------------- // CLandmarksEditDialog::FetchFloatL // // (other items were commented in a header). // ----------------------------------------------------------------------------- // void CLandmarksEditDialog::FetchFloatL( TRealX& aFloat, TInt aEditorResourceId, TInt aErrorResourceId) { const TChar KDecimalPoint = '.'; TBuf<KPosLmMaxTextFieldLength> textFieldValue; TLex fieldLex; TInt result(KErrNone); CEikEdwin* editor = static_cast <CEikEdwin*> (Control(aEditorResourceId)); editor->GetText(textFieldValue); if (textFieldValue == KNullDesC) { // User has indicated that he/she wants this value to be undefined. aFloat.SetNaN(); } else { // Try to extract value fieldLex = textFieldValue; TReal floatValue(0); result = fieldLex.Val(floatValue, KDecimalPoint); if (result != KErrNone) { NotifyErrorToUserL(aErrorResourceId); } // Update output parameter User::LeaveIfError(aFloat.Set(floatValue)); } }
// ---------------------------------------------------------------------------- // CCreate2WayVideoSessionDialog::PreLayoutDynInitL() // . // ---------------------------------------------------------------------------- // void CCreate2WayVideoSessionDialog::PreLayoutDynInitL() { CEikEdwin* edwinPoCAddress = static_cast<CEikEdwin*>( Control( ESessionDialog2WayVideoRecipientAddress ) ); TBuf<KBufLength> defaultAddress; defaultAddress.Copy(iParams->iRecipentAddress); edwinPoCAddress->SetTextL(&defaultAddress); edwinPoCAddress->SetCursorPosL(defaultAddress.Length(),EFalse); CAknPopupFieldText* popupFieldText = static_cast <CAknPopupFieldText*> (Control(ESessionDialog2WayVideoVideoCodec)); popupFieldText->SetCurrentValueIndex(0); popupFieldText = static_cast <CAknPopupFieldText*> (Control(ESessionDialog2WayVideoAudioCodec)); popupFieldText->SetCurrentValueIndex(0); popupFieldText = static_cast <CAknPopupFieldText*> (Control(ESessionDialog2WayVideoViewFinder)); popupFieldText->SetCurrentValueIndex(0); popupFieldText = static_cast <CAknPopupFieldText*> (Control(ESessionDialog2WayVideoCamera)); popupFieldText->SetCurrentValueIndex(0); CAknForm::PreLayoutDynInitL(); }
// ---------------------------------------------------------------------------- // CNewDestDialog::PrepareLC( TInt aResourceId ) // // ---------------------------------------------------------------------------- // void CNewDestDialog::PrepareLC( TInt aResourceId ) { CAknForm::PrepareLC( aResourceId ); SetLineNonFocusing( EWayFinderCtrlNewDestCountryEdwin ); CEikEdwin* control = static_cast<CEikEdwin*>( ControlOrNull( EWayFinderCtrlNewDestStringEdwin ) ); if( control ){ control->AddEdwinObserverL( this ); } }
/** * If aControl is an edwin, set its clipping rect to empty. This * will disable the text hiding. */ static void ResetHides(CEikCaptionedControl *aControl) { aControl->SetPartiallyVisible( EFalse ); if (aControl->ControlIsAnEdwin(aControl->iControlType)) { CEikEdwin *edwin = (CEikEdwin*)aControl->iControl; edwin->SetTextLinesRect(TRect()); } }
void CSymellaConsoleView::HandleLogWriteL(const TDesC& aText) { /*if (aText.Length() < KMaxConsoleBufferSize) { // Checks the new text length TInt diff = iTextBuffer->DocumentLength() + aText.Length() - KMaxConsoleBufferSize; // If it's longer than the maximum then deletes from // the beginning if ( diff > 0) { iTextBuffer->DeleteL(0, diff); if (iContainer) iContainer->Edwin()->Text()->DeleteL(0, diff); } iTextBuffer->InsertL(iTextBuffer->DocumentLength(), aText);*/ if (iContainer) { CEikEdwin* edwin = iContainer->Edwin(); TInt diff = edwin->Text()->DocumentLength() + aText.Length() - KMaxConsoleBufferSize; if (diff > edwin->Text()->DocumentLength()) diff = edwin->Text()->DocumentLength(); if ( diff > 0) edwin->Text()->DeleteL(0, diff); edwin->Text()->InsertL(edwin->Text()->DocumentLength(), aText); edwin->HandleTextChangedL(); edwin->SetCursorPosL(edwin->Text()->DocumentLength(), EFalse); } /* } else { TPtrC ptr = aText.Right(KMaxConsoleBufferSize); iTextBuffer->DeleteL(0, iTextBuffer->DocumentLength()); iTextBuffer->InsertL(0, ptr); if (iContainer) { CEikEdwin* edwin = iContainer->Edwin(); edwin->Text()->DeleteL(0, edwin->Text()->DocumentLength()); edwin->Text()->InsertL(0, ptr); edwin->HandleTextChangedL(); edwin->SetCursorPosL(edwin->Text()->DocumentLength(), EFalse); } }*/ }
void CCustomWrapAppControl::CreateEdwinL() { const TSize screenSize(iCoeEnv->ScreenDevice()->SizeInPixels()); // Rich text editor. iEdwin=new(ELeave) CEikRichTextEditor; STATIC_CAST(CEikRichTextEditor*,iEdwin)->ConstructL(this,0,0,0); //STATIC_CAST(CEikRichTextEditor*,iEdwin)->ConstructL(this,0,0,EEikEdwinInclusiveSizeFixed); iEdwin->SetObserver(this); iEdwin->CreateScrollBarFrameL(); iEdwin->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff, CEikScrollBarFrame::EOn); iEdwin->SetExtent(TPoint(screenSize.iWidth/5,screenSize.iHeight/8),TSize(screenSize.iWidth/3,screenSize.iHeight*3/5)); }
TKeyResponse OfferKeyEventL(const TKeyEvent &aKeyEvent, TEventCode aType) { LOGD("CMyAknTextQueryDialog::OfferKeyEventL(%i, %i)\n", aKeyEvent.iCode, aType); if(aKeyEvent.iCode == EKeyEnter) { LOGD("Enter 7\n"); // offer this event to only the edit box. // this prevents it from closing the dialog. CEikEdwin* e = ((CMyAknQueryControl*)QueryControl())->getEdwin(); DEBUG_ASSERT(e != NULL); //e->ClearSelectionL(); return e->OfferKeyEventL(aKeyEvent, aType); } return CAknTextQueryDialog::OfferKeyEventL(aKeyEvent, aType); }
// --------------------------------------------------------------------------- // CBCTestMix50Case::TestCEikEdwinCaseL() // ( menu item -7- ) // --------------------------------------------------------------------------- // void CBCTestMix50Case::TestCEikEdwinCaseL() { CEikEdwin* eikEdwin = new( ELeave ) CEikEdwin; CleanupStack::PushL( eikEdwin ); _LIT( KTxtCEikEdwin, "CEikEdwin::CEikEdwin" ); AssertNotNullL( eikEdwin, KTxtCEikEdwin ); TRect rect( KXLeftPos, KYUpPos, KXRightPos, KYDownPos ); eikEdwin->SetScrollRect( rect ); _LIT( KTxtSetScrollRect, "CEikEdwin::SetScrollRect" ); AssertTrueL( ETrue, KTxtSetScrollRect ); CleanupStack::PopAndDestroy( eikEdwin ); }
void CUploadContainer::Draw(const TRect& aRect) const { CALLSTACKITEM_N(_CL("CUploadContainer"), _CL("Draw")); CWindowGc& gc = SystemGc(); gc.SetPenStyle(CGraphicsContext::ENullPen); gc.SetBrushColor(KRgbWhite); gc.SetBrushStyle(CGraphicsContext::ESolidBrush); gc.DrawRect(aRect); gc.SetPenStyle(CGraphicsContext::ESolidPen); gc.SetBrushStyle(CGraphicsContext::ENullBrush); TGulBorder border(TGulBorder::ESingleGray); TRect edit_rect=iTagEdit->Rect(); edit_rect.Resize(4, 4); edit_rect.Move(-2, -2); border.Draw(gc, edit_rect); if (iDescriptionEdit) { edit_rect=iDescriptionEdit->Rect(); edit_rect.Resize(4, 4); edit_rect.Move(-2, -2); border.Draw(gc, edit_rect); } if (iSelected) { TGulBorder border(TGulBorder::ESingleBlack); //gc.SetPenColor(KRgbBlack); TRect edit_rect=iSelected->Rect(); edit_rect.Resize(4, 4); edit_rect.Move(-2, -2); border.Draw(gc, edit_rect); } if (iActive) { TGulBorder border(TGulBorder::EFocusedSunkenControl); //gc.SetPenColor(KRgbBlack); TRect edit_rect=iActive->Rect(); edit_rect.Resize(4, 4); edit_rect.Move(-2, -2); border.Draw(gc, edit_rect); } if (scaled) { TSize s=iScaledBitmap->SizeInPixels(); TPoint lt=TPoint( (Rect().Width()-s.iWidth)/2, 4); TRect r( lt, s); gc.DrawBitmap(r, iScaledBitmap); } }
TKeyResponse CCustomWrapAppControl::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType) { if (aType==EEventKey) { iEdwin->OfferKeyEventL(aKeyEvent, aType); } return(EKeyWasConsumed); }
// ----------------------------------------------------------------------------- // CLandmarksEditDialog::UpdateTitleBarL // // (other items were commented in a header). // ----------------------------------------------------------------------------- // void CLandmarksEditDialog::UpdateTitleBarL(TBool aFromField) { if (aFromField) { TBuf<KPosLmMaxTextFieldLength> name; CEikEdwin* nameEditor = static_cast<CEikEdwin*>(Control(ELandmarkNameField)); nameEditor->GetText(name); iTitlePane->SetTextL(name); } else { TPtrC ptr; iLandmark->GetLandmarkName(ptr); iTitlePane->SetTextL(ptr); } }
void CCustomWrapAppControl::ConstructL() { CreateWindowL(); Window().SetShadowDisabled(ETrue); CreateEdwinL(); iStandardCustomWrap = iEdwin->TextLayout()->CustomWrap(); iFocusControl=iEdwin; SetExtentToWholeScreen(); ActivateL(); iFocusControl->SetFocus(ETrue); }
void CUploadContainer::GetFieldsLC(HBufC*& Tag, HBufC*& Description) { CALLSTACKITEM_N(_CL("CUploadContainer"), _CL("GetFieldsLC")); const TDesC& tag=iTagEdit->Text()->Read(0); delete Tag; Tag=0; if (tag.Length()>0 && tag.Left(tag.Length()-1).CompareF(KTag)) Tag=tag.Left(tag.Length()-1).AllocLC(); else Tag=HBufC::NewLC(0); delete Description; Description=0; if (iDescriptionEdit) { const TDesC& desc=iDescriptionEdit->Text()->Read(0); if (desc.Length()>0 && desc.Left(desc.Length()-1).CompareF(KDescription)) Description=desc.Left(desc.Length()-1).AllocLC(); else Description=HBufC::NewLC(0); } else { Description=HBufC::NewLC(0); } }
TKeyResponse CUploadContainer::OfferKeyEventL(const TKeyEvent &aKeyEvent, TEventCode aType) { CALLSTACKITEM_N(_CL("CUploadContainer"), _CL("OfferKeyEventL")); // lessen chance of accidental dismissal if (aKeyEvent.iCode == KEY_CANCEL) return EKeyWasConsumed; if (! iDescriptionEdit) { if (iActive) { return iActive->OfferKeyEventL(aKeyEvent, aType); } else { return EKeyWasNotConsumed; } } if (aKeyEvent.iCode==JOY_CLICK) { SetEditActive(iSelected, iActive==0); return EKeyWasConsumed; } else if(iActive) { TKeyResponse ret; ret=iActive->OfferKeyEventL(aKeyEvent, aType); return ret; } else if (aKeyEvent.iCode==JOY_UP || aKeyEvent.iCode==JOY_DOWN || aKeyEvent.iCode==JOY_LEFT || aKeyEvent.iCode==JOY_RIGHT ) { CEikEdwin *prev=iSelected; SetEditSelected(iSelected, false); if (prev==iTagEdit) { SetEditSelected(iDescriptionEdit, true); } else { SetEditSelected(iTagEdit, true); } return EKeyWasConsumed; } else { return EKeyWasNotConsumed; } }
void CEikListBoxTextEditor::UseFontL( CEikEdwin& aEditor, const CFont& aFont ) { _AKNTRACE_FUNC_ENTER; CGlobalText* globalText; TCharFormatMask defaultCharFormatMask; defaultCharFormatMask.SetAttrib(EAttFontTypeface); defaultCharFormatMask.SetAttrib(EAttFontHeight); TFontSpec fontspec = aFont.FontSpecInTwips(); TCharFormat defaultCharFormat( fontspec.iTypeface.iName, fontspec.iHeight ); iParaFormatLayer=CParaFormatLayer::NewL(); iCharFormatLayer=CCharFormatLayer::NewL(defaultCharFormat,defaultCharFormatMask); globalText=CGlobalText::NewL(iParaFormatLayer,iCharFormatLayer,CEditableText::ESegmentedStorage,5); CleanupStack::PushL(globalText); TCharFormat charFormat; TCharFormatMask charMask; iCharFormatLayer->Sense(charFormat,charMask); if ( fontspec.iFontStyle.Posture()==EPostureItalic ) { charMask.SetAttrib(EAttFontPosture); charFormat.iFontSpec.iFontStyle.SetPosture(EPostureItalic); } if ( fontspec.iFontStyle.StrokeWeight()==EStrokeWeightBold ) { charMask.SetAttrib(EAttFontStrokeWeight ); charFormat.iFontSpec.iFontStyle.SetStrokeWeight(EStrokeWeightBold); } iCharFormatLayer->SetL(charFormat,charMask); CPlainText* old=aEditor.Text(); CleanupStack::Pop(); // globalText CleanupStack::PushL(old); // old is pushed because we're using EUseText in the subsequent call aEditor.SetDocumentContentL(*globalText,CEikEdwin::EUseText); CleanupStack::PopAndDestroy(); // old _AKNTRACE_FUNC_EXIT; }
// ----------------------------------------------------------------------------- // CTestSDKForm::TestFSaveFormDataL // ----------------------------------------------------------------------------- TInt CTestSDKForm::TestFSaveFormDataL( CStifItemParser& /*aItem*/ ) { CTestSDKFormControl* form = new (ELeave) CTestSDKFormControl; CleanupStack::PushL( form ); STIF_ASSERT_NOT_NULL( form ); form->ConstructL(); form->PrepareLC( R_TESTSDK_FORM_DIALOG ); CleanupStack::Pop( form ); CEikEdwin* edwin = static_cast<CEikEdwin*>( form->ControlOrNull( ETestSDKEdwin ) ); _LIT( KEdwin, "edwin" ); TBuf<KLength> tedwin( KEdwin ); edwin->SetTextL( &tedwin ); TBool save = form->SaveFormDataL(); STIF_ASSERT_TRUE( save ); CleanupStack::PopAndDestroy( form ); return KErrNone; }
void CUploadContainer::SetEditActive(CEikEdwin *Edit, bool IsActive) { CALLSTACKITEM_N(_CL("CUploadContainer"), _CL("SetEditActive")); TBuf<20> label; if (Edit==iDescriptionEdit) label=KDescription(); else label=KTag(); const TDesC& text=Edit->Text()->Read(0).Left(Edit->Text()->Read(0).Length()-1); if (IsActive) { iActive=Edit; iActive->SetFocus(ETrue); if (! text.CompareF(label) ) { Edit->SetTextL(&KNullDesC); } } else { if (iActive) iActive->SetFocus(EFalse); if (text.Length()==0) Edit->SetTextL(&label); iActive=0; } DrawNow(); }
TBool CEmTubeVideoUploadDialog::SaveFormDataL() { TBuf<KUploadVideoMaxFieldLength> data; CEikEdwin* editor; editor = static_cast <CEikEdwin*> (Control(EUploadVideoFieldTitle)); editor->GetText( data ); iQueueEntry->SetTitleL( data ); editor = static_cast <CEikEdwin*> (Control(EUploadVideoFieldDescription)); editor->GetText( data ); iQueueEntry->SetDescriptionL( data ); editor = static_cast <CEikEdwin*> (Control(EUploadVideoFieldTags)); editor->GetText( data ); iQueueEntry->SetTagsL( data ); CAknPopupFieldText* popup = static_cast<CAknPopupFieldText*>(ControlOrNull(EUploadVideoFieldPublic)); switch ( popup->CurrentValueIndex() ) { case 0: iQueueEntry->SetPublic( ETrue ); break; case 1: iQueueEntry->SetPublic( EFalse ); break; } popup = static_cast<CAknPopupFieldText*>(ControlOrNull(EUploadVideoFieldCategory)); iQueueEntry->SetCategory( KCategories[ popup->CurrentValueIndex() ] ); return ETrue; }
TBool CVoIPForm::SaveFormDataL() { CVoIPAppUi* iAppUi = static_cast<CVoIPAppUi*> (iEikonEnv->EikAppUi()); CVoIPDocument* iDocument = static_cast<CVoIPDocument*> (iAppUi->Document()); TInt iModifyIndex = iDocument->ModifyIndex(); RPointerArray<CContact> contacts = iAppUi->GetPhoneBook()->GetContactsL(); if (iModifyIndex >= 0) { CContact* contact = contacts[iModifyIndex]; if (contact) { iAppUi->GetPhoneBook()->DeleteContactItem(contact->GetEntryId()); TContactItemId contactItemId = iAppUi->GetPhoneBook()->CreateDefaultContactItem(); contact->SetEntryId(contactItemId); CPbkContactItem* contactItem = iAppUi->GetPhoneBook()->OpenContactItemLCX(contactItemId); TInt pageId = ActivePageId(); RArray<CEikCaptionedControl*> aControls; ControlsOnPage(aControls, pageId); for (TInt i = 0; i < aControls.Count(); i++) { CEikCaptionedControl* control = ((CEikCaptionedControl*) aControls[i]); TPbkContactItemField* field = contactItem->FindField( control->iId); if (field == NULL) { CPbkFieldInfo* fieldInfo = iAppUi->GetPhoneBook()->GetFieldsInfo().Find( control->iId); contactItem->AddFieldL(*fieldInfo); field = contactItem->FindField(control->iId); } field->SetLabelL(control->GetFullCaptionText()); CPbkFieldInfo& fieldInfo = field->FieldInfo(); if (fieldInfo.CtrlType() == EPbkFieldCtrlTypeDateEditor) { CEikDateEditor* nEditor = static_cast<CEikDateEditor*> (ControlOrNull( control->iId)); TTime time = nEditor->Date(); field->DateTimeStorage()->SetTime(time); } else { CEikEdwin* nEditor = static_cast<CEikEdwin*> (ControlOrNull( control->iId)); HBufC* text = nEditor->GetTextInHBufL(); field->TextStorage()->SetText(text); } } aControls.Reset(); iAppUi->GetPhoneBook()->CommitContactItem(contactItem); CleanupStack::PopAndDestroy(2); //OpenContactItemLCX } } return ETrue; }
// ----------------------------------------------------------------------------- // CLandmarksEditDialog::SaveFormDataL // // (other items were commented in a header). // ----------------------------------------------------------------------------- // TBool CLandmarksEditDialog::SaveFormDataL() { CEikEdwin* editor = NULL; // Fetch name TBuf<KPosLmMaxTextFieldLength> name; editor = static_cast <CEikEdwin*> (Control(ELandmarkNameField)); editor->GetText(name); // Fetch description HBufC* descBuf = HBufC::NewLC(KPosLmMaxDescriptionLength); TPtr desc = descBuf->Des(); editor = static_cast <CEikEdwin*> (Control(ELandmarkDescField)); editor->GetText(desc); // Fetch existing location TLocality existingLocation; TBool locationExists = (iLandmark->GetPosition(existingLocation) == KErrNone); TRealX floatFieldValue; // Fetch Latitude TReal latitude = existingLocation.Latitude(); if (iIsRealValueEdited[ELatitudeEditor] || !locationExists) { FetchFloatL(floatFieldValue, ELandmarkLatitudeField, R_LMREFAPP_LATITUDE_ERROR); floatFieldValue.GetTReal(latitude); } // Fetch Longitude TReal longitude = existingLocation.Longitude(); if (iIsRealValueEdited[ELongitudeEditor] || !locationExists) { FetchFloatL(floatFieldValue, ELandmarkLongitudeField, R_LMREFAPP_LONGITUDE_ERROR); floatFieldValue.GetTReal(longitude); } // Fetch Altitude TReal32 altitude = existingLocation.Altitude(); if (iIsRealValueEdited[EAltitudeEditor] || !locationExists) { FetchFloatL(floatFieldValue, ELandmarkAltitudeField, R_LMREFAPP_ALTITUDE_ERROR); floatFieldValue.GetTReal(altitude); } // Fetch horizontal accuracy TReal32 horAcc = existingLocation.HorizontalAccuracy(); if (iIsRealValueEdited[EHorizontalAccEditor] || !locationExists) { FetchFloatL(floatFieldValue, ELandmarkHorAccField, R_LMREFAPP_HOR_ACC_ERROR); floatFieldValue.GetTReal(horAcc); } // Fetch vertical accuracy TReal32 verAcc = existingLocation.VerticalAccuracy(); if (iIsRealValueEdited[EVerticalAccEditor] || !locationExists) { FetchFloatL(floatFieldValue, ELandmarkVerAccField, R_LMREFAPP_VER_ACC_ERROR); floatFieldValue.GetTReal(verAcc); } // Fetch Coverage Radius TReal32 radius; TInt radiusExists = (iLandmark->GetCoverageRadius(radius) == KErrNone); if (iIsRealValueEdited[ERadiusEditor] || !radiusExists) { FetchFloatL(floatFieldValue, ELandmarkRadiusField, R_LMREFAPP_RADIUS_ERROR); floatFieldValue.GetTReal(radius); } // Fetch street TBuf<KPosLmMaxTextFieldLength> street; editor = static_cast <CEikEdwin*> (Control(ELandmarkStreetField)); editor->GetText(street); // Fetch postal code TBuf<KPosLmMaxTextFieldLength> postalCode; editor = static_cast <CEikEdwin*> (Control(ELandmarkPostalField)); editor->GetText(postalCode); // Fetch city TBuf<KPosLmMaxTextFieldLength> city; editor = static_cast <CEikEdwin*> (Control(ELandmarkCityField)); editor->GetText(city); // Fetch country TBuf<KPosLmMaxTextFieldLength> country; editor = static_cast <CEikEdwin*> (Control(ELandmarkCountryField)); editor->GetText(country); // Update category iLandmark->RemoveLandmarkAttributes(CPosLandmark::ECategoryInfo); for (TInt i = 0; i < iCategoryIds.Count(); i++) { iLandmark->AddCategoryL(iCategoryIds[i]); } // Check that at least some data is entered if (!name.Length() && !desc.Length() && !street.Length() && !city.Length() && !country.Length() && !postalCode.Length() && !iCategoryIds.Count() && Math::IsNaN(latitude) && Math::IsNaN(longitude) && Math::IsNaN(altitude) && Math::IsNaN(radius) && Math::IsNaN(horAcc) && Math::IsNaN(verAcc)) { NotifyErrorToUserL(R_LMREFAPP_EMPTY_LANDMARK); } // Update name iLandmark->SetLandmarkNameL(name); // Update description iLandmark->SetLandmarkDescriptionL(desc); CleanupStack::PopAndDestroy(descBuf); // Update coverage radius if (!Math::IsNaN(radius) && radius < 0) { NotifyErrorToUserL(R_LMREFAPP_RADIUS_ERROR); } iLandmark->SetCoverageRadius(radius); // Update street iLandmark->SetPositionFieldL(EPositionFieldStreet, street); // Update postal code iLandmark->SetPositionFieldL(EPositionFieldPostalCode, postalCode); // Update city iLandmark->SetPositionFieldL(EPositionFieldCity, city); // Update country iLandmark->SetPositionFieldL(EPositionFieldCountry, country); // Update location. There are some rules specified by TLocality and // TCoordinate how to update a location. These rules are taken into // account below when validating the location data. if (Math::IsNaN(latitude) && Math::IsNaN(longitude)) { // If lat long are undefined, then alt and hAcc // must be undefined if (!Math::IsNaN(horAcc)) { NotifyErrorToUserL(R_LMREFAPP_HACC_LAT_LONG_ERROR); } else if (!Math::IsNaN(altitude)) { NotifyErrorToUserL(R_LMREFAPP_ALT_LAT_LONG_ERROR); } else if (!Math::IsNaN(verAcc)) { NotifyErrorToUserL(R_LMREFAPP_VACC_ALT_ERROR); } else { // None position fields are set, Remove position info. iLandmark->RemoveLandmarkAttributes(CPosLandmark::EPosition); } } else if (!Math::IsNaN(latitude) && !Math::IsNaN(longitude)) { // If lat long are defined, hAcc must be positive if defined if (!Math::IsNaN(horAcc) && horAcc < 0) { NotifyErrorToUserL(R_LMREFAPP_HOR_ACC_ERROR); } // if altitude is undefined, then vertical accuracy // must be undefined if (Math::IsNaN(altitude) && !Math::IsNaN(verAcc)) { NotifyErrorToUserL(R_LMREFAPP_VACC_ALT_ERROR); } // vertical accuracy must be positive if defined if (!Math::IsNaN(verAcc) && verAcc < 0) { NotifyErrorToUserL(R_LMREFAPP_VER_ACC_ERROR); } // We are allowed to set the new locality TCoordinate coordinate(latitude, longitude, altitude); TLocality newLocation(coordinate, horAcc, verAcc); iLandmark->SetPositionL(newLocation); } else { // Inform user that no valid lat/long has been entered NotifyErrorToUserL(R_LMREFAPP_LAT_LONG_ERROR); } iEdited = ETrue; return ETrue; }
void CVoIPForm::LoadFormValuesFromDataL() { TInt pageId = ActivePageId(); // Delete all controls not saved. RArray<CEikCaptionedControl*> aControls; ControlsOnPage(aControls, pageId); for (TInt i = 0; i < aControls.Count(); i++) { CEikCaptionedControl* control = ((CEikCaptionedControl*) aControls[i]); DeleteLine(control->iId, EFalse); } aControls.Reset(); // Create controls based on PhoneBook contact item. CVoIPAppUi* iAppUi = static_cast<CVoIPAppUi*> (iEikonEnv->EikAppUi()); CVoIPDocument* iDocument = static_cast<CVoIPDocument*> (iAppUi->Document()); TInt iModifyIndex = iDocument->ModifyIndex(); RPointerArray<CContact> contacts = iAppUi->GetPhoneBook()->GetContactsL(); if (iModifyIndex >= 0) { CContact* contact = contacts[iModifyIndex]; if (contact) { CPbkContactItem* contactItem = iAppUi->GetPhoneBook()->ReadContactItemLC( contact->GetEntryId()); CPbkFieldArray& fieldArray = contactItem->CardFields(); for (TInt i = 0; i < fieldArray.Count(); i++) { TPbkContactItemField field = fieldArray[i]; if (field.IsEmpty() == EFalse) { CPbkFieldInfo& fieldInfo = field.FieldInfo(); TInt id = fieldInfo.FieldId(); TAny* unused = 0; if (fieldInfo.CtrlType() == EPbkFieldCtrlTypeTextEditor) { TInt type = EEikCtEdwin; CEikEdwin * nEditor = static_cast<CEikEdwin*> (ControlOrNull(id)); if (!nEditor) { CEikEdwin* edwin = (CEikEdwin*) CreateLineByTypeL( field.Label(), pageId, id, type, unused); edwin->ConstructL(EEikEdwinNoHorizScrolling | EEikEdwinResizable, 10, 100, 1); edwin->SetTextL(&(field.Text())); } } else if (fieldInfo.CtrlType() == EPbkFieldCtrlTypeNumberEditor) { TInt type = EAknCtIntegerEdwin; CAknNumericEdwin * nEditor = static_cast<CAknNumericEdwin*> (ControlOrNull( id)); if (!nEditor) { CAknNumericEdwin* edwin = (CAknNumericEdwin*) CreateLineByTypeL( field.Label(), pageId, id, type, unused); edwin->ConstructL(EEikEdwinNoHorizScrolling | EEikEdwinResizable, 10, 100, 1); edwin->SetTextL(&(field.Text())); } } else if (fieldInfo.CtrlType() == EPbkFieldCtrlTypeDateEditor) { TInt type = EEikCtDateEditor; CEikDateEditor * nEditor = static_cast<CEikDateEditor*> (ControlOrNull( id)); if (!nEditor) { CEikDateEditor* editor = (CEikDateEditor*) CreateLineByTypeL( field.Label(), pageId, id, type, unused); editor->ConstructL(TTime(mindateTime), TTime( maxdateTime), field.DateTimeStorage()->Time(), ETrue); } Line(id)->ActivateL(); } } } SetChangesPending(ETrue); UpdatePageL(ETrue); CleanupStack::PopAndDestroy(); //contactItem } } }
void CVoIPForm::ProcessCommandL(TInt aCommandId) { CAknForm::ProcessCommandL(aCommandId); switch (aCommandId) { case EVoIPEditMenuItemCommand: { CAknForm::ProcessCommandL(EAknFormCmdEdit); break; } case EVoIPAddMenuItemCommand: { CAknForm::ProcessCommandL(EAknFormCmdAdd); CVoIPAppUi* iAppUi = static_cast<CVoIPAppUi*> (iEikonEnv->EikAppUi()); const CPbkFieldsInfo& fieldsInfo = iAppUi->GetPhoneBook()->GetFieldsInfo(); const TInt count = fieldsInfo.Count(); CDesCArray* list = new (ELeave) CDesCArrayFlat(count); CleanupStack::PushL(list); CArrayFixFlat<TInt>* correspondence = new (ELeave) CArrayFixFlat< TInt> (count); CleanupStack::PushL(correspondence); for (TInt i = 0; i < count; ++i) { CPbkFieldInfo* fieldInfo = fieldsInfo[i]; const TDesC* fieldName = &(fieldInfo->FieldName()); if (fieldName->Length() > 0) { _LIT(KFormat, "\t%S"); TBuf<256> fieldStr; fieldStr.Format(KFormat, fieldName); list->AppendL(fieldStr); correspondence->AppendL(i); } } TInt selectedIndex; CAknSelectionListDialog* dialog = CAknSelectionListDialog::NewL( selectedIndex, list, 0); if (dialog->ExecuteLD(R_LIST_DIALOG)) { CPbkFieldInfo* fieldInfo = fieldsInfo[(*correspondence)[selectedIndex]]; const TDesC& fieldName = fieldInfo->FieldName(); TInt id = fieldInfo->FieldId(); TInt pageId = ActivePageId(); TAny* unused = 0; if (fieldInfo->EditMode() == EPbkFieldEditModeAlpha) { TInt type = EEikCtEdwin; CEikEdwin* editor = (CEikEdwin*) CreateLineByTypeL( fieldName, pageId, id, type, unused); editor->ConstructL(EEikEdwinNoHorizScrolling | EEikEdwinResizable, 10, 100, 1); } else if (fieldInfo->EditMode() == EPbkFieldEditModeNumeric) { TInt type = EEikCtEdwin; CEikEdwin* editor = (CEikEdwin*) CreateLineByTypeL( fieldName, pageId, id, type, unused); editor->SetAknEditorInputMode(EAknEditorNumericInputMode); editor->SetAknEditorAllowedInputModes( EAknEditorNumericInputMode); editor->ConstructL(EEikEdwinNoHorizScrolling | EEikEdwinResizable, 10, 100, 1); } else if (fieldInfo->EditMode() == EPbkFieldEditModeDate) { TInt type = EEikCtDateEditor; CEikDateEditor* editor = (CEikDateEditor*) CreateLineByTypeL(fieldName, pageId, id, type, unused); editor->ConstructL(TTime(mindateTime), TTime(maxdateTime), TTime(nowdateTime), ETrue); } Line(id)->ActivateL(); SetChangesPending(ETrue); UpdatePageL(ETrue); } CleanupStack::PopAndDestroy(2); // list, correspondence break; } default: { CVoIPAppUi* iAppUi = static_cast<CVoIPAppUi*> (iEikonEnv->EikAppUi()); CVoIPListBoxView* iView = static_cast<CVoIPListBoxView*> (iAppUi->View(TUid::Uid( EVoIPListBoxViewId))); iView->HandleCommandL(aCommandId); break; } } }
void CLandmarksEditDialog::ConfigureTextFieldL(TInt aId, const TDesC& aText) { CEikEdwin* editor = static_cast<CEikEdwin*>(Control(aId)); editor->SetTextL(&aText); }
void CUploadContainer::ConstructL(const TRect& aRect) { CALLSTACKITEM_N(_CL("CUploadContainer"), _CL("ConstructL")); iControls=new (ELeave) CArrayPtrFlat< CCoeControl >(10); CreateWindowL(); TRect r(TPoint(5, 5), TSize(aRect.Width()-10, 1)); if (iFileName.Right(3).CompareF(_L("jpg"))==0) { #ifndef __S60V2__ iMdaServer=CMdaServer::NewL(); iFileUtil=CMdaImageFileToBitmapUtility::NewL(*this, iMdaServer); #else iFileUtil=CMdaImageFileToBitmapUtility::NewL(*this, 0); #endif iFileUtil->OpenL(iFileName); scaled=false; iImgPlaceHolder=new (ELeave) CEikLabel; iControls->AppendL(iImgPlaceHolder); iImgPlaceHolder->SetContainerWindowL( *this ); iImgPlaceHolder->SetFont(iEikonEnv->DenseFont()); iImgPlaceHolder->SetTextL( _L("loading image...") ); r.SetHeight(IMG_HEIGHT); iImgPlaceHolder->SetRect(r); r.Move(0, r.Height()+4); } else { r.SetHeight(IMG_HEIGHT); r.Move(0, r.Height()+4); } TInt tagw=0; /* iTagLabel=new (ELeave) CEikLabel; iControls->AppendL(iTagLabel); iTagLabel->SetContainerWindowL( *this ); iTagLabel->SetTextL( _L("Tag:") ); r.SetHeight(12); iTagLabel->SetRect(r); tagw=iTagLabel->MinimumSize().iWidth+4; r.Move( tagw , 0); r.SetWidth(r.Width()-tagw); */ TBuf<100> tag; Settings().GetSettingL(SETTING_UPLOAD_TAG, tag); if (tag.Length() == 0) tag=KTag(); iTagEdit=new (ELeave) CEikEdwin; iControls->AppendL(iTagEdit); iTagEdit->SetContainerWindowL( *this ); iTagEdit->ConstructL(); iTagEdit->SetTextL(&tag); iTagEdit->AddEdwinObserverL(this); r.SetHeight(16); iTagEdit->SetRect(r); iTagEdit->ActivateL(); r.Move(-tagw, r.Height()+4); r.SetWidth(r.Width()+tagw); TBool no_descr; if (iTagOnly) no_descr=true; else no_descr=false; if (!no_descr) { TInt height=56; /* iDescriptionLabel=new (ELeave) CEikLabel; iControls->AppendL(iDescriptionLabel); iDescriptionLabel->SetContainerWindowL( *this ); iDescriptionLabel->SetTextL( _L("Description:") ); r.SetHeight(12); iDescriptionLabel->SetRect(r); r.Move(0, r.Height()+4); height-=16; */ r.Move(0, 2); iDescriptionEdit=new (ELeave) CEikEdwin; iControls->AppendL(iDescriptionEdit); iDescriptionEdit->SetContainerWindowL( *this ); iDescriptionEdit->ConstructL(); iDescriptionEdit->AddEdwinObserverL(this); iDescriptionEdit->SetTextL(&(KDescription())); r.SetHeight(height); iDescriptionEdit->SetRect(r); r.Move(0, r.Height()+4); SetEditSelected(iDescriptionEdit, true); SetEditActive(iDescriptionEdit, true); } else { SetEditSelected(iTagEdit, true); SetEditActive(iTagEdit, true); } SetRect(aRect); ActivateL(); }
void CCustomWrapAppControl::SetCustomWrapOnL() { iEdwin->TextLayout()->SetCustomWrap(iStandardCustomWrap); ReformatL(); }
TBool CCreate2WayVideoSessionDialog::OkToExitL( TInt aKey ) { if ( aKey == EEikCmdCanceled ) { // Cancel pressed. Just exit. return ETrue; } CEikEdwin* edwinRecipientAddress = static_cast<CEikEdwin*>( Control( ESessionDialog2WayVideoRecipientAddress ) ); TBuf<KBufLength> buffer; edwinRecipientAddress->GetText(buffer); iParams->iRecipentAddress = buffer; CAknPopupFieldText* popupFieldText = static_cast <CAknPopupFieldText*> (Control(ESessionDialog2WayVideoVideoCodec)); TInt index = popupFieldText->CurrentValueIndex(); if(index == 0) { iParams->iVideoCodec = TSessionParams::EMceCodecSingle; } else if ( index == 1 ) { iParams->iVideoCodec = TSessionParams::EMceCodecAll; } else { iParams->iVideoCodec = TSessionParams::EMceCodecMultipleModes; } popupFieldText = static_cast <CAknPopupFieldText*> (Control(ESessionDialog2WayVideoAudioCodec)); index = popupFieldText->CurrentValueIndex(); if(index == 0) { iParams->iAudioCodec = TSessionParams::EMceCodecSingle; } else if (index == 1) { iParams->iAudioCodec = TSessionParams::EMceCodecAll; } else { iParams->iAudioCodec = TSessionParams::EMceCodecNone; } popupFieldText = static_cast <CAknPopupFieldText*> (Control(ESessionDialog2WayVideoViewFinder)); index = popupFieldText->CurrentValueIndex(); if(index == 0) { iParams->videoSinkDisplay = TSessionParams::EMceViewFinderDisabled; } else { iParams->videoSinkDisplay = TSessionParams::EMceViewFinderEnabled; } popupFieldText = static_cast <CAknPopupFieldText*> (Control(ESessionDialog2WayVideoCamera)); index = popupFieldText->CurrentValueIndex(); if(index == 0) { iParams->iCameraSetting = TSessionParams::EMceCameraPrimary; } else { iParams->iCameraSetting = TSessionParams::EMceCameraSecondary; } return ETrue; }
void CCustomWrapAppControl::SetCustomWrapCustomL() { iEdwin->TextLayout()->SetCustomWrap(&iCustomCustomWrap); ReformatL(); }
void CCustomWrapAppControl::SetCustomWrapOffL() { iEdwin->TextLayout()->SetCustomWrap(0); ReformatL(); }
void CCustomWrapAppControl::ReformatL() { iEdwin->NotifyNewFormatL(); }