cmmanager/cmmgr/Plugins/cmpluginwlan/src/cmpwlansettingsdlgipv4.cpp
branchRCL_3
changeset 24 c45d4fe2ff0a
parent 0 5a93021fdf25
equal deleted inserted replaced
19:22c3c67e5001 24:c45d4fe2ff0a
    67 // CmPluginWlanSettingsDlgIpv4::ConstructAndRunLD
    67 // CmPluginWlanSettingsDlgIpv4::ConstructAndRunLD
    68 // --------------------------------------------------------------------------
    68 // --------------------------------------------------------------------------
    69 //
    69 //
    70 TInt CmPluginWlanSettingsDlgIpv4::ConstructAndRunLD()
    70 TInt CmPluginWlanSettingsDlgIpv4::ConstructAndRunLD()
    71     {
    71     {
       
    72     // Set this flag to allow edit continue
       
    73     iCanEditingContinue = ETrue;
       
    74     
    72     CCmManagerImpl& cmMgr = iCmPluginBaseEng.CmMgr();
    75     CCmManagerImpl& cmMgr = iCmPluginBaseEng.CmMgr();
    73     cmMgr.WatcherRegisterL( this );
    76     cmMgr.WatcherRegisterL( this );
    74     
    77     
    75     return CmPluginBaseSettingsDlgIp::ConstructAndRunLD();
    78     return CmPluginBaseSettingsDlgIp::ConstructAndRunLD();
    76     }
    79     }
   155 // CmPluginWlanSettingsDlgIpv4::ProcessCommandL
   158 // CmPluginWlanSettingsDlgIpv4::ProcessCommandL
   156 //---------------------------------------------------------------------------
   159 //---------------------------------------------------------------------------
   157 //
   160 //
   158 void CmPluginWlanSettingsDlgIpv4::ProcessCommandL( TInt aCommandId )
   161 void CmPluginWlanSettingsDlgIpv4::ProcessCommandL( TInt aCommandId )
   159     {
   162     {
       
   163     if ( !iCanEditingContinue )
       
   164         {
       
   165         // We have to block all editing activity if database changed by
       
   166         // other application
       
   167         return;
       
   168         }
       
   169 
   160     if ( MenuShowing() )
   170     if ( MenuShowing() )
   161         {
   171         {
   162         HideMenu();
   172         HideMenu();
   163         }
   173         }
       
   174     
   164     switch ( aCommandId )
   175     switch ( aCommandId )
   165         {
   176         {
   166         case EPluginBaseCmdExit:
   177         case EPluginBaseCmdExit:
   167             {
   178             {
   168             if ( ValidateAttribsL() )
   179             if ( ValidateAttribsL() )
   194 // CmPluginWlanSettingsDlgIpv4::OkToExitL
   205 // CmPluginWlanSettingsDlgIpv4::OkToExitL
   195 // --------------------------------------------------------------------------
   206 // --------------------------------------------------------------------------
   196 //
   207 //
   197 TBool CmPluginWlanSettingsDlgIpv4::OkToExitL( TInt aButtonId )
   208 TBool CmPluginWlanSettingsDlgIpv4::OkToExitL( TInt aButtonId )
   198     {
   209     {
       
   210     // Database has been changed by other application so exit from this view
       
   211     // without update editings to database
       
   212     if ( !iCanEditingContinue )
       
   213         {
       
   214         if ( iExitReason == KDialogUserExit )
       
   215             {
       
   216             iCmPluginBaseEng.CmMgr().WatcherUnRegister();
       
   217             
       
   218             // Set iExitReason back to KDialogUserBack so as to exit from this view through else in the next call
       
   219             TInt exitValue = KDialogUserExit;
       
   220             iExitReason = KDialogUserBack;
       
   221             // If destination has been deleted by other application
       
   222             // then we may have to exit from Cmmgr
       
   223             TryExitL( exitValue );
       
   224             return EFalse;
       
   225             }
       
   226         else
       
   227             {
       
   228             // Exit from this view here to avoid possible update to databse
       
   229             return ETrue;
       
   230             }
       
   231         }
       
   232     
   199     TBool retval( EFalse );
   233     TBool retval( EFalse );
   200     
   234     
   201     switch ( aButtonId )
   235     switch ( aButtonId )
   202         {
   236         {
   203         case EAknSoftkeyOk:
   237         case EAknSoftkeyOk:
   313 // CmPluginWlanSettingsDlgIpv4::CommsDatChangesL
   347 // CmPluginWlanSettingsDlgIpv4::CommsDatChangesL
   314 // --------------------------------------------------------------------------
   348 // --------------------------------------------------------------------------
   315 //
   349 //
   316 void CmPluginWlanSettingsDlgIpv4::CommsDatChangesL()
   350 void CmPluginWlanSettingsDlgIpv4::CommsDatChangesL()
   317     {
   351     {
       
   352     if ( !iCanEditingContinue )
       
   353         {
       
   354         return;
       
   355         }
       
   356     
   318     CCmManagerImpl& cmMgr = iCmPluginBaseEng.CmMgr();
   357     CCmManagerImpl& cmMgr = iCmPluginBaseEng.CmMgr();
   319     CCmDestinationImpl* parentDest = iCmPluginBaseEng.ParentDestination();
   358     CCmDestinationImpl* parentDest = iCmPluginBaseEng.ParentDestination();
   320     
   359     
   321     if ( parentDest )
   360     if ( parentDest )
   322         {
   361         {
   325             if( iParent )
   364             if( iParent )
   326                 {
   365                 {
   327                 iParent->NotifyParentView( KCmNotifiedDestinationDisappear );
   366                 iParent->NotifyParentView( KCmNotifiedDestinationDisappear );
   328                 }
   367                 }
   329             
   368             
   330             cmMgr.WatcherUnRegister();
       
   331             // If parent destination is deleted by somebody then the dialog must exit back to main view
   369             // If parent destination is deleted by somebody then the dialog must exit back to main view
   332             iExitReason = KDialogUserExit;
   370             iExitReason = KDialogUserExit;
   333             TryExitL( iExitReason );
   371             iCanEditingContinue = EFalse;
   334                 
   372      
   335             cmMgr.RemoveDestFromPool( parentDest );
   373             cmMgr.RemoveDestFromPool( parentDest );
   336             delete parentDest;
   374             delete parentDest;
   337             return;
   375             return;
   338             }
   376             }
   339             
       
   340         if( !cmMgr.IsIapStillInDestL( parentDest, iCmPluginBaseEng ) )
       
   341             {
       
   342             if( iParent )
       
   343                 {
       
   344                 iParent->NotifyParentView( KCmNotifiedIapIsNotInThisDestination );
       
   345                 }
       
   346             
       
   347             cmMgr.WatcherUnRegister();
       
   348             // In this case, the dialog can go back to the parent view
       
   349             TryExitL( iExitReason );
       
   350             
       
   351             cmMgr.RemoveDestFromPool( parentDest );
       
   352             delete parentDest;
       
   353             return;
       
   354             }
       
   355         
   377         
   356         // We may have to notify parent view to go back to its parent view even though this Iap is still in CommsDat
   378         // We may have to go back to parent view if database is changed by other application
   357         // for cmMgr ( = iCmPluginBaseEng.CmMgr() ) can not be accessed any more
       
   358         // after this call when some Iap is deleted.
       
   359         if( iParent )
   379         if( iParent )
   360             {
   380             {
   361             iParent->NotifyParentView( KCmNotifiedIapDisappear );
   381             iParent->NotifyParentView( KCmNotifiedIapDisappear );
   362             }
   382             }
   363         cmMgr.WatcherUnRegister();
   383         iCanEditingContinue = EFalse;
   364         TryExitL( iExitReason );
   384 
   365             
       
   366         cmMgr.RemoveDestFromPool( parentDest );
   385         cmMgr.RemoveDestFromPool( parentDest );
   367         delete parentDest;
   386         delete parentDest;
   368         }
   387         }
   369     else
   388     else // Legacy
   370         {
   389         {
   371         if( !cmMgr.IapStillExistedL( iCmPluginBaseEng ) )
   390         // We may have to go back to parent view if database is changed by other application
   372             {
   391         if( iParent )
   373             if( iParent )
       
   374             {
   392             {
   375             iParent->NotifyParentView( KCmNotifiedIapDisappear );
   393             iParent->NotifyParentView( KCmNotifiedIapDisappear );
   376             }
   394             }
   377             
   395         iCanEditingContinue = EFalse;
   378             cmMgr.WatcherUnRegister();
   396         }
   379             // In this case, the dialog can go back to the parent view
   397     }
   380             TryExitL( iExitReason );
       
   381             return;
       
   382             }
       
   383         
       
   384         // We may have to notify parent view to go back to its parent view even though this Iap is still in CommsDat
       
   385         // for cmMgr ( = iCmPluginBaseEng.CmMgr() ) can not be accessed any more
       
   386         // after this call when some Iap is deleted.
       
   387         if( iParent )
       
   388             {
       
   389             iParent->NotifyParentView( KCmNotifiedIapDisappear );
       
   390             }
       
   391         cmMgr.WatcherUnRegister();
       
   392         TryExitL( iExitReason );
       
   393         }
       
   394     }