connectionutilities/ConnectionDialogs/cconndlg/clientsrc/ActiveLogin.cpp
author Simon Howkins <simonh@symbian.org>
Thu, 18 Nov 2010 15:05:52 +0000
branchRCL_3
changeset 76 40780c2f3a6b
parent 0 5a93021fdf25
permissions -rw-r--r--
Adjusted to avoid exports, etc, from a top-level bld.inf

/*
* Copyright (c) 2003 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"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:  Implementation of CActiveLogin class
*
*/


// INCLUDE FILES
#include "ActiveLogin.h"


// ================= MEMBER FUNCTIONS =======================
//
// ----------------------------------------------------------------------------
// CActiveLogin::CActiveLogin
// ----------------------------------------------------------------------------
//
CActiveLogin::CActiveLogin( TDes& aUsername, TDes& aPassword )
: CActive( CActive::EPriorityUserInput ),
  iUsername( &aUsername ),
  iPassword( &aPassword )
    {
    iAuthenticationPairBuff().iUsername = aUsername;
    iAuthenticationPairBuff().iPassword = aPassword;
    }


// ----------------------------------------------------------------------------
// CActiveLogin::NewL
// ----------------------------------------------------------------------------
//
CActiveLogin* CActiveLogin::NewL( TDes& aUsername, TDes& aPassword )
    {
    CActiveLogin* self = new( ELeave )CActiveLogin( aUsername, aPassword );
    CleanupStack::PushL( self );
    self->ConstructL();
    CleanupStack::Pop( self );

    return self;
    }


// ----------------------------------------------------------------------------
// CActiveLogin::ConstructL
// ----------------------------------------------------------------------------
//
void CActiveLogin::ConstructL()
    {
    }


// ----------------------------------------------------
// CActiveLogin::~CActiveLogin()
// ----------------------------------------------------
//
CActiveLogin::~CActiveLogin()
    {
    Cancel();
    }


// ----------------------------------------------------------------------------
// CActiveLogin::RunL
// ----------------------------------------------------------------------------
//
void CActiveLogin::RunL()
    {
    if ( iStatus.Int() == KErrNone )
        {
        *iUsername = iAuthenticationPairBuff().iUsername;
        *iPassword = iAuthenticationPairBuff().iPassword;
        }

    TRequestStatus* pS = iRs;
    User::RequestComplete( pS, iStatus.Int() );

    delete this;
    }


// ----------------------------------------------------------------------------
// CActiveLogin::DoCancel
// ----------------------------------------------------------------------------
//
void CActiveLogin::DoCancel()
    {
    TRequestStatus* pS = iRs;
    User::RequestComplete( pS, KErrCancel );
    }


// ----------------------------------------------------------------------------
// CActiveLogin::Observe
// ----------------------------------------------------------------------------
//
void CActiveLogin::Observe( TRequestStatus &aStatus )
    {
    CActiveScheduler::Add( this );

    iRs = &aStatus;
    *iRs = KRequestPending;

    SetActive();
    }


// ----------------------------------------------------------------------------
// CActiveLogin::GetBuffer
// ----------------------------------------------------------------------------
//
TPckgBuf<TAuthenticationPairBuff>* CActiveLogin::GetBuffer() 
    { 
    return &iAuthenticationPairBuff; 
    }


// End of File