|
1 /* |
|
2 * Copyright (c) 2006 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: Settings page container for Calendar |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CALENSETTINGSUICONTAINER_H |
|
20 #define CALENSETTINGSUICONTAINER_H |
|
21 |
|
22 #include "calensetting.h" |
|
23 #include <gulicon.h> |
|
24 #include "calendar.hrh" // TSettingListItemId |
|
25 #include <cmrmailboxutils.h> // CMRMailboxUtils::TMailboxInfo |
|
26 #include <cenrepnotifyhandler.h> // MCenRepNotifyHandlerCallback |
|
27 |
|
28 // FORWARD DECLARATIONS |
|
29 class CAknSettingItemArray; |
|
30 class CCalenGlobalData; |
|
31 class CAknSettingItem; |
|
32 class CAknSettingStyleListBox; |
|
33 class CCalenSetting; |
|
34 class CCalenUiPluginHandler; |
|
35 class CEnvironmentChangeNotifier; |
|
36 class CRepository; |
|
37 class CCenRepNotifyHandler; |
|
38 class CCoeControl; |
|
39 class TCoeHelpContext; |
|
40 class CCalenCustomisationManager; |
|
41 class CCalenViewInfo; |
|
42 |
|
43 #ifdef RD_CALEN_EXTERNAL_CAL |
|
44 class CAiwServiceHandler; |
|
45 #endif //RD_CALEN_EXTERNAL_CAL |
|
46 |
|
47 typedef CCalenCustomisationManager::CCalenPluginStatusArray pluginAvail; |
|
48 // CLASS DECLARATION |
|
49 /** |
|
50 * CCalenSettingsUiContainer class |
|
51 */ |
|
52 class CCalenSettingsUiContainer : public CBase, |
|
53 private MCenRepNotifyHandlerCallback |
|
54 { |
|
55 public: // Constructors and destructor |
|
56 |
|
57 /** |
|
58 * Two-phased constructor. Does NOT take ownership of aParentControl or aListBox. |
|
59 * @param aParentControl Parent control. Ownership remains with caller. |
|
60 * @param aListBox Listbox used in this settings menu. Ownership remains with caller. |
|
61 */ |
|
62 IMPORT_C static CCalenSettingsUiContainer* NewL( CCoeControl* aParentControl, |
|
63 CAknSettingStyleListBox& aListBox, |
|
64 CCalenGlobalData& aGlobalData, |
|
65 CCalenCustomisationManager& aCustomisationManager ); |
|
66 |
|
67 /** |
|
68 * Destructor. |
|
69 */ |
|
70 ~CCalenSettingsUiContainer(); |
|
71 |
|
72 public: // New functions |
|
73 /** |
|
74 * Updates list box |
|
75 * |
|
76 * @param aFeatureId is a updated list box item |
|
77 */ |
|
78 IMPORT_C void UpdateListBoxL(); |
|
79 |
|
80 /** |
|
81 * Creates list box |
|
82 */ |
|
83 IMPORT_C void ConstructListBoxL(); |
|
84 |
|
85 /** |
|
86 * Retrieves the currently selected listbox feature id |
|
87 * @return feature id. |
|
88 * @since 3.1 |
|
89 */ |
|
90 IMPORT_C TInt CurrentFeatureId() const; |
|
91 |
|
92 /** |
|
93 * Handle listbox selection event |
|
94 * @param aCommand Command id to tell origin of event |
|
95 */ |
|
96 IMPORT_C void HandleListBoxSelectionL( TInt aCommand ,TBool& aPageStatus ); |
|
97 |
|
98 private: // New functions |
|
99 |
|
100 void HandlePluginChange(); |
|
101 |
|
102 /** |
|
103 * Creates list box items |
|
104 */ |
|
105 void CreateListBoxItemsL(); |
|
106 |
|
107 /** |
|
108 * Populates the given array. |
|
109 */ |
|
110 void PopulateViewsArrayL( RArray<CCalenViewInfo>& aArray ); |
|
111 |
|
112 /** |
|
113 * Required for help. |
|
114 */ |
|
115 void GetHelpContext( TCoeHelpContext& aContext ) const; |
|
116 |
|
117 /** |
|
118 * Stores changes to the default mailbox setting. |
|
119 */ |
|
120 void StoreMailboxSettingsL(); |
|
121 |
|
122 void AddSnoozeTimeItemL(TInt aOrdinal, CArrayPtr<CGulIcon>* aIconArray, TInt& aSnoozeTime); |
|
123 |
|
124 void AddEnumerationItemL( TInt& aBuffer, |
|
125 TInt aId, |
|
126 TInt aTitleResource, |
|
127 TInt aSettingPageResource, |
|
128 TInt aAssociatedResource, |
|
129 TInt aOrdinal ); |
|
130 |
|
131 void AddBinaryItemL( TBool& aBuffer, |
|
132 TInt aId, |
|
133 TInt aTitleResource, |
|
134 TInt aSettingPageResource, |
|
135 TInt aAssociatedResource, |
|
136 TInt aOrdinal ); |
|
137 |
|
138 void AddAlarmToneItemL(TInt aOrdinal); |
|
139 |
|
140 void CreateMailboxSettingsItemL(TInt aOrdinal); |
|
141 |
|
142 TBool ShouldShowWeekTitleItem() const; |
|
143 |
|
144 CAknSettingItem* Item(TSettingListItemId aId); |
|
145 |
|
146 void ValidateWeekTitleItemL(CAknSettingItem* aItem); |
|
147 |
|
148 #ifdef RD_CALEN_EXTERNAL_CAL |
|
149 |
|
150 TBool ExtCalendarAvailableL(); |
|
151 |
|
152 #endif // RD_CALEN_EXTERNAL_CAL |
|
153 |
|
154 void LoadCurrentValuesL(); |
|
155 |
|
156 void LoadMailboxSettingsL(); |
|
157 |
|
158 /** |
|
159 * This function is called when the locale is changed. |
|
160 * @param aThisPtr Pointer to this object |
|
161 * @return FALSE |
|
162 */ |
|
163 static TInt LocaleCallbackL( TAny* aThisPtr ); |
|
164 |
|
165 /** |
|
166 * Non static implementation of locale callback. |
|
167 * We need to check if the week start has been modified and if so, |
|
168 * update the listbox. |
|
169 */ |
|
170 void DoLocaleCallbackL(); |
|
171 |
|
172 /** |
|
173 * Called when something else modified our settings. |
|
174 */ |
|
175 void HandleExternalSettingsChangedL(TUint32 aId = 0); |
|
176 |
|
177 /** |
|
178 * Shows or hides the week title setting as appropriate. |
|
179 */ |
|
180 void ShowOrHideWeekTitleL(); |
|
181 |
|
182 void AddCustomSettingsWithLinkL( RPointerArray<CAknSettingItem>& aSettings, |
|
183 const TDesC& aName, |
|
184 TInt aOrdinal ); |
|
185 |
|
186 void AddSingleCustomSettingL( CAknSettingItem* aSetting, |
|
187 TInt aOrdinal ); |
|
188 |
|
189 void AddCustomSettingsItemsL( TInt& aOrdinal ); |
|
190 |
|
191 void AddDefaultViewItemL( TInt& aBuffer, |
|
192 TInt aId, |
|
193 TInt aTitleResource, |
|
194 TInt aSettingPageResource, |
|
195 TInt aOrdinal ); |
|
196 |
|
197 void AddPluginSettingItemL( TInt& aOrdinal ); |
|
198 |
|
199 private: // From MCenRepNotifyHandlerCallback |
|
200 /** |
|
201 * Called when the central repository changes. |
|
202 */ |
|
203 void HandleNotifyError( TUint32 aId, |
|
204 TInt aError, |
|
205 CCenRepNotifyHandler* aHandler ); |
|
206 |
|
207 void HandleNotifyGeneric( TUint32 aId ); |
|
208 |
|
209 void PluginListChangedL(); |
|
210 |
|
211 private: // Construction and destruction |
|
212 /** |
|
213 * Default C++ constructor |
|
214 */ |
|
215 CCalenSettingsUiContainer( CCoeControl* aParentControl, |
|
216 CAknSettingStyleListBox& aListBox, |
|
217 CCalenGlobalData& aGlobalData, |
|
218 CCalenCustomisationManager& aCustomisationManager ); |
|
219 |
|
220 /** |
|
221 * Symbian OS default constructor. |
|
222 */ |
|
223 void ConstructL(); |
|
224 |
|
225 private: // New functions |
|
226 /** |
|
227 * Matches a uid to an array item's uid. Used in Find(). |
|
228 */ |
|
229 static TBool PluginUidFinder( const TUid* aUid, |
|
230 const CImplementationInformation& aArrayItem ); |
|
231 |
|
232 private: |
|
233 /** |
|
234 * Array of setting items contained in the listbox. Owned. |
|
235 */ |
|
236 CAknSettingItemArray* iSettingItemArray; |
|
237 |
|
238 // Wraps all settings items and the ability to load/save from cenrep. |
|
239 CCalenSetting* iSetting; |
|
240 // Default view enumeration |
|
241 TInt iDefView; |
|
242 // week format enumeration |
|
243 TInt iWeekFormat; |
|
244 // week title enumeration |
|
245 TInt iWeekTitle; |
|
246 // Default mailbox enumeration |
|
247 TInt iDefMailbox; |
|
248 // Snooze time |
|
249 TInt iSnoozeTime; |
|
250 #ifdef RD_SCALABLE_UI_V2_NO_TOOLBAR_SETTING |
|
251 // Toolbar setting |
|
252 TInt iToolbar; |
|
253 #endif // RD_SCALABLE_UI_V2_NO_TOOLBAR_SETTING |
|
254 |
|
255 CCalenGlobalData& iGlobalData; |
|
256 |
|
257 TBool iHasSelectedMailbox; |
|
258 CCoeControl *iParentControl; // not owned |
|
259 CAknSettingStyleListBox &iListBox; |
|
260 RArray<CMRMailboxUtils::TMailboxInfo> iMailBoxes; |
|
261 CEnvironmentChangeNotifier* iLocaleChangeNotifier; |
|
262 CRepository* iRepository; |
|
263 CCenRepNotifyHandler* iCenRepNotifyHandler; |
|
264 CCalenCustomisationManager& iCustomisationManager; |
|
265 |
|
266 // This gets set to ETrue when we've changed a setting, so we don't |
|
267 // save the setting twice. |
|
268 TBool iIgnoreNextSettingsNotification; |
|
269 // When initialising the locale change observer, we get a notification |
|
270 // when observing starts. We ignore this as we don't need to act on it. |
|
271 TBool iIgnoreFirstLocaleChange; |
|
272 |
|
273 #ifdef RD_CALEN_EXTERNAL_CAL |
|
274 // week title enumeration |
|
275 TInt iExtCalendar; |
|
276 CAiwServiceHandler* iServiceHandler; |
|
277 #endif //RD_CALEN_EXTERNAL_CAL |
|
278 |
|
279 TBool iPageStatus; |
|
280 }; |
|
281 |
|
282 #endif // CALENSETTINGSUICONTAINER_H |
|
283 |
|
284 // End of File |