epoc32/include/app/MVPbkStoreContactField.h
branchSymbian3
changeset 4 837f303aceeb
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/app/MVPbkStoreContactField.h	Wed Mar 31 12:33:34 2010 +0100
     1.3 @@ -0,0 +1,158 @@
     1.4 +/*
     1.5 +* Copyright (c) 2004-2007 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +* All rights reserved.
     1.7 +* This component and the accompanying materials are made available
     1.8 +* under the terms of "Eclipse Public License v1.0"
     1.9 +* which accompanies this distribution, and is available
    1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.11 +*
    1.12 +* Initial Contributors:
    1.13 +* Nokia Corporation - initial contribution.
    1.14 +*
    1.15 +* Contributors:
    1.16 +*
    1.17 +* Description:  An interface for the field of the store contact
    1.18 +*
    1.19 +*/
    1.20 +
    1.21 +#ifndef MVPBKSTORECONTACTFIELD_H
    1.22 +#define MVPBKSTORECONTACTFIELD_H
    1.23 +
    1.24 +// INCLUDES
    1.25 +#include <e32std.h>
    1.26 +#include <mvpbkbasecontactfield.h>
    1.27 +
    1.28 +// CONSTANTS
    1.29 +/// A constant that indicates that the store doesn't set limits
    1.30 +/// to the length of the label
    1.31 +const TInt KVPbkUnlimitedLabelLength = -1;
    1.32 +
    1.33 +// FORWARD DECLARATIONS
    1.34 +class MVPbkContactLink;
    1.35 +
    1.36 +// CLASS DECLARATIONS
    1.37 +
    1.38 +/**
    1.39 + * An interface for the field of the store contact.
    1.40 + *
    1.41 + * Client can access the contact field using this interface. The field
    1.42 + * can have a label and a data.
    1.43 + *
    1.44 + * A new field can be created using the MVPbkStoreContact interface.
    1.45 + * For looping the contact fields see MVPbkStoreContactFieldCollection.
    1.46 + * The parent of the field in the object hierarchy is the store contact.
    1.47 + *
    1.48 + * @see CVPbkContactFieldTypeIterator
    1.49 + * @see CVPbkFieldTypeSelector
    1.50 + */
    1.51 +class MVPbkStoreContactField : public MVPbkBaseContactField,
    1.52 +                               public MVPbkObjectHierarchy
    1.53 +    {
    1.54 +    public:  // Destructor
    1.55 +        /**
    1.56 +         * Destructor
    1.57 +         */
    1.58 +        virtual ~MVPbkStoreContactField() { }
    1.59 +
    1.60 +    public: // From MVPbkBaseContactField
    1.61 +        virtual const MVPbkContactFieldData& FieldData() const = 0;
    1.62 +
    1.63 +    public:  // New functions
    1.64 +        /**
    1.65 +         * Returns ETrue if the field supports label.
    1.66 +         *
    1.67 +         * Overwrites the global setting in MVPbkContactStoreProperties.
    1.68 +         * This must be confirmed before using SetFieldLabelL or
    1.69 +         * MaxLabelLength.
    1.70 +         *
    1.71 +         * @return ETrue if the field supports label. Otherwise EFalse.
    1.72 +         */
    1.73 +        virtual TBool SupportsLabel() const = 0;
    1.74 +
    1.75 +        /**
    1.76 +         * Returns the label of the field or KNullDesC if there is no field
    1.77 +         * label.
    1.78 +         *
    1.79 +         * @return The label of the field or KNullDesC
    1.80 +         */
    1.81 +        virtual TPtrC FieldLabel() const = 0;
    1.82 +
    1.83 +        /**
    1.84 +         * Sets this field's label.
    1.85 +         *
    1.86 +         * SupportsLabel must be true for using this.
    1.87 +         *
    1.88 +         * @param aText The label for the field.
    1.89 +         */
    1.90 +        virtual void SetFieldLabelL( const TDesC& aText ) = 0;
    1.91 +
    1.92 +        /**
    1.93 +         * Gets the maximum length of the label.
    1.94 +         *
    1.95 +         * SupportsLabel must be true for using this.
    1.96 +         *
    1.97 +         * @return The maximum length of the label or KVPbkUnlimitedLabelLength
    1.98 +         *         if the store has no limits. Zero should be returned in other
    1.99 +         *         cases though this shouldn't be called if labels are
   1.100 +         *         not supported.
   1.101 +         */
   1.102 +        virtual TInt MaxLabelLength() const = 0;
   1.103 +
   1.104 +        /**
   1.105 +         * Returns the data storage (read-write) of the field.
   1.106 +         *
   1.107 +         * The data type depends on the field and it's client's responsibility
   1.108 +         * to check the type before casting the type.
   1.109 +         *
   1.110 +         * @return The data storage of the field.
   1.111 +         * @see MVPbkContactFieldTextData::Cast
   1.112 +         * @see MVPbkContactFieldDateTimeData::Cast
   1.113 +         * @see MVPbkContactFieldBinaryData::Cast
   1.114 +         */
   1.115 +        virtual MVPbkContactFieldData& FieldData() = 0;
   1.116 +
   1.117 +        /**
   1.118 +         * Clones the field.
   1.119 +         *
   1.120 +         * Pushes the created copy to the cleanup stack.
   1.121 +         *
   1.122 +         * @return A copy of the field.
   1.123 +         * @see MVPbkStoreContactFieldCollection::FieldAt
   1.124 +         */
   1.125 +        virtual MVPbkStoreContactField* CloneLC() const = 0;
   1.126 +
   1.127 +        /**
   1.128 +         * Creates a link representing the contact and the field.
   1.129 +         *
   1.130 +         * The field can be later retrieved using the RetrieveField of
   1.131 +         * MVPbkStoreContactFieldCollection interface.
   1.132 +         *
   1.133 +         * NOTE: implementations of stores are possibly using an index
   1.134 +         *       of the field as an identifier so clients should prefer not
   1.135 +         *       to save field links permanently. E.g modifying the contact
   1.136 +         *       can invalidate the link in some store implementations.
   1.137 +         *       A field link is practical in use cases where the link is
   1.138 +         *       created and immediately given to another component.
   1.139 +         *
   1.140 +         * @return A link representing the contact and the field or NULL
   1.141 +         *         if the contact doesn't exist in the store. E.g a new
   1.142 +         *         contact that hasn't been committed has no unique
   1.143 +         *         identifier yet.
   1.144 +         *         NULL is not put into the CleanupStack.
   1.145 +         */
   1.146 +        virtual MVPbkContactLink* CreateLinkLC() const = 0;
   1.147 +
   1.148 +        /**
   1.149 +         * Returns an extension point for this interface or NULL.
   1.150 +         *
   1.151 +         * @param aExtensionUid no extensions defined currently.
   1.152 +         * @return An extension point for this interface or NULL.
   1.153 +         */
   1.154 +        virtual TAny* StoreContactFieldExtension( TUid /*aExtensionUid*/ )
   1.155 +            { return NULL; }
   1.156 +    };
   1.157 +
   1.158 +
   1.159 +#endif  // MVPBKSTORECONTACTFIELD_H
   1.160 +
   1.161 +// End of file