cmmanager/cmmgr/Framework/Src/cmsettingsuiimpl.cpp
branchRCL_3
changeset 55 fc7b30ed2058
parent 0 5a93021fdf25
equal deleted inserted replaced
54:984e13af52c4 55:fc7b30ed2058
     1 /*
     1 /*
     2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). 
     2 * Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies). 
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    18 #include <cmmanager.rsg>
    18 #include <cmmanager.rsg>
    19 
    19 
    20 #include "cmsettingsuiimpl.h"
    20 #include "cmsettingsuiimpl.h"
    21 #include "cmmanagerimpl.h"
    21 #include "cmmanagerimpl.h"
    22 #include "destdlg.h"
    22 #include "destdlg.h"
       
    23 #include <cmcommonui.h>
       
    24 #include <cmpluginbase.h>
       
    25 #include <cmmanagerdef.h>
    23 #include <cmcommonconstants.h>
    26 #include <cmcommonconstants.h>
       
    27 #include <cmpluginwlandef.h>
    24 #include "selectdestinationdlg.h"
    28 #include "selectdestinationdlg.h"
    25 #include <data_caging_path_literals.hrh>
    29 #include <data_caging_path_literals.hrh>
    26 
    30 
    27 //-----------------------------------------------------------------------------
    31 //-----------------------------------------------------------------------------
    28 //  CCmSettingsUiImpl::NewL()
    32 //  CCmSettingsUiImpl::NewL()
   120     CSelectDestinationDlg* dlg = CSelectDestinationDlg::NewL( aDestinationId,
   124     CSelectDestinationDlg* dlg = CSelectDestinationDlg::NewL( aDestinationId,
   121                                                               *iCmManagerImpl );
   125                                                               *iCmManagerImpl );
   122                                                               
   126                                                               
   123     return dlg->ExecuteLD( R_CMMANAGER_LIST_QUERY_WITH_MSGBOX );    
   127     return dlg->ExecuteLD( R_CMMANAGER_LIST_QUERY_WITH_MSGBOX );    
   124     }
   128     }
       
   129 //-----------------------------------------------------------------------------
       
   130 //  CCmSettingsUiImpl::AddCmL
       
   131 //-----------------------------------------------------------------------------
       
   132 //
       
   133 TUint32 CCmSettingsUiImpl::AddCmL( TUint32& aDestUid, TUint32 aBearerType )
       
   134     {
       
   135     // Add new connection method
       
   136     TUint32 addedIapId(0);
       
   137 
       
   138     CCmDestinationImpl* destImpl = iCmManagerImpl->DestinationL( aDestUid );
       
   139     CleanupStack::PushL(destImpl);
       
   140     
       
   141     // Check first if parent destination is protected
       
   142     if ( destImpl->ProtectionLevel() == CMManager::EProtLevel1 )
       
   143         {
       
   144         TCmCommonUi::ShowNoteL( R_CMWIZARD_CANNOT_PERFORM_FOR_PROTECTED,
       
   145                                 TCmCommonUi::ECmErrorNote );
       
   146         }
       
   147     else
       
   148         {
       
   149         // Automatically check for available conn methods?
       
   150     
       
   151         TBool manualConfigure = ETrue;    
       
   152         if (aBearerType == KUidWlanBearerType)
       
   153             {
       
   154             TInt retval =
       
   155                     TCmCommonUi::ShowConfirmationQueryL( R_CMWIZARD_AUTOMATIC_CHECK );
       
   156     
       
   157             manualConfigure = ( retval == EAknSoftkeyYes || retval == EAknSoftkeyOk )
       
   158                                       ?  EFalse : ETrue;
       
   159             }
       
   160             
       
   161         CCmPluginBase* plugin = destImpl->CreateConnectionMethodL( aBearerType );
       
   162         CleanupStack::PushL( plugin );
       
   163        
       
   164         // Bearer-specific UI-supported initialization is done by plug-ins
       
   165         if ( plugin->InitializeWithUiL( manualConfigure ) )
       
   166             {
       
   167             destImpl->UpdateL();  // commit changes
       
   168 
       
   169             RArray<TUint32> additionalCms;
       
   170             CleanupClosePushL (additionalCms);
       
   171             plugin->GetAdditionalUids( additionalCms );
       
   172             //if there are additional cms created, move them to the target destination as well
       
   173             for ( TInt i = 0; i<additionalCms.Count(); i++)
       
   174                 {
       
   175                 CCmPluginBase* cm = iCmManagerImpl->GetConnectionMethodL( additionalCms[i] );
       
   176                 CleanupStack::PushL(cm);
       
   177                 iCmManagerImpl->CopyConnectionMethodL( *destImpl, *cm );
       
   178                 CleanupStack::PopAndDestroy( cm );
       
   179                 }
       
   180             CleanupStack::PopAndDestroy( &additionalCms );   
       
   181             addedIapId = plugin->GetIntAttributeL( CMManager::ECmIapId );
       
   182             }
       
   183         CleanupStack::PopAndDestroy(plugin);
       
   184         }    
       
   185     CleanupStack::PopAndDestroy(destImpl);
       
   186     
       
   187     return addedIapId;
       
   188     }
       
   189 
       
   190 //-----------------------------------------------------------------------------
       
   191 //  CCmSettingsUiImpl::EditCmL
       
   192 //-----------------------------------------------------------------------------
       
   193 //
       
   194 TInt CCmSettingsUiImpl::EditCmL( TUint32 aCmId )
       
   195     {
       
   196     // Edit connection method  
       
   197     TInt ret( KDialogUserBack );
       
   198     
       
   199     CCmPluginBase* cm = iCmManagerImpl->GetConnectionMethodL( aCmId );
       
   200     CleanupStack::PushL( cm );
       
   201     
       
   202     cm->ReLoadL();
       
   203     if ( cm->GetBoolAttributeL( CMManager::ECmProtected ) ||
       
   204          cm->GetBoolAttributeL( CMManager::ECmDestination ) )
       
   205         {
       
   206         TCmCommonUi::ShowNoteL( R_CMMANAGERUI_INFO_PROTECTED_CANNOT_EDIT,
       
   207                                             TCmCommonUi::ECmErrorNote );
       
   208         }
       
   209    else if ( cm->GetBoolAttributeL( CMManager::ECmBearerHasUi ) )
       
   210         {
       
   211         // check if the cm is in use
       
   212         if ( cm->GetBoolAttributeL( CMManager::ECmConnected ) )
       
   213             {
       
   214             TCmCommonUi::ShowNoteL( R_QTN_SET_NOTE_AP_IN_USE_EDIT,
       
   215                                     TCmCommonUi::ECmErrorNote );
       
   216             }
       
   217         else
       
   218             {
       
   219             //Makes sure that the commsdat notifier is initialized.           
       
   220             cm->CmMgr().StartCommsDatNotifierL();
       
   221             ret = cm->RunSettingsL();
       
   222             }
       
   223         }
       
   224     CleanupStack::PopAndDestroy(cm);
       
   225     return ret;
       
   226     }
       
   227