|
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 "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". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * Field type selection dialog for Phonebook's Create New / Edit Memory entry |
|
16 * functions. |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 #ifndef __CPbkMemoryEntryAddItemDlg_H__ |
|
22 #define __CPbkMemoryEntryAddItemDlg_H__ |
|
23 |
|
24 // INCLUDES |
|
25 #include <e32base.h> |
|
26 |
|
27 // FORWARD DECLARATIONS |
|
28 class CPbkFieldInfo; |
|
29 class CEikFormattedCellListBox; |
|
30 class CAknPopupList; |
|
31 |
|
32 // CLASS DECLARATION |
|
33 |
|
34 /** |
|
35 * Field type selection dialog for Phonebook's Create New- and Edit Memory |
|
36 * entry-functions. |
|
37 * Also used externally for Create New Entry- and Add to Existing |
|
38 * Entry-services. |
|
39 */ |
|
40 class CPbkMemoryEntryAddItemDlg : public CBase |
|
41 { |
|
42 public: // Interface |
|
43 /** |
|
44 * Constructor. |
|
45 */ |
|
46 IMPORT_C CPbkMemoryEntryAddItemDlg(); |
|
47 |
|
48 /** |
|
49 * Sets *aSelfPtr to NULL when this dialog is destroyed. |
|
50 * @precond !aSelfPtr || *aSelfPtr==this |
|
51 */ |
|
52 IMPORT_C void ResetWhenDestroyed(CPbkMemoryEntryAddItemDlg** aSelfPtr); |
|
53 |
|
54 /** |
|
55 * Run the dialog and return selected field info. |
|
56 * |
|
57 * @param aFieldInfos An array of field info objects to select from. |
|
58 * @param aCbaResource Cba buttons to use with the dialog. |
|
59 * @return Pointer to a field info in aFieldInfos or NULL if canceled. |
|
60 */ |
|
61 IMPORT_C CPbkFieldInfo* ExecuteLD |
|
62 (CArrayPtrFlat<CPbkFieldInfo>& aFieldInfos, TInt aCbaResource); |
|
63 |
|
64 /** |
|
65 * Run the dialog and return selected field info. |
|
66 * |
|
67 * @param aFieldInfos An array of field info objects to select from. |
|
68 * @param aCbaResource Cba buttons to use with the dialog. |
|
69 * @param aTitleText Text to put into popup list's title. No title |
|
70 * pane if aTitleText is empty. |
|
71 * @return Pointer to a field info in aFieldInfos or NULL if canceled. |
|
72 */ |
|
73 IMPORT_C CPbkFieldInfo* ExecuteLD |
|
74 (CArrayPtr<CPbkFieldInfo>& aFieldInfos, |
|
75 TInt aCbaResource, |
|
76 const TDesC& aTitleText); |
|
77 |
|
78 /** |
|
79 * Basic ExecuteLD for derived classes to override. |
|
80 * @param aFieldInfos An array of field info objects to select from. |
|
81 */ |
|
82 IMPORT_C virtual CPbkFieldInfo* ExecuteLD |
|
83 (CArrayPtr<CPbkFieldInfo>& aFieldInfos); |
|
84 |
|
85 /** |
|
86 * Destructor. |
|
87 * Also cancels and dismisses this popup list, in other words makes |
|
88 * ExecuteLD return just like cancel was pressed. |
|
89 */ |
|
90 IMPORT_C ~CPbkMemoryEntryAddItemDlg(); |
|
91 |
|
92 public: // internal implementation |
|
93 /** |
|
94 * @internal |
|
95 * Sorts the field info objects according to Phonebook specific rules. |
|
96 */ |
|
97 void SortFieldInfoArray(); |
|
98 |
|
99 protected: // Interface for derived classes |
|
100 /** |
|
101 * Creates list items, sets Cba and title. |
|
102 * Executed before RunLD. |
|
103 * First part of ExecuteLD. |
|
104 * @param aFieldInfos An array of field info objects to select from. |
|
105 * @param aCbaResource Cba buttons to use with the dialog |
|
106 * @param aTitle Text to put into popup list's title |
|
107 */ |
|
108 void PrepareLC(CArrayPtr<CPbkFieldInfo>& aFieldInfos, |
|
109 TInt aCbaResource, const TDesC& aTitle); |
|
110 |
|
111 /** |
|
112 * Execute the initialized dialog. |
|
113 * Second part of ExecuteLD. |
|
114 * @return Pointer to a field info |
|
115 */ |
|
116 CPbkFieldInfo* RunLD(); |
|
117 |
|
118 private: // Spare virtual functions |
|
119 IMPORT_C virtual void Reserved_1(); |
|
120 IMPORT_C virtual void Reserved_2(); |
|
121 |
|
122 private: // Data types |
|
123 class CListBoxModel; |
|
124 |
|
125 private: // Data members |
|
126 /// Own: list box. |
|
127 CEikFormattedCellListBox* iListBox; |
|
128 /// Own: popup listbox. |
|
129 CAknPopupList* iPopupList; |
|
130 /// Ref: Referred boolean is set to ETrue when this object is destroyed. |
|
131 TBool* iDestroyedPtr; |
|
132 /// Ref: set to NULL from destructor |
|
133 CPbkMemoryEntryAddItemDlg** iSelfPtr; |
|
134 // Own: Sort Field Infos |
|
135 TBool iSortFieldInfos; |
|
136 }; |
|
137 |
|
138 |
|
139 /** |
|
140 * Field type selection dialog for Phonebook's Create New service. |
|
141 * This service can be used to show a popup dialog of Phonebook field |
|
142 * types and then let the user select a particular field type from it. |
|
143 */ |
|
144 class CPbkItemTypeSelectCreateNew : public CPbkMemoryEntryAddItemDlg |
|
145 { |
|
146 public: // Interface |
|
147 /** |
|
148 * Constructor. |
|
149 */ |
|
150 IMPORT_C CPbkItemTypeSelectCreateNew(); |
|
151 |
|
152 /** |
|
153 * Destructor. |
|
154 * Also cancels and dismisses this popup list, in other words makes |
|
155 * ExecuteLD return just like cancel was pressed. |
|
156 */ |
|
157 IMPORT_C ~CPbkItemTypeSelectCreateNew(); |
|
158 |
|
159 public: // from CPbkMemoryEntryAddItemDlg |
|
160 /** |
|
161 * Runs this dialog and returns the selected field info. |
|
162 * |
|
163 * @param aFieldInfos An array of field info objects to select from. |
|
164 * @return Pointer to a field info in aFieldInfos or NULL if canceled. |
|
165 */ |
|
166 IMPORT_C CPbkFieldInfo* ExecuteLD(CArrayPtr<CPbkFieldInfo>& aFieldInfos); |
|
167 |
|
168 private: // Data |
|
169 /// Own: popup list title text |
|
170 HBufC* iTitleBuf; |
|
171 // Spare data |
|
172 TInt32 iSpare1; |
|
173 }; |
|
174 |
|
175 |
|
176 /** |
|
177 * Field type selection dialog for Phonebook's Add to Existing-service. |
|
178 * This service can be used to show a popup dialog of Phonebook field |
|
179 * types and then let the user select a particular field type from it. |
|
180 */ |
|
181 class CPbkItemTypeSelectAddToExisting : public CPbkMemoryEntryAddItemDlg |
|
182 { |
|
183 public: // Interface |
|
184 /** |
|
185 * Constructor. |
|
186 */ |
|
187 IMPORT_C CPbkItemTypeSelectAddToExisting(); |
|
188 |
|
189 /** |
|
190 * Destructor. |
|
191 * Also cancels and dismisses this popup list, in other words makes |
|
192 * ExecuteLD return just like cancel was pressed. |
|
193 */ |
|
194 IMPORT_C ~CPbkItemTypeSelectAddToExisting(); |
|
195 |
|
196 public: // from CPbkMemoryEntryAddItemDlg |
|
197 /** |
|
198 * Run this dialog and return selected field info. |
|
199 * |
|
200 * @param aFieldInfos An array of field info objects to select from. |
|
201 * @return Pointer to a field info in aFieldInfos or NULL if canceled. |
|
202 */ |
|
203 IMPORT_C CPbkFieldInfo* ExecuteLD(CArrayPtr<CPbkFieldInfo>& aFieldInfos); |
|
204 |
|
205 private: // Data |
|
206 /// Own: popup list title text |
|
207 HBufC* iTitleBuf; |
|
208 // Spare data |
|
209 TInt32 iSpare1; |
|
210 }; |
|
211 |
|
212 #endif // __CPbkMemoryEntryAddItemDlg_H__ |
|
213 |
|
214 // End of File |