|
1 /* |
|
2 * Copyright (c) 2005-2010 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 Application UI Class CNSmlDMSyncAppUi |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef __NSMLDMSYNCAPPUI_H |
|
21 #define __NSMLDMSYNCAPPUI_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <bldvariant.hrh> |
|
25 |
|
26 #include <aknViewAppUi.h> |
|
27 #include <akntitle.h> |
|
28 |
|
29 #include "NSmlDMdef.h" |
|
30 #include "NSmlDMSyncAppEngine.h" |
|
31 |
|
32 // FORWARD DECLARATIONS |
|
33 class CAknNavigationControlContainer; |
|
34 class CAknNavigationDecorator; |
|
35 |
|
36 class CNSmlDMProfilesView; |
|
37 class CNSmlDMDlgProfileView; |
|
38 class CNSmlDMSyncDocument; |
|
39 class CNSmlDMSyncAppEngine; |
|
40 class CNSmlDMFotaModel; |
|
41 class CNSmlDMDbNotifier; |
|
42 class CNSmlDMFotaView; |
|
43 |
|
44 /** |
|
45 * Application UI class. |
|
46 * Provides support for the following features: |
|
47 * - dialog architecture |
|
48 * |
|
49 */ |
|
50 NONSHARABLE_CLASS (CNSmlDMSyncAppUi) : public CAknViewAppUi, |
|
51 public MNSmlDMSyncObserver |
|
52 |
|
53 { |
|
54 enum TViews |
|
55 { |
|
56 MainView, |
|
57 LogView, |
|
58 SettingsView, |
|
59 ProgressView |
|
60 }; |
|
61 |
|
62 public: // Constructors and destructor |
|
63 |
|
64 /** |
|
65 * By default Symbian 2nd phase constructor is private. |
|
66 */ |
|
67 void ConstructL(); |
|
68 |
|
69 /** |
|
70 * Destructor. |
|
71 */ |
|
72 virtual ~CNSmlDMSyncAppUi(); |
|
73 |
|
74 public: // New functions |
|
75 |
|
76 /** |
|
77 * Used to close the settings view gracefully |
|
78 * @param aRefresh |
|
79 * @return - |
|
80 */ |
|
81 void ChangeViewL( TBool aRefresh = EFalse ); |
|
82 |
|
83 /** |
|
84 * Help context |
|
85 * @param None. |
|
86 * @return pointer to CArrayFix<TCoeHelpContext> |
|
87 */ |
|
88 CArrayFix<TCoeHelpContext>* HelpContextL() const; |
|
89 /** |
|
90 * Shows profile editing dialog |
|
91 * @param aMode (EEditProfile to edit or ENewProfile to create a profile |
|
92 * @return - |
|
93 */ |
|
94 void ShowEditProfileDialogL( TNSmlEditMode aMode, TInt aStartUp = 0 ); |
|
95 |
|
96 /** |
|
97 * Public method to access HandleCommandL outside the class |
|
98 * @param aCommand -forwards command from listquery |
|
99 * @return - |
|
100 */ |
|
101 void HandleContextMenu( TInt aCommand ) { HandleCommandL( aCommand ); } |
|
102 |
|
103 /** |
|
104 * Called before the application is started |
|
105 * @param aCommand - StartUp command |
|
106 * @param aDocumentName - Document name |
|
107 * @param aTail - Additional information (profileID) |
|
108 * @return - |
|
109 */ |
|
110 TBool ProcessCommandParametersL( TApaCommand aCommand, |
|
111 TFileName& aDocumentName, |
|
112 const TDesC8& aTail ); |
|
113 |
|
114 /** |
|
115 * Called by settingsdialog to set if the settingdialog is properly closed |
|
116 * @param - |
|
117 * @return - |
|
118 */ |
|
119 void DoExit() { iDestroyed = 0; |
|
120 CloseGs(); |
|
121 |
|
122 } |
|
123 |
|
124 /** |
|
125 * Called to exit Dm application and control panel |
|
126 * @param - |
|
127 * @return - |
|
128 */ |
|
129 void CloseGs(); |
|
130 |
|
131 |
|
132 /** |
|
133 * Shows error note |
|
134 * @param TInt aResource resource id |
|
135 * @return - |
|
136 */ |
|
137 void ShowResourceErrorNoteL( TInt aResource ) const; |
|
138 |
|
139 /** |
|
140 * Returns the iFotaModel pointer. |
|
141 * @param None. |
|
142 * @return Pointer to the CNSmlDMFotaModel instance or NULL if it does not exist. |
|
143 */ |
|
144 CNSmlDMFotaModel* FotaModel() const; |
|
145 |
|
146 /** |
|
147 * Saves the current state of update packages. |
|
148 * @param None. |
|
149 * @return None. |
|
150 */ |
|
151 void MarkFwUpdChangesStartL(); |
|
152 |
|
153 /** |
|
154 * Checks if the state of update packages has changed since the saved |
|
155 * situation. |
|
156 * @param None. |
|
157 * @return True if there are differences in pcakage identifiers or states. |
|
158 */ |
|
159 TBool FwUpdStatesChangedL(); |
|
160 |
|
161 |
|
162 void SetTitleCall(TInt aView) |
|
163 { |
|
164 iViewTitle = aView; |
|
165 } |
|
166 |
|
167 |
|
168 public: // Functions from base classes |
|
169 |
|
170 /** |
|
171 * Initiates a device management session with a server. |
|
172 * @param aProfileId Profile identifier, with which the session is be |
|
173 * started. If left empty, defaults to Currently |
|
174 * selected profile in the list. |
|
175 * @param aUseFotaProgressNote If true, the progress notes are replaced |
|
176 * with a simpler FOTA specific note and |
|
177 * changes in firmware update packages are |
|
178 * checked after the session. |
|
179 * @return None |
|
180 */ |
|
181 void StartSyncL( const TInt aProfileId = KErrNotFound, |
|
182 const TBool aUseFotaProgressNote = EFalse ); |
|
183 |
|
184 /** |
|
185 * Confirms if the synchronisation on and the progress dialog is up |
|
186 * @param None |
|
187 * @return ETrue if sync running |
|
188 */ |
|
189 TBool Synchronise(); |
|
190 |
|
191 /** |
|
192 * Handles error notes |
|
193 * @param aError error number |
|
194 * @return - |
|
195 */ |
|
196 void ShowErrorNoteL( TInt aError ) const; |
|
197 |
|
198 void SyncComplete( TNSmlStatus aStatus ); |
|
199 |
|
200 /** |
|
201 * Sets the iExitPress value of fota view |
|
202 * @param None |
|
203 * @return - |
|
204 */ |
|
205 void ExitCallL(); |
|
206 |
|
207 /** |
|
208 * Refrsehes Main view |
|
209 * @param None |
|
210 * @return - |
|
211 */ |
|
212 void RefreshMainViewL(); |
|
213 |
|
214 /** |
|
215 * Used to check the fota download going |
|
216 * @param aNone |
|
217 * @return aNone |
|
218 */ |
|
219 void CheckFotaDlL(); |
|
220 |
|
221 void CheckAMDlL(); |
|
222 private: |
|
223 |
|
224 |
|
225 /** |
|
226 * From MEikMenuObserver, called by the framework before |
|
227 * the options menu is shown |
|
228 * @param aResourceId - resourceid of the menu |
|
229 * @param aMenuPane - pointer to that menu |
|
230 * @return - |
|
231 */ |
|
232 void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ); |
|
233 |
|
234 private: |
|
235 |
|
236 /** |
|
237 * From CEikAppUi, takes care of command handling. |
|
238 * @param aCommand - id of the command to be handled |
|
239 * @return - |
|
240 */ |
|
241 void HandleCommandL( TInt aCommand ); |
|
242 |
|
243 /** |
|
244 * From CEikAppUi, handles key events. |
|
245 * @param aKeyEvent - Event to handled. |
|
246 * @param aType - Type of the key event. |
|
247 * @return Reponse code (EKeyWasConsumed, EKeyWasNotConsumed). |
|
248 */ |
|
249 virtual TKeyResponse HandleKeyEventL( const TKeyEvent& aKeyEvent, |
|
250 TEventCode aType ); |
|
251 |
|
252 private: |
|
253 |
|
254 /** |
|
255 * Handles up scroll and forwards the action to right view |
|
256 * @param - |
|
257 * @return - |
|
258 */ |
|
259 void HandleUpScrollL(); |
|
260 |
|
261 /** |
|
262 * Handles down scroll and forwards the action to right view |
|
263 * @param - |
|
264 * @return - |
|
265 */ |
|
266 void HandleDownScrollL(); |
|
267 |
|
268 /** |
|
269 * Handles the error in synchronisation |
|
270 * @param aProfileId the id of the |
|
271 * @return 0 if no error or user cancellation |
|
272 */ |
|
273 TInt HandleSyncErrorL( TInt aProfileId ); |
|
274 |
|
275 /** |
|
276 * Handles the error message text in synchronisation |
|
277 * @param aError Error value |
|
278 * @param aMsg the error message |
|
279 * @return - |
|
280 */ |
|
281 void SetErrorMessageL( TInt aError, TDes& aMsg ) const; |
|
282 |
|
283 /** |
|
284 * Shows confirmation dialog |
|
285 * @param aResource prompt resource id |
|
286 * @return ETrue in case note is accepted or EFalse if rejected |
|
287 */ |
|
288 TBool ShowConfirmationNoteL( TInt aResource ) const; |
|
289 |
|
290 /** |
|
291 * Utility function for handling New profile command |
|
292 * @param None |
|
293 * @return None |
|
294 */ |
|
295 void HandleCommandNewProfileL(); |
|
296 |
|
297 /** |
|
298 * Utility function for handling erase profile command |
|
299 * @param None |
|
300 * @return None |
|
301 */ |
|
302 void HandleCommandEraseProfileL(); |
|
303 |
|
304 /** |
|
305 * Determines whether Fota update is allowed. |
|
306 * @param Server profile to check |
|
307 * @return ETrue if allowed |
|
308 * EFalse if not not allowed |
|
309 */ |
|
310 TBool IsUpdateAllowedL( CNSmlDMSyncProfile& aProfile ); |
|
311 |
|
312 |
|
313 private: //Data |
|
314 CNSmlDMProfilesView* iProfilesView; |
|
315 |
|
316 CNSmlDMDlgProfileView* iAppView; |
|
317 CNSmlDMDbNotifier* iSmlDbNotifier; |
|
318 CEikStatusPane* iStatusPane; |
|
319 CAknNavigationControlContainer* iNaviPane; // NaviPane |
|
320 CAknNavigationDecorator* iNaviDecorator; |
|
321 |
|
322 TInt iViewTitle;// 1 for DM main view, 0-for servers view |
|
323 |
|
324 CNSmlDMFotaView* iMainView; |
|
325 // Left/RightSoftkeys and scrolling |
|
326 CEikButtonGroupContainer* iControlPane; |
|
327 TInt iActiveView; |
|
328 CAknTitlePane* iTitlePane; |
|
329 |
|
330 TInt iDialogUp; |
|
331 TInt iDestroyed; |
|
332 TInt iConfedProfileId; |
|
333 TBool iDbChanged; |
|
334 TBool iBusy; |
|
335 |
|
336 CNSmlDMSyncDocument* iSyncDocument; |
|
337 CNSmlDMSyncAppEngine* iSyncAppEngine; |
|
338 |
|
339 // Pointer to the fota model. |
|
340 CNSmlDMFotaModel* iFotaModel; |
|
341 |
|
342 }; |
|
343 |
|
344 #endif |
|
345 |
|
346 // End of File |