connectionutilities/ConnectionDialogs/cconndlg/src/ConnDlgPlugin.cpp
branchRCL_3
changeset 58 83ca720e2b9a
parent 57 05bc53fe583b
--- a/connectionutilities/ConnectionDialogs/cconndlg/src/ConnDlgPlugin.cpp	Tue Aug 31 15:35:44 2010 +0300
+++ b/connectionutilities/ConnectionDialogs/cconndlg/src/ConnDlgPlugin.cpp	Wed Sep 01 12:23:51 2010 +0100
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies). 
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -17,7 +17,14 @@
 
 // INCLUDE FILES
 #include "ConnDlgPlugin.h"
+#include "AuthenticationDialog.h"
+#include "ReconnectDialog.h"
+#include "QosDialog.h"
+#include "NewIapDialog.h"
+#include "ActiveIapPlugin.h"
 
+#include "ActiveSelectConnectionPlugin.h"
+#include "CConnDlgPrivateCRKeys.h"
 #include <centralrepository.h>
 
 #include "ConnectionDialogsUidDefs.h"
@@ -27,23 +34,29 @@
 #include <bautils.h>
 #include <e32property.h> 
 #include <rmpm.h>
-#include <cmmanager.h>
-#include <cmdestination.h>
-#include <commsdat.h>
+#include <startupdomainpskeys.h>
 
+#include <CConnDlgPlugin.rsg>
 #include <data_caging_path_literals.hrh>
-
-
-// NOTE that the functionality this file is DEPRECATED
-// None on the methods have UI functionality, the plugins complete the requests
-// immediately when they are started
+#include <vpnapi.h>
 
 using namespace CommsDat;
 
 // CONSTANTS
 
+// RSC file name.
+_LIT( KResourceFileName, "CConnDlgPlugin.rsc" );
+
+// Panic string
+_LIT( KConnDlgPluginPanic, "CConnDlgPlugin" );
+
 LOCAL_D const TInt KPluginGranularity = 4;
 
+#if defined(_DEBUG)
+_LIT( KErrActiveObjectNull, "iActivePlugin not NULL" );
+#endif
+
+
 
 LOCAL_C void CreateNotifiersL( 
                             CArrayPtrFlat<MEikSrvNotifierBase2>* aNotifiers );
