1.1 --- a/epoc32/include/app/tpbkcontactitemfield.h Tue Nov 24 13:55:44 2009 +0000
1.2 +++ b/epoc32/include/app/tpbkcontactitemfield.h Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -1,1 +1,332 @@
1.4 -tpbkcontactitemfield.h
1.5 +/*
1.6 +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
1.7 +* All rights reserved.
1.8 +* This component and the accompanying materials are made available
1.9 +* under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
1.10 +* which accompanies this distribution, and is available
1.11 +* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.12 +*
1.13 +* Initial Contributors:
1.14 +* Nokia Corporation - initial contribution.
1.15 +*
1.16 +* Contributors:
1.17 +*
1.18 +* Description:
1.19 +* This class extends Symbian Contacts model CContactItemField class capabilities
1.20 +* to better suit Phonebook's needs.
1.21 +*
1.22 +*/
1.23 +
1.24 +
1.25 +#ifndef __TPbkContactItemField_H__
1.26 +#define __TPbkContactItemField_H__
1.27 +
1.28 +// INCLUDES
1.29 +#include <e32std.h>
1.30 +#include "MPbkFieldData.h"
1.31 +#include <cntdef.h> // TStorageType
1.32 +#include "PbkIconId.hrh"
1.33 +
1.34 +// These two includes are not needed here anymore
1.35 +// and might be removed in the future
1.36 +#include <cntitem.h> // CContactItem
1.37 +#include <cntfldst.h> // CContactItemField storage types
1.38 +
1.39 +
1.40 +// FORWARD DECLARATIONS
1.41 +class CPbkFieldInfo;
1.42 +class CContactItemField;
1.43 +class CContactTextField;
1.44 +class CPbkContactItem;
1.45 +class CContactDateField;
1.46 +
1.47 +
1.48 +// CLASS DECLARATION
1.49 +
1.50 +/**
1.51 + * Phonebook Contact item field class.
1.52 + * This class extends Symbian Contacts model CContactItemField class
1.53 + * capabilities to better suit Phonebook's needs.
1.54 + */
1.55 +class TPbkContactItemField : public MPbkFieldData
1.56 + {
1.57 + public: // Constructors and destructor
1.58 + /**
1.59 + * C++ default constructor.
1.60 + */
1.61 + IMPORT_C TPbkContactItemField();
1.62 +
1.63 + /**
1.64 + * C++ constructor.
1.65 + *
1.66 + * @param aField Contacts Model field this object is wrapping.
1.67 + * @param aFieldInfo Phonebook field type of aField.
1.68 + */
1.69 + IMPORT_C TPbkContactItemField(CContactItemField* aField,
1.70 + CPbkFieldInfo* aFieldInfo);
1.71 +
1.72 + /**
1.73 + * Sets the contents of this object after construction.
1.74 + * @param aField Contacts Model field this object is wrapping
1.75 + * @param aFieldInfo Phonebook field type of aField
1.76 + */
1.77 + IMPORT_C void Set(CContactItemField* aField,
1.78 + CPbkFieldInfo* aFieldInfo);
1.79 +
1.80 + public: // New functions
1.81 + /**
1.82 + * Returns an Phonebook icon id for this field.
1.83 + * @return The Phonebook icon id for this field.
1.84 + */
1.85 + IMPORT_C TPbkIconId IconId() const;
1.86 +
1.87 + /**
1.88 + * Returns the Phonebook field info object of this field.
1.89 + * @return Field info for this field.
1.90 + */
1.91 + IMPORT_C CPbkFieldInfo& FieldInfo() const;
1.92 +
1.93 + /**
1.94 + * Returns this field's textual content.
1.95 + * @return This field's textual content.
1.96 + * @precond StorageType()==KStorageTypeText.
1.97 + */
1.98 + IMPORT_C TPtrC Text() const;
1.99 +
1.100 + /**
1.101 + * Returns this field's date/time content.
1.102 + * @return This field's date/time content.
1.103 + * @precond StorageType()==KStorageTypeDateTime.
1.104 + */
1.105 + IMPORT_C TTime Time() const;
1.106 +
1.107 + /**
1.108 + * Fills aText with field's text content. If field is of date
1.109 + * type formats the date as text.
1.110 + * @param aText Fills parameter with field's content.
1.111 + *
1.112 + * @exception KErrOverflow if aText is not big enough for
1.113 + * the text. aText contents will be clipped to aText.MaxLength().
1.114 + * @exception KErrNotSupported if the field content cannot be
1.115 + * represented as text.
1.116 + */
1.117 + IMPORT_C void GetTextL(TDes& aText) const;
1.118 +
1.119 + /**
1.120 + * Returns the storage type of this field.
1.121 + * @return The storage type of this field.
1.122 + */
1.123 + IMPORT_C TStorageType StorageType() const;
1.124 +
1.125 + /**
1.126 + * Returns the embedded contact item field.
1.127 + * @return The embedded contact item field.
1.128 + */
1.129 + IMPORT_C CContactItemField& ItemField() const;
1.130 +
1.131 + /**
1.132 + * Returns the text storage object of this field. If the storage type is
1.133 + * not KStorageTypeText the function raises a panic.
1.134 + * @return The text storage object of this field.
1.135 + */
1.136 + IMPORT_C CContactTextField* TextStorage() const;
1.137 +
1.138 + /**
1.139 + * Returns the label text of this field.
1.140 + * @return The label text of this field.
1.141 + */
1.142 + IMPORT_C TPtrC Label() const;
1.143 +
1.144 + /**
1.145 + * Sets the label text of this field to aLabel.
1.146 + * @param aLabel Text to set as the label of this field.
1.147 + */
1.148 + IMPORT_C void SetLabelL(const TDesC& aLabel);
1.149 +
1.150 + /**
1.151 + * Marks this field as hidden or unhidden.
1.152 + * @param aHidden ETrue marks as hidden EFalse removes the mark.
1.153 + */
1.154 + IMPORT_C void SetHidden(TBool aHidden);
1.155 +
1.156 + /**
1.157 + * Check if field is marked hidden.
1.158 + * @return ETrue if this field is hidden, EFalse if not.
1.159 + */
1.160 + IMPORT_C TBool IsHidden() const;
1.161 +
1.162 + /**
1.163 + * Returns time storage of this field. If the storage type is
1.164 + * not KStorageTypeDateTime the function raises a panic.
1.165 + * @return The time storage object of this field.
1.166 + */
1.167 + IMPORT_C CContactDateField* DateTimeStorage() const;
1.168 +
1.169 + /**
1.170 + * Returns ETrue if this is the same field as aField.
1.171 + * @return ETrue if this is the same field as aField.
1.172 + */
1.173 + IMPORT_C TBool IsSame(const TPbkContactItemField& aField) const;
1.174 +
1.175 + /**
1.176 + * Converts this field to a CContactItemField.
1.177 + * @return The embedded CContactItemField object.
1.178 + */
1.179 + IMPORT_C CContactItemField& ContactItemField();
1.180 +
1.181 + /**
1.182 + * Converts this field to a const CContactItemField.
1.183 + * @return The embedded CContactItemField object.
1.184 + */
1.185 + IMPORT_C const CContactItemField& ContactItemField() const;
1.186 +
1.187 + /**
1.188 + * Compares two items against the group ordering.
1.189 + * @param aRhs Contact item field to compare to this field.
1.190 + */
1.191 + IMPORT_C TInt Compare(const TPbkContactItemField& aRhs) const;
1.192 +
1.193 + /**
1.194 + * Returns an unique id for this field.
1.195 + * NOTE: Returned id is valid only as long as this object is in memory
1.196 + * in other words the id is not persistent!
1.197 + * @return The unique id for this field.
1.198 + */
1.199 + IMPORT_C TInt UniqueFieldIdentity() const;
1.200 +
1.201 + /**
1.202 + * Returns ETrue if this field's contents is empty.
1.203 + * @return ETrue if this field's contents is empty.
1.204 + */
1.205 + IMPORT_C TBool IsEmpty() const;
1.206 +
1.207 + /**
1.208 + * Returns ETrue if this field's contents is empty or all spaces.
1.209 + * @return ETrue if this field's contents is empty or all spaces.
1.210 + */
1.211 + IMPORT_C TBool IsEmptyOrAllSpaces() const;
1.212 +
1.213 + /**
1.214 + * Returns ETrue is this field is a default phone number field.
1.215 + * @see CPbkContactItem::DefaultPhoneNumberField
1.216 + * @see CPbkContactItem::SetDefaultPhoneNumberField
1.217 + * @return ETrue is this field is a default phone number field.
1.218 + */
1.219 + IMPORT_C TBool DefaultPhoneNumberField() const;
1.220 +
1.221 + /**
1.222 + * Returns ETrue if this field is a default video number field.
1.223 + * @see CPbkContactItem::DefaultVideoNumberField
1.224 + * @see CPbkContactItem::SetDefaultVideoNumberField
1.225 + * @return ETrue if this field is a default video number field.
1.226 + */
1.227 + IMPORT_C TBool DefaultVideoNumberField() const;
1.228 +
1.229 + /**
1.230 + * Returns ETrue is this field is a default SMS field.
1.231 + * @see CPbkContactItem::DefaultSmsField
1.232 + * @see CPbkContactItem::SetDefaultSmsField
1.233 + * @return ETrue is this field is a default SMS field.
1.234 + */
1.235 + IMPORT_C TBool DefaultSmsField() const;
1.236 +
1.237 + /**
1.238 + * Returns ETrue is this field is a default SMS With Email field.
1.239 + * @see CPbkContactItem::DefaultEmailOverSmsField
1.240 + * @see CPbkContactItem::SetDefaultEmailOverSmsField
1.241 + * @return ETrue is this field is a default SMS With Email field.
1.242 + */
1.243 + IMPORT_C TBool DefaultEmailOverSmsField() const;
1.244 +
1.245 + /**
1.246 + * Returns ETrue is this field is a default email field.
1.247 + * @see CPbkContactItem::DefaultEmailField
1.248 + * @see CPbkContactItem::SetDefaultEmailField
1.249 + * @return ETrue is this field is a default email field.
1.250 + */
1.251 + IMPORT_C TBool DefaultEmailField() const;
1.252 +
1.253 + /**
1.254 + * Returns ETrue is this field is a default MMS field.
1.255 + * @see CPbkContactItem::DefaultMmsField
1.256 + * @see CPbkContactItem::SetDefaultMmsField
1.257 + * @return ETrue is this field is a default MMS field.
1.258 + */
1.259 + IMPORT_C TBool DefaultMmsField() const;
1.260 +
1.261 + /**
1.262 + * Returns ETrue is this field is a default POC field.
1.263 + * @see CPbkContactItem::DefaultPocField
1.264 + * @see CPbkContactItem::SetDefaultPocField
1.265 + * @return ETrue is this field is a default POC field.
1.266 + */
1.267 + IMPORT_C TBool DefaultPocField() const;
1.268 +
1.269 + /**
1.270 + * Returns ETrue is this field is a default VOIP field.
1.271 + * @see CPbkContactItem::DefaultVoipField
1.272 + * @see CPbkContactItem::SetDefaultVoipField
1.273 + * @return ETrue is this field is a default VOIP field.
1.274 + */
1.275 + IMPORT_C TBool DefaultVoipField() const;
1.276 +
1.277 + /**
1.278 + * Returns an array of speed dial indexes assigned to this field,
1.279 + * NULL if none.
1.280 + * @return An array of speed dial indexes assigned to this field,
1.281 + * NULL if none.
1.282 + */
1.283 + IMPORT_C CArrayFix<TInt>* SpeedDialIndexesL() const;
1.284 +
1.285 + public: // from MPbkFieldData
1.286 + IMPORT_C TStorageType PbkFieldType() const;
1.287 + IMPORT_C TPbkFieldId PbkFieldId() const;
1.288 + IMPORT_C TPtrC PbkFieldText() const;
1.289 + IMPORT_C TTime PbkFieldTime() const;
1.290 +
1.291 + private: // CPbkContactItem support functions
1.292 + /// CPbkContactItem calls private functions of this class
1.293 + friend class CPbkContactItem;
1.294 + void PrepareForSaveL();
1.295 + void PrepareAfterLoadL();
1.296 + TBool HasInvalidDate();
1.297 +
1.298 + private: // Data
1.299 + /// Ref: Contact item field to be expanded into greater heights
1.300 + CContactItemField* iField;
1.301 + /// Ref: field info object matching iField's type
1.302 + CPbkFieldInfo* iFieldInfo;
1.303 +
1.304 + private: // Friend declarations
1.305 + friend IMPORT_C TBool operator==
1.306 + (const TPbkContactItemField& aLeft,
1.307 + const TPbkContactItemField& aRight);
1.308 + };
1.309 +
1.310 +
1.311 +// FUNCTION DECLARATIONS
1.312 +
1.313 +/**
1.314 + * Returns ETrue if aLeft has same contents as aRight.
1.315 + * Doesn't compare everything (all field flags etc.) but all the attributes
1.316 + * that could affect how this field looks like in the Phonebook UI. This
1.317 + * function can be used to determine wheter to update this field in the UI.
1.318 + */
1.319 +IMPORT_C TBool operator==
1.320 + (const TPbkContactItemField& aLeft,
1.321 + const TPbkContactItemField& aRight);
1.322 +
1.323 +/**
1.324 + * Returns !(aLeft==aRight).
1.325 + */
1.326 +inline TBool operator!=
1.327 + (const TPbkContactItemField& aLeft,
1.328 + const TPbkContactItemField& aRight)
1.329 + {
1.330 + return !(aLeft==aRight);
1.331 + }
1.332 +
1.333 +
1.334 +#endif // __TPbkContactItemField_H__
1.335 +
1.336 +// End of File