|
1 /* |
|
2 * Copyright (c) 2007 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: Dialog for selecting wanted field. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_CMSSELECTIONDIALOG_H |
|
20 #define C_CMSSELECTIONDIALOG_H |
|
21 |
|
22 #include <e32base.h> |
|
23 #include "cmscontactfield.h" |
|
24 |
|
25 /** |
|
26 * CCMSSelectionDialog |
|
27 * Dialog for selecting wanted field. |
|
28 * |
|
29 * @code |
|
30 * |
|
31 * @endcode |
|
32 * |
|
33 * @lib cmscontactor |
|
34 * @since S60 v5.0 |
|
35 */ |
|
36 NONSHARABLE_CLASS(CCMSSelectionDialog) : public CBase |
|
37 { |
|
38 public: |
|
39 |
|
40 /** |
|
41 * Two-phased constructor. |
|
42 */ |
|
43 static CCMSSelectionDialog* NewL( const RPointerArray<CCmsContactField>& aFieldArray ); |
|
44 |
|
45 /** |
|
46 * Destructor. |
|
47 */ |
|
48 virtual ~CCMSSelectionDialog(); |
|
49 |
|
50 /** |
|
51 * Executes the dialog. |
|
52 * |
|
53 * @since S60 v5.0 |
|
54 * @param aCbaResourceId: Resource Id of softkey buttons. |
|
55 * @param aHeading: Resource Id of heading text. |
|
56 * @param aFocusIndex Focused item. |
|
57 * @return selected field item. |
|
58 */ |
|
59 const CCmsContactFieldItem* CCMSSelectionDialog::ExecuteLD |
|
60 ( TInt aCbaResourceId, const TDesC& aHeading, |
|
61 TInt aFocusIndex ); |
|
62 |
|
63 private: // Implementation |
|
64 |
|
65 CCMSSelectionDialog( const RPointerArray<CCmsContactField>& aFieldArray ); |
|
66 |
|
67 /** |
|
68 * Creating and initializing actual listbox. |
|
69 * |
|
70 * @since S60 v5.0 |
|
71 * @param aCbaResourceId: Resource Id of softkey buttons. |
|
72 * @param aHeading: Resource Id of heading text. |
|
73 * @param aFocusIndex Focused item. |
|
74 */ |
|
75 void CreateListBoxL( |
|
76 TInt aCbaResourceId, |
|
77 const TDesC& aHeading, |
|
78 TInt aFocusIndex ); |
|
79 |
|
80 /** |
|
81 * Prepares the listbox model. |
|
82 * |
|
83 * @since S60 v5.0 |
|
84 * @return listbox model. |
|
85 */ |
|
86 MDesCArray* CCMSSelectionDialog::CreateListItemsL( ); |
|
87 |
|
88 /** |
|
89 * Helper function for making correct model data for listbox. |
|
90 * |
|
91 * @since S60 v5.0 |
|
92 * @param aContactField: Contact field where to get the type. |
|
93 * @return model data, ownership changed. |
|
94 */ |
|
95 TDesC* CreateModelDataL( const CCmsContactField& aContactField, const CCmsContactFieldItem& aContactFieldItem ); |
|
96 |
|
97 /** |
|
98 * Helper function for getting correct localized field type string. |
|
99 * |
|
100 * @since S60 v5.0 |
|
101 * @param aContactField: Contact field where to get the type. |
|
102 * @return contact type string, ownership changed, set to cleanupstack. |
|
103 */ |
|
104 TDesC* GetContactTypeStringLC( const CCmsContactField& aContactField ); |
|
105 |
|
106 /** |
|
107 * Helper function for getting needed contact field item. |
|
108 * |
|
109 * @since S60 v5.0 |
|
110 * @param aIndex: Index of needed item. |
|
111 * @return contact field item. |
|
112 */ |
|
113 const CCmsContactFieldItem& GetContactFieldItemL( TInt aIndex ); |
|
114 |
|
115 private: // data |
|
116 |
|
117 /// Specialized list box class |
|
118 class CListBox; |
|
119 /** |
|
120 * List box inside the popup list. |
|
121 * Own. |
|
122 */ |
|
123 CListBox* iListBox; |
|
124 |
|
125 /// Specialized popup list class |
|
126 class CPopupList; |
|
127 /** |
|
128 * Popup list query. |
|
129 * Own. |
|
130 */ |
|
131 CPopupList* iPopupList; |
|
132 |
|
133 /** |
|
134 * Array of listbox items. |
|
135 * Not Own. |
|
136 */ |
|
137 const RPointerArray<CCmsContactField>& iFieldArray; |
|
138 |
|
139 }; |
|
140 |
|
141 #endif // C_CMSSELECTIONDIALOG_H |
|
142 |
|
143 // End of File |