connectionutilities/ConnectionDialogs/cconndlg/clientsrc/ActiveLogin.cpp
branchRCL_3
changeset 58 83ca720e2b9a
parent 0 5a93021fdf25
equal deleted inserted replaced
57:05bc53fe583b 58:83ca720e2b9a
       
     1 /*
       
     2 * Copyright (c) 2003 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:  Implementation of CActiveLogin class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include "ActiveLogin.h"
       
    21 
       
    22 
       
    23 // ================= MEMBER FUNCTIONS =======================
       
    24 //
       
    25 // ----------------------------------------------------------------------------
       
    26 // CActiveLogin::CActiveLogin
       
    27 // ----------------------------------------------------------------------------
       
    28 //
       
    29 CActiveLogin::CActiveLogin( TDes& aUsername, TDes& aPassword )
       
    30 : CActive( CActive::EPriorityUserInput ),
       
    31   iUsername( &aUsername ),
       
    32   iPassword( &aPassword )
       
    33     {
       
    34     iAuthenticationPairBuff().iUsername = aUsername;
       
    35     iAuthenticationPairBuff().iPassword = aPassword;
       
    36     }
       
    37 
       
    38 
       
    39 // ----------------------------------------------------------------------------
       
    40 // CActiveLogin::NewL
       
    41 // ----------------------------------------------------------------------------
       
    42 //
       
    43 CActiveLogin* CActiveLogin::NewL( TDes& aUsername, TDes& aPassword )
       
    44     {
       
    45     CActiveLogin* self = new( ELeave )CActiveLogin( aUsername, aPassword );
       
    46     CleanupStack::PushL( self );
       
    47     self->ConstructL();
       
    48     CleanupStack::Pop( self );
       
    49 
       
    50     return self;
       
    51     }
       
    52 
       
    53 
       
    54 // ----------------------------------------------------------------------------
       
    55 // CActiveLogin::ConstructL
       
    56 // ----------------------------------------------------------------------------
       
    57 //
       
    58 void CActiveLogin::ConstructL()
       
    59     {
       
    60     }
       
    61 
       
    62 
       
    63 // ----------------------------------------------------
       
    64 // CActiveLogin::~CActiveLogin()
       
    65 // ----------------------------------------------------
       
    66 //
       
    67 CActiveLogin::~CActiveLogin()
       
    68     {
       
    69     Cancel();
       
    70     }
       
    71 
       
    72 
       
    73 // ----------------------------------------------------------------------------
       
    74 // CActiveLogin::RunL
       
    75 // ----------------------------------------------------------------------------
       
    76 //
       
    77 void CActiveLogin::RunL()
       
    78     {
       
    79     if ( iStatus.Int() == KErrNone )
       
    80         {
       
    81         *iUsername = iAuthenticationPairBuff().iUsername;
       
    82         *iPassword = iAuthenticationPairBuff().iPassword;
       
    83         }
       
    84 
       
    85     TRequestStatus* pS = iRs;
       
    86     User::RequestComplete( pS, iStatus.Int() );
       
    87 
       
    88     delete this;
       
    89     }
       
    90 
       
    91 
       
    92 // ----------------------------------------------------------------------------
       
    93 // CActiveLogin::DoCancel
       
    94 // ----------------------------------------------------------------------------
       
    95 //
       
    96 void CActiveLogin::DoCancel()
       
    97     {
       
    98     TRequestStatus* pS = iRs;
       
    99     User::RequestComplete( pS, KErrCancel );
       
   100     }
       
   101 
       
   102 
       
   103 // ----------------------------------------------------------------------------
       
   104 // CActiveLogin::Observe
       
   105 // ----------------------------------------------------------------------------
       
   106 //
       
   107 void CActiveLogin::Observe( TRequestStatus &aStatus )
       
   108     {
       
   109     CActiveScheduler::Add( this );
       
   110 
       
   111     iRs = &aStatus;
       
   112     *iRs = KRequestPending;
       
   113 
       
   114     SetActive();
       
   115     }
       
   116 
       
   117 
       
   118 // ----------------------------------------------------------------------------
       
   119 // CActiveLogin::GetBuffer
       
   120 // ----------------------------------------------------------------------------
       
   121 //
       
   122 TPckgBuf<TAuthenticationPairBuff>* CActiveLogin::GetBuffer() 
       
   123     { 
       
   124     return &iAuthenticationPairBuff; 
       
   125     }
       
   126 
       
   127 
       
   128 // End of File