878 TUint CNSmlDSSettings::ViewColUint( const TDesC& aFieldName ) |
881 TUint CNSmlDSSettings::ViewColUint( const TDesC& aFieldName ) |
879 { |
882 { |
880 return iView.ColUint( iColSet->ColNo( aFieldName ) ); |
883 return iView.ColUint( iColSet->ColNo( aFieldName ) ); |
881 } |
884 } |
882 |
885 |
|
886 //----------------------------------------------------------------------------- |
|
887 // CNSmlDSSettings::IsOperatorProfileL |
|
888 // Is current profile Operator specific profile. |
|
889 //----------------------------------------------------------------------------- |
|
890 // |
|
891 EXPORT_C TBool CNSmlDSSettings::IsOperatorProfileL( const TDesC& aServerId ) |
|
892 { |
|
893 if( aServerId.Length() != 0 ) |
|
894 { |
|
895 TBuf8<KUrlLength> value; |
|
896 TBuf<KUrlLength> valueUtf16; |
|
897 |
|
898 CRepository* rep = NULL; |
|
899 |
|
900 // don't leave in case of missing or corrupted cenrep. |
|
901 TRAPD( err, rep = CRepository::NewL( |
|
902 KCRUidOperatorDatasyncInternalKeys ) ); |
|
903 |
|
904 if ( err == KErrNone ) |
|
905 { |
|
906 rep->Get( KNsmlOpDsOperatorSyncServerId, value ); |
|
907 delete rep; |
|
908 valueUtf16.Copy( value ); |
|
909 if ( aServerId.Compare( valueUtf16 ) == 0 ) |
|
910 { |
|
911 return ETrue; |
|
912 } |
|
913 } |
|
914 } |
|
915 return EFalse; |
|
916 } |
|
917 |
|
918 //----------------------------------------------------------------------------- |
|
919 // CNSmlDSSettings::OperatorProfileSWVValueLC |
|
920 // SW version of Operator specific profile. |
|
921 //----------------------------------------------------------------------------- |
|
922 // |
|
923 EXPORT_C HBufC8* CNSmlDSSettings::OperatorProfileSWVValueLC() |
|
924 { |
|
925 const TInt KSwvLength = 30; |
|
926 HBufC8* buf = HBufC8::NewLC( KSwvLength ); |
|
927 TPtr8 ptr = buf->Des(); |
|
928 CRepository* rep = NULL; |
|
929 TRAPD( err, rep = CRepository::NewL( |
|
930 KCRUidOperatorDatasyncInternalKeys ) ); |
|
931 // in case of missing or corrupted cenrep don't leave, just |
|
932 // return 0-length desc |
|
933 if( err == KErrNone ) |
|
934 { |
|
935 CleanupStack::PushL( rep ); |
|
936 TInt actualLength; |
|
937 err = rep->Get( KNsmlOpDsDevInfoSwVValue, ptr, actualLength ); |
|
938 if( err == KErrOverflow ) |
|
939 { |
|
940 CleanupStack::Pop( buf ); |
|
941 buf = buf->ReAllocL( actualLength ); |
|
942 CleanupStack::PushL( buf ); |
|
943 ptr.Set( buf->Des() ); |
|
944 // ignore return error |
|
945 rep->Get( KNsmlOpDsDevInfoSwVValue, ptr ); |
|
946 } |
|
947 CleanupStack::PopAndDestroy( rep ); |
|
948 } |
|
949 return buf; |
|
950 } |
|
951 |
|
952 //----------------------------------------------------------------------------- |
|
953 // CNSmlDSSettings:::OperatorProfileModValueLC |
|
954 // Mod value of Operator specific profile. |
|
955 //----------------------------------------------------------------------------- |
|
956 // |
|
957 EXPORT_C HBufC8* CNSmlDSSettings::OperatorProfileModValueLC() |
|
958 { |
|
959 const TInt KModelLength = 20; |
|
960 HBufC8* buf = HBufC8::NewLC( KModelLength ); |
|
961 TPtr8 ptr = buf->Des(); |
|
962 CRepository* rep = NULL; |
|
963 TRAPD( err, rep = CRepository::NewL( |
|
964 KCRUidOperatorDatasyncInternalKeys ) ); |
|
965 // in case of missing or corrupted cenrep don't leave, just |
|
966 // return 0-length desc |
|
967 if( err == KErrNone ) |
|
968 { |
|
969 CleanupStack::PushL( rep ); |
|
970 TInt actualLength; |
|
971 err = rep->Get( KNsmlOpDsDevInfoModValue, ptr, actualLength ); |
|
972 if( err == KErrOverflow ) |
|
973 { |
|
974 CleanupStack::Pop( buf ); |
|
975 buf = buf->ReAllocL( actualLength ); |
|
976 CleanupStack::PushL( buf ); |
|
977 ptr.Set( buf->Des() ); |
|
978 // ignore return error |
|
979 rep->Get( KNsmlOpDsDevInfoModValue, ptr ); |
|
980 } |
|
981 CleanupStack::PopAndDestroy( rep ); |
|
982 } |
|
983 return buf; |
|
984 } |
|
985 |
|
986 //----------------------------------------------------------------------------- |
|
987 // CNSmlDSSettings::StoreSyncType |
|
988 // Checks if received Alert Code is a sync type and tries to convert |
|
989 // it to Sync Type (TSmlSyncType). |
|
990 //----------------------------------------------------------------------------- |
|
991 // |
|
992 EXPORT_C void CNSmlDSSettings::StoreSyncType( const TDes8& aAlertCode ) |
|
993 { |
|
994 TInt syncType = KErrNotFound; |
|
995 |
|
996 if ( aAlertCode == KNSmlDSTwoWay ) |
|
997 { |
|
998 syncType = ESmlTwoWay; |
|
999 } |
|
1000 else if ( aAlertCode == KNSmlDSOneWayFromServer ) |
|
1001 { |
|
1002 syncType = ESmlOneWayFromServer; |
|
1003 } |
|
1004 else if ( aAlertCode == KNSmlDSOneWayFromClient ) |
|
1005 { |
|
1006 syncType = ESmlOneWayFromClient; |
|
1007 } |
|
1008 else if ( aAlertCode == KNSmlDSSlowSync ) |
|
1009 { |
|
1010 syncType = ESmlSlowSync; |
|
1011 } |
|
1012 else if ( aAlertCode == KNSmlDSRefreshFromServer ) |
|
1013 { |
|
1014 syncType = ESmlRefreshFromServer; |
|
1015 } |
|
1016 else if ( aAlertCode == KNSmlDSRefreshFromClient ) |
|
1017 { |
|
1018 syncType = ESmlRefreshFromClient; |
|
1019 } |
|
1020 |
|
1021 if ( syncType != KErrNotFound ) |
|
1022 { |
|
1023 CRepository* rep = NULL; |
|
1024 TRAPD ( err, rep = CRepository::NewL( KCRUidOperatorDatasyncErrorKeys ) ); |
|
1025 if ( err == KErrNone ) |
|
1026 { |
|
1027 rep->Set( KNsmlOpDsSyncType, syncType ); |
|
1028 delete rep; |
|
1029 } |
|
1030 } |
|
1031 } |
883 |
1032 |
884 // End of File |
1033 // End of File |