94 // -------------------------------------------------------------------------- |
94 // -------------------------------------------------------------------------- |
95 // |
95 // |
96 |
96 |
97 TInt CmPluginPacketDataSettingsDlg::ConstructAndRunLD( ) |
97 TInt CmPluginPacketDataSettingsDlg::ConstructAndRunLD( ) |
98 { |
98 { |
|
99 // Set this flag to allow edit continue |
|
100 iCanEditingContinue = ETrue; |
|
101 |
99 CleanupStack::PushL( this ); |
102 CleanupStack::PushL( this ); |
100 LoadResourceL( KPluginPacketDataResDirAndFileName ); |
103 LoadResourceL( KPluginPacketDataResDirAndFileName ); |
101 CleanupStack::Pop( this ); |
104 CleanupStack::Pop( this ); |
102 |
105 |
103 CCmManagerImpl& cmMgr = iCmPluginBaseEng.CmMgr(); |
106 CCmManagerImpl& cmMgr = iCmPluginBaseEng.CmMgr(); |
321 // CmPluginPacketDataSettingsDlg::OkToExitL |
331 // CmPluginPacketDataSettingsDlg::OkToExitL |
322 // -------------------------------------------------------------------------- |
332 // -------------------------------------------------------------------------- |
323 // |
333 // |
324 TBool CmPluginPacketDataSettingsDlg::OkToExitL( TInt aButtonId ) |
334 TBool CmPluginPacketDataSettingsDlg::OkToExitL( TInt aButtonId ) |
325 { |
335 { |
|
336 // Database has been changed by other application so exit from this view |
|
337 // without update editings to database |
|
338 if ( !iCanEditingContinue ) |
|
339 { |
|
340 if ( iExitReason == KDialogUserExit ) |
|
341 { |
|
342 iCmPluginBaseEng.CmMgr().WatcherUnRegister(); |
|
343 |
|
344 // Set iExitReason back to KDialogUserBack so as to exit from this view through else in the next call |
|
345 TInt exitValue = KDialogUserExit; |
|
346 iExitReason = KDialogUserBack; |
|
347 // If destination has been deleted by other application |
|
348 // then we may have to exit from Cmmgr |
|
349 TryExitL( exitValue ); |
|
350 return EFalse; |
|
351 } |
|
352 else |
|
353 { |
|
354 // Exit from this view here to avoid possible update to databse |
|
355 return ETrue; |
|
356 } |
|
357 } |
|
358 |
326 TBool retval( EFalse ); |
359 TBool retval( EFalse ); |
327 |
360 |
328 switch ( aButtonId ) |
361 switch ( aButtonId ) |
329 { |
362 { |
330 case EPluginBaseCmdExit: |
363 case EPluginBaseCmdExit: |
360 // CmPluginPacketDataSettingsDlg::CommsDatChangesL |
393 // CmPluginPacketDataSettingsDlg::CommsDatChangesL |
361 // -------------------------------------------------------------------------- |
394 // -------------------------------------------------------------------------- |
362 // |
395 // |
363 void CmPluginPacketDataSettingsDlg::CommsDatChangesL() |
396 void CmPluginPacketDataSettingsDlg::CommsDatChangesL() |
364 { |
397 { |
|
398 if ( !iCanEditingContinue ) |
|
399 { |
|
400 return; |
|
401 } |
|
402 |
365 CCmManagerImpl& cmMgr = iCmPluginBaseEng.CmMgr(); |
403 CCmManagerImpl& cmMgr = iCmPluginBaseEng.CmMgr(); |
366 CCmDestinationImpl* parentDest = iCmPluginBaseEng.ParentDestination(); |
404 CCmDestinationImpl* parentDest = iCmPluginBaseEng.ParentDestination(); |
367 |
405 |
368 if ( parentDest ) |
406 if ( parentDest ) |
369 { |
407 { |
370 if( !cmMgr.DestinationStillExistedL( parentDest ) ) |
408 if( !cmMgr.DestinationStillExistedL( parentDest ) ) |
371 { |
409 { |
372 cmMgr.WatcherUnRegister(); |
|
373 // If parent destination diappears with some reason |
|
374 // then the view must exit back to main view for it |
|
375 // may be danger if going back to parent view |
|
376 iExitReason = KDialogUserExit; |
410 iExitReason = KDialogUserExit; |
377 TryExitL( iExitReason ); |
411 iCanEditingContinue = EFalse; |
378 |
412 |
379 cmMgr.RemoveDestFromPool( parentDest ); |
413 cmMgr.RemoveDestFromPool( parentDest ); |
380 delete parentDest; |
414 delete parentDest; |
381 return; |
415 return; |
382 } |
416 } |
383 |
417 |
384 if( !cmMgr.IsIapStillInDestL( parentDest, iCmPluginBaseEng ) ) |
418 // We may have to go back to parent view if database is changed by other application |
385 { |
419 iCanEditingContinue = EFalse; |
386 cmMgr.WatcherUnRegister(); |
420 |
387 // In this case, the view can go back to the parent view |
|
388 TryExitL( iExitReason ); |
|
389 |
|
390 cmMgr.RemoveDestFromPool( parentDest ); |
|
391 delete parentDest; |
|
392 return; |
|
393 } |
|
394 |
|
395 // We may have to go back to parent view even though this Iap is still in CommsDat |
|
396 // for cmMgr ( = iCmPluginBaseEng.CmMgr() ) can not be accessed any more |
|
397 // after this call when some Iap is deleted. |
|
398 cmMgr.WatcherUnRegister(); |
|
399 TryExitL( iExitReason ); |
|
400 |
|
401 cmMgr.RemoveDestFromPool( parentDest ); |
421 cmMgr.RemoveDestFromPool( parentDest ); |
402 delete parentDest; |
422 delete parentDest; |
403 } |
423 } |
404 else |
424 else // Legacy |
405 { |
425 { |
406 if( !cmMgr.IapStillExistedL( iCmPluginBaseEng ) ) |
426 // We may have to go back to parent view if database is changed by other application |
407 { |
427 iCanEditingContinue = EFalse; |
408 cmMgr.WatcherUnRegister(); |
|
409 // In this case, the dialog can go back to the parent view |
|
410 TryExitL( iExitReason ); |
|
411 return; |
|
412 } |
|
413 |
|
414 // We may have to go back to parent view even though this Iap is still in CommsDat |
|
415 // for cmMgr ( = iCmPluginBaseEng.CmMgr() ) can not be accessed any more |
|
416 // after this call when some Iap is deleted. |
|
417 cmMgr.WatcherUnRegister(); |
|
418 TryExitL( iExitReason ); |
|
419 } |
428 } |
420 } |
429 } |
421 |
430 |
422 // -------------------------------------------------------------------------- |
431 // -------------------------------------------------------------------------- |
423 // CmPluginPacketDataSettingsDlg::NotifyParentView |
432 // CmPluginPacketDataSettingsDlg::NotifyParentView |
431 // -------------------------------------------------------------------------- |
440 // -------------------------------------------------------------------------- |
432 // CmPluginPacketDataSettingsDlg::HandleCommsDatChangeL |
441 // CmPluginPacketDataSettingsDlg::HandleCommsDatChangeL |
433 // -------------------------------------------------------------------------- |
442 // -------------------------------------------------------------------------- |
434 // |
443 // |
435 void CmPluginPacketDataSettingsDlg::HandleCommsDatChangeL() |
444 void CmPluginPacketDataSettingsDlg::HandleCommsDatChangeL() |
436 { |
445 { |
|
446 if ( iCanEditingContinue ) |
|
447 { |
|
448 // Set iCanEditingContinue to False so that exit fromn this view without update editings |
|
449 iCanEditingContinue = EFalse; |
|
450 } |
|
451 |
437 if( iNotifyFromSon == KCmNotifiedIapIsNotInThisDestination || |
452 if( iNotifyFromSon == KCmNotifiedIapIsNotInThisDestination || |
438 iNotifyFromSon == KCmNotifiedIapDisappear ) |
453 iNotifyFromSon == KCmNotifiedIapDisappear ) |
439 { |
454 { |
440 TryExitL( iExitReason ); |
455 TryExitL( iExitReason ); |
441 } |
456 } |