1 /* |
|
2 * Copyright (c) 2005-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: The firmware update result notifier. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include <eikenv.h> // Eikon environment |
|
22 #include <uikon/eiksrvui.h> |
|
23 #include <AknQueryDialog.h> |
|
24 #include <aknmessagequerydialog.h> |
|
25 #include <aknstaticnotedialog.h> |
|
26 #include <centralrepository.h> |
|
27 #include <StringLoader.h> // Localisation stringloader |
|
28 #include <SyncMLClient.h> |
|
29 #include <SyncMLClientDS.h> |
|
30 #include <SyncMLClientDM.h> |
|
31 #include <centralrepository.h> |
|
32 #include <DevManInternalCRKeys.h> |
|
33 #include <SyncMLNotifierDomainCRKeys.h> |
|
34 #include <SyncMLNotifier.rsg> // Own resources |
|
35 #include <aknnotewrappers.h> |
|
36 #include <e32property.h> |
|
37 |
|
38 #include "SyncMLFwUpdNotifier.h" // Class declaration |
|
39 #include "SyncMLNotifDebug.h" |
|
40 |
|
41 #include "SyncMLQueryDialog.h" |
|
42 #include "SyncMLMessageQueryDialog.h" |
|
43 #include "SyncMLNotifPrivateCRKeys.h" |
|
44 |
|
45 // ============================ MEMBER FUNCTIONS =============================== |
|
46 |
|
47 // ----------------------------------------------------------------------------- |
|
48 // CSyncMLFwUpdNotifier::CSyncMLFwUpdNotifier |
|
49 // C++ default constructor can NOT contain any code, that |
|
50 // might leave. |
|
51 // ----------------------------------------------------------------------------- |
|
52 // |
|
53 CSyncMLFwUpdNotifier::CSyncMLFwUpdNotifier() |
|
54 { |
|
55 iRunLhang = EFalse; |
|
56 iDlg = NULL; |
|
57 iFotaEncryptReq = EFalse; |
|
58 } |
|
59 |
|
60 // ----------------------------------------------------------------------------- |
|
61 // CSyncMLDSNotifier::NewL |
|
62 // Two-phased constructor. |
|
63 // ----------------------------------------------------------------------------- |
|
64 // |
|
65 CSyncMLFwUpdNotifier* CSyncMLFwUpdNotifier::NewL() |
|
66 { |
|
67 CSyncMLFwUpdNotifier* self = new (ELeave) CSyncMLFwUpdNotifier(); |
|
68 CleanupStack::PushL( self ); |
|
69 self->ConstructL(); |
|
70 CleanupStack::Pop(); |
|
71 return self; |
|
72 } |
|
73 |
|
74 |
|
75 // ----------------------------------------------------------------------------- |
|
76 // Destructor |
|
77 // ----------------------------------------------------------------------------- |
|
78 // |
|
79 CSyncMLFwUpdNotifier::~CSyncMLFwUpdNotifier() |
|
80 { |
|
81 Cancel(); // Free own resources |
|
82 } |
|
83 |
|
84 |
|
85 // ----------------------------------------------------------------------------- |
|
86 // CSyncMLFwUpdNotifier::RegisterL |
|
87 // ----------------------------------------------------------------------------- |
|
88 // |
|
89 CSyncMLFwUpdNotifier::TNotifierInfo CSyncMLFwUpdNotifier::RegisterL() |
|
90 { |
|
91 FLOG(_L("[SmlNotif]\t CSyncMLFwUpdNotifier::RegisterL()")); |
|
92 iInfo.iUid = KSyncMLFwUpdNotifierUid; |
|
93 iInfo.iChannel = KSmlFwUpdChannel; |
|
94 iInfo.iPriority = ENotifierPriorityHigh; |
|
95 FLOG(_L("[SmlNotif]\t CSyncMLFwUpdNotifier::RegisterL() completed")); |
|
96 return iInfo; |
|
97 } |
|
98 |
|
99 // ----------------------------------------------------------------------------- |
|
100 // CSyncMLFwUpdNotifier::GetParamsL |
|
101 // Initialize parameters and check if device is already |
|
102 // in registry. Jump to RunL as soon as possible. |
|
103 // ----------------------------------------------------------------------------- |
|
104 // |
|
105 void CSyncMLFwUpdNotifier::GetParamsL( const TDesC8& aBuffer, |
|
106 TInt aReplySlot, |
|
107 const RMessagePtr2& aMessage ) |
|
108 { |
|
109 FLOG(_L("[SmlNotif]\t CSyncMLFwUpdNotifier::GetParamsL()")); |
|
110 |
|
111 if( iReplySlot != NULL || iNeedToCompleteMessage ) |
|
112 { |
|
113 User::Leave( KErrInUse ); |
|
114 } |
|
115 iMessage = aMessage; |
|
116 iNeedToCompleteMessage = ETrue; |
|
117 iReplySlot = aReplySlot; |
|
118 |
|
119 TSyncMLFwUpdNotifParams param; |
|
120 TPckgC<TSyncMLFwUpdNotifParams> pckg( param ); |
|
121 pckg.Set( aBuffer ); |
|
122 |
|
123 iNoteType = pckg().iNoteType; |
|
124 iNoteInfo = pckg().iIntParam; |
|
125 iFotaMemoryNeeded = pckg().iMemoryNeeded; |
|
126 iFotaEncryptReq = pckg().iEncryptReq; |
|
127 |
|
128 // Call SetActive() so RunL() will be called by the active scheduler |
|
129 // |
|
130 SetActive(); |
|
131 iStatus = KRequestPending; |
|
132 TRequestStatus* stat = &iStatus; |
|
133 User::RequestComplete( stat, KErrNone ); |
|
134 |
|
135 FLOG(_L("[SmlNotif]\t CSyncMLFwUpdNotifier::GetParamsL() completed")); |
|
136 } |
|
137 |
|
138 // ----------------------------------------------------------------------------- |
|
139 // CSyncMLFwUpdNotifier::RunL |
|
140 // Ask user response and return it to caller. |
|
141 // ----------------------------------------------------------------------------- |
|
142 // |
|
143 void CSyncMLFwUpdNotifier::RunL() |
|
144 { |
|
145 FLOG(_L("[SmlNotif]\t CSyncMLFwUpdNotifier::RunL()")); |
|
146 |
|
147 TInt result( KErrNone ); |
|
148 |
|
149 // Turn lights on and deactivate apps -key |
|
150 // |
|
151 TurnLightsOn(); |
|
152 SuppressAppSwitching( ETrue ); |
|
153 |
|
154 switch( iNoteType ) |
|
155 { |
|
156 case ESyncMLFwUpdErrorNote: |
|
157 { |
|
158 result = ShowUpdateErrorNoteL(); |
|
159 break; |
|
160 } |
|
161 |
|
162 case ESyncMLFwUpdResultNote: |
|
163 { |
|
164 if (iFotaEncryptReq) |
|
165 { |
|
166 result = ShowUpdateResultWithEncryptionNoteL(); |
|
167 } |
|
168 else |
|
169 { |
|
170 result = ShowUpdateResultNoteL(); |
|
171 } |
|
172 break; |
|
173 } |
|
174 |
|
175 case ESyncMLFwUpdStartQuery: |
|
176 { |
|
177 result = ShowUpdateStartQueryL(); |
|
178 break; |
|
179 } |
|
180 case ESyncMLFwUpdRebootNote: |
|
181 { |
|
182 CAknStaticNoteDialog* dlg = new ( ELeave ) CAknStaticNoteDialog; |
|
183 dlg->PrepareLC( R_SML_FOTA_RESTART_NOTE ); |
|
184 |
|
185 HBufC* stringHolder = StringLoader::LoadLC( R_FOTA_REBOOT_NOTE ); |
|
186 dlg->SetTextL( *stringHolder ); |
|
187 CleanupStack::PopAndDestroy( stringHolder ); |
|
188 |
|
189 result = dlg->RunLD(); |
|
190 if ( result == KErrNone ) |
|
191 { |
|
192 result = EAknSoftkeyOk; |
|
193 }; |
|
194 |
|
195 break; |
|
196 } |
|
197 case ESyncMLFwUpdNoReminder: |
|
198 { |
|
199 result = ShowNoReminderQueryL(); |
|
200 break; |
|
201 } |
|
202 case ESyncMLFwUpdLargeNotEnoughMemory: |
|
203 { |
|
204 result = ShowNotEnoughMemoryL( iFotaMemoryNeeded , EFalse ); |
|
205 break; |
|
206 } |
|
207 case ESyncMLFwUpdOmaDLNotEnoughMemory: |
|
208 { |
|
209 result = ShowNotEnoughMemoryL( iFotaMemoryNeeded , ETrue ); |
|
210 break; |
|
211 } |
|
212 case ESyncMLFwUpdOmaDLUserCancel: |
|
213 { |
|
214 result = ShowDownloadUserCancelL(); |
|
215 break; |
|
216 } |
|
217 case ESyncMLFwUpdOmaDLPostponed: |
|
218 { |
|
219 result = ShowDownloadPostponedL(); |
|
220 break; |
|
221 } |
|
222 case ESyncMLFwUpdOmaDLCancelled: |
|
223 { |
|
224 result = ShowDownloadCancelledL(); |
|
225 break; |
|
226 } |
|
227 case ESyncMLFwUpdOmaDLResume: |
|
228 { |
|
229 result = ShowDownloadResumeL(); |
|
230 break; |
|
231 } |
|
232 case ESyncMLFwUpdStartQueryEnc: |
|
233 { |
|
234 result = ShowUpdateStartQueryEncryptionL(); |
|
235 break; |
|
236 } |
|
237 default: // Unhandled note type |
|
238 { |
|
239 FLOG(_L("[SMLNOTIF]\t CSyncMLDlgNotifier::RunL() Note type not handled")); |
|
240 User::Leave( KErrArgument ); |
|
241 break; |
|
242 } |
|
243 } |
|
244 |
|
245 // Activate apps -key again |
|
246 // |
|
247 SuppressAppSwitching( EFalse ); |
|
248 |
|
249 if ( iNeedToCompleteMessage ) |
|
250 { |
|
251 // Translate the user key presses to message completion response |
|
252 FTRACE( FPrint( _L("[SmlNotif]\t User Key-Press for dialog = %d" ), result ) ); |
|
253 switch( result ) |
|
254 { |
|
255 case ESyncMLDlgRespKeyOk://all LSK press will fall here. |
|
256 iMessage.Complete( KErrNone ); |
|
257 break; |
|
258 case ESyncMLDlgRespKeyCancel://all RSK press will fall here. |
|
259 iMessage.Complete (KErrCancel); |
|
260 break; |
|
261 case ESyncMLDlgRespKeyOthers: //all call-termination key press fall here. |
|
262 iMessage.Complete (KErrNotFound); |
|
263 break; |
|
264 default://rest of the cases and errors |
|
265 iMessage.Complete (KErrNone); |
|
266 break; |
|
267 } |
|
268 } |
|
269 |
|
270 |
|
271 // Complete message and free resources |
|
272 // |
|
273 iNeedToCompleteMessage = EFalse; |
|
274 iReplySlot = NULL; |
|
275 |
|
276 iNoteType = ESyncMLFwUpdUnknown; |
|
277 |
|
278 FLOG(_L("[SmlNotif]\t CSyncMLFwUpdNotifier::RunL() completed")); |
|
279 } |
|
280 |
|
281 // ----------------------------------------------------------------------------- |
|
282 // CSyncMLFwUpdNotifier::Cancel |
|
283 // Release all own resources (member variables) |
|
284 // ----------------------------------------------------------------------------- |
|
285 // |
|
286 void CSyncMLFwUpdNotifier::Cancel() |
|
287 { |
|
288 FLOG(_L("[SmlNotif]\t CSyncMLFwUpdNotifier::Cancel()")); |
|
289 if(iRunLhang) |
|
290 { |
|
291 FLOG(_L("[SmlNotif]\t CSyncMLFwUpdNotifier::Cancel() inside Runlhang")); |
|
292 if(iDlg) |
|
293 { |
|
294 FLOG(_L("[SmlNotif]\t CSyncMLFwUpdNotifier::Cancel()before exit")); |
|
295 TRAP_IGNORE(iDlg->ExitL()); |
|
296 if(iDlg) |
|
297 { |
|
298 FLOG(_L("[SmlNotif]\t CSyncMLFwUpdNotifier::Cancel()before delete")); |
|
299 delete iDlg; |
|
300 iDlg = NULL; |
|
301 FLOG(_L("[SmlNotif]\t CSyncMLFwUpdNotifier::Cancel()after delete")); |
|
302 } |
|
303 } |
|
304 } |
|
305 CSyncMLNotifierBase::Cancel(); |
|
306 |
|
307 FLOG(_L("[SmlNotif]\t CSyncMLFwUpdNotifier::Cancel() completed")); |
|
308 } |
|
309 |
|
310 // ----------------------------------------------------------------------------- |
|
311 // CSyncMLFwUpdNotifier::ShowUpdateErrorNoteL |
|
312 // ----------------------------------------------------------------------------- |
|
313 // |
|
314 TInt CSyncMLFwUpdNotifier::ShowUpdateErrorNoteL() |
|
315 { |
|
316 FTRACE( FPrint( _L( |
|
317 "[SmlNotif]\t CSyncMLFwUpdNotifier::ShowUpdateErrorNoteL() error = %d" ), |
|
318 iNoteInfo ) ); |
|
319 |
|
320 HBufC* stringHolder( NULL ); |
|
321 |
|
322 switch ( iNoteInfo ) |
|
323 { |
|
324 case KErrDiskFull: |
|
325 { |
|
326 stringHolder = StringLoader::LoadLC( R_FOTA_NOT_PERMITTED ); |
|
327 break; |
|
328 } |
|
329 case KErrCommsLineFail: |
|
330 { |
|
331 stringHolder = StringLoader::LoadLC( R_FOTA_LOST_CONNECTION ); |
|
332 break; |
|
333 } |
|
334 case KErrCouldNotConnect: |
|
335 { |
|
336 stringHolder = StringLoader::LoadLC( R_FOTA_SERVER_ERROR ); |
|
337 break; |
|
338 } |
|
339 case KErrBadPower: |
|
340 { |
|
341 stringHolder = StringLoader::LoadLC( R_FOTA_BATTERY_LOW ); |
|
342 break; |
|
343 } |
|
344 case KErrBadUsbPower: |
|
345 { |
|
346 stringHolder = StringLoader::LoadLC( R_FOTA_USB_BATTERY_LOW ); |
|
347 break; |
|
348 } |
|
349 case KErrCommsLineFail2: |
|
350 { |
|
351 stringHolder = StringLoader::LoadLC( R_FOTA_CONNECTION_FAIL2 ); |
|
352 break; |
|
353 } |
|
354 case KErrGeneralResume: |
|
355 { |
|
356 stringHolder = StringLoader::LoadLC( R_FOTA_DOWNLOAD_GENERAL_RESUME ); |
|
357 break; |
|
358 } |
|
359 case KErrGeneralNoResume: |
|
360 { |
|
361 stringHolder = StringLoader::LoadLC( R_FOTA_DOWNLOAD_NO_RESUME ); |
|
362 break; |
|
363 } |
|
364 case KErrBadPowerForEnc: |
|
365 { |
|
366 stringHolder = StringLoader::LoadLC( R_FOTA_UPDATE_ENC_BATTERY_LOW ); |
|
367 break; |
|
368 } |
|
369 case KErrDeviceMemoryBusy: |
|
370 { |
|
371 stringHolder = StringLoader::LoadLC( R_FOTA_DEVICE_MEMORY_BUSY ); |
|
372 break; |
|
373 } |
|
374 default: |
|
375 { |
|
376 return KErrArgument; // Will be converted to KErrNone when completing |
|
377 // message, since this is not actually an error. |
|
378 } |
|
379 } |
|
380 |
|
381 |
|
382 TBool keypress(EFalse); |
|
383 CSyncMLMessageQueryDialog* msgDlg = CSyncMLMessageQueryDialog::NewL(keypress); |
|
384 msgDlg->SetMessageTextL(*stringHolder); |
|
385 |
|
386 CleanupStack::PopAndDestroy( stringHolder ); |
|
387 |
|
388 msgDlg->PrepareLC( R_SML_MESSAGE_QUERY ); // Pushed dialog is popped inside RunLD |
|
389 |
|
390 stringHolder = StringLoader::LoadLC( R_FOTA_TITLE_PHONE_UPDATES ); |
|
391 msgDlg->SetHeaderTextL( stringHolder->Des() ); |
|
392 CleanupStack::PopAndDestroy( stringHolder ); |
|
393 stringHolder = NULL; |
|
394 |
|
395 msgDlg->ButtonGroupContainer().SetCommandSetL( |
|
396 R_AVKON_SOFTKEYS_OK_EMPTY__OK ); |
|
397 |
|
398 TInt retval (ESyncMLDlgRespKeyNone); |
|
399 iRunLhang = ETrue; |
|
400 iDlg = msgDlg; |
|
401 retval = msgDlg->RunLD(); |
|
402 iRunLhang = EFalse; |
|
403 msgDlg = NULL; |
|
404 iDlg = NULL; |
|
405 |
|
406 //call-termination key press is handled here. |
|
407 if (keypress) |
|
408 retval = ESyncMLDlgRespKeyOthers; |
|
409 |
|
410 FTRACE( FPrint( _L( |
|
411 "[SmlNotif]\t CSyncMLFwUpdNotifier::ShowUpdateErrorNoteL() completed: retval = %d" ), |
|
412 retval ) ); |
|
413 |
|
414 return retval; |
|
415 } |
|
416 |
|
417 // ----------------------------------------------------------------------------- |
|
418 // CSyncMLFwUpdNotifier::ShowUpdateResultNoteL |
|
419 // ----------------------------------------------------------------------------- |
|
420 // |
|
421 TInt CSyncMLFwUpdNotifier::ShowUpdateResultNoteL() |
|
422 { |
|
423 FTRACE( FPrint( _L( |
|
424 "[SmlNotif]\t CSyncMLFwUpdNotifier::ShowUpdateResultNoteL() result = %d" ), |
|
425 iNoteInfo ) ); |
|
426 |
|
427 HBufC* stringHolder( NULL ); |
|
428 |
|
429 switch ( iNoteInfo ) // It is easier to add cases to switch structure |
|
430 { |
|
431 case KErrNone: |
|
432 { |
|
433 stringHolder = StringLoader::LoadLC( R_FOTA_NOTIF_COMPLETE ); |
|
434 break; |
|
435 } |
|
436 default: |
|
437 { |
|
438 stringHolder = StringLoader::LoadLC( R_FOTA_MSG_QUERY_NOT_UPDATED ); |
|
439 break; |
|
440 } |
|
441 } |
|
442 |
|
443 TBool keypress(EFalse); |
|
444 CSyncMLMessageQueryDialog* msgDlg = CSyncMLMessageQueryDialog::NewL(keypress); |
|
445 msgDlg->SetMessageTextL(*stringHolder); |
|
446 |
|
447 CleanupStack::PopAndDestroy( stringHolder ); |
|
448 |
|
449 msgDlg->PrepareLC( R_SML_MESSAGE_QUERY ); // Pushed dialog is popped inside RunLD |
|
450 |
|
451 stringHolder = StringLoader::LoadLC( R_FOTA_TITLE_PHONE_UPDATES ); |
|
452 msgDlg->SetHeaderTextL( stringHolder->Des() ); |
|
453 CleanupStack::PopAndDestroy( stringHolder ); |
|
454 stringHolder = NULL; |
|
455 |
|
456 msgDlg->ButtonGroupContainer().SetCommandSetL( |
|
457 R_AVKON_SOFTKEYS_OK_EMPTY__OK ); |
|
458 TInt retval(ESyncMLDlgRespKeyNone); |
|
459 iRunLhang = ETrue; |
|
460 iDlg = msgDlg; |
|
461 retval = msgDlg->RunLD(); |
|
462 iRunLhang = EFalse; |
|
463 msgDlg = NULL; |
|
464 iDlg = NULL; |
|
465 //call-termination key press has to be suppressed here. so keypress has no significance here! |
|
466 /*if (keypress) |
|
467 retval = EKeyOthers;*/ |
|
468 |
|
469 FTRACE( FPrint( _L( |
|
470 "[SmlNotif]\t CSyncMLFwUpdNotifier::ShowUpdateResultNoteL() completed: retval = %d" ), |
|
471 retval ) ); |
|
472 |
|
473 return retval; |
|
474 } |
|
475 |
|
476 // ----------------------------------------------------------------------------- |
|
477 // CSyncMLFwUpdNotifier::ShowUpdateStartQueryL |
|
478 // ----------------------------------------------------------------------------- |
|
479 // |
|
480 TInt CSyncMLFwUpdNotifier::ShowUpdateStartQueryL() |
|
481 { |
|
482 FTRACE( FPrint( _L( |
|
483 "[SmlNotif]\t CSyncMLFwUpdNotifier::ShowUpdateStartQueryL() profileId = %d" ), |
|
484 iNoteInfo ) ); |
|
485 |
|
486 HBufC* headerText = StringLoader::LoadLC( R_FOTA_TITLE_PHONE_UPDATES ); |
|
487 TInt retval (ESyncMLDlgRespKeyNone); |
|
488 TInt CustomNotes(KErrNone); |
|
489 CRepository* centrep = NULL; |
|
490 TRAPD( err, centrep = CRepository::NewL( KCRUidDeviceManagementInternalKeys) ); |
|
491 if(!err && centrep) |
|
492 { |
|
493 TInt err= centrep->Get( KDevManUINotesCustomization, CustomNotes); |
|
494 if (err) |
|
495 CustomNotes = 0; |
|
496 } |
|
497 else |
|
498 { |
|
499 CustomNotes = 0; |
|
500 } |
|
501 TBool keypress(EFalse); |
|
502 CSyncMLQueryDialog* dlg = CSyncMLQueryDialog::NewL(keypress); |
|
503 TLanguage language = User::Language(); |
|
504 if((CustomNotes) && IsLanguageSupportedL()) |
|
505 { //This note will be shown in chinese and english variant only and localisation is not done |
|
506 CSyncMLMessageQueryDialog* msgDlg = CSyncMLMessageQueryDialog::NewL(keypress); |
|
507 HBufC* stringHolder = StringLoader::LoadLC (R_QTN_FOTA_MSG_QUERY_UPDATE_CUSTOM_WARNING); |
|
508 msgDlg->SetMessageTextL(*stringHolder); |
|
509 CleanupStack::PopAndDestroy( stringHolder ); |
|
510 stringHolder = NULL; |
|
511 msgDlg->PrepareLC( R_SML_MESSAGE_QUERY ); // Pushed dialog is popped inside RunLD |
|
512 msgDlg->SetHeaderTextL( headerText->Des() ); |
|
513 msgDlg->ButtonGroupContainer().SetCommandSetL( R_FOTA_INSTALL_QUERY_SOFTKEYS_NOW_LATER__NOW ); |
|
514 retval = ESyncMLDlgRespKeyNone; |
|
515 retval = msgDlg->RunLD(); |
|
516 msgDlg = NULL; |
|
517 FLOG(_L("[SmlNotif]\t CSyncMLFwUpdNotifier::ShowUpdateStartQueryL() after new changes in phone updates")); |
|
518 } |
|
519 else |
|
520 { |
|
521 TBuf< KSyncMLMaxProfileNameLength > profileName; |
|
522 RetrieveProfileNameL( profileName ); |
|
523 |
|
524 HBufC* stringHolder = NULL; |
|
525 retval = ESyncMLDlgRespKeyOk; |
|
526 TBool bShowInstallQuery = ETrue; |
|
527 TInt fotaUpdateAppName (EFotaUpdateDM); |
|
528 TInt errAppName = RProperty::Get( KPSUidNSmlDMSyncApp, KNSmlCurrentFotaUpdateAppName, fotaUpdateAppName ); |
|
529 TInt errShowInstall = RProperty::Get( KPSUidNSmlDMSyncApp, KDevManShowInstallNowQuery, bShowInstallQuery ); |
|
530 |
|
531 FTRACE( FPrint( |
|
532 _L("CSyncMLFwUpdNotifier::ShowUpdateStartQueryL found key Show install query = %d"), |
|
533 bShowInstallQuery ) ); |
|
534 |
|
535 |
|
536 if ( !errAppName && !errShowInstall && fotaUpdateAppName == EFotaUpdateNSC && !bShowInstallQuery ) |
|
537 { |
|
538 FLOG(_L("[SmlNotif]\t CSyncMLFwUpdNotifier::ShowUpdateStartQueryL() do not show install now query ")); |
|
539 bShowInstallQuery = EFalse; |
|
540 } |
|
541 |
|
542 if ( !bShowInstallQuery ) |
|
543 { |
|
544 |
|
545 FLOG(_L("[SmlNotif]\t CSyncMLFwUpdNotifier::ShowUpdateStartQueryL() should not query ")); |
|
546 |
|
547 } |
|
548 |
|
549 else |
|
550 |
|
551 { |
|
552 FLOG(_L("[SmlNotif]\t CSyncMLFwUpdNotifier::ShowUpdateStartQueryL() will query for Install now? ")); |
|
553 stringHolder = StringLoader::LoadLC( R_FOTA_QUERY_INSTALL_NOW, profileName ); |
|
554 dlg->SetPromptL( *stringHolder ); |
|
555 CleanupStack::PopAndDestroy( stringHolder ); |
|
556 stringHolder = NULL; |
|
557 retval = ESyncMLDlgRespKeyNone; |
|
558 |
|
559 |
|
560 retval = dlg->ExecuteLD( R_FOTA_INSTALL_CONFIRMATION_QUERY ); |
|
561 dlg = NULL; |
|
562 } |
|
563 // set KDevManShowInstallNowQuery key back to value that it should show query |
|
564 TInt err = RProperty::Set(KPSUidNSmlDMSyncApp,KDevManShowInstallNowQuery,1 ); |
|
565 FTRACE( FPrint( |
|
566 _L("Install query is set back to be shown, err = %d"), |
|
567 err ) ); |
|
568 |
|
569 if ( !keypress && retval ) |
|
570 { |
|
571 stringHolder = StringLoader::LoadLC( R_FOTA_UPDATE_1_WARNING ); |
|
572 |
|
573 //keypress is EFalse here |
|
574 CSyncMLMessageQueryDialog* msgDlg = CSyncMLMessageQueryDialog::NewL(keypress); |
|
575 |
|
576 msgDlg->SetMessageTextL(*stringHolder); |
|
577 CleanupStack::PopAndDestroy( stringHolder ); |
|
578 stringHolder = NULL; |
|
579 |
|
580 msgDlg->PrepareLC( R_SML_MESSAGE_QUERY ); // Pushed dialog is popped inside RunLD |
|
581 msgDlg->SetHeaderTextL( headerText->Des() ); |
|
582 |
|
583 msgDlg->ButtonGroupContainer().SetCommandSetL( R_SML_SOFTKEYS_ACCEPT_CANCEL__ACCEPT ); |
|
584 |
|
585 retval = ESyncMLDlgRespKeyNone;; |
|
586 retval = msgDlg->RunLD(); |
|
587 msgDlg = NULL; |
|
588 |
|
589 |
|
590 if ( !keypress && retval ) |
|
591 { |
|
592 stringHolder = StringLoader::LoadLC( R_FOTA_UPDATE_2_WARNING ); |
|
593 |
|
594 //keypress is EFalse here |
|
595 msgDlg = CSyncMLMessageQueryDialog::NewL(keypress); |
|
596 msgDlg->SetMessageTextL( *stringHolder ); |
|
597 |
|
598 CleanupStack::PopAndDestroy( stringHolder ); |
|
599 stringHolder = NULL; |
|
600 |
|
601 msgDlg->PrepareLC( R_SML_MESSAGE_QUERY ); // Pushed dialog is popped inside RunLD |
|
602 msgDlg->SetHeaderTextL( headerText->Des() ); |
|
603 |
|
604 msgDlg->ButtonGroupContainer().SetCommandSetL( |
|
605 R_SML_SOFTKEYS_ACCEPT_CANCEL__ACCEPT ); |
|
606 |
|
607 retval = ESyncMLDlgRespKeyNone; |
|
608 retval = msgDlg->RunLD(); |
|
609 msgDlg = NULL; |
|
610 } |
|
611 } |
|
612 } |
|
613 |
|
614 |
|
615 CleanupStack::PopAndDestroy( headerText ); |
|
616 |
|
617 FTRACE( FPrint( _L( |
|
618 "[SmlNotif]\t CSyncMLFwUpdNotifier::ShowUpdateStartQueryL() completed: retval = %d, keypress = %d" ), |
|
619 retval,keypress ) ); |
|
620 |
|
621 //call-termination key press is handled here. |
|
622 if (keypress) |
|
623 retval = ESyncMLDlgRespKeyOthers; |
|
624 |
|
625 return retval; |
|
626 } |
|
627 |
|
628 |
|
629 // ----------------------------------------------------------------------------- |
|
630 // CSyncMLFwUpdNotifier::ShowUpdateStartQueryEncryptionL |
|
631 // ----------------------------------------------------------------------------- |
|
632 // |
|
633 TInt CSyncMLFwUpdNotifier::ShowUpdateStartQueryEncryptionL() |
|
634 { |
|
635 FTRACE( FPrint( _L( |
|
636 "[SmlNotif]\t CSyncMLFwUpdNotifier::ShowUpdateStartQueryEncryptionL() profileId = %d" ), |
|
637 iNoteInfo ) ); |
|
638 |
|
639 HBufC* headerText = StringLoader::LoadLC( R_FOTA_TITLE_PHONE_UPDATES ); |
|
640 TInt retval (ESyncMLDlgRespKeyNone); |
|
641 TBool keypress(EFalse); |
|
642 |
|
643 CSyncMLMessageQueryDialog* msgDlg = CSyncMLMessageQueryDialog::NewL(keypress); |
|
644 HBufC* stringHolder = StringLoader::LoadLC (R_FOTA_UPDATE_DEC_WARNING); |
|
645 msgDlg->SetMessageTextL(*stringHolder); |
|
646 CleanupStack::PopAndDestroy( stringHolder ); |
|
647 |
|
648 msgDlg->PrepareLC( R_SML_MESSAGE_QUERY ); // Pushed dialog is popped inside RunLD |
|
649 msgDlg->SetHeaderTextL( headerText->Des() ); |
|
650 msgDlg->ButtonGroupContainer().SetCommandSetL( R_SML_SOFTKEYS_ACCEPT_CANCEL__ACCEPT ); |
|
651 retval = ESyncMLDlgRespKeyNone; |
|
652 retval = msgDlg->RunLD(); |
|
653 msgDlg = NULL; |
|
654 |
|
655 CleanupStack::PopAndDestroy(headerText); |
|
656 FLOG(_L("[SmlNotif]\t CSyncMLFwUpdNotifier::ShowUpdateStartQueryL() after new changes in phone updates")); |
|
657 return retval; |
|
658 } |
|
659 |
|
660 // ----------------------------------------------------------------------------- |
|
661 // CSyncMLFwUpdNotifier::ShowUpdateResultNoteL |
|
662 // ----------------------------------------------------------------------------- |
|
663 // |
|
664 TInt CSyncMLFwUpdNotifier::ShowUpdateResultWithEncryptionNoteL() |
|
665 { |
|
666 FTRACE( FPrint( _L( |
|
667 "[SmlNotif]\t CSyncMLFwUpdNotifier::ShowUpdateResultWithEncryptionNoteL() result = %d" ), |
|
668 iNoteInfo ) ); |
|
669 |
|
670 HBufC* firstStr( NULL ); |
|
671 |
|
672 switch ( iNoteInfo ) // It is easier to add cases to switch structure |
|
673 { |
|
674 case KErrNone: |
|
675 { |
|
676 firstStr = StringLoader::LoadLC( R_FOTA_NOTIF_COMPLETE ); |
|
677 break; |
|
678 } |
|
679 default: |
|
680 { |
|
681 firstStr = StringLoader::LoadLC( R_FOTA_MSG_QUERY_NOT_UPDATED ); |
|
682 break; |
|
683 } |
|
684 } |
|
685 |
|
686 HBufC* secStr = StringLoader::LoadLC(R_FOTA_UPDATE_ENC); |
|
687 |
|
688 HBufC* stringHolder = HBufC::NewLC(firstStr->Length() + secStr->Length()); |
|
689 TPtr ptr (stringHolder->Des()); |
|
690 ptr.Append(firstStr->Des()); |
|
691 ptr.Append(secStr->Des()); |
|
692 |
|
693 TBool keypress(EFalse); |
|
694 CSyncMLMessageQueryDialog* msgDlg = CSyncMLMessageQueryDialog::NewL(keypress); |
|
695 msgDlg->SetMessageTextL(*stringHolder); |
|
696 CleanupStack::PopAndDestroy( stringHolder ); |
|
697 CleanupStack::PopAndDestroy(secStr); |
|
698 CleanupStack::PopAndDestroy(firstStr); |
|
699 |
|
700 |
|
701 msgDlg->PrepareLC( R_SML_MESSAGE_QUERY ); // Pushed dialog is popped inside RunLD |
|
702 |
|
703 stringHolder = StringLoader::LoadLC( R_FOTA_TITLE_PHONE_UPDATES ); |
|
704 msgDlg->SetHeaderTextL( stringHolder->Des() ); |
|
705 CleanupStack::PopAndDestroy( stringHolder ); |
|
706 stringHolder = NULL; |
|
707 |
|
708 msgDlg->ButtonGroupContainer().SetCommandSetL( R_SML_SOFTKEYS_ACCEPT_CANCEL__ACCEPT ); |
|
709 TInt retval(ESyncMLDlgRespKeyNone); |
|
710 iRunLhang = ETrue; |
|
711 iDlg = msgDlg; |
|
712 retval = msgDlg->RunLD(); |
|
713 iRunLhang = EFalse; |
|
714 msgDlg = NULL; |
|
715 iDlg = NULL; |
|
716 //call-termination key press has to be suppressed here. so keypress has no significance here! |
|
717 /*if (keypress) |
|
718 retval = EKeyOthers;*/ |
|
719 |
|
720 FTRACE( FPrint( _L( |
|
721 "[SmlNotif]\t CSyncMLFwUpdNotifier::ShowUpdateResultWithEncryptionNoteL() completed: retval = %d" ), |
|
722 retval ) ); |
|
723 |
|
724 return retval; |
|
725 } |
|
726 |
|
727 |
|
728 // ----------------------------------------------------------------------------- |
|
729 // CSyncMLFwUpdNotifier::RetrieveProfileNameL |
|
730 // ----------------------------------------------------------------------------- |
|
731 // |
|
732 void CSyncMLFwUpdNotifier::RetrieveProfileNameL( TDes& aServerName ) |
|
733 { |
|
734 FLOG(_L("[SmlNotif]\t CSyncMLFwUpdNotifier::RetrieveProfileNameL()")); |
|
735 |
|
736 RSyncMLSession syncSession; |
|
737 RSyncMLDevManProfile syncProfile; |
|
738 |
|
739 syncSession.OpenL(); |
|
740 CleanupClosePushL( syncSession ); |
|
741 |
|
742 syncProfile.OpenL( syncSession, iNoteInfo, ESmlOpenRead ); |
|
743 CleanupClosePushL( syncProfile ); |
|
744 |
|
745 aServerName = syncProfile.DisplayName(); |
|
746 |
|
747 CleanupStack::PopAndDestroy( &syncProfile ); |
|
748 CleanupStack::PopAndDestroy( &syncSession ); |
|
749 |
|
750 FTRACE( FPrint( _L( |
|
751 "[SmlNotif]\t CSyncMLFwUpdNotifier::RetrieveProfileNameL() completed: aServerName = %S" ), |
|
752 &aServerName ) ); |
|
753 } |
|
754 |
|
755 // ----------------------------------------------------------------------------- |
|
756 // CSyncMLFwUpdNotifier::ShowNoReminderQuery |
|
757 // ----------------------------------------------------------------------------- |
|
758 // |
|
759 |
|
760 TInt CSyncMLFwUpdNotifier::ShowNoReminderQueryL() |
|
761 { |
|
762 |
|
763 FLOG( _L( |
|
764 "[SmlNotif]\t CSyncMLFwUpdNotifier::ShowNoReminderQueryL() begin ")); |
|
765 |
|
766 TInt configFlags( 0 ); |
|
767 CRepository* cenrep = NULL; |
|
768 cenrep = CRepository::NewL( KCRUidNSmlDMSyncApp ); |
|
769 cenrep->Get( KNSmlDMFotaConfigurationKey, configFlags ); |
|
770 delete cenrep; |
|
771 cenrep = NULL; |
|
772 TInt retval (KErrNone); |
|
773 |
|
774 // Show note if fota is not hidden |
|
775 if ( configFlags & KNSmlDMFotaEnableFotaViewFlag ) |
|
776 { |
|
777 HBufC* headerText = StringLoader::LoadLC( R_FOTA_TITLE_PHONE_UPDATES ); |
|
778 HBufC* stringHolder = StringLoader::LoadLC( R_FOTA_UPDATE_REMINDER ); |
|
779 |
|
780 TBool keypress(EFalse); |
|
781 CSyncMLMessageQueryDialog* msgDlg = CSyncMLMessageQueryDialog::NewL(keypress); |
|
782 msgDlg->SetMessageTextL(*stringHolder); |
|
783 CleanupStack::PopAndDestroy( stringHolder ); |
|
784 stringHolder = NULL; |
|
785 |
|
786 msgDlg->PrepareLC( R_SML_MESSAGE_QUERY ); // Pushed dialog is popped inside RunLD |
|
787 msgDlg->SetHeaderTextL( headerText->Des() ); |
|
788 |
|
789 msgDlg->ButtonGroupContainer().SetCommandSetL( R_AVKON_SOFTKEYS_OK_EMPTY__OK ); |
|
790 retval = msgDlg->RunLD(); |
|
791 msgDlg = NULL; |
|
792 |
|
793 //call-termination key press is handled here. |
|
794 if (keypress) |
|
795 retval = ESyncMLDlgRespKeyOthers; |
|
796 |
|
797 CleanupStack::PopAndDestroy( headerText ); |
|
798 } |
|
799 |
|
800 FLOG( _L( |
|
801 "[SmlNotif]\t CSyncMLFwUpdNotifier::ShowNoReminderQueryL() Completed ")); |
|
802 |
|
803 return retval; |
|
804 } |
|
805 |
|
806 // ----------------------------------------------------------------------------- |
|
807 // CSyncMLFwUpdNotifier::ShowNotEnoughMemory |
|
808 // ----------------------------------------------------------------------------- |
|
809 // |
|
810 TInt CSyncMLFwUpdNotifier::ShowNotEnoughMemoryL( TInt &aMemoryNeeded , TBool aOmaDL) |
|
811 { |
|
812 FLOG( _L( |
|
813 "[SmlNotif]\t CSyncMLFwUpdNotifier::ShowNotEnoughMemoryL() begin ")); |
|
814 |
|
815 HBufC* headerText = StringLoader::LoadLC( R_FOTA_TITLE_PHONE_UPDATES ); |
|
816 |
|
817 HBufC* stringHolder; |
|
818 |
|
819 if( aOmaDL ) |
|
820 stringHolder = StringLoader::LoadLC( R_FOTA_OMADL_NO_FLEXIBLE_MEMORY , aMemoryNeeded ); |
|
821 else |
|
822 stringHolder = StringLoader::LoadLC( R_FOTA_LARGE_NO_FLEXIBLE_MEMORY , aMemoryNeeded ); |
|
823 |
|
824 TBool keypress(EFalse); |
|
825 CSyncMLMessageQueryDialog* msgDlg = CSyncMLMessageQueryDialog::NewL(keypress); |
|
826 msgDlg->SetMessageTextL(*stringHolder); |
|
827 CleanupStack::PopAndDestroy( stringHolder ); |
|
828 stringHolder = NULL; |
|
829 |
|
830 msgDlg->PrepareLC( R_SML_MESSAGE_QUERY ); // Pushed dialog is popped inside RunLD |
|
831 msgDlg->SetHeaderTextL( headerText->Des() ); |
|
832 |
|
833 msgDlg->ButtonGroupContainer().SetCommandSetL( R_AVKON_SOFTKEYS_OK_EMPTY__OK ); |
|
834 TInt retval (ESyncMLDlgRespKeyNone); |
|
835 retval = msgDlg->RunLD(); |
|
836 msgDlg = NULL; |
|
837 CleanupStack::PopAndDestroy( headerText ); |
|
838 |
|
839 FLOG( _L( |
|
840 "[SmlNotif]\t CSyncMLFwUpdNotifier::ShowNotEnoughMemoryL() Completed ")); |
|
841 |
|
842 //call-termination key press is handled here. |
|
843 if (keypress) |
|
844 retval = ESyncMLDlgRespKeyOthers; |
|
845 |
|
846 return retval; |
|
847 } |
|
848 // ----------------------------------------------------------------------------- |
|
849 // CSyncMLFwUpdNotifier::ShowDownloadUserCancelL |
|
850 // Shows the notification when the user cancels the download. |
|
851 // And inform the user the download is suspended. |
|
852 // ----------------------------------------------------------------------------- |
|
853 // |
|
854 TInt CSyncMLFwUpdNotifier::ShowDownloadUserCancelL() |
|
855 { |
|
856 |
|
857 FLOG( _L( |
|
858 "[SmlNotif]\t CSyncMLFwUpdNotifier::ShowDownloadUserCancelL() begin ")); |
|
859 |
|
860 TInt retval (KErrNone); |
|
861 |
|
862 HBufC* headerText = StringLoader::LoadLC( R_FOTA_TITLE_PHONE_UPDATES ); |
|
863 HBufC* stringHolder = StringLoader::LoadLC( R_FOTA_USER_CANCEL ); |
|
864 |
|
865 TBool endKeyPress(EFalse); |
|
866 CSyncMLMessageQueryDialog* msgDlg = CSyncMLMessageQueryDialog::NewL(endKeyPress); |
|
867 msgDlg->SetMessageTextL(*stringHolder); |
|
868 CleanupStack::PopAndDestroy( stringHolder ); |
|
869 stringHolder = NULL; |
|
870 |
|
871 msgDlg->PrepareLC( R_SML_MESSAGE_QUERY ); // Pushed dialog is popped inside RunLD |
|
872 msgDlg->SetHeaderTextL( headerText->Des() ); |
|
873 |
|
874 msgDlg->ButtonGroupContainer().SetCommandSetL( R_AVKON_SOFTKEYS_YES_NO__YES ); |
|
875 iRunLhang = ETrue; |
|
876 iDlg = msgDlg; |
|
877 retval = msgDlg->RunLD(); |
|
878 iRunLhang = EFalse; |
|
879 msgDlg = NULL; |
|
880 iDlg = NULL; |
|
881 //call-termination key press is handled here. |
|
882 if (endKeyPress) |
|
883 retval = ESyncMLDlgRespKeyOthers; |
|
884 |
|
885 CleanupStack::PopAndDestroy( headerText ); |
|
886 |
|
887 FLOG( _L( |
|
888 "[SmlNotif]\t CSyncMLFwUpdNotifier::ShowDownloadUserCancelL() Completed ")); |
|
889 |
|
890 return retval; |
|
891 } |
|
892 // ----------------------------------------------------------------------------- |
|
893 // CSyncMLFwUpdNotifier::ShowDownloadPostponedL |
|
894 // Shows the notification that the download is postponed. |
|
895 // ----------------------------------------------------------------------------- |
|
896 // |
|
897 TInt CSyncMLFwUpdNotifier::ShowDownloadPostponedL() |
|
898 { |
|
899 |
|
900 FLOG( _L( |
|
901 "[SmlNotif]\t CSyncMLFwUpdNotifier::ShowDownloadPostponedL() begin ")); |
|
902 |
|
903 TInt retval (KErrNone); |
|
904 |
|
905 HBufC* stringHolder = StringLoader::LoadLC( R_FOTA_DOWNLOAD_POSTPONED ); |
|
906 CAknInformationNote* infoNote = new (ELeave) CAknInformationNote; |
|
907 |
|
908 infoNote->ExecuteLD( *stringHolder ); |
|
909 CleanupStack::PopAndDestroy( stringHolder ); |
|
910 |
|
911 FLOG( _L( |
|
912 "[SmlNotif]\t CSyncMLFwUpdNotifier::ShowDownloadPostponedL() Completed ")); |
|
913 |
|
914 return retval; |
|
915 } |
|
916 // ----------------------------------------------------------------------------- |
|
917 // CSyncMLFwUpdNotifier::ShowDownloadCancelledL |
|
918 // Shows the notification that the download is cancelled. |
|
919 // ----------------------------------------------------------------------------- |
|
920 // |
|
921 TInt CSyncMLFwUpdNotifier::ShowDownloadCancelledL() |
|
922 { |
|
923 |
|
924 FLOG( _L( |
|
925 "[SmlNotif]\t CSyncMLFwUpdNotifier::ShowDownloadCancelledL() begin ")); |
|
926 |
|
927 TInt retval (KErrNone); |
|
928 |
|
929 HBufC* stringHolder = StringLoader::LoadLC( R_FOTA_DOWNLOAD_CANCELLED ); |
|
930 CAknInformationNote* infoNote = new (ELeave) CAknInformationNote; |
|
931 |
|
932 infoNote->ExecuteLD( *stringHolder ); |
|
933 CleanupStack::PopAndDestroy( stringHolder ); |
|
934 |
|
935 FLOG( _L( |
|
936 "[SmlNotif]\t CSyncMLFwUpdNotifier::ShowDownloadCancelledL() Completed ")); |
|
937 |
|
938 return retval; |
|
939 } |
|
940 // ----------------------------------------------------------------------------- |
|
941 // CSyncMLFwUpdNotifier::ShowDownloadResumeL |
|
942 // Shows the notification to the user for resuming the download. |
|
943 // ----------------------------------------------------------------------------- |
|
944 // |
|
945 TInt CSyncMLFwUpdNotifier::ShowDownloadResumeL() |
|
946 { |
|
947 |
|
948 FLOG( _L( |
|
949 "[SmlNotif]\t CSyncMLFwUpdNotifier::ShowDownloadResumeL() begin ")); |
|
950 |
|
951 TInt retval (KErrNone); |
|
952 |
|
953 HBufC* headerText = StringLoader::LoadLC( R_FOTA_TITLE_PHONE_UPDATES ); |
|
954 HBufC* stringHolder = StringLoader::LoadLC( R_FOTA_DOWNLOAD_RESUME ); |
|
955 |
|
956 TBool endKeyPress(EFalse); |
|
957 CSyncMLMessageQueryDialog* msgDlg = CSyncMLMessageQueryDialog::NewL(endKeyPress); |
|
958 msgDlg->SetMessageTextL(*stringHolder); |
|
959 CleanupStack::PopAndDestroy( stringHolder ); |
|
960 stringHolder = NULL; |
|
961 |
|
962 msgDlg->PrepareLC( R_SML_MESSAGE_QUERY ); // Pushed dialog is popped inside RunLD |
|
963 msgDlg->SetHeaderTextL( headerText->Des() ); |
|
964 |
|
965 msgDlg->ButtonGroupContainer().SetCommandSetL( R_AVKON_SOFTKEYS_YES_NO__YES ); |
|
966 iRunLhang = ETrue; |
|
967 iDlg = msgDlg; |
|
968 retval = msgDlg->RunLD(); |
|
969 iRunLhang = EFalse; |
|
970 iDlg = NULL; |
|
971 msgDlg = NULL; |
|
972 |
|
973 //call-termination key press is handled here. |
|
974 if (endKeyPress) |
|
975 retval = ESyncMLDlgRespKeyOthers; |
|
976 |
|
977 CleanupStack::PopAndDestroy( headerText ); |
|
978 |
|
979 FLOG( _L( |
|
980 "[SmlNotif]\t CSyncMLFwUpdNotifier::ShowDownloadResumeL() Completed ")); |
|
981 |
|
982 return retval; |
|
983 } |
|
984 |
|
985 // ----------------------------------------------------------------------------- |
|
986 // CSyncMLFwUpdNotifier::ShowDownloadResumeL |
|
987 // Shows the notification to the user for resuming the download. |
|
988 // ----------------------------------------------------------------------------- |
|
989 // |
|
990 TBool CSyncMLFwUpdNotifier::IsLanguageSupportedL() |
|
991 { |
|
992 TBool retVal(EFalse); |
|
993 TLanguage language = User::Language(); |
|
994 if(language == ELangEnglish || language == ELangInternationalEnglish || |
|
995 language == ELangTaiwanChinese ||language == ELangHongKongChinese || language == ELangPrcChinese) |
|
996 retVal = ETrue; |
|
997 return retVal; |
|
998 } |
|
999 |
|
1000 // End of File |
|