iaupdate/IAD/ui/src/iaupdateroaminghandler.cpp
changeset 0 ba25891c3a9e
child 9 51c0f5edf5ef
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/iaupdate/IAD/ui/src/iaupdateroaminghandler.cpp	Thu Dec 17 08:51:10 2009 +0200
@@ -0,0 +1,178 @@
+/*
+* Copyright (c) 2008 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:   This module contains the implementation of 
+*                CIAUpdateRoamingHandler class member functions.
+*
+*/
+
+
+
+//INCLUDES
+#include <centralrepository.h>
+#include <avkon.hrh>
+#include <avkon.rsg>
+#include <iaupdate.rsg>
+
+#include "iaupdateroaminghandler.h"
+#include "iaupdateroaminghandlerobserver.h"
+#include "iaupdatenetworkregistration.h"
+#include "iaupdateprivatecrkeys.h"
+#include "iaupdatedialogutil.h"
+#include "iaupdate.hrh"
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------------------------
+// CIAUpdateRoamingHandler::NewL
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CIAUpdateRoamingHandler* CIAUpdateRoamingHandler::NewL()
+    {
+    CIAUpdateRoamingHandler* self = new (ELeave) CIAUpdateRoamingHandler();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// void CIAUpdateRoamingHandler::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CIAUpdateRoamingHandler::ConstructL()
+    {
+    iNwReg = CIAUpdateNetworkRegistration::NewL( *this );
+    }    
+
+// ---------------------------------------------------------------------------
+// CIAUpdateRoamingHandler::CIAUpdateRoamingHandler
+// constructor
+// ---------------------------------------------------------------------------
+//
+CIAUpdateRoamingHandler::CIAUpdateRoamingHandler()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CIAUpdateRoamingHandler::~CIAUpdateRoamingHandler
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CIAUpdateRoamingHandler::~CIAUpdateRoamingHandler()
+    {
+    CancelPreparing();
+    delete iNwReg;
+    }
+
+// ---------------------------------------------------------------------------
+// CIAUpdateRoamingHandler::StatusMonitored
+// 
+// ---------------------------------------------------------------------------
+//
+void CIAUpdateRoamingHandler::StatusMonitored( TBool aRoaming )
+    {
+	iRoaming = aRoaming;
+	if ( iPreparing )
+	    {
+		iObserver->RoamingHandlerPrepared();
+		iObserver = NULL;
+		iPreparing = EFalse;
+		iPrepared = ETrue;
+	    }
+    }
+
+
+
+// ---------------------------------------------------------------------------
+// CIAUpdateRoamingHandler::PrepareL
+// 
+// ---------------------------------------------------------------------------
+//
+void CIAUpdateRoamingHandler::PrepareL( MIAUpdateRoamingHandlerObserver& aObserver ) 
+    {
+    iObserver = &aObserver;
+    iPreparing = ETrue; 
+    iNwReg->StartMonitoringL();
+    }
+
+// ---------------------------------------------------------------------------
+// CIAUpdateRoamingHandler::CancelPreparing
+// 
+// ---------------------------------------------------------------------------
+//
+void CIAUpdateRoamingHandler::CancelPreparing()
+    {
+	iNwReg->Cancel();
+    }
+
+
+// ---------------------------------------------------------------------------
+// CIAUpdateRoamingHandler::Prepared()
+// 
+// ---------------------------------------------------------------------------
+//
+TBool CIAUpdateRoamingHandler::Prepared() const
+    {
+    return iPrepared;	
+    }
+
+
+// ---------------------------------------------------------------------------
+// CIAUpdateRoamingHandler::IsRoaming()
+// 
+// ---------------------------------------------------------------------------
+//
+TBool CIAUpdateRoamingHandler::IsRoaming()
+    {
+	return iRoaming;
+    }
+    
+// ---------------------------------------------------------------------------
+// CIAUpdateRoamingHandler::RoamingRejectionL()
+// 
+// ---------------------------------------------------------------------------
+//    
+TBool CIAUpdateRoamingHandler::RoamingRejectionL()
+    {
+  	TBool rejected = EFalse;
+  	if ( ( iRoaming )  && ( !iRoamingConnectionAccepted ) )
+  	    {
+  		CRepository* cenrep = CRepository::NewLC( KCRUidIAUpdateSettings );
+    
+        TInt num = KErrNotFound;
+        User::LeaveIfError( cenrep->Get( KIAUpdateRoamingWarning, num ) );
+        
+        CleanupStack::PopAndDestroy( cenrep );
+        if ( num == EIAUpdateSettingValueOn ) 
+            {
+        	TInt ret = IAUpdateDialogUtil::ShowConfirmationQueryL( 
+   	                                          R_IAUPDATE_CONNECT_TO_SERVER, 
+	                                          R_AVKON_SOFTKEYS_YES_NO );
+	        if ( ret == EAknSoftkeyYes )
+	            {
+	        	iRoamingConnectionAccepted = ETrue;
+	            }
+	        else
+	            {
+	            rejected = ETrue;
+	            }
+	        }   
+  	    }
+	return rejected;
+    }
+
+    
+// End of File