diff -r ad0f53516d84 -r b922b9936679 omads/omadsappui/AspSyncUtil/src/AspProfile.cpp --- a/omads/omadsappui/AspSyncUtil/src/AspProfile.cpp Fri Feb 19 22:40:37 2010 +0200 +++ b/omads/omadsappui/AspSyncUtil/src/AspProfile.cpp Fri Mar 12 15:41:30 2010 +0200 @@ -21,6 +21,9 @@ #include #include // FeatureManager +#include // CRepository +#include // KCRUidOperatorDatasyncInternalKeys + #include #include #include @@ -407,6 +410,10 @@ Session().ListDataProvidersL(arr); CleanupClosePushL(arr); + TBool operatorProfile = CAspProfile::IsOperatorProfileL(iProfile); + TInt operatorUid = CAspProfile::OperatorAdapterUidL(); + TInt profileUid = CAspProfile::ProfileAdapterUidL(); + TInt count = arr.Count(); for (TInt i=0; iOpenL(id, CAspProfile::EOpenRead, CAspProfile::EAllProperties); } + + // Hidden operator specific profile should not be visible + if (profile->IsHiddenOperatorProfileL()) + { + CleanupStack::PopAndDestroy(profile); + continue; + } TAspProfileItem item; item.Init(); if (iApplicationId != EApplicationIdSync) { - TInt dataProviderId = TUtil::ProviderIdFromAppId(iApplicationId); + TInt dataProviderId = TUtil::ProviderIdFromAppId(iApplicationId, CAspProfile::IsOperatorProfileL(profile)); TInt taskId = TAspTask::FindTaskIdL(profile, dataProviderId, KNullDesC); item.iTaskId = taskId; // needed for syncing only one content } @@ -2567,7 +2601,13 @@ { return ETrue; } - + + // Operator specific serverID is not considered as unique + if (CAspProfile::EqualsToOperatorServerId(aServerId)) + { + return EFalse; + } + TBool serverIdFound = EFalse; TInt count = iList.Count(); @@ -2916,9 +2956,20 @@ // ----------------------------------------------------------------------------- // TBool CAspProfile::DeleteAllowed() - { - return iProfile.DeleteAllowed(); - } + { + TBool operatorProfile = EFalse; + TRAPD( err, operatorProfile = IsReadOnlyOperatorProfileL() ); + + // Disallow deletion of operator specific profile + if( err == KErrNone && operatorProfile ) + { + return EFalse; + } + else + { + return iProfile.DeleteAllowed(); + } + } // ----------------------------------------------------------------------------- @@ -4123,7 +4174,133 @@ } } - +//----------------------------------------------------------------------------- +// CAspProfile:::IsOperatorProfileL +// +//----------------------------------------------------------------------------- +// +TBool CAspProfile::IsOperatorProfileL( CAspProfile* aProfile ) + { + if ( !aProfile ) + { + return EFalse; + } + + TBuf serverId; + TBuf8 serverIdUtf8; + TBuf8 value; + + aProfile->GetServerId( serverId ); + if ( serverId.Length() > 0 ) + { + serverIdUtf8.Copy( serverId ); + + CRepository* rep = CRepository::NewLC( KCRUidOperatorDatasyncInternalKeys ); + TInt err = rep->Get( KNsmlOpDsOperatorSyncServerId, value ); + CleanupStack::PopAndDestroy( rep ); + + if ( !err && serverIdUtf8.Compare( value ) == 0 ) + { + return ETrue; + } + } + return EFalse; + } + +//----------------------------------------------------------------------------- +// CAspProfile:::OperatorAdapterUidL +// +//----------------------------------------------------------------------------- +// +TInt CAspProfile::OperatorAdapterUidL() + { + TInt value = 0; + CRepository* rep = CRepository::NewLC( KCRUidOperatorDatasyncInternalKeys ); + rep->Get( KNsmlOpDsOperatorAdapterUid, value ); + CleanupStack::PopAndDestroy( rep ); + return value; + } + +//----------------------------------------------------------------------------- +// CAspProfile:::ProfileAdapterUidL +// +//----------------------------------------------------------------------------- +// +TInt CAspProfile::ProfileAdapterUidL() + { + TInt value = 0; + CRepository* rep = CRepository::NewLC( KCRUidOperatorDatasyncInternalKeys ); + rep->Get( KNsmlOpDsProfileAdapterUid, value ); + CleanupStack::PopAndDestroy( rep ); + return value; + } + +//----------------------------------------------------------------------------- +// CAspProfile:::ProfileVisibilityL +// +//----------------------------------------------------------------------------- +// +TInt CAspProfile::ProfileVisibilityL() + { + TInt value = 0; + CRepository* rep = CRepository::NewLC( KCRUidOperatorDatasyncInternalKeys ); + rep->Get( KNsmlOpDsSyncProfileVisibility, value ); + CleanupStack::PopAndDestroy( rep ); + return value; + } + +//----------------------------------------------------------------------------- +// CAspProfile:::IsReadOnlyOperatorProfileL +// +//----------------------------------------------------------------------------- +// +TBool CAspProfile::IsReadOnlyOperatorProfileL() + { + return ( IsOperatorProfileL( this ) && + ProfileVisibilityL() == EProfileVisibilityReadOnly ); + } + +//----------------------------------------------------------------------------- +// CAspProfile:::IsHiddenOperatorProfileL +// +//----------------------------------------------------------------------------- +// +TBool CAspProfile::IsHiddenOperatorProfileL() + { + return ( IsOperatorProfileL( this ) && + ProfileVisibilityL() == EProfileVisibilityHidden ); + } + +//----------------------------------------------------------------------------- +// CAspProfile:::EqualsToOperatorServerIdL +// +//----------------------------------------------------------------------------- +// +TBool CAspProfile::EqualsToOperatorServerId( const TDesC& aServerId ) + { + if ( aServerId.Length() > 0 ) + { + TBuf8 serverIdUtf8; + TBuf8 value; + serverIdUtf8.Copy( aServerId ); + + // Read operator specific serverId from cenrep + CRepository* rep = NULL; + TRAPD( err, rep = CRepository::NewL( KCRUidOperatorDatasyncInternalKeys ) ); + if( err == KErrNone ) + { + rep->Get( KNsmlOpDsOperatorSyncServerId, value ); + delete rep; + + if ( serverIdUtf8.Compare( value ) == 0 ) + { + return ETrue; + } + } + } + + return EFalse; + } /******************************************************************************* * class TAspTask