diff -r 000000000000 -r e686773b3f54 phonebookui/Phonebook2/UIControls/src/CPbk2ContactEditorFieldBase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/phonebookui/Phonebook2/UIControls/src/CPbk2ContactEditorFieldBase.cpp Tue Feb 02 10:12:17 2010 +0200 @@ -0,0 +1,174 @@ +/* +* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Phonebook 2 contact editor field base class. +* +*/ + + +#include "CPbk2ContactEditorFieldBase.h" + +// Phonebook 2 +#include "MPbk2ContactEditorUiBuilder.h" +#include +#include + +// Virtual Phonebook +#include +#include +#include +#include +#include + +// System includes +#include + +// ----------------------------------------------------------------------------- +// CPbk2ContactEditorFieldBase::CPbk2ContactEditorFieldBase +// ----------------------------------------------------------------------------- +// +CPbk2ContactEditorFieldBase::CPbk2ContactEditorFieldBase + ( CPbk2PresentationContactField& aContactField, + MPbk2ContactEditorUiBuilder& aUiBuilder, + CPbk2IconInfoContainer& aIconInfoContainer ) : + iContactField( aContactField ), + iUiBuilder( aUiBuilder ), + iIconInfoContainer( aIconInfoContainer ), + iContactDataHasChanged( EFalse ) + { + } + +// ----------------------------------------------------------------------------- +// CPbk2ContactEditorFieldBase::~CPbk2ContactEditorFieldBase +// ----------------------------------------------------------------------------- +// +CPbk2ContactEditorFieldBase::~CPbk2ContactEditorFieldBase() + { + } + +// ----------------------------------------------------------------------------- +// CPbk2ContactEditorFieldBase::ControlId +// ----------------------------------------------------------------------------- +// +TInt CPbk2ContactEditorFieldBase::ControlId() const + { + return ( TInt ) this; + } + +// ----------------------------------------------------------------------------- +// CPbk2ContactEditorFieldBase::ContactEditorFieldExtension +// ----------------------------------------------------------------------------- +// +TAny* CPbk2ContactEditorFieldBase::ContactEditorFieldExtension(TUid aExtensionUid ) + { + if( aExtensionUid == KMPbk2ContactEditorFieldExtension2Uid ) + { + return static_cast( this ); + } + + return NULL; + } +// CPbk2ContactEditorFieldBase::HandleCustomFieldCommandL +// ----------------------------------------------------------------------------- +// +TBool CPbk2ContactEditorFieldBase::HandleCustomFieldCommandL(TInt /*aCommand*/ ) + { + return EFalse; + } + +// ----------------------------------------------------------------------------- +// CPbk2ContactEditorFieldBase::FieldDataChanged +// ----------------------------------------------------------------------------- +// +TBool CPbk2ContactEditorFieldBase::FieldDataChanged() const + { + return iContactDataHasChanged; + } + +// ----------------------------------------------------------------------------- +// CPbk2ContactEditorFieldBase::FieldLabel +// ----------------------------------------------------------------------------- +// +TPtrC CPbk2ContactEditorFieldBase::FieldLabel() const + { + return iContactField.FieldLabel(); + } + +// ----------------------------------------------------------------------------- +// CPbk2ContactEditorFieldBase::SetFieldLabelL +// ----------------------------------------------------------------------------- +// +void CPbk2ContactEditorFieldBase::SetFieldLabelL( const TDesC& aLabel ) + { + iUiBuilder.SetCurrentLineCaptionL( aLabel ); + iContactField.SetFieldLabelL( aLabel ); + } + +// ----------------------------------------------------------------------------- +// CPbk2ContactEditorFieldBase::ControlTextL +// ----------------------------------------------------------------------------- +// +HBufC* CPbk2ContactEditorFieldBase::ControlTextL() const + { + HBufC* textBuf = NULL; + + CCoeControl* ctrl = iUiBuilder.Control( ControlId() ); + TVPbkFieldStorageType fType = iContactField.FieldData().DataType(); + if ( ctrl && ( ( fType == EVPbkFieldStorageTypeText ) || + (fType == EVPbkFieldStorageTypeUri) ) ) + { + textBuf = static_cast( ctrl )->GetTextInHBufL(); + } + + return textBuf; + } + +// ----------------------------------------------------------------------------- +// CPbk2ContactEditorFieldBase::SetFocus +// ----------------------------------------------------------------------------- +// +void CPbk2ContactEditorFieldBase::SetFocus() + { + // It's not fatal if focusing fails + TRAP_IGNORE( iUiBuilder.TryChangeFocusL( ControlId() ) ); + } + +// ----------------------------------------------------------------------------- +// CPbk2ContactEditorFieldBase::ContactField +// ----------------------------------------------------------------------------- +// +MVPbkStoreContactField& CPbk2ContactEditorFieldBase::ContactField() const + { + return iContactField.StoreField(); + } + +// ----------------------------------------------------------------------------- +// CPbk2ContactEditorFieldBase::FieldProperty +// ----------------------------------------------------------------------------- +// +const MPbk2FieldProperty& CPbk2ContactEditorFieldBase::FieldProperty() const + { + return iContactField.FieldProperty(); + } + +// ----------------------------------------------------------------------------- +// CPbk2ContactEditorFieldBase::ConsumesKeyEvent +// ----------------------------------------------------------------------------- +// +TBool CPbk2ContactEditorFieldBase::ConsumesKeyEvent + ( const TKeyEvent& /*aKeyEvent*/, TEventCode /*aType*/ ) + { + return EFalse; + } + +// End of File