phonebookui/Phonebook2/UIControls/inc/CPbk2ContactEditorImageField.h
branchRCL_3
changeset 20 f4a778e096c2
equal deleted inserted replaced
19:5b6f26637ad3 20:f4a778e096c2
       
     1 /*
       
     2 * Copyright (c) 2002-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 contact editor image field.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CPBK2CONTACTEDITORIMAGEFIELD_H
       
    20 #define CPBK2CONTACTEDITORIMAGEFIELD_H
       
    21 
       
    22 // INCLUDES
       
    23 #include "CPbk2ContactEditorFieldBase.h"
       
    24 #include "CPbk2ContactEditorReadonlyField.h"
       
    25 
       
    26 // FORWARD DECLARATIONS
       
    27 class CEikEdwin;
       
    28 class CEikCaptionedControl;
       
    29 
       
    30 // CLASS DECLARATION
       
    31 
       
    32 /**
       
    33  * Phonebook 2 contact editor ringtone field.
       
    34  */
       
    35 NONSHARABLE_CLASS(CPbk2ContactEditorImageField) :
       
    36         public CPbk2ContactEditorFieldBase
       
    37     {
       
    38     public:
       
    39         enum TTextState
       
    40             {
       
    41             ENoData,  //AddImage
       
    42             EFilename,            
       
    43             EThumbnail
       
    44             };
       
    45         
       
    46         enum TClipFileExtension
       
    47             {
       
    48             EClipFileExtension,
       
    49             EDontClipFileExtension
       
    50             };
       
    51     
       
    52     public:  // Constructors and destructor
       
    53         
       
    54         /**
       
    55          * Creates a new instance of this class.
       
    56          *
       
    57          * @param aContactField         Contact field.
       
    58          * @param aUiBuilder            UI builder for adding the
       
    59          *                              field into dialog.
       
    60          * @param aIconInfoContainer    Icon container for
       
    61          *                              setting the field icon.
       
    62          * @param aCustomPosition       Position where this custom controls should be placed.
       
    63          * @return  A new instance of this class.
       
    64          */
       
    65         static CPbk2ContactEditorImageField* NewLC(
       
    66                 CPbk2PresentationContactField& aContactField,
       
    67                 MPbk2ContactEditorUiBuilder& aUiBuilder,
       
    68                 CPbk2IconInfoContainer& aIconInfoContainer,
       
    69                 TInt aCustomPosition);
       
    70         
       
    71         /**
       
    72          * Destructor.
       
    73          */
       
    74         virtual ~CPbk2ContactEditorImageField();
       
    75 
       
    76         /**
       
    77          * Returns control id of this custom line.
       
    78          *
       
    79          * @return  Control id.
       
    80          */
       
    81         TInt ControlId() const; 
       
    82 
       
    83     public:
       
    84         void SetTextL();
       
    85         TInt TextState();
       
    86         CPbk2PresentationContactField& ContactField();
       
    87         
       
    88     private: // From MPbk2ContactEditorField        
       
    89         CEikEdwin* Control() const;
       
    90         void SaveFieldL();
       
    91         void ActivateL();
       
    92         void AcceptL(
       
    93                 MPbk2ContactEditorFieldVisitor& aVisitor );
       
    94         TBool ConsumesKeyEvent
       
    95         	( const TKeyEvent& aKeyEvent, TEventCode aType );
       
    96         TAny* ContactEditorFieldExtension(
       
    97                 TUid aExtensionUid );
       
    98         HBufC* ControlTextL() const;      
       
    99         TBool HandleCustomFieldCommandL(TInt aCommand );
       
   100         
       
   101     private: // Implementation
       
   102         CPbk2ContactEditorImageField(
       
   103                 CPbk2PresentationContactField& aContactField,
       
   104                 MPbk2ContactEditorUiBuilder& aUiBuilder,
       
   105                 CPbk2IconInfoContainer& aIconInfoContainer );
       
   106         void ConstructL(TInt aCustomPosition);
       
   107         void FormatTextL(TPtrC aDataPtr, TClipFileExtension aClipFileExtension);       
       
   108         
       
   109     private: // Data
       
   110         /// Ref: Editor control
       
   111         CPbk2ContactEditorReadonlyField* iControl;
       
   112         /// Ref: Fields captioned control
       
   113         CEikCaptionedControl* iCaptionedCtrl;
       
   114         /// Own: Text content when editor was opened
       
   115         HBufC* iInitialText;
       
   116         TInt iTextState;
       
   117     };
       
   118 
       
   119 #endif // CPBK2CONTACTEDITORIMAGEFIELD_H
       
   120             
       
   121 // End of File