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 * Field type selection dialog for Phonebook's Create New / Edit Memory entry
21 #ifndef __CPbkMemoryEntryAddItemDlg_H__
22 #define __CPbkMemoryEntryAddItemDlg_H__
27 // FORWARD DECLARATIONS
29 class CEikFormattedCellListBox;
35 * Field type selection dialog for Phonebook's Create New- and Edit Memory
37 * Also used externally for Create New Entry- and Add to Existing
40 class CPbkMemoryEntryAddItemDlg : public CBase
46 IMPORT_C CPbkMemoryEntryAddItemDlg();
49 * Sets *aSelfPtr to NULL when this dialog is destroyed.
50 * @precond !aSelfPtr || *aSelfPtr==this
52 IMPORT_C void ResetWhenDestroyed(CPbkMemoryEntryAddItemDlg** aSelfPtr);
55 * Run the dialog and return selected field info.
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.
61 IMPORT_C CPbkFieldInfo* ExecuteLD
62 (CArrayPtrFlat<CPbkFieldInfo>& aFieldInfos, TInt aCbaResource);
65 * Run the dialog and return selected field info.
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.
73 IMPORT_C CPbkFieldInfo* ExecuteLD
74 (CArrayPtr<CPbkFieldInfo>& aFieldInfos,
76 const TDesC& aTitleText);
79 * Basic ExecuteLD for derived classes to override.
80 * @param aFieldInfos An array of field info objects to select from.
82 IMPORT_C virtual CPbkFieldInfo* ExecuteLD
83 (CArrayPtr<CPbkFieldInfo>& aFieldInfos);
87 * Also cancels and dismisses this popup list, in other words makes
88 * ExecuteLD return just like cancel was pressed.
90 IMPORT_C ~CPbkMemoryEntryAddItemDlg();
92 public: // internal implementation
95 * Sorts the field info objects according to Phonebook specific rules.
97 void SortFieldInfoArray();
99 protected: // Interface for derived classes
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
108 void PrepareLC(CArrayPtr<CPbkFieldInfo>& aFieldInfos,
109 TInt aCbaResource, const TDesC& aTitle);
112 * Execute the initialized dialog.
113 * Second part of ExecuteLD.
114 * @return Pointer to a field info
116 CPbkFieldInfo* RunLD();
118 private: // Spare virtual functions
119 IMPORT_C virtual void Reserved_1();
120 IMPORT_C virtual void Reserved_2();
122 private: // Data types
125 private: // Data members
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;
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.
144 class CPbkItemTypeSelectCreateNew : public CPbkMemoryEntryAddItemDlg
150 IMPORT_C CPbkItemTypeSelectCreateNew();
154 * Also cancels and dismisses this popup list, in other words makes
155 * ExecuteLD return just like cancel was pressed.
157 IMPORT_C ~CPbkItemTypeSelectCreateNew();
159 public: // from CPbkMemoryEntryAddItemDlg
161 * Runs this dialog and returns the selected field info.
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.
166 IMPORT_C CPbkFieldInfo* ExecuteLD(CArrayPtr<CPbkFieldInfo>& aFieldInfos);
169 /// Own: popup list title text
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.
181 class CPbkItemTypeSelectAddToExisting : public CPbkMemoryEntryAddItemDlg
187 IMPORT_C CPbkItemTypeSelectAddToExisting();
191 * Also cancels and dismisses this popup list, in other words makes
192 * ExecuteLD return just like cancel was pressed.
194 IMPORT_C ~CPbkItemTypeSelectAddToExisting();
196 public: // from CPbkMemoryEntryAddItemDlg
198 * Run this dialog and return selected field info.
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.
203 IMPORT_C CPbkFieldInfo* ExecuteLD(CArrayPtr<CPbkFieldInfo>& aFieldInfos);
206 /// Own: popup list title text
212 #endif // __CPbkMemoryEntryAddItemDlg_H__