epoc32/include/app/cpbkaddressselect.h
branchSymbian2
changeset 2 2fe1408b6811
parent 1 666f914201fb
child 4 837f303aceeb
equal deleted inserted replaced
1:666f914201fb 2:2fe1408b6811
     1 cpbkaddressselect.h
     1 /*
       
     2 * Copyright (c) 2002 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 the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *       Generic Phonebook address selection dialog. Used for selecting recipient
       
    16 *       address from a contact for Call, Send SMS, email and MMS.
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 #ifndef __CPbkAddressSelect_H__
       
    22 #define __CPbkAddressSelect_H__
       
    23 
       
    24 //  INCLUDES
       
    25 #include <e32base.h>
       
    26 #include <coedef.h> // TKeyResponse
       
    27 #include <w32std.h> // TKeyEvent, TEventCode
       
    28 
       
    29 
       
    30 // FORWARD DECLARATIONS
       
    31 class CPbkContactItem;
       
    32 class TPbkContactItemField;
       
    33 class CPbkSelectFieldDlg;
       
    34 class CPbkFieldArray;
       
    35 
       
    36 
       
    37 // CLASS DECLARATION
       
    38 
       
    39 /**
       
    40  * This class is the abstrack base class for Phonebook address selection
       
    41  * dialogs. Address selection dialogs are used for selecting recipient
       
    42  * address from a contact for Call, Send SMS, email and MMS. Select one 
       
    43  * of the derived classes for a particular concrete dialog implementation.
       
    44  */
       
    45 class CPbkAddressSelect : public CBase
       
    46     {
       
    47     public:  // Interface
       
    48         /**
       
    49          * Parameters for ExecuteLD(TBaseParams&).
       
    50          * @see ExecuteLD(TBaseParams&)
       
    51          */
       
    52         class TBaseParams
       
    53             {
       
    54             public:  // Interface
       
    55                 /**
       
    56                  * Returns the contact supplied to constructor.
       
    57                  * @return Contact item.
       
    58                  */
       
    59                 IMPORT_C const CPbkContactItem& ContactItem();
       
    60 
       
    61                 /**
       
    62                  * Sets the focused field of the contact item. If focused field
       
    63                  * is a non-empty address field it is returned directly by
       
    64                  * ExecuteLD. The default value is NULL.
       
    65 				 * @param aFocusedField The focused field to set
       
    66                  */
       
    67                 IMPORT_C void SetFocusedField(const TPbkContactItemField* aFocusedField);
       
    68         
       
    69                 /**
       
    70                  * Set to ETrue to use default address of the contact directly.
       
    71                  * Focused field overrides default address if both are
       
    72                  * available. The default value is EFalse.
       
    73 				 * @param aUseDefaultDirectly   Defines whether the default address
       
    74 				 *                              should be used directly
       
    75                  */
       
    76                 IMPORT_C void SetUseDefaultDirectly(TBool aUseDefaultDirectly);
       
    77 
       
    78                 /**
       
    79                  * Returns the selected field or NULL if no selection was made.
       
    80                  * @return  Selected contact item field.
       
    81                  */
       
    82                 IMPORT_C const TPbkContactItemField* SelectedField() const;
       
    83 
       
    84                 /**
       
    85                  * Returns the focused field or NULL if there was no field
       
    86                  * level focus.
       
    87                  * @return  Focused contact item field.
       
    88                  */
       
    89                 IMPORT_C const TPbkContactItemField* FocusedField() const;
       
    90 
       
    91             protected:  // Derived class interface
       
    92                 /**
       
    93                  * Constructor.
       
    94                  *
       
    95                  * @param aContact      Contact from which to select an address.
       
    96                  * @param aDefaultField The field to use as the default. NULL if 
       
    97                  *                      no default is set for aContact.
       
    98                  */
       
    99                 IMPORT_C TBaseParams
       
   100                     (const CPbkContactItem& aContact, 
       
   101                     const TPbkContactItemField* aDefaultField);
       
   102 
       
   103             private:  // Data
       
   104 				/// Ref: the contact where to select an address
       
   105                 const CPbkContactItem& iContact;
       
   106 				/// Ref: the default field of the contact
       
   107                 const TPbkContactItemField* iDefaultField;
       
   108 				/// Ref: the focused field of the contact
       
   109                 const TPbkContactItemField* iFocusedField;
       
   110 				/// Own: is the default address to be used directly
       
   111                 TBool iUseDefaultDirectly;
       
   112 				/// Own: the selected field of the contact
       
   113                 const TPbkContactItemField* iSelectedField;
       
   114 				/// Spare data
       
   115                 TInt32 iSpare1;
       
   116 				/// Spare data
       
   117                 TInt32 iSpare2;
       
   118 
       
   119             private:  // friends
       
   120                 friend class CPbkAddressSelect;
       
   121             };
       
   122 
       
   123         /**
       
   124          * Destructor. Cancels address selection query if active.
       
   125          */
       
   126         IMPORT_C ~CPbkAddressSelect();
       
   127 
       
   128     protected:  // Base class interface
       
   129         /**
       
   130          * Constructor.
       
   131          */
       
   132         IMPORT_C CPbkAddressSelect();
       
   133 
       
   134         /**
       
   135          * Runs an address selection query (if necessary).
       
   136          *
       
   137          * @param aParams   see TBaseParams.
       
   138          * @return ETrue if query was accepted, EFalse if canceled.
       
   139          */
       
   140         IMPORT_C TBool ExecuteLD(TBaseParams& aParams);
       
   141 
       
   142         /**
       
   143          * Returns aItem passed to ExecuteLD.
       
   144          * @return  Contact item.
       
   145          */
       
   146         IMPORT_C const CPbkContactItem& ContactItem() const;
       
   147 
       
   148         /**
       
   149          * Exit any address selection query. Makes ExecuteLD return which means
       
   150          * this object is destroyed after this function returns!
       
   151          * @param aAccept   ETrue means the query selection is accepted and
       
   152          *                  EFalse that query is canceled.
       
   153          */ 
       
   154 	    IMPORT_C void AttemptExitL(TBool aAccept);
       
   155 
       
   156     private:    // Base class interface. Private because these functions are
       
   157                 // only to be called from this classes implementation.
       
   158         /**
       
   159          * Returns ETrue if aField is an applicable address field.
       
   160          * @param aField    Contact item field.
       
   161          * @return  ETrue if the contact item field is an applicable address field.
       
   162          */
       
   163         virtual TBool AddressField(const TPbkContactItemField& aField) const = 0;
       
   164 
       
   165         /**
       
   166          * Called if there are no applicable address fields in aItem passed
       
   167          * to ExecuteLD.
       
   168          */
       
   169         virtual void NoAddressesL() = 0;
       
   170 
       
   171         /**
       
   172          * Returns title to use for the address selection list query.
       
   173          * @return Title used for the address selection list query.
       
   174          */
       
   175         virtual const TDesC& QueryTitleL() = 0;
       
   176 
       
   177         /**
       
   178          * Returns a softkey resource id to use for the address 
       
   179          * selection list query.
       
   180          * @return  Softkey resource if that is used for the address 
       
   181          *          selection list query.
       
   182          */
       
   183         virtual TInt QuerySoftkeysResource() const = 0;
       
   184 
       
   185         /**
       
   186          * Override to handle key events in the list query.
       
   187          * The default implementation is empty.
       
   188          * @param aKeyEvent The key event.
       
   189          * @param aType The key event type.
       
   190          */
       
   191         IMPORT_C virtual TKeyResponse PbkControlKeyEventL
       
   192             (const TKeyEvent& aKeyEvent,TEventCode aType);
       
   193 
       
   194         // Spare virtual functions
       
   195         IMPORT_C virtual void Reserved_1();
       
   196         IMPORT_C virtual void Reserved_2();
       
   197 
       
   198     private: // data members
       
   199         /// Ref: aItem passed to ExecuteLD
       
   200         const CPbkContactItem* iContactItem;
       
   201         /// Field selection dialog for this class
       
   202         class CSelectFieldDlg;
       
   203         friend class CSelectFieldDlg;
       
   204         /// Own: field selection dialog
       
   205         CPbkSelectFieldDlg* iFieldDlg;
       
   206         /// Own: field array for iFieldDlg
       
   207         CPbkFieldArray* iFields;
       
   208         /// Ref: set to ETrue when exeuction enters destructor
       
   209         TBool* iDestroyedPtr;
       
   210         // Spare data
       
   211         TInt32 iSpare1;
       
   212     }; 
       
   213 
       
   214 
       
   215 #endif // __CPbkAddressSelect_H__
       
   216             
       
   217 // End of File