--- a/omadrm/drmhelper/src/drmhelper.cpp Fri Apr 16 15:14:55 2010 +0300
+++ b/omadrm/drmhelper/src/drmhelper.cpp Mon May 03 12:46:34 2010 +0300
@@ -25,7 +25,6 @@
#include "DcfCommon.h"
#include "DRMHelperDownloadManager.h"
-#include <sacls.h>
#include <Drmhelper.rsg>
#include <AknQueryDialog.h>
#include <DRMCommon.h>
@@ -60,7 +59,7 @@
#include <utf.h>
-#include <SchemeHandler.h> // for handling URLs
+#include <schemehandler.h> // for handling URLs
#include "DRMHelperServer.h"
#include "ConsumeData.h"
#include "DRMTypes.h"
@@ -83,25 +82,15 @@
#include "DRMRIContext.h"
#include "DRMDomainContext.h"
-#include <cmconnectionmethod.h>
-#include <cmdestination.h>
-#include <cmconnectionmethoddef.h>
-#include <cmmanager.h>
-
// publish & subrscibe
#include <e32property.h>
#include <PSVariables.h>
-#ifdef __SERIES60_NATIVE_BROWSER
-#include <BrowserUiSDKCRKeys.h>
-#endif
-
-#ifndef __SERIES60_NATIVE_BROWSER
-const TUid KCRUidBrowser = {0x10008D39};
-const TUint32 KBrowserDefaultAccessPoint = 0x0000000E;
-const TUint32 KBrowserAccessPointSelectionMode = 0x0000001E;
-#endif
-
+
+//connectivity logic
+#include <cmconnectionmethod.h> // RCmConnectionMethod
+#include <cmdestination.h> // RCmDestination
+#include <cmmanager.h> // RCmManager
// EXTERNAL DATA STRUCTURES
@@ -169,32 +158,65 @@
};
// ============================= LOCAL FUNCTIONS ===============================
-
-// -----------------------------------------------------------------------------
-// IapIdOfDefaultSnapL
-// for trapping purposes only
+// -----------------------------------------------------------------------------
+// HasDefaultConnectionL
+// Finds default IAP id
+// @return Etrue: valid AP found
+// EFalse: valid AP not found
+// @leave system wide error codes
// -----------------------------------------------------------------------------
//
-LOCAL_C TUint32 IapIdOfDefaultSnapL(
- RCmManager& aCmManager,
- const TUint32 aDefaultSnap )
- {
- RCmDestination dest( aCmManager.DestinationL( aDefaultSnap ) );
- CleanupClosePushL( dest );
- TUint32 iapIdOfDest( 0 );
-
- if ( dest.ConnectionMethodCount() <= 0 )
- {
- User::Leave( KErrNotFound );
- }
-
- RCmConnectionMethod cMeth( dest.ConnectionMethodL( 0 ) );
- CleanupClosePushL( cMeth );
-
- iapIdOfDest = cMeth.GetIntAttributeL( CMManager::ECmIapId );
- CleanupStack::PopAndDestroy( &cMeth );
- CleanupStack::PopAndDestroy( &dest );
- return iapIdOfDest;
+LOCAL_C TBool HasDefaultConnectionL()
+ {
+ TBool hasDefault(EFalse);
+ TCmDefConnValue defConn;
+ RCmManager cmManager;
+ cmManager.OpenLC();
+ cmManager.ReadDefConnL(defConn);
+ if (defConn.iType == ECmDefConnConnectionMethod)
+ {
+ cmManager.GetConnectionMethodInfoIntL(defConn.iId,
+ CMManager::ECmIapId);
+ hasDefault = ETrue;
+ }
+ else if (defConn.iType == ECmDefConnDestination)
+ {
+ RCmDestination dest(cmManager.DestinationL(defConn.iId));
+ CleanupClosePushL(dest);
+
+ if (dest.ConnectionMethodCount() <= 0)
+ {
+ User::Leave(KErrNotFound);
+ }
+
+ RCmConnectionMethod cMeth(dest.ConnectionMethodL(0));
+ CleanupClosePushL(cMeth);
+
+ cMeth.GetIntAttributeL(CMManager::ECmIapId);
+ CleanupStack::PopAndDestroy(&cMeth);
+ CleanupStack::PopAndDestroy(&dest);
+ hasDefault = ETrue;
+ }
+ CleanupStack::PopAndDestroy(&cmManager);
+ return hasDefault;
+ }
+
+// -----------------------------------------------------------------------------
+// HasAccessPointsL
+// -----------------------------------------------------------------------------
+//
+LOCAL_C TBool HasAccessPointsL()
+ {
+ TInt apCount(0);
+ RCmManager cmManager;
+ CleanupClosePushL(cmManager);
+ cmManager.OpenL();
+ RArray<TUint32> aps;
+ CleanupClosePushL(aps);
+ cmManager.ConnectionMethodL(aps, EFalse, EFalse, ETrue);
+ apCount = aps.Count();
+ CleanupStack::PopAndDestroy(2, &cmManager); //aps, cmManager
+ return apCount > 0;
}
// -----------------------------------------------------------------------------
@@ -2339,13 +2361,7 @@
if ( buttonCode == EAknSoftkeyYes )
{
// check if there are any APs defined
- RCmManager cmManager;
- cmManager.OpenLC();
- RArray<TUint32> aps;
- CleanupClosePushL( aps );
- cmManager.ConnectionMethodL( aps, EFalse, EFalse, ETrue );
- TUint32 APs( aps.Count() );
- CleanupStack::PopAndDestroy( 2, &cmManager ); //aps, cmManager
+ TBool APs( HasAccessPointsL() );
if ( !APs )
{
// No AP defined
@@ -2430,43 +2446,17 @@
}
+// -----------------------------------------------------------------------------
+// CDRMHelper::CheckRightsPercentL
+// Note: obsolete function name kept only
+// to avoid SC break on Helper selection logic
+// -----------------------------------------------------------------------------
+//
TBool CDRMHelper::BrowserAPDefinedL()
{
- const TInt KDestinationSelectionMode( 2 );
- TInt err( KErrNone );
- TInt ap( 0 );
- TInt alwaysAsk( 0 );
- TInt defaultSnap( 0 );
-
- CRepository* repository( CRepository::NewL( KCRUidBrowser ) );
- repository->Get( KBrowserDefaultAccessPoint, ap );
- repository->Get( KBrowserAccessPointSelectionMode, alwaysAsk );
- repository->Get( KBrowserNGDefaultSnapId, defaultSnap );
- delete repository;
- if ( ap <= KErrNotFound && defaultSnap <= KErrNotFound )
- {
- alwaysAsk = ETrue;
- }
- else
- {
- RCmManager cmManager;
- cmManager.OpenLC();
- if ( !alwaysAsk )
- {
- TRAP( err, cmManager.GetConnectionMethodInfoIntL(
- ap, CMManager::ECmIapId ) );
- }
- else if ( alwaysAsk == KDestinationSelectionMode )
- {
- TRAP( err, IapIdOfDefaultSnapL( cmManager, defaultSnap ) );
- }
- CleanupStack::PopAndDestroy( &cmManager );
- if ( !err && ( !alwaysAsk || alwaysAsk == KDestinationSelectionMode ) )
- {
- return ETrue;
- }
- }
- return EFalse;
+ TBool apFound( EFalse );
+ TRAP_IGNORE( apFound = HasDefaultConnectionL() );
+ return apFound;
}