phonebookui/Phonebook2/inc/CPbk2PresentationContactField.h
changeset 0 e686773b3f54
equal deleted inserted replaced
-1:000000000000 0:e686773b3f54
       
     1 /*
       
     2 * Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Phonebook 2 presentation level contact field.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CPBK2PRESENTATIONCONTACTFIELD_H
       
    20 #define CPBK2PRESENTATIONCONTACTFIELD_H
       
    21 
       
    22 //  INCLUDES
       
    23 #include <e32base.h>
       
    24 #include <MVPbkStoreContactField.h>
       
    25 
       
    26 // FORWARD DECLARATIONS
       
    27 class MPbk2FieldProperty;
       
    28 class MVPbkStoreContact;
       
    29 class MVPbkContactFieldData;
       
    30 
       
    31 // CLASS DECLARATION
       
    32 
       
    33 /**
       
    34  * Phonebook 2 presentation level contact field.
       
    35  */
       
    36 class CPbk2PresentationContactField : public CBase,
       
    37                                       public MVPbkStoreContactField
       
    38     {
       
    39     public: // Constructors and destructor
       
    40 
       
    41         /**
       
    42          * Creates a new instance of this class.
       
    43          *
       
    44          * @param aFieldProperty    Phonebook 2 field property.
       
    45          * @param aStoreField       The field from the contact store.
       
    46          * @param aParentContact    The parent contact of the field.
       
    47          * @return  A new instance of this class.
       
    48          */
       
    49         IMPORT_C static CPbk2PresentationContactField* NewL(
       
    50                 const MPbk2FieldProperty& aFieldProperty,
       
    51                 const MVPbkStoreContactField& aStoreField,
       
    52                 MVPbkStoreContact& aParentContact );
       
    53 
       
    54         /**
       
    55          * Creates a new instance of this class.
       
    56          *
       
    57          * @param aFieldProperty    Phonebook 2 field property.
       
    58          * @param aStoreField       The field from the contact store.
       
    59          * @param aParentContact    The parent contact of the field.
       
    60          * @return  A new instance of this class.
       
    61          */
       
    62         IMPORT_C static CPbk2PresentationContactField* NewLC(
       
    63                 const MPbk2FieldProperty& aFieldProperty,
       
    64                 const MVPbkStoreContactField& aStoreField,
       
    65                 MVPbkStoreContact& aParentContact );
       
    66 
       
    67         /**
       
    68          * Destructor.
       
    69          */
       
    70         ~CPbk2PresentationContactField();
       
    71 
       
    72     public: // Interface
       
    73 
       
    74         /**
       
    75          * Returns the maximum length of the field data.
       
    76          *
       
    77          * @return  Maximum length of field data.
       
    78          */
       
    79         IMPORT_C TInt MaxDataLength() const;
       
    80 
       
    81         /**
       
    82          * Checks if the field contains data.
       
    83          *
       
    84          * @return  ETrue if the field doesn't contain data.
       
    85          */
       
    86         IMPORT_C TBool IsEmpty() const;
       
    87 
       
    88         /**
       
    89          * Checks is the field editable.
       
    90          *
       
    91          * @return  ETrue if the field can be edited.
       
    92          */
       
    93         IMPORT_C TBool IsEditable() const;
       
    94 
       
    95         /**
       
    96          * Checks is the field removable.
       
    97          *
       
    98          * @return  ETrue if the field can not be removed from the
       
    99          *          contact. This is a static property of the field.
       
   100          */
       
   101         IMPORT_C TBool IsRemovable() const;
       
   102 
       
   103         /**
       
   104          * Checks is the visible in contact details view.
       
   105          *
       
   106          * @return  ETrue if the contact is visible in contact details view.
       
   107          */
       
   108         IMPORT_C TBool IsVisibleInDetailsView() const;
       
   109         
       
   110         /**
       
   111          * Sets field's dynamic visibility.
       
   112          *
       
   113          * @param aVisibility Dynamic Visibility.
       
   114          */
       
   115         IMPORT_C void SetDynamicVisibility( TBool aVisibility );
       
   116 
       
   117         /**
       
   118          * Gets field's dynamic visibility.
       
   119          *
       
   120          * @return Dynamic Visibility.
       
   121          */
       
   122         IMPORT_C TBool DynamicVisibility();
       
   123 
       
   124         /**
       
   125          * Returns the field's property.
       
   126          *
       
   127          * @return  The field's property.
       
   128          */
       
   129         inline const MPbk2FieldProperty& FieldProperty() const;
       
   130 
       
   131         /**
       
   132          * Returns corresponding store contact field.
       
   133          *
       
   134          * @return T    he contact store field.
       
   135          */
       
   136         inline MVPbkStoreContactField& StoreField() const;
       
   137 
       
   138     public: // From MVPbkObjectHierarchy
       
   139         MVPbkObjectHierarchy& ParentObject() const;
       
   140 
       
   141     public: // From MVPbkBaseContactField
       
   142         MVPbkBaseContact& ParentContact() const;
       
   143         const MVPbkFieldType* MatchFieldType(
       
   144                 TInt aMatchPriority ) const;
       
   145         const MVPbkFieldType* BestMatchingFieldType() const;
       
   146         const MVPbkContactFieldData& FieldData() const;
       
   147         TBool IsSame(
       
   148                 const MVPbkBaseContactField& aOther ) const;
       
   149 
       
   150     public: // From MVPbkStoreContactField
       
   151         TBool SupportsLabel() const;
       
   152         TPtrC FieldLabel() const;
       
   153         void SetFieldLabelL(
       
   154                 const TDesC& aText );
       
   155         TInt MaxLabelLength() const;
       
   156         MVPbkContactFieldData& FieldData();
       
   157         MVPbkStoreContactField* CloneLC() const;
       
   158         MVPbkContactLink* CreateLinkLC() const;
       
   159 
       
   160     private: // Construction
       
   161         CPbk2PresentationContactField(
       
   162                 const MPbk2FieldProperty& aFieldProperty,
       
   163                 MVPbkStoreContact& aParentContact );
       
   164         void ConstructL(
       
   165                 const MVPbkStoreContactField& aStoreField );
       
   166 
       
   167     private: // Data
       
   168         /// Ref: Phonebook 2 field property
       
   169         const MPbk2FieldProperty& iFieldProperty;
       
   170         /// Own: The field that is used to access actual field data
       
   171         MVPbkStoreContactField* iStoreField;
       
   172         /// Ref: The parent contact of the field
       
   173         MVPbkStoreContact& iParentContact;
       
   174         /// Ref: Presentation contact field text data
       
   175         MVPbkContactFieldData* iData;
       
   176         /// Own: Field's dynamic visibility.
       
   177         TBool iDynamicVisibility;
       
   178     };
       
   179 
       
   180 
       
   181 // INLINE IMPLEMENTATION
       
   182 
       
   183 // --------------------------------------------------------------------------
       
   184 // CPbk2PresentationContactField::FieldProperty
       
   185 // --------------------------------------------------------------------------
       
   186 //
       
   187 inline const MPbk2FieldProperty&
       
   188         CPbk2PresentationContactField::FieldProperty() const
       
   189     {
       
   190     return iFieldProperty;
       
   191     }
       
   192 
       
   193 // --------------------------------------------------------------------------
       
   194 // CPbk2PresentationContactField::StoreField
       
   195 // --------------------------------------------------------------------------
       
   196 //
       
   197 inline MVPbkStoreContactField&
       
   198         CPbk2PresentationContactField::StoreField() const
       
   199     {
       
   200     return *iStoreField;
       
   201     }
       
   202 
       
   203 #endif // CPBK2PRESENTATIONCONTACTFIELD_H
       
   204 
       
   205 // End of File