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 Item Fetch API.
20 #ifndef __CPbkSingleItemFetchDlg_H__
21 #define __CPbkSingleItemFetchDlg_H__
24 #include <e32base.h> // CBase
25 #include <cntdef.h> // TContactItemId
27 // FORWARD DECLARATIONS
28 class CContactViewBase;
30 class CPbkSelectFieldDlg;
31 class CPbkContactEngine;
32 class CPbkFieldIdArray;
33 class CPbkContactItem;
34 class TPbkContactItemField;
35 class MObjectProvider;
41 * Phonebook Single Item Fetch API. This class is used to construct
42 * a Phonebook UI dialog where the user is able to select a single
43 * contact entry from a contact list. Then the user must select a
44 * particular field of that selected contact. The selected contact
45 * item and field are then returned to the client.
47 class CPbkSingleItemFetchDlg : public CBase
51 * Single item fetch parameter class.
55 public: // Input parameters
57 * Contact view to display. If NULL, loads the default
58 * contact view containing all names in the contact
61 CContactViewBase* iContactView;
64 * Array of field types to fetch.
66 const CPbkFieldIdArray* iFieldIdArray;
68 public: // Output parameters
70 * Returns an contact item of the selected entry, undefined
71 * if the dialog is canceled. Caller is responsible of
72 * deleting iContactItem.
74 CPbkContactItem* iContactItem;
77 * Returns a field of the selected entry, undefined if the
78 * dialog is canceled. This is iContactItem's field so it
79 * is deleted when iContactItem is deleted.
81 TPbkContactItemField* iContactItemField;
83 public: // Additional input parameters
85 * OPTIONAL: Fetch softkey resource ID.
86 * If 0, Default softkeys are used.
90 public: // Constructors
96 // Compiler-generated destructor is ok for this class
99 * Returns a cleanup item which will handle cleanup of this
100 * object in case a leave occurs.
102 IMPORT_C operator TCleanupItem();
104 private: // Implementation
105 static void Cleanup(TAny* aSelf);
107 private: // Unimplemented functions
108 /// Unimplemented copy constructor
109 TParams(const TParams&);
110 /// Unimplemented assignment operator
111 TParams& operator=(const TParams&);
120 * Creates a new single entry fetch dialog.
122 * @param aParams Fetch parameters, @see TParams
123 * @param aEngine Phonebook engine
125 IMPORT_C static CPbkSingleItemFetchDlg* NewL
126 (TParams& aParams, CPbkContactEngine& aEngine);
129 * @see CCoeControl::SetMopParent(MObjectProvider* aParent)
131 IMPORT_C void SetMopParent(MObjectProvider* aParent);
134 * Executes this dialog.
135 * NOTE: this object is deleted when ExecuteLD returns or leaves!
136 * NOTE: current status pane layout is replaced with the Phonebook
137 * one. Restoring the original pane is left to be the responsibility
140 * @return A non-zero value if not canceled.
142 IMPORT_C TInt ExecuteLD();
145 * Destructor. Also cancels this dialog if ExecuteLD() has been called.
147 ~CPbkSingleItemFetchDlg();
149 private: // Implementation
150 CPbkSingleItemFetchDlg(TParams& aParams, CPbkContactEngine& aEngine);
152 TBool EntryFetchAcceptedL(TContactItemId aCid);
153 class TFetchCallback;
154 friend class TFetchCallback;
159 /// Ref: contact view containing contacts to choose from
160 CContactViewBase* iContactView;
161 /// Own: fetch dialog
162 CPbkFetchDlg* iFetchDlg;
163 /// Own: field selection dialog
164 CPbkSelectFieldDlg* iFieldDlg;
165 /// Own: Phonebook engine
166 CPbkContactEngine& iPbkEngine;
167 /// Own: contact item to return to user via iParams
168 CPbkContactItem* iContactItem;
169 /// Own: contact item field to return to user via iParams
170 TPbkContactItemField* iContactItemField;
171 /// Ref: set to ETrue in destructor
172 TBool* iDestroyedPtr;
173 /// Own: object provicer
174 MObjectProvider* iObjectProvider;
177 #endif // __CPbkSingleItemFetchDlg_H__