--- a/syncmlfw/ds/settings/src/NSmlDSSettings.cpp Tue Aug 31 16:04:06 2010 +0300
+++ b/syncmlfw/ds/settings/src/NSmlDSSettings.cpp Wed Sep 01 12:27:42 2010 +0100
@@ -26,13 +26,14 @@
#include "bautils.h"
#include "nsmlroam.h"
//XML profiles
-#include "xml/RXMLReader.h"
+#include "rxmlreader.h"
#include "NSmlProfileContentHandler.h"
+#include "nsmldsagconstants.h"
#include <centralrepository.h> //CRepository
+#include <NsmlOperatorDataCRKeys.h> // KCRUidOperatorDatasyncInternalKeys
-//CONSTANTS
_LIT(Kinfile,"z:\\Private\\101F99FB\\VariantData.xml");
-
+const TInt KUrlLength = 256;
//=============================================
//
@@ -120,7 +121,7 @@
// Destructor.
//=============================================
-EXPORT_C CNSmlDSSettings::~CNSmlDSSettings()
+CNSmlDSSettings::~CNSmlDSSettings()
{
if(iResourceProfileArray)
{
@@ -881,5 +882,104 @@
return iView.ColUint( iColSet->ColNo( aFieldName ) );
}
+//-----------------------------------------------------------------------------
+// CNSmlDSSettings::IsOperatorProfileL
+// Is current profile Operator specific profile.
+//-----------------------------------------------------------------------------
+//
+EXPORT_C TBool CNSmlDSSettings::IsOperatorProfileL( const TDesC& aServerId )
+ {
+ if( aServerId.Length() != 0 )
+ {
+ TBuf8<KUrlLength> value;
+ TBuf<KUrlLength> valueUtf16;
+
+ CRepository* rep = NULL;
+
+ // don't leave in case of missing or corrupted cenrep.
+ TRAPD( err, rep = CRepository::NewL(
+ KCRUidOperatorDatasyncInternalKeys ) );
+ if ( err == KErrNone )
+ {
+ rep->Get( KNsmlOpDsOperatorSyncServerId, value );
+ delete rep;
+ valueUtf16.Copy( value );
+ if ( aServerId.Compare( valueUtf16 ) == 0 )
+ {
+ return ETrue;
+ }
+ }
+ }
+ return EFalse;
+ }
+
+//-----------------------------------------------------------------------------
+// CNSmlDSSettings::OperatorProfileSWVValueLC
+// SW version of Operator specific profile.
+//-----------------------------------------------------------------------------
+//
+EXPORT_C HBufC8* CNSmlDSSettings::OperatorProfileSWVValueLC()
+ {
+ const TInt KSwvLength = 30;
+ HBufC8* buf = HBufC8::NewLC( KSwvLength );
+ TPtr8 ptr = buf->Des();
+ CRepository* rep = NULL;
+ TRAPD( err, rep = CRepository::NewL(
+ KCRUidOperatorDatasyncInternalKeys ) );
+ // in case of missing or corrupted cenrep don't leave, just
+ // return 0-length desc
+ if( err == KErrNone )
+ {
+ CleanupStack::PushL( rep );
+ TInt actualLength;
+ err = rep->Get( KNsmlOpDsDevInfoSwVValue, ptr, actualLength );
+ if( err == KErrOverflow )
+ {
+ CleanupStack::Pop( buf );
+ buf = buf->ReAllocL( actualLength );
+ CleanupStack::PushL( buf );
+ ptr.Set( buf->Des() );
+ // ignore return error
+ rep->Get( KNsmlOpDsDevInfoSwVValue, ptr );
+ }
+ CleanupStack::PopAndDestroy( rep );
+ }
+ return buf;
+ }
+
+//-----------------------------------------------------------------------------
+// CNSmlDSSettings:::OperatorProfileModValueLC
+// Mod value of Operator specific profile.
+//-----------------------------------------------------------------------------
+//
+EXPORT_C HBufC8* CNSmlDSSettings::OperatorProfileModValueLC()
+ {
+ const TInt KModelLength = 20;
+ HBufC8* buf = HBufC8::NewLC( KModelLength );
+ TPtr8 ptr = buf->Des();
+ CRepository* rep = NULL;
+ TRAPD( err, rep = CRepository::NewL(
+ KCRUidOperatorDatasyncInternalKeys ) );
+ // in case of missing or corrupted cenrep don't leave, just
+ // return 0-length desc
+ if( err == KErrNone )
+ {
+ CleanupStack::PushL( rep );
+ TInt actualLength;
+ err = rep->Get( KNsmlOpDsDevInfoModValue, ptr, actualLength );
+ if( err == KErrOverflow )
+ {
+ CleanupStack::Pop( buf );
+ buf = buf->ReAllocL( actualLength );
+ CleanupStack::PushL( buf );
+ ptr.Set( buf->Des() );
+ // ignore return error
+ rep->Get( KNsmlOpDsDevInfoModValue, ptr );
+ }
+ CleanupStack::PopAndDestroy( rep );
+ }
+ return buf;
+ }
+
// End of File