@@ -59,9 +72,8 @@
 
 EXPORT_C CArrayPtr<MEikSrvNotifierBase2>* NotifierArray()
     {
-    CArrayPtrFlat<MEikSrvNotifierBase2>* array = NULL;
-    TRAP_IGNORE( array = new (ELeave) 
-                    CArrayPtrFlat<MEikSrvNotifierBase2>( KPluginGranularity ); )
+    CArrayPtrFlat<MEikSrvNotifierBase2>* array = new (ELeave) 
+                    CArrayPtrFlat<MEikSrvNotifierBase2>( KPluginGranularity );
 
     if ( array )
         {
@@ -149,62 +161,64 @@
 
 void CConnDlgIapPlugin::StartL( const TDesC8& aBuffer, TInt aReplySlot,
                                 const RMessagePtr2& aMessage )
-    {
+    {    
+    if ( ScreenSaverOn() || AutolockOn() )
+        {
+        // Screen saver or Autolock is active. Cancel the dialog. 
+        CLOG_WRITE( "CConnDlgAuthenticationPlugin::StartL: Screen saver or Autolock is active." );
+        aMessage.Complete( KErrCancel );
+        return;
+        }
+
+    iPrefs.Copy( (TPtrC8) aBuffer );
 
     iCancelled = EFalse;
     iReplySlot = aReplySlot;
     iMessage = aMessage;
     
-    // The UI is deprectad, complete the request and return the best available iap
-    RCmManager cmManager;
-    cmManager.OpenL();     
-    CleanupClosePushL( cmManager ); 
-    
-    RArray<TUint32> destinationArray;    
-    cmManager.AllDestinationsL( destinationArray );
-    CleanupClosePushL(destinationArray);   
-    TInt error = KErrNotFound;
+    // Check if there is a suitable active connection
+    TInt iap( 0 );
+    TInt bearer( ECommDbBearerWLAN ); // User conn. is always WLAN in 9.1
+                                      
+    // Is there active User connection
+    TInt err = GetUserConnection( iap );
     
-    // loop the destinations and find the internet snap
-    for (TInt i = 0; i < destinationArray.Count(); ++i)
-        {   
-        RCmDestination destination = cmManager.DestinationL( destinationArray[i] );
-        CleanupClosePushL(destination);
-        TUint32 purposeMetaData = destination.MetadataL( CMManager::ESnapMetadataPurpose );
-        
-        // If the internet snap was found, check out the IAPs
-        if ( CMManager::ESnapPurposeInternet ==  purposeMetaData )
-            {
-            RMPM mpm;
-            User::LeaveIfError(mpm.Connect());
-            TMpmSnapBuffer buffer;
-            buffer.Reset();
-            User::LeaveIfError( mpm.SortSNAP( destination.Id(), buffer )); 
-            mpm.Close();
-            // if there are iaps in the list, return the first
-            // if there are none, return an error
-            if ( buffer.Count() > 0 )
-                {
-                iIAP = buffer.iIapId[0];
-                error = KErrNone;
-                }
-            CleanupStack::PopAndDestroy(); //destination
-            break;
-            }                
-        CleanupStack::PopAndDestroy(); //destination
+    if ( err != KErrNone || iap == 0 )
+        {
+        // Is there any active connection
+    	err = GetActiveConnection( iap, bearer );
         }
-    CleanupStack::PopAndDestroy(); //destinationArray
-    CleanupStack::PopAndDestroy(); //cmManager
+
+    if ( ( err == KErrNone ) && 
+         ( iap != 0 )        &&  
+         ( iPrefs().iBearerSet & bearer ) )
+        {
+    	// a suitable connection is already active
+    	iIAP = iap;
+    	CompleteL( KErrNone );
+        }
+    else
+        {
+        // display a dialog
+        __ASSERT_DEBUG( !iActivePlugin, 
+                    User::Panic( KErrActiveObjectNull, KErrNone ) );
     
-    CompleteL( error );
+        iActivePlugin = CActiveCConnDlgIapPlugin::NewL( this, iPrefs() );
+        iActivePlugin->StartSearchIAPsL();	
+        }
     }
 
+
+
 // ---------------------------------------------------------
 // void CConnDlgIapPlugin::Cancel()
 // ---------------------------------------------------------
 //
 void CConnDlgIapPlugin::Cancel()
-    { 
+    {
+    delete iActivePlugin;
+    iActivePlugin = NULL;
+    
     if ( !iCancelled )
         {
         iCancelled = ETrue;
@@ -247,11 +261,79 @@
 // ---------------------------------------------------------
 //
 CConnDlgIapPlugin* CConnDlgIapPlugin::NewL( 
-                                        const TBool /*aResourceFileResponsible*/ )
+                                        const TBool aResourceFileResponsible )
     {
     CConnDlgIapPlugin* self = new (ELeave) CConnDlgIapPlugin();
+    CleanupStack::PushL( self );
+    self->ConstructL( KResourceFileName, aResourceFileResponsible );
+    CleanupStack::Pop();
+
     return self;
     }
+
+// ---------------------------------------------------------
+// CConnDlgIapPlugin::SetPreferredIapIdL
+// ---------------------------------------------------------
+//    
+void CConnDlgIapPlugin::SetPreferredIapIdL( TUint32 aIAPId )
+    {
+    CLOG_ENTERFN( "CConnDlgIapPlugin::SetPreferredIapIdL " );
+    
+    iIAP = aIAPId;
+        
+    CLOG_LEAVEFN( "CConnDlgIapPlugin::SetPreferredIapIdL " );
+    }
+    
+    
+// ---------------------------------------------------------
+// CConnDlgIapPlugin::GetActiveConnection
+// ---------------------------------------------------------
+//    
+TInt CConnDlgIapPlugin::GetActiveConnection( TInt& aIapId, 
+                                             TInt& aBearer )
+    {
+    aIapId  = 0;
+    aBearer = 0;
+    
+    TInt err = RProperty::Get( KMPMActiveConnectionCategory, 
+                               KMPMPSKeyActiveConnectionIap, 
+                               aIapId );
+                               
+    CLOG_WRITEF( _L( "KMPMPSKeyActiveConnectionIap : %d" ), aIapId );                           
+    CLOG_WRITEF( _L( "err : %d" ), err );                           
+                               
+    if ( err == KErrNone )
+        {
+    	err = RProperty::Get( KMPMActiveConnectionCategory, 
+                              KMPMPSKeyActiveConnectionBearer, 
+                              aBearer );
+        }
+        
+    CLOG_WRITEF( _L( "KMPMPSKeyActiveConnectionBearer : %d" ), aBearer );                           
+    CLOG_WRITEF( _L( "err : %d" ), err );
+    CLOG_WRITEF( _L( "iPrefs().iBearerSet : %d" ), iPrefs().iBearerSet );
+    
+    return err;
+    }
+    
+    
+// ---------------------------------------------------------
+// CConnDlgIapPlugin::GetUserConnection
+// ---------------------------------------------------------
+//    
+TInt CConnDlgIapPlugin::GetUserConnection( TInt& aIapId )
+    {
+    aIapId  = 0;
+    
+    TInt err = RProperty::Get( KMPMUserConnectionCategory, 
+                               KMPMPSKeyUserConnectionIap, 
+                               aIapId );
+                
+    CLOG_WRITEF( _L( "KMPMPSKeyUserConnectionIap : %d" ), aIapId );                           
+    CLOG_WRITEF( _L( "err : %d" ), err );                            
+        
+    return err;    
+    }
             
 
 // ---------------------------------------------------------
@@ -281,12 +363,27 @@
     {
     CLOG_ENTERFN( "CConnDlgAuthenticationPlugin::StartL" );
 
+    if ( ScreenSaverOn() || AutolockOn() )
+        {
+        // Screen saver or Autolock is active. Cancel the dialog. 
+        CLOG_WRITE( "CConnDlgAuthenticationPlugin::StartL: Screen saver or Autolock is active." );
+        aMessage.Complete( KErrCancel );
+        return;
+        }
+
+    if ( aBuffer.Length() > iAuthPairBuff.Length() )
+        {
+        CLOG_WRITE( "User::Panic, EConnDlgIllegalRequest" );
+        User::Panic( KConnDlgPluginPanic, EConnDlgIllegalRequest );
+        }
+
+    iAuthPairBuff.Copy( aBuffer );
+
     iReplySlot = aReplySlot;
     iMessage = aMessage;
     iCancelled = EFalse;
 
-    // The UI is deprecated, just complete the request
-    CompleteL(KErrNotSupported);
+    GetAuthenticationL();
 
     CLOG_LEAVEFN( "CConnDlgAuthenticationPlugin::StartL" );
     }
@@ -308,6 +405,8 @@
             {
             iMessage.Complete( KErrCancel );
             }
+        delete iDialog;
+        iDialog = NULL;
         }
 
     CLOG_LEAVEFN( "CConnDlgAuthenticationPlugin::Cancel" );
@@ -315,6 +414,24 @@
 
 
 // ---------------------------------------------------------
+// void CConnDlgAuthenticationPlugin::GetAuthenticationL()
+// ---------------------------------------------------------
+//
+void CConnDlgAuthenticationPlugin::GetAuthenticationL()
+    {
+    CLOG_ENTERFN( "CConnDlgAuthenticationPlugin::GetAuthenticationL" );
+
+    iDialog = CAuthenticationDialog::NewL( this, iAuthPairBuff().iUsername, 
+                                           iAuthPairBuff().iPassword );
+
+
+    iDialog->ExecuteLD( R_CONNDLG_AUTHENTICATION );
+
+    CLOG_LEAVEFN( "CConnDlgAuthenticationPlugin::GetAuthenticationL" );
+    }
+
+
+// ---------------------------------------------------------
 // void CConnDlgAuthenticationPlugin::CompleteL( TInt aStatus )
 // ---------------------------------------------------------
 //
@@ -325,6 +442,11 @@
     iCancelled = ETrue;
     if ( !iMessage.IsNull() )
         {
+        if ( aStatus == KErrNone )
+            {
+            iMessage.WriteL( iReplySlot, iAuthPairBuff );
+            }
+
         iMessage.Complete( aStatus );
         }
     Cancel();
@@ -338,10 +460,14 @@
 // ---------------------------------------------------------
 //
 CConnDlgAuthenticationPlugin* CConnDlgAuthenticationPlugin::NewL( 
-                                        const TBool /*aResourceFileResponsible*/ )
+                                        const TBool aResourceFileResponsible )
     {
     CConnDlgAuthenticationPlugin* self = new (ELeave) 
                                                 CConnDlgAuthenticationPlugin();
+    CleanupStack::PushL( self );
+    self->ConstructL( KResourceFileName, aResourceFileResponsible );
+    CleanupStack::Pop();
+
     return self;
     }
 
@@ -351,6 +477,7 @@
 // ---------------------------------------------------------
 //
 CConnDlgAuthenticationPlugin::CConnDlgAuthenticationPlugin()
+: iAuthPair( TAuthenticationPair() )
     {
     }
 
@@ -380,7 +507,7 @@
     iMessage = aMessage;
     iCancelled = EFalse;
 
-    CompleteL(KErrNotSupported);
+    GetReconnectL();
     }
 
 
@@ -397,11 +524,24 @@
             {
             iMessage.Complete( KErrCancel );
             }
+        delete iDialog;
+        iDialog = NULL;
         }
     }
 
 
 // ---------------------------------------------------------
+// void CConnDlgQosPlugin::GetReconnectL()
+// ---------------------------------------------------------
+//
+void CConnDlgQosPlugin::GetReconnectL()
+    {
+    iDialog = new (ELeave) CQosDialog( this, iBool );
+    iDialog->ExecuteLD( R_CONNDLG_QOS );
+    }
+
+
+// ---------------------------------------------------------
 // void CConnDlgQosPlugin::CompleteL( TInt aStatus )
 // ---------------------------------------------------------
 //
@@ -410,6 +550,11 @@
     iCancelled = ETrue;
     if ( !iMessage.IsNull() )
         {
+        if ( aStatus == KErrNone )
+            {
+            TRAP_IGNORE( iMessage.WriteL( iReplySlot, TPckg<TBool>( iBool ) ) );
+            }
+
         iMessage.Complete( aStatus );
         }
     Cancel();
@@ -421,9 +566,13 @@
 // ---------------------------------------------------------
 //
 CConnDlgQosPlugin* CConnDlgQosPlugin::NewL( 
-                                        const TBool /*aResourceFileResponsible*/ )
+                                        const TBool aResourceFileResponsible )
     {
     CConnDlgQosPlugin* self = new (ELeave) CConnDlgQosPlugin();
+    CleanupStack::PushL( self );
+    self->ConstructL( KResourceFileName, aResourceFileResponsible );
+    CleanupStack::Pop();
+
     return self;
     }
 
