uiservicetab/vimpstui/src/cvimpstuitermsofusedialoghandler.cpp
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Tue, 02 Feb 2010 10:12:18 +0200
changeset 0 5e5d6b214f4f
child 9 9fdee5e1da30
permissions -rw-r--r--
Revision: 201003 Kit: 201005

/*
* Copyright (c) 2006 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:  Dialogue handler for TOU
*
*/


#include "cvimpstuitermsofusedialoghandler.h"
#include "cvimpstuitermsofusedlg.h"

#include "cvimpstsettingsstore.h"
#include <vimpstuires.rsg>
#include <avkon.hrh>




    
// ======== MEMBER FUNCTIONS ========

// ---------------------------------------------------------------------------
// CVIMPSTUiTermsOfUseDialogHandler::HandleTermsOfUseDialogLD
// ---------------------------------------------------------------------------
//
TInt CVIMPSTUiTermsOfUseDialogHandler::HandleTermsOfUseDialogLD(    
        MVIMPSTSettingsStore& aSettingsStore,
        const TDesC& /*aUserName*/,
        TInt& aServiceId,
        HBufC* aToUMsg/* = NULL*/)
    {   
    // Show Terms of Use, return KErrCancel if user does not accept them,
    // otherwise continue
    if ( !DisplayTermsOfUseAndQueryLD(aToUMsg) )
        {
        // User canceled ToU query, login cancelled
        // note is already shown inside DisplayTermsOfUseAndQueryL
        // method, just return KErrCancel
        //CleanupStack::PopAndDestroy(tmpSap);
        return KErrCancel;
        }
    else
        {
        TInt touOff =1;
        aSettingsStore.SetL(aServiceId, ETOUDlgOff, touOff ); 
        }
    return KErrNone;
    }

// -----------------------------------------------------------------------------
// CVIMPSTUiTermsOfUseDialogHandler::DisplayTermsOfUseAndQueryLD()
// -----------------------------------------------------------------------------
//
TBool CVIMPSTUiTermsOfUseDialogHandler::DisplayTermsOfUseAndQueryLD(HBufC* aToUMsg/* = NULL*/)
    {
    TInt retVal = EAknSoftkeyCancel;    
    CVIMPSTUiTermsOfUseDlg* dlg = CVIMPSTUiTermsOfUseDlg::NewLC(  );
    dlg->SetToUMsgL(aToUMsg);
    retVal = dlg->RunDialogLD( R_CNUI_TERMS_OF_USE_DIALOG );
    CleanupStack::Pop(dlg);
    if ( retVal == EAknSoftkeyOk ||  retVal == EAknSoftkeyYes)
        {                
        return ETrue;
        }
    else 
        {    
        return EFalse;
        }
    }

//End of File