1 cpbksingleitemfetchdlg.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 Item Fetch API. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef __CPbkSingleItemFetchDlg_H__ |
|
21 #define __CPbkSingleItemFetchDlg_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 CPbkSelectFieldDlg; |
|
31 class CPbkContactEngine; |
|
32 class CPbkFieldIdArray; |
|
33 class CPbkContactItem; |
|
34 class TPbkContactItemField; |
|
35 class MObjectProvider; |
|
36 |
|
37 |
|
38 // CLASS DECLARATION |
|
39 |
|
40 /** |
|
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. |
|
46 */ |
|
47 class CPbkSingleItemFetchDlg : public CBase |
|
48 { |
|
49 public: // Types |
|
50 /** |
|
51 * Single item fetch parameter class. |
|
52 */ |
|
53 class TParams |
|
54 { |
|
55 public: // Input parameters |
|
56 /** |
|
57 * Contact view to display. If NULL, loads the default |
|
58 * contact view containing all names in the contact |
|
59 * database. |
|
60 */ |
|
61 CContactViewBase* iContactView; |
|
62 |
|
63 /** |
|
64 * Array of field types to fetch. |
|
65 */ |
|
66 const CPbkFieldIdArray* iFieldIdArray; |
|
67 |
|
68 public: // Output parameters |
|
69 /** |
|
70 * Returns an contact item of the selected entry, undefined |
|
71 * if the dialog is canceled. Caller is responsible of |
|
72 * deleting iContactItem. |
|
73 */ |
|
74 CPbkContactItem* iContactItem; |
|
75 |
|
76 /** |
|
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. |
|
80 */ |
|
81 TPbkContactItemField* iContactItemField; |
|
82 |
|
83 public: // Additional input parameters |
|
84 /** |
|
85 * OPTIONAL: Fetch softkey resource ID. |
|
86 * If 0, Default softkeys are used. |
|
87 */ |
|
88 TInt iCbaId; |
|
89 |
|
90 public: // Constructors |
|
91 /** |
|
92 * C++ constructor. |
|
93 */ |
|
94 IMPORT_C TParams(); |
|
95 |
|
96 // Compiler-generated destructor is ok for this class |
|
97 |
|
98 /** |
|
99 * Returns a cleanup item which will handle cleanup of this |
|
100 * object in case a leave occurs. |
|
101 */ |
|
102 IMPORT_C operator TCleanupItem(); |
|
103 |
|
104 private: // Implementation |
|
105 static void Cleanup(TAny* aSelf); |
|
106 |
|
107 private: // Unimplemented functions |
|
108 /// Unimplemented copy constructor |
|
109 TParams(const TParams&); |
|
110 /// Unimplemented assignment operator |
|
111 TParams& operator=(const TParams&); |
|
112 |
|
113 private: // data |
|
114 /// Own: spare data |
|
115 TInt32 iSpare1; |
|
116 }; |
|
117 |
|
118 public: // Interface |
|
119 /** |
|
120 * Creates a new single entry fetch dialog. |
|
121 * |
|
122 * @param aParams Fetch parameters, @see TParams |
|
123 * @param aEngine Phonebook engine |
|
124 */ |
|
125 IMPORT_C static CPbkSingleItemFetchDlg* NewL |
|
126 (TParams& aParams, CPbkContactEngine& aEngine); |
|
127 |
|
128 /** |
|
129 * @see CCoeControl::SetMopParent(MObjectProvider* aParent) |
|
130 */ |
|
131 IMPORT_C void SetMopParent(MObjectProvider* aParent); |
|
132 |
|
133 /** |
|
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 |
|
138 * of the caller. |
|
139 * |
|
140 * @return A non-zero value if not canceled. |
|
141 */ |
|
142 IMPORT_C TInt ExecuteLD(); |
|
143 |
|
144 /** |
|
145 * Destructor. Also cancels this dialog if ExecuteLD() has been called. |
|
146 */ |
|
147 ~CPbkSingleItemFetchDlg(); |
|
148 |
|
149 private: // Implementation |
|
150 CPbkSingleItemFetchDlg(TParams& aParams, CPbkContactEngine& aEngine); |
|
151 void ConstructL(); |
|
152 TBool EntryFetchAcceptedL(TContactItemId aCid); |
|
153 class TFetchCallback; |
|
154 friend class TFetchCallback; |
|
155 |
|
156 private: // Data |
|
157 /// Own: parameters |
|
158 TParams& iParams; |
|
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; |
|
175 }; |
|
176 |
|
177 #endif // __CPbkSingleItemFetchDlg_H__ |
|
178 |
|
179 // End of File |