@@ -454,8 +603,7 @@
     iMessage = aMessage;
     iCancelled = EFalse;
 
-    // The UI is deprecated, just complete the request
-    CompleteL(KErrNotSupported);
+    GetReconnectL();
     }
 
 
@@ -472,11 +620,24 @@
             {
             iMessage.Complete( KErrCancel );
             }
+        delete iDialog;
+        iDialog = NULL;
         }
     }
 
 
 // ---------------------------------------------------------
+// void CConnDlgReconnectPlugin::GetReconnectL()
+// ---------------------------------------------------------
+//
+void CConnDlgReconnectPlugin::GetReconnectL()
+    {
+    iDialog = new (ELeave) CReconnectDialog( this, iBool );
+    iDialog->ExecuteLD( R_CONNDLG_RECONNECT );
+    }
+
+
+// ---------------------------------------------------------
 // void CConnDlgReconnectPlugin::CompleteL( TInt aStatus )
 // ---------------------------------------------------------
 //
@@ -485,6 +646,11 @@
     iCancelled = ETrue;
     if ( !iMessage.IsNull() )
         {
+        if ( aStatus == KErrNone )
+            {
+            iMessage.WriteL( iReplySlot, TPckg<TBool>( iBool ) );
+            }
+
         iMessage.Complete( aStatus );
         }
     Cancel();
