2 * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
15 * Phonebook Single Entry Fetch dialog API.
20 #ifndef __CPbkSingleEntryFetchDlg_H__
21 #define __CPbkSingleEntryFetchDlg_H__
24 #include <e32base.h> // CBase
25 #include <cntdef.h> // TContactItemId
27 // FORWARD DECLARATIONS
28 class CContactViewBase;
30 class CPbkContactEngine;
31 class MObjectProvider;
32 class MPbkFetchKeyCallback;
33 class MPbkFetchDlgAccept;
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
43 class CPbkSingleEntryFetchDlg :
48 * Single entry fetch parameter class.
52 public: // Input parameters
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.
59 CPbkContactEngine* iPbkEngine;
62 * Contact view to display. If NULL, loads the default
63 * contact view containing all names in the contact
65 * @see CPbkContactEngine::AllContactsView()
66 * @see CPbkContactEngine::FilteredContactsViewL()
68 CContactViewBase* iContactView;
71 * OPTIONAL: Fetch key event callback.
72 * If NULL, not applicable.
74 MPbkFetchKeyCallback* iFetchKeyCallback;
77 * OPTIONAL: Fetch accept callback.
78 * If NULL, not applicable.
80 MPbkFetchDlgAccept* iFetchDlgAccept;
82 public: // Output parameters
84 * Returns the id of the selected entry, undefined if the dialog
87 TContactItemId iSelectedEntry;
89 public: // Additional input parameters
91 * OPTIONAL: Fetch softkey resource ID.
92 * If 0, default softkeys are used.
96 public: // Constructors
102 // Compiler-generated destructor is ok for this class
104 private: // Unimplemented functions
105 /// Unimplemented copy constructor
106 TParams(const TParams&);
107 /// Unimplemented assignment operator
108 TParams& operator=(const TParams&);
117 * Creates a new single entry fetch dialog.
119 * @param aParams Fetch parameters, @see TParams
120 * @return New instance of this class.
122 IMPORT_C static CPbkSingleEntryFetchDlg* NewL(TParams& aParams);
125 * @see CCoeControl::SetMopParent(MObjectProvider* aParent)
127 IMPORT_C void SetMopParent(MObjectProvider* aParent);
130 * Sets *aSelfPtr to NULL when this dialog is destroyed.
131 * @precond !aSelfPtr || *aSelfPtr==this
133 IMPORT_C void ResetWhenDestroyed(CPbkSingleEntryFetchDlg** aSelfPtr);
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
142 * @return A non-zero value if accepted, 0 if canceled.
144 IMPORT_C TInt ExecuteLD();
147 * Destructor. Also cancels this dialog and makes ExecuteLD return.
149 ~CPbkSingleEntryFetchDlg();
151 private: // Implementation
152 CPbkSingleEntryFetchDlg(TParams& aParams);
154 static void Panic(TInt aReason);
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;
175 #endif // __CPbkSingleEntryFetchDlg_H__