vpnengine/vpnmanager/src/pwdchanger.cpp
changeset 0 33413c0669b9
equal deleted inserted replaced
-1:000000000000 0:33413c0669b9
       
     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: 
       
    15 * Handles the calling of PKI Service Server module’s password change function.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 #include "pwdchanger.h"
       
    22 #include "vpnapiservant.h"
       
    23 
       
    24 CPwdChanger* CPwdChanger::NewL(const RMessage2& aMessage, CVpnApiServant& aVpnApiServant)
       
    25     {
       
    26     CPwdChanger* self = new (ELeave) CPwdChanger(aMessage, aVpnApiServant);
       
    27     CleanupStack::PushL(self);
       
    28     self->ConstructL();
       
    29     CleanupStack::Pop(); // self
       
    30     return self;
       
    31     }
       
    32 
       
    33 CPwdChanger::CPwdChanger(const RMessage2& aMessage, CVpnApiServant& aVpnApiServant) :
       
    34     CActive(0), iMessage(aMessage), iVpnApiServant(aVpnApiServant)
       
    35     {
       
    36     }
       
    37 
       
    38 void CPwdChanger::ConstructL()
       
    39     {
       
    40     CActiveScheduler::Add(this);
       
    41     User::LeaveIfError(iPkiService.Connect());
       
    42     }
       
    43 
       
    44 CPwdChanger::~CPwdChanger()
       
    45     {
       
    46     Cancel();
       
    47     iPkiService.Close();
       
    48     }
       
    49 
       
    50 void CPwdChanger::ChangePassword()
       
    51     {
       
    52     iPkiService.ChangePassword(iStatus);
       
    53     SetActive();
       
    54     }
       
    55 
       
    56 void CPwdChanger::DoCancel()
       
    57     {
       
    58     iPkiService.CancelPendingOperation();
       
    59     iMessage.Complete(KErrCancel);
       
    60     }
       
    61 
       
    62 void CPwdChanger::RunL()
       
    63     {
       
    64     iMessage.Complete(iStatus.Int());
       
    65     iVpnApiServant.PasswordChangeComplete();
       
    66     }
       
    67