|
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: Setting item class for "Alert for" setting. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef CPROFILEALERTFORSETTINGITEM_H |
|
21 #define CPROFILEALERTFORSETTINGITEM_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <aknsettingitemlist.h> |
|
25 #include <MPbkContactDbObserver.h> |
|
26 #include <akncheckboxsettingpage.h> // For CSelectionItemList member data |
|
27 |
|
28 // FORWARD DECLARATIONS |
|
29 class CCoeEnv; |
|
30 class CPbkContactChangeNotifier; |
|
31 |
|
32 // CONSTANTS |
|
33 const TInt KMaxPbkContactGroupNameLength( 64 ); |
|
34 |
|
35 // CLASS DECLARATION |
|
36 /** |
|
37 * Setting item class for "Alert for" setting. |
|
38 * CProfileAlertForSettingItem reads user defined groups from |
|
39 * Phonebook contact database and shows a list of the groups |
|
40 * in a check box setting page (CAknCheckBoxSettingPage). |
|
41 * CProfileAlertForSettingItem is inherited from MPbkContactDbObserver |
|
42 * in order to catch Phonebook contact group change events and |
|
43 * dynamically update its contents. |
|
44 * |
|
45 * @lib ProfileSettingsView.lib |
|
46 * @since 1.2 |
|
47 */ |
|
48 NONSHARABLE_CLASS( CProfileAlertForSettingItem ) : public CAknSettingItem |
|
49 ,public MPbkContactDbObserver |
|
50 { |
|
51 |
|
52 public: // Constructors and destructor |
|
53 |
|
54 /** |
|
55 * C++ constructor. |
|
56 * @param aIdentifier Resource identifier. |
|
57 * @aContactList Array where selected contact groups are stored. |
|
58 * @aCoeEnv A pointer to Control Environment. |
|
59 */ |
|
60 CProfileAlertForSettingItem( |
|
61 TInt aIdentifier, |
|
62 RArray<TContactItemId>& aContactList, |
|
63 CCoeEnv* aCoeEnv ); |
|
64 |
|
65 /** |
|
66 * Destructor |
|
67 */ |
|
68 ~CProfileAlertForSettingItem(); |
|
69 |
|
70 private: // Enumerations |
|
71 |
|
72 enum TAlertForStatus |
|
73 { |
|
74 EAlertForAllCallers, |
|
75 EAlertForSingleGroup, |
|
76 EAlertForSeveralGroups |
|
77 }; |
|
78 |
|
79 private: // New functions |
|
80 |
|
81 /** |
|
82 * Resolves the alert for status of iPopupArray. |
|
83 * @return Returns the alert for status of iPopupArray. |
|
84 */ |
|
85 TAlertForStatus AlertForStatus() const; |
|
86 |
|
87 /** |
|
88 * Sets selection status to iPopupArray at specified index. |
|
89 * @param aIndex Index in iPopupArray. |
|
90 * @param aStatus Selection status of an item. |
|
91 */ |
|
92 void SetSelectionStatus( TInt aIndex, TBool aStatus ); |
|
93 |
|
94 /** |
|
95 * Returns selection status of an item in iPopupArray. |
|
96 * @param aIndex Index in iPopupArray. |
|
97 * @return Returns selection status of an item. |
|
98 */ |
|
99 TBool SelectionStatus( TInt aIndex ) const; |
|
100 |
|
101 /** |
|
102 * Populates iPopupArray. Reads contact group names from Phonebook engine. |
|
103 */ |
|
104 void PopulatePopupArrayL(); |
|
105 |
|
106 /** |
|
107 * Sets other groups unselected if "All callers" has been selected. |
|
108 */ |
|
109 void CheckAllCallersSetting(); |
|
110 |
|
111 /** |
|
112 * Updates iPopupArray and if setting page is opened, |
|
113 * updates items of the setting page too. |
|
114 */ |
|
115 void UpdateSettingPageL(); |
|
116 |
|
117 /** |
|
118 * Stores currently selected groups to given array. |
|
119 * @param aArray An array to store currently selected groups to. |
|
120 */ |
|
121 void StoreL( RArray<TContactItemId>& aArray ) const; |
|
122 |
|
123 /** |
|
124 * Loads selected groups from given array and sets them to iPopupArray. |
|
125 * @param aArray An array to load currently selected groups from. |
|
126 */ |
|
127 void LoadL( const RArray<TContactItemId>& aArray ); |
|
128 |
|
129 private: // Functions from base classes |
|
130 |
|
131 /** |
|
132 * From CAknSettingItem |
|
133 */ |
|
134 void CompleteConstructionL(); |
|
135 |
|
136 /** |
|
137 * From CAknSettingItem |
|
138 */ |
|
139 void StoreL(); |
|
140 |
|
141 /** |
|
142 * From CAknSettingItem |
|
143 */ |
|
144 void LoadL(); |
|
145 |
|
146 /** |
|
147 * From CAknSettingItem |
|
148 */ |
|
149 void EditItemL( TBool aCalledFromMenu ); |
|
150 |
|
151 /** |
|
152 * From CAknSettingItem |
|
153 */ |
|
154 const TDesC& SettingTextL(); |
|
155 |
|
156 /** |
|
157 * From MPbkContactDbObserver |
|
158 */ |
|
159 void HandleDatabaseEventL( TContactDbObserverEvent aEvent ); |
|
160 |
|
161 /** |
|
162 * From MAknSettingPageObserver |
|
163 */ |
|
164 void HandleSettingPageEventL( |
|
165 CAknSettingPage* aSettingPage, |
|
166 TAknSettingPageEvent aEventType ); |
|
167 |
|
168 private: // Data |
|
169 |
|
170 // Contains all items in check box setting list |
|
171 // (item name string and selection status boolean value) |
|
172 CSelectionItemList iPopupArray; |
|
173 |
|
174 // Own: Localised text "All callers" |
|
175 HBufC* iTextAllCallers; |
|
176 |
|
177 // Own: Localised text "Several groups" |
|
178 HBufC* iTextSeveralGroups; |
|
179 |
|
180 // Text to return with SettingTextL() |
|
181 TBuf<KMaxPbkContactGroupNameLength> iSettingText; |
|
182 |
|
183 // An array which contains contact item id:s of all contact groups |
|
184 RArray<TContactItemId> iFullContactArray; |
|
185 |
|
186 // Array of selected contact groups |
|
187 RArray<TContactItemId>& iExternalContactArray; |
|
188 |
|
189 // Own: PhoneBook contact change notifier |
|
190 CPbkContactChangeNotifier* iChangeNotifier; |
|
191 |
|
192 // Own: PhoneBook contact engine |
|
193 CPbkContactEngine* iPbkContactEngine; |
|
194 |
|
195 // Ref: Pointer to Control Environment |
|
196 CCoeEnv* iCoeEnv; |
|
197 |
|
198 }; |
|
199 |
|
200 #endif // CPROFILEALERTFORSETTINGITEM_H |
|
201 |
|
202 // End of File |