24 #include "NSmlDSResourceProfile.h" |
24 #include "NSmlDSResourceProfile.h" |
25 #include "barsc.h" |
25 #include "barsc.h" |
26 #include "bautils.h" |
26 #include "bautils.h" |
27 #include "nsmlroam.h" |
27 #include "nsmlroam.h" |
28 //XML profiles |
28 //XML profiles |
29 #include "xml/RXMLReader.h" |
29 #include "rxmlreader.h" |
30 #include "NSmlProfileContentHandler.h" |
30 #include "NSmlProfileContentHandler.h" |
|
31 #include "nsmldsagconstants.h" |
31 #include <centralrepository.h> //CRepository |
32 #include <centralrepository.h> //CRepository |
32 |
33 #include <NsmlOperatorDataCRKeys.h> // KCRUidOperatorDatasyncInternalKeys |
33 //CONSTANTS |
34 |
34 _LIT(Kinfile,"z:\\Private\\101F99FB\\VariantData.xml"); |
35 _LIT(Kinfile,"z:\\Private\\101F99FB\\VariantData.xml"); |
35 |
36 const TInt KUrlLength = 256; |
36 |
37 |
37 //============================================= |
38 //============================================= |
38 // |
39 // |
39 // CNSmlDSSettings |
40 // CNSmlDSSettings |
40 // |
41 // |
879 TUint CNSmlDSSettings::ViewColUint( const TDesC& aFieldName ) |
880 TUint CNSmlDSSettings::ViewColUint( const TDesC& aFieldName ) |
880 { |
881 { |
881 return iView.ColUint( iColSet->ColNo( aFieldName ) ); |
882 return iView.ColUint( iColSet->ColNo( aFieldName ) ); |
882 } |
883 } |
883 |
884 |
884 |
885 //----------------------------------------------------------------------------- |
|
886 // CNSmlDSSettings::IsOperatorProfileL |
|
887 // Is current profile Operator specific profile. |
|
888 //----------------------------------------------------------------------------- |
|
889 // |
|
890 EXPORT_C TBool CNSmlDSSettings::IsOperatorProfileL( const TDesC& aServerId ) |
|
891 { |
|
892 if( aServerId.Length() != 0 ) |
|
893 { |
|
894 TBuf8<KUrlLength> value; |
|
895 TBuf<KUrlLength> valueUtf16; |
|
896 |
|
897 CRepository* rep = NULL; |
|
898 |
|
899 // don't leave in case of missing or corrupted cenrep. |
|
900 TRAPD( err, rep = CRepository::NewL( |
|
901 KCRUidOperatorDatasyncInternalKeys ) ); |
|
902 |
|
903 if ( err == KErrNone ) |
|
904 { |
|
905 rep->Get( KNsmlOpDsOperatorSyncServerId, value ); |
|
906 delete rep; |
|
907 valueUtf16.Copy( value ); |
|
908 if ( aServerId.Compare( valueUtf16 ) == 0 ) |
|
909 { |
|
910 return ETrue; |
|
911 } |
|
912 } |
|
913 } |
|
914 return EFalse; |
|
915 } |
|
916 |
|
917 //----------------------------------------------------------------------------- |
|
918 // CNSmlDSSettings::OperatorProfileSWVValueLC |
|
919 // SW version of Operator specific profile. |
|
920 //----------------------------------------------------------------------------- |
|
921 // |
|
922 EXPORT_C HBufC8* CNSmlDSSettings::OperatorProfileSWVValueLC() |
|
923 { |
|
924 const TInt KSwvLength = 30; |
|
925 HBufC8* buf = HBufC8::NewLC( KSwvLength ); |
|
926 TPtr8 ptr = buf->Des(); |
|
927 CRepository* rep = NULL; |
|
928 TRAPD( err, rep = CRepository::NewL( |
|
929 KCRUidOperatorDatasyncInternalKeys ) ); |
|
930 // in case of missing or corrupted cenrep don't leave, just |
|
931 // return 0-length desc |
|
932 if( err == KErrNone ) |
|
933 { |
|
934 CleanupStack::PushL( rep ); |
|
935 TInt actualLength; |
|
936 err = rep->Get( KNsmlOpDsDevInfoSwVValue, ptr, actualLength ); |
|
937 if( err == KErrOverflow ) |
|
938 { |
|
939 CleanupStack::Pop( buf ); |
|
940 buf = buf->ReAllocL( actualLength ); |
|
941 CleanupStack::PushL( buf ); |
|
942 ptr.Set( buf->Des() ); |
|
943 // ignore return error |
|
944 rep->Get( KNsmlOpDsDevInfoSwVValue, ptr ); |
|
945 } |
|
946 CleanupStack::PopAndDestroy( rep ); |
|
947 } |
|
948 return buf; |
|
949 } |
|
950 |
|
951 //----------------------------------------------------------------------------- |
|
952 // CNSmlDSSettings:::OperatorProfileModValueLC |
|
953 // Mod value of Operator specific profile. |
|
954 //----------------------------------------------------------------------------- |
|
955 // |
|
956 EXPORT_C HBufC8* CNSmlDSSettings::OperatorProfileModValueLC() |
|
957 { |
|
958 const TInt KModelLength = 20; |
|
959 HBufC8* buf = HBufC8::NewLC( KModelLength ); |
|
960 TPtr8 ptr = buf->Des(); |
|
961 CRepository* rep = NULL; |
|
962 TRAPD( err, rep = CRepository::NewL( |
|
963 KCRUidOperatorDatasyncInternalKeys ) ); |
|
964 // in case of missing or corrupted cenrep don't leave, just |
|
965 // return 0-length desc |
|
966 if( err == KErrNone ) |
|
967 { |
|
968 CleanupStack::PushL( rep ); |
|
969 TInt actualLength; |
|
970 err = rep->Get( KNsmlOpDsDevInfoModValue, ptr, actualLength ); |
|
971 if( err == KErrOverflow ) |
|
972 { |
|
973 CleanupStack::Pop( buf ); |
|
974 buf = buf->ReAllocL( actualLength ); |
|
975 CleanupStack::PushL( buf ); |
|
976 ptr.Set( buf->Des() ); |
|
977 // ignore return error |
|
978 rep->Get( KNsmlOpDsDevInfoModValue, ptr ); |
|
979 } |
|
980 CleanupStack::PopAndDestroy( rep ); |
|
981 } |
|
982 return buf; |
|
983 } |
|
984 |
885 // End of File |
985 // End of File |