epoc32/include/app/cpbksingleentryfetchdlg.h
branchSymbian2
changeset 2 2fe1408b6811
parent 1 666f914201fb
child 4 837f303aceeb
equal deleted inserted replaced
1:666f914201fb 2:2fe1408b6811
     1 cpbksingleentryfetchdlg.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 *      Phonebook Single Entry Fetch dialog API.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef __CPbkSingleEntryFetchDlg_H__
       
    21 #define __CPbkSingleEntryFetchDlg_H__
       
    22 
       
    23 //  INCLUDES
       
    24 #include <e32base.h>    // CBase
       
    25 #include <cntdef.h>     // TContactItemId
       
    26 
       
    27 //  FORWARD DECLARATIONS
       
    28 class CContactViewBase;
       
    29 class CPbkFetchDlg;
       
    30 class CPbkContactEngine;
       
    31 class MObjectProvider;
       
    32 class MPbkFetchKeyCallback;
       
    33 class MPbkFetchDlgAccept;
       
    34 
       
    35 
       
    36 // CLASS DECLARATION
       
    37 /**
       
    38  * Phonebook Single Entry Fetch API. This class is used to construct 
       
    39  * a Phonebook UI dialog where the user is able to select a single 
       
    40  * contact entry from a contact list. The user selection is then returned 
       
    41  * to the client.
       
    42  */
       
    43 class CPbkSingleEntryFetchDlg : 
       
    44         public CBase
       
    45     {
       
    46     public:  // Types
       
    47         /**
       
    48          * Single entry fetch parameter class. 
       
    49          */
       
    50         class TParams
       
    51             {
       
    52             public:  // Input parameters
       
    53                 /**
       
    54                  * Contact database. If NULL, the contact database is 
       
    55                  * retrieved from TLS or constructed if not available.
       
    56                  * If you have a Contact database on the client side
       
    57                  * please supply it here. 
       
    58                  */
       
    59                 CPbkContactEngine* iPbkEngine;
       
    60 
       
    61                 /**
       
    62                  * Contact view to display. If NULL, loads the default
       
    63                  * contact view containing all names in the contact
       
    64                  * database.
       
    65                  * @see CPbkContactEngine::AllContactsView()
       
    66                  * @see CPbkContactEngine::FilteredContactsViewL()
       
    67                  */
       
    68                 CContactViewBase* iContactView;
       
    69 
       
    70                 /**
       
    71                  * OPTIONAL: Fetch key event callback. 
       
    72                  * If NULL, not applicable.
       
    73                  */
       
    74                 MPbkFetchKeyCallback* iFetchKeyCallback;
       
    75 
       
    76                 /**
       
    77                  * OPTIONAL: Fetch accept callback.
       
    78                  * If NULL, not applicable.
       
    79                  */
       
    80                 MPbkFetchDlgAccept* iFetchDlgAccept;
       
    81 
       
    82             public:  // Output parameters
       
    83                 /**
       
    84                  * Returns the id of the selected entry, undefined if the dialog
       
    85                  * is canceled.
       
    86                  */
       
    87                 TContactItemId iSelectedEntry;
       
    88 
       
    89             public: // Additional input parameters
       
    90                 /**
       
    91                  * OPTIONAL: Fetch softkey resource ID.
       
    92                  * If 0, default softkeys are used.
       
    93                  */
       
    94                 TInt iCbaId;
       
    95 
       
    96             public:  // Constructors
       
    97                 /**
       
    98                  * C++ Constructor.
       
    99                  */
       
   100                 IMPORT_C TParams();
       
   101 
       
   102                 // Compiler-generated destructor is ok for this class
       
   103 
       
   104             private:  // Unimplemented functions
       
   105                 /// Unimplemented copy constructor
       
   106                 TParams(const TParams&);
       
   107                 /// Unimplemented assignment operator
       
   108                 TParams& operator=(const TParams&);
       
   109 
       
   110             private:  // data
       
   111 				/// Own: spare data
       
   112                 TInt32 iSpare1;
       
   113             };
       
   114 
       
   115     public:  // Interface
       
   116         /**
       
   117          * Creates a new single entry fetch dialog.
       
   118          *
       
   119          * @param aParams   Fetch parameters, @see TParams
       
   120          * @return New instance of this class.
       
   121          */
       
   122         IMPORT_C static CPbkSingleEntryFetchDlg* NewL(TParams& aParams);
       
   123 
       
   124         /**
       
   125          * @see CCoeControl::SetMopParent(MObjectProvider* aParent)
       
   126          */
       
   127         IMPORT_C void SetMopParent(MObjectProvider* aParent);
       
   128 
       
   129         /**
       
   130          * Sets *aSelfPtr to NULL when this dialog is destroyed.
       
   131          * @precond !aSelfPtr || *aSelfPtr==this
       
   132          */
       
   133         IMPORT_C void ResetWhenDestroyed(CPbkSingleEntryFetchDlg** aSelfPtr);
       
   134 
       
   135         /**
       
   136          * Executes this dialog.
       
   137          * NOTE: this object is deleted when ExecuteLD returns or leaves!
       
   138          * NOTE: current status pane layout is replaced with the Phonebook
       
   139          * one. Restoring the original pane is left to be the responsibility
       
   140          * of the caller.
       
   141          *
       
   142          * @return A non-zero value if accepted, 0 if canceled.
       
   143          */
       
   144         IMPORT_C TInt ExecuteLD();
       
   145 
       
   146         /**
       
   147          * Destructor. Also cancels this dialog and makes ExecuteLD return.
       
   148          */
       
   149         ~CPbkSingleEntryFetchDlg();
       
   150 
       
   151     private:  // Implementation
       
   152         CPbkSingleEntryFetchDlg(TParams& aParams);
       
   153         void ConstructL();
       
   154         static void Panic(TInt aReason);
       
   155 
       
   156     private:  // Data
       
   157         /// Own: parameters
       
   158         TParams& iParams;
       
   159         /// Own: fetch dialog
       
   160         CPbkFetchDlg* iFetchDlg;
       
   161         /// Ref: Phonebook engine
       
   162         CPbkContactEngine* iPbkEngine;
       
   163         /// Own: Phonebook engine
       
   164         CPbkContactEngine* iOwnPbkEngine;
       
   165         /// Ref: contact view to use for fetcing
       
   166         CContactViewBase* iContactView;
       
   167         /// Ref: set to ETrue in destructor
       
   168         TBool* iDestroyedPtr;
       
   169         /// Ref: pointer to self
       
   170         CPbkSingleEntryFetchDlg** iSelfPtr;
       
   171         /// Own: Object Provider
       
   172         MObjectProvider* iObjectProvider;
       
   173     };
       
   174 
       
   175 #endif // __CPbkSingleEntryFetchDlg_H__
       
   176 
       
   177 // End of File