telephonyprotocols/pdplayer/src/authenticationdialog.cpp
branchRCL_3
changeset 21 2492a6e4aed7
child 24 6638e7f4bd8f
equal deleted inserted replaced
17:3f227a47ad75 21:2492a6e4aed7
       
     1 // Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Interface between the PDP and the connection agent dialog server implementation
       
    15 //
       
    16 //
       
    17 
       
    18 /**
       
    19  @file
       
    20  @internalComponent
       
    21 */
       
    22 
       
    23 #include "AuthenticationDialog.h"
       
    24 
       
    25 //
       
    26 // CAuthenticationDialog definitions
       
    27 //
       
    28 
       
    29 CAuthenticationDialog* CAuthenticationDialog::NewL(TInt aPriority)
       
    30     {
       
    31     CAuthenticationDialog* self = new(ELeave) CAuthenticationDialog(aPriority);
       
    32     CleanupStack::PushL(self);
       
    33     self->ConstructL();
       
    34     CleanupStack::Pop(); // self
       
    35     return self;
       
    36     }
       
    37 
       
    38 CAuthenticationDialog::CAuthenticationDialog(TInt aPriority) 
       
    39     : CActive(aPriority)
       
    40     {}
       
    41 
       
    42 void CAuthenticationDialog::ConstructL()
       
    43     {
       
    44     CActiveScheduler::Add(this);
       
    45     TInt ret = iDlgServ.Connect();
       
    46     User::LeaveIfError(ret);
       
    47     }
       
    48 
       
    49 CAuthenticationDialog::~CAuthenticationDialog()
       
    50     {
       
    51     Cancel();
       
    52     iDlgServ.Close();
       
    53     }
       
    54 
       
    55 void CAuthenticationDialog::Authenticate(MAuthenticationDialogObserver& aObserver, TDes& aUsername,TDes& aPassword,TBool aIsReconnect)
       
    56 /**
       
    57 Request authentication information (pops up authentication dialog)
       
    58 */
       
    59     {
       
    60     __ASSERT_DEBUG(iObserver == NULL, User::Invariant());
       
    61     iDlgServ.Authenticate(aUsername,aPassword,aIsReconnect,iStatus);
       
    62     iObserver = &aObserver;
       
    63     CActive::SetActive();
       
    64     }
       
    65 
       
    66 void CAuthenticationDialog::RunL()
       
    67     {
       
    68     MAuthenticationDialogObserver* observer = iObserver;
       
    69     iObserver = NULL;
       
    70 
       
    71     observer->AuthenticationCompleteL(iStatus.Int());
       
    72     }
       
    73 
       
    74 void CAuthenticationDialog::DoCancel()
       
    75     {
       
    76     iDlgServ.CancelAuthenticate();
       
    77     iObserver = NULL;
       
    78     }