|
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: Header file for the CCbsUiSettingsViewContainer class. |
|
15 * |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef __CCBSUISETTINGSVIEWCONTAINER_H |
|
21 #define __CCBSUISETTINGSVIEWCONTAINER_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <bldvariant.hrh> |
|
25 #include <coecntrl.h> |
|
26 #include <eiklbo.h> // MEikListBoxObserver |
|
27 #include <CbsCommon.h> |
|
28 #include "CbsUiConstants.h" |
|
29 |
|
30 |
|
31 // FORWARD DECLARATIONS |
|
32 class CCbsUiMsgView; |
|
33 class MCbs; |
|
34 class CCbsUiSettingsView; |
|
35 class CAknSettingStyleListBox; |
|
36 class CSelectionItemList; |
|
37 |
|
38 // CLASS DECLARATION |
|
39 |
|
40 /** |
|
41 * Container for settings view components. |
|
42 * |
|
43 */ |
|
44 class CCbsUiSettingsViewContainer : public CCoeControl, |
|
45 public MEikListBoxObserver |
|
46 { |
|
47 public: // Constructors and destructor |
|
48 |
|
49 /** |
|
50 * Two-phased constructor. |
|
51 * |
|
52 * @param aView settings view |
|
53 * @param aRect containers area |
|
54 * @param aServer cbs server |
|
55 */ |
|
56 static CCbsUiSettingsViewContainer* NewL( CCbsUiSettingsView& aView, |
|
57 const TRect& aRect, |
|
58 MCbs& aServer ); |
|
59 |
|
60 /** |
|
61 * Destructor. |
|
62 */ |
|
63 ~CCbsUiSettingsViewContainer(); |
|
64 |
|
65 public: // From CCoeControl |
|
66 |
|
67 /** |
|
68 * Returns the numbers of components. |
|
69 * |
|
70 * @return Number of components in the container |
|
71 */ |
|
72 TInt CountComponentControls() const; |
|
73 |
|
74 /** |
|
75 * Returns a component. |
|
76 * |
|
77 * @param aIndex component index which is required |
|
78 * @return required component |
|
79 */ |
|
80 CCoeControl* ComponentControl( TInt aIndex ) const; |
|
81 |
|
82 /** |
|
83 * Sets a new size to list box. |
|
84 */ |
|
85 void SizeChanged(); |
|
86 |
|
87 /** |
|
88 * Informs that the focus is changed. |
|
89 * @param aDrawNow Contains the value that was passed to it by SetFocus() |
|
90 */ |
|
91 void FocusChanged( TDrawNow aDrawNow ); |
|
92 |
|
93 /** |
|
94 * Offers key event to list box. |
|
95 * |
|
96 * @param aKeyEvent what kind of key produced this event |
|
97 * @param aType Which kind of action produced this event |
|
98 * @return EKeyWasConsumed |
|
99 */ |
|
100 TKeyResponse OfferKeyEventL( |
|
101 const TKeyEvent& aKeyEvent, TEventCode aType ); |
|
102 |
|
103 /** |
|
104 * Gets the control's help context. |
|
105 * |
|
106 * @param aContext The control's help context |
|
107 */ |
|
108 void GetHelpContext( TCoeHelpContext& aContext ) const; |
|
109 |
|
110 /** |
|
111 * Handles a change to the control's resources. |
|
112 * @param aType A message UID value. |
|
113 */ |
|
114 void HandleResourceChange( TInt aType ); |
|
115 |
|
116 public: // New functions |
|
117 |
|
118 /** |
|
119 * Changes the value which the user has pushed and asks |
|
120 * server to save that value. If the user has choosed the |
|
121 * language item the language page will show up. Calls |
|
122 * private HandleListViewActionL. |
|
123 * |
|
124 * @param aLaunchedFromOptionMenu if ETrue pop_up_setting_item |
|
125 * will be launhed |
|
126 * @return EKeyWasConsumed |
|
127 */ |
|
128 TKeyResponse HandleListViewActionL( TBool aLaunchedFromOptionMenu ); |
|
129 |
|
130 /** |
|
131 * Offers public interface to update all settings. |
|
132 * Is needed if operator changes some values during in settings view. |
|
133 */ |
|
134 void UpdateSettingsL(); |
|
135 |
|
136 /** |
|
137 * Sets focus to first item in settings list box. Needed, because |
|
138 * sometimes view is not activated correctly. |
|
139 */ |
|
140 void SetFocusToFirstItem() const; |
|
141 |
|
142 protected: // From MEikListBoxObsever |
|
143 |
|
144 /** |
|
145 * Handles list box events. |
|
146 * |
|
147 * @param aListBox the originating list box |
|
148 * @param aEventType a code for the event. |
|
149 */ |
|
150 void HandleListBoxEventL( CEikListBox* aListBox, |
|
151 TListBoxEvent aEventType ); |
|
152 |
|
153 private: // New functions |
|
154 |
|
155 /** |
|
156 * With this settings view can update the text in the |
|
157 * list box for language item. This can only be called from |
|
158 * GetSettingsL! |
|
159 */ |
|
160 void SetLanguageSelectionL( CDesCArray& aItemArray ); |
|
161 |
|
162 /** |
|
163 * Creates a list box. |
|
164 */ |
|
165 void CreateListBoxL(); |
|
166 |
|
167 /** |
|
168 * Gets the settings of reception, language and detection from the |
|
169 * sserver and sets these values to list box. |
|
170 */ |
|
171 void GetSettingsL(); |
|
172 |
|
173 /** |
|
174 * Changes the value which the user has pushed and asks |
|
175 * server to save that value. If the user has choosed the |
|
176 * language item the language page will show up. |
|
177 * |
|
178 * @param aListBox changes are focused on this list box |
|
179 * @param aLaunchedFromOptionMenu if ETrue pop_up_setting_item |
|
180 * will be launhed |
|
181 * @return EKeyWasConsumed |
|
182 */ |
|
183 TKeyResponse HandleListViewActionL( |
|
184 const CEikListBox* aListBox, TBool aLaunchedFromOptionMenu ); |
|
185 |
|
186 /** |
|
187 * Launches a dialog for On and Off setting items. |
|
188 * |
|
189 * @param aValue it will contain selected value in dialog |
|
190 * @param aUpdate if aValue has changed in dialog |
|
191 * @param aResouceId setting text resource id |
|
192 */ |
|
193 void LaunchDialogOnOffL( |
|
194 const TBool& aValue, TBool& aUpdate, TInt aResouceId ) const; |
|
195 |
|
196 /** |
|
197 * Launches a topic detection dialog for On and Off setting items. |
|
198 * |
|
199 * @param aValue it will contain selected value in dialog |
|
200 * @param aUpdate if aValue has changed in dialog |
|
201 * @param aResouceId setting text resource id |
|
202 */ |
|
203 void LaunchTopicDetectionDialogOnOffL( |
|
204 const TBool& aValue, TBool& aUpdate, TInt aResouceId ) const; |
|
205 |
|
206 /** |
|
207 * Prepares the language setting page with the values stored in |
|
208 * the server. |
|
209 */ |
|
210 void PrepareLanguageSettingPageL(); |
|
211 |
|
212 /** |
|
213 * Returns selected item in settings page. |
|
214 * |
|
215 * @return selected item |
|
216 */ |
|
217 TCbsUiLanguageSelectionIndex GetSelected(); |
|
218 |
|
219 /** |
|
220 * Launchs language setting page with aItems. |
|
221 * |
|
222 * @param aItems items in language setting page. |
|
223 * @param aCurrentSelectionIndex item to be selected |
|
224 */ |
|
225 void LaunchLanguageSettingPageL( |
|
226 CDesCArrayFlat& aItems, TInt& aCurrentSelectionIndex ); |
|
227 |
|
228 /** |
|
229 * Sets items to a aItemList from resource array. |
|
230 * |
|
231 * @param aResourceId resource array |
|
232 * @param aItemList list to be filled |
|
233 */ |
|
234 void AddItemsToListL( |
|
235 TInt aResourceId, |
|
236 CDesCArrayFlat& aItemList ) const; |
|
237 |
|
238 private: |
|
239 |
|
240 /** |
|
241 * C++ constructor. |
|
242 * |
|
243 * @param aView settings view |
|
244 * @param aServer cbs server |
|
245 */ |
|
246 CCbsUiSettingsViewContainer( CCbsUiSettingsView& aView, |
|
247 MCbs& aServer ); |
|
248 |
|
249 /** |
|
250 * Symbian OS default constructor. |
|
251 */ |
|
252 void ConstructL( const TRect& aRect ); |
|
253 |
|
254 |
|
255 /** |
|
256 * Checks if phone is in offline mode or not |
|
257 * @return ETrue if phone is in offline mode |
|
258 * Otherwise EFalse. |
|
259 */ |
|
260 TBool IsPhoneOfflineL() const; |
|
261 |
|
262 |
|
263 private: // Data |
|
264 |
|
265 // List box object in dialog. |
|
266 CAknSettingStyleListBox* iListBox; |
|
267 |
|
268 // For setting mop parent |
|
269 CCbsUiSettingsView& iView; |
|
270 |
|
271 // With the help of server it is possible to set and get |
|
272 // setting information. |
|
273 MCbs& iServer; |
|
274 |
|
275 // If ofline feature is supported then this is ETrue. |
|
276 TBool iOfflineFeatureSupported; |
|
277 |
|
278 }; |
|
279 |
|
280 |
|
281 #endif //__CCBSUISETTINGSVIEWCONTAINER_H |
|
282 |
|
283 // End of file |