@@ -497,9 +663,13 @@
 // ---------------------------------------------------------
 //
 CConnDlgReconnectPlugin* CConnDlgReconnectPlugin::NewL( 
-                                        const TBool /*aResourceFileResponsible*/ )
+                                        const TBool aResourceFileResponsible )
     {
     CConnDlgReconnectPlugin* self = new (ELeave) CConnDlgReconnectPlugin();
+    CleanupStack::PushL( self );
+    self->ConstructL( KResourceFileName, aResourceFileResponsible );
+    CleanupStack::Pop();
+
     return self;
     }
 
@@ -526,12 +696,17 @@
 void CConnDlgNewIapPlugin::StartL( const TDesC8& aBuffer, TInt aReplySlot,
                                    const RMessagePtr2& aMessage )
     {
+    if ( aBuffer.Length() > iPrefs.Length() )
+        {
+        User::Panic( KConnDlgPluginPanic, EConnDlgIllegalRequest );
+        }
+
+    iPrefs.Copy( aBuffer );
     iReplySlot = aReplySlot;
     iMessage = aMessage;
     iCancelled = EFalse;
 
-    // This api has been deprecated, just Complete the request
-    CompleteL(KErrNotSupported);
+    GetNewIapL();
     }
 
 
@@ -548,11 +723,24 @@
             {
             iMessage.Complete( KErrCancel );
             }
+        delete iDialog;
+        iDialog = NULL;
         }
     }
 
 
 // ---------------------------------------------------------
+// void CConnDlgNewIapPlugin::GetNewIapL()
+// ---------------------------------------------------------
+//
+void CConnDlgNewIapPlugin::GetNewIapL()
+    {
+    iDialog = new (ELeave) CNewIapDialog( this, iConnect, iPrefs() );
+    iDialog->ExecuteLD( R_CONNDLG_NEW_IAP );
+    }
+
+
+// ---------------------------------------------------------
 // void CConnDlgNewIapPlugin::CompleteL( TInt aStatus )
 // ---------------------------------------------------------
 //
@@ -561,6 +749,11 @@
     iCancelled = ETrue;
     if ( !iMessage.IsNull() )
         {
+        if ( aStatus == KErrNone )
+            {
+            iMessage.WriteL( iReplySlot, TPckg<TBool>( iConnect ) );
+            }
+
         iMessage.Complete( aStatus );
         }
     Cancel();
@@ -572,9 +765,13 @@
 // ---------------------------------------------------------
 //
 CConnDlgNewIapPlugin* CConnDlgNewIapPlugin::NewL( 
-                                        const TBool /*aResourceFileResponsible*/ )
+                                        const TBool aResourceFileResponsible )
     {
     CConnDlgNewIapPlugin* self = new (ELeave) CConnDlgNewIapPlugin();
+    CleanupStack::PushL( self );
+    self->ConstructL( KResourceFileName, aResourceFileResponsible );
+    CleanupStack::Pop();
+
     return self;
     }
 
@@ -600,59 +797,105 @@
 // ---------------------------------------------------------
 //
 
-void CConnDlgSelectConnectionPlugin::StartL( const TDesC8& /*aBuffer*/, 
+void CConnDlgSelectConnectionPlugin::StartL( const TDesC8& aBuffer, 
                                              TInt aReplySlot,
                                              const RMessagePtr2& aMessage )
     {
-        
+     CLOG_ENTERFN( "CConnDlgSelectConnectionPlugin::StartL" );      	
+    	
+    if ( iActivePlugin )
+        {
+        aMessage.Complete( KErrServerBusy );
+        return;
+        }
+     
+    TInt iStartUpPhaseValue( EStartupUiPhaseUninitialized );
+    RProperty::Get( KPSUidStartup, KPSStartupUiPhase, iStartUpPhaseValue );
+    CLOG_WRITEF( _L( "CConnDlgSelectConnectionPlugin::Phone start up phase: %d" ), 
+    									iStartUpPhaseValue );           
+    // Don't show the dialog if phone boot up isn't complete or screen saver or Autolock is on.
+    if ( iStartUpPhaseValue != EStartupUiPhaseAllDone || ScreenSaverOn() || AutolockOn() )
+        { 
+        CLOG_WRITE( "CConnDlgSelectConnectionPlugin::StartL: Screen saver or Autolock is active or start up phase not completed yet." );
+        aMessage.Complete( KErrCancel );
+        return;
+        }
+
+    iPrefs.Copy( ( TPtrC8 ) aBuffer );
+
+    iCancelled = ETrue; // This method could leave before displaying the dialog.
     iReplySlot = aReplySlot;
     iMessage = aMessage;
     
-    // because the connection dialog is deprecated and removed functionality,
-    // return the Internet SNAP and complete
-    RCmManager cmManager;
-    cmManager.OpenL();     
-    CleanupClosePushL( cmManager ); 
+    __ASSERT_DEBUG( !iActivePlugin, 
+                     User::Panic( KErrActiveObjectNull, KErrNone ) );
+    
+    iElementID = iPrefs().iRank;
+    iActivePlugin = CActiveSelectConnectionPlugin::NewL( this,
+                                                         iElementID,
+                                                         iPrefs().iBearerSet );
+    // Check if there is a suitable active connection
+    TInt snap( 0 );
+    TInt iap( 0 );
+    TInt bearer( ECommDbBearerWLAN ); // User conn. is always WLAN in 9.1
+    
+    // Is there active User connection
+    TInt err = GetUserConnection( iap, snap );
     
-    RArray<TUint32> destinationArray;    
-    cmManager.AllDestinationsL( destinationArray );
-    CleanupClosePushL(destinationArray);   
-    bool found = false;
+    if ( ( err != KErrNone ) || ( iap == 0 && snap == 0 ) )
+        {
+        // Is there any active connection
+    	err = GetActiveConnection( iap, snap, bearer );
+        }
+                                      
+    RVpnServ vpn;
+    TInt vpnErr( KErrNone );
+    TInt policyCount( 0 );
+    TBool forceDialogForIntranetUsers( EFalse );
     
-    // loop the destinations and find the internet snap
-    for (TInt i = 0; i < destinationArray.Count() && !found; ++i)
-        {   
-        RCmDestination destination = cmManager.DestinationL( destinationArray[i] );
-        CleanupClosePushL(destination);
+    vpnErr = vpn.Connect();
+    if ( !vpnErr ) 
+    	  {
+    	  vpnErr = vpn.EnumeratePolicies(policyCount);
+    	  if ( !vpnErr && policyCount > 0 )
+    	  	  {
+    	  	  forceDialogForIntranetUsers = ETrue;
+    	  	  }
+        vpn.Close();
+        }
         
-        TUint32 purposeMetaData = destination.MetadataL( CMManager::ESnapMetadataPurpose );
-        if ( CMManager::ESnapPurposeInternet ==  purposeMetaData )
-            {
-            iElementID = destination.ElementId();
-            found = true;
-            }                
-        CleanupStack::PopAndDestroy(); //destination
+    if ( !forceDialogForIntranetUsers &&
+    	 ( err == KErrNone ) && 
+         ( iap != 0 || snap != 0 ) && 
+         ( iPrefs().iBearerSet & bearer ) &&
+         ( iPrefs().iDirection == 0 ) )     // JavaVM sets iDirection to "1"
+        {
+    	// a suitable connection is already active
+    	SetElementIDL( iap, snap );
+    	CompleteL( KErrNone );
         }
-    CleanupStack::PopAndDestroy(); //destinationArray
-    CleanupStack::PopAndDestroy(); //cmManager
-    
-    if (found)
+    else
         {
-        CompleteL(KErrNone);
-        } 
-    else 
-        {
-        CompleteL(KErrNotFound);
+        // display dialog
+        iActivePlugin->ShowSelectConnectionL();
+        iCancelled = EFalse; // Dialog is now up and running
         }
     }
 
+
+
 // ---------------------------------------------------------
 // void CConnDlgSelectConnectionPlugin::Cancel()
 // ---------------------------------------------------------
 //
 void CConnDlgSelectConnectionPlugin::Cancel()
     {
-    CLOG_ENTERFN( "CConnDlgSelectConnectionPlugin::Cancel" );          
+    CLOG_ENTERFN( "CConnDlgSelectConnectionPlugin::Cancel" );      
+
+    delete iActivePlugin;
+    CLOG_WRITE( "iActivePlugin deleted" );      
+    iActivePlugin = NULL;
+    CLOG_WRITE( "iActivePlugin NULLed" );      
     
     if ( !iCancelled )
         {
@@ -701,12 +944,97 @@
 // ---------------------------------------------------------
 //
 CConnDlgSelectConnectionPlugin* CConnDlgSelectConnectionPlugin::NewL( 
-                                        const TBool /*aResourceFileResponsible*/ )
+                                        const TBool aResourceFileResponsible )
     {
     CConnDlgSelectConnectionPlugin* self = 
                             new (ELeave) CConnDlgSelectConnectionPlugin();
+    CleanupStack::PushL( self );
+    self->ConstructL( KResourceFileName, aResourceFileResponsible );
+    CleanupStack::Pop();
+
     return self;
     }
+
+
+// ---------------------------------------------------------
+// CConnDlgSelectConnectionPlugin::SetSelectedIDsL
+// ---------------------------------------------------------
+//    
+void CConnDlgSelectConnectionPlugin::SetElementIDL( TUint32 aIAPId, 
+                                                    TUint32 aDestinationId )
+    {
+    iElementID = iActivePlugin->GetElementIDL( aIAPId, aDestinationId );
+    }
     
+    
+// ---------------------------------------------------------
+// CConnDlgSelectConnectionPlugin::GetUserConnection
+// ---------------------------------------------------------
+//    
+TInt CConnDlgSelectConnectionPlugin::GetUserConnection( TInt& aIapId, 
+                                                        TInt& aSnapId )
+    {
+    aIapId  = 0;
+    aSnapId = 0;
+    
+    TInt err = RProperty::Get( KMPMUserConnectionCategory, 
+                               KMPMPSKeyUserConnectionSnap, 
+                               aSnapId );
+    
+    if ( err != KErrNone || aSnapId == 0 )
+        {
+        err = RProperty::Get( KMPMUserConnectionCategory, 
+                              KMPMPSKeyUserConnectionIap, 
+                              aIapId );
+        }
+       
+    CLOG_WRITEF( _L( "KMPMPSKeyUserConnectionSnap : %d" ), aSnapId );                      
+    CLOG_WRITEF( _L( "KMPMPSKeyUserConnectionIap : %d" ), aIapId );                           
+    CLOG_WRITEF( _L( "err : %d" ), err );
+        
+    return err;    
+    }
+
+
+// ---------------------------------------------------------
+// CConnDlgSelectConnectionPlugin::GetActiveConnection
+// ---------------------------------------------------------
+//    
+TInt CConnDlgSelectConnectionPlugin::GetActiveConnection( TInt& aIapId, 
+                                                          TInt& aSnapId,
+                                                          TInt& aBearer )
+    {
+    aIapId  = 0;
+    aSnapId = 0;
+    aBearer = 0;
+    
+    TInt err = RProperty::Get( KMPMActiveConnectionCategory, 
+                               KMPMPSKeyActiveConnectionSnap, 
+                               aSnapId );
+                                  
+    if ( err != KErrNone || aSnapId == 0 )
+        {
+        err = RProperty::Get( KMPMActiveConnectionCategory, 
+                              KMPMPSKeyActiveConnectionIap, 
+                              aIapId );
+        }
+         
+    CLOG_WRITEF( _L( "KMPMPSKeyActiveConnectionSnap : %d" ), aSnapId );                      
+    CLOG_WRITEF( _L( "KMPMPSKeyActiveConnectionIap : %d" ), aIapId );                           
+    CLOG_WRITEF( _L( "err : %d" ), err );                           
+                               
+    if ( err == KErrNone )
+        {
+    	err = RProperty::Get( KMPMActiveConnectionCategory, 
+                              KMPMPSKeyActiveConnectionBearer, 
+                              aBearer );
+        }
+
+    CLOG_WRITEF( _L( "KMPMPSKeyActiveConnectionBearer : %d" ), aBearer );                           
+    CLOG_WRITEF( _L( "iPrefs().iBearerSet : %d" ), iPrefs().iBearerSet );
+    CLOG_WRITEF( _L( "err : %d" ), err );
+    
+    return err;
+    }
 
 // End of File