uiservicetab/vimpstui/src/cvimpstuitermsofusedialoghandler.cpp
changeset 0 5e5d6b214f4f
child 9 9fdee5e1da30
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/uiservicetab/vimpstui/src/cvimpstuitermsofusedialoghandler.cpp	Tue Feb 02 10:12:18 2010 +0200
@@ -0,0 +1,81 @@
+/*
+* 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