profilesservices/ProfileEngine/EngSrc/CProfileImpl.cpp
branchRCL_3
changeset 54 7e0eff37aedb
parent 53 8ee96d21d9bf
--- a/profilesservices/ProfileEngine/EngSrc/CProfileImpl.cpp	Tue Aug 31 15:29:50 2010 +0300
+++ b/profilesservices/ProfileEngine/EngSrc/CProfileImpl.cpp	Wed Sep 01 12:20:44 2010 +0100
@@ -19,28 +19,28 @@
 
 // INCLUDE FILES
 #include "CProfileImpl.h"
-#include "CProfileNameImpl.h"
-#include "CProfileTonesImpl.h"
-#include "CProfileExtraTonesImpl.h"
-#include "CProfileExtraSettingsImpl.h"
-#include "CProfilePresenceImpl.h"
-#include "ProfileEngUtils.h"
-#include "ProfileEnginePrivateCRKeys.h"
 #include <e32svr.h>
 #include <cntitem.h>
+#include <CPbkContactEngine.h>
 #include <cntdb.h>
 #include <cntdef.h>
 #include <TProfileToneSettings.h>
 #include <MProfilePttSettings.h>
 #include <featmgr.h>
 #include <bldvariant.hrh>
-#include <rsssettings.h>
+#include <RSSSettings.h>
 #include <pathinfo.h>
+#include "CProfileNameImpl.h"
+#include "CProfileTonesImpl.h"
+#include "CProfileExtraTonesImpl.h"
+#include "CProfileExtraSettingsImpl.h"
+#include "CProfilePresenceImpl.h"
 #include <MProfilesLocalFeatures.h>
 #include <MProfileUtilitySingleton.h>
-#include <ProfilesVariant.hrh>
+#include "ProfilesVariant.hrh"
+#include "ProfileEngUtils.h"
+#include "ProfileEnginePrivateCRKeys.h"
 #include <ProfileEngineDomainConstants.h>
-#include "CProfileVibraSettingsImpl.h"
 
 // CONSTANTS
 // Max. number of Alert for groups:
@@ -78,7 +78,6 @@
     // ProfileUtility must be released in destructor:
     iFeatures = &( ProfileUtilityInstanceL().ProfilesLocalFeatures() );
     iProfileExtraSettings = CProfileExtraSettingsImpl::NewL();
-    iProfileVibraSettings = CProfileVibraSettingsImpl::NewL();
     }
 
 // -----------------------------------------------------------------------------
@@ -87,7 +86,7 @@
 // -----------------------------------------------------------------------------
 //
 void CProfileImpl::ConstructL(
-    const MProfileExtended2& aProfile,
+    const MProfileExtended& aProfile,
     TInt aId )
     {
     iProfileName = CProfileNameImpl::NewLC( aId, KNullDesC );
@@ -95,7 +94,7 @@
     CommonConstructL();
     iProfileTones = CProfileTonesImpl::NewL( aProfile.ProfileTones() );
     iProfileExtraTones = CProfileExtraTonesImpl::NewL(
-        aProfile.ProfileExtraTones2() );
+        aProfile.ProfileExtraTones() );
 
     iFeatures = &( ProfileUtilityInstanceL().ProfilesLocalFeatures() );
 
@@ -104,9 +103,6 @@
         aProfile.ProfilePresence() );
     iVisibleFlags = aProfile.VisibleFlags();
     iModifiableFlags = aProfile.ModifiableFlags();
-    
-    iProfileVibraSettings = CProfileVibraSettingsImpl::NewL();
-    
     }
 
 // -----------------------------------------------------------------------------
@@ -146,7 +142,7 @@
 //
 CProfileImpl* CProfileImpl::NewLC(
     RFs& aFs,
-    const MProfileExtended2& aProfile,
+    const MProfileExtended& aProfile,
     TInt aId )
     {
     CProfileImpl* self = new( ELeave ) CProfileImpl( aFs );
@@ -174,8 +170,6 @@
     delete iProfileTones;
     delete iProfileExtraTones;
     delete iProfilePresence;
-    
-    delete iProfileVibraSettings;
     }
 
 // -----------------------------------------------------------------------------
@@ -222,7 +216,39 @@
 const TArray<TContactItemId> CProfileImpl::AlertForL()
     {
     TInt contactIdListCount( iAlertFor.Count() );
+    if( contactIdListCount > 0 )
+        {
+        // create CPbkContactEngine
+        CPbkContactEngine* contactEngine = CPbkContactEngine::NewL( &iFs );
+        CleanupStack::PushL( contactEngine );
+        CContactIdArray* groupIds = contactEngine->Database().GetGroupIdListL();
 
+        if( !groupIds )
+            { // There are no groups in Contacts db -> clear the alert for IDs:
+            iAlertFor.Reset();
+            }
+        else
+            {
+            CleanupStack::PushL( groupIds );
+            TInt err;
+            for( TInt i( 0 ) ; i < contactIdListCount ; ++i )
+                {
+                err = groupIds->Find( iAlertFor[i] );
+
+                if( err == KErrNotFound )
+                    {
+                    // remove this
+                    iAlertFor.Remove( i );
+                    --contactIdListCount;
+                    --i;
+                    err = KErrNone;
+                    }
+                User::LeaveIfError( err );
+                }
+            CleanupStack::PopAndDestroy();  // groupIds
+            }
+        CleanupStack::PopAndDestroy();  // contactEngine
+        }
 
     return iAlertFor.Array();
     }
@@ -235,16 +261,6 @@
 //
 TBool CProfileImpl::IsSilent() const
     {
-	//Since 10.1, firstly check maste silence mode
-	TInt silenceMode( 0 );
-	CRepository* cenrep = CRepository::NewLC( KCRUidProfileEngine  );
-    cenrep->Get( KProEngSilenceMode , silenceMode );
-    CleanupStack::PopAndDestroy( cenrep );
-    if ( silenceMode ) 
-    	{
-		return ETrue;
-    	}
-	
     TProfileRingingType ringType( iProfileTones->ToneSettings().iRingingType );
     if ( ringType == EProfileRingingTypeSilent )
         {
@@ -499,8 +515,6 @@
 
     iProfilePresence->InternalizeL( aCenRep, aProfileId );
     iProfileExtraSettings->InternalizeL( aCenRep, aProfileId );
-    
-    iProfileVibraSettings->InternalizeL( aCenRep, aProfileId );
     }
 
 void CProfileImpl::ExternalizeL( CRepository& aCenRep )
@@ -537,8 +551,6 @@
     iProfileExtraTones->ExternalizeL( aCenRep, profileId );
     iProfilePresence->ExternalizeL( aCenRep, profileId );
     iProfileExtraSettings->ExternalizeL( aCenRep, profileId );
-    
-    iProfileVibraSettings->ExternalizeL(  aCenRep, profileId );
     }
 
 // -----------------------------------------------------------------------------
@@ -586,49 +598,4 @@
     FeatureManager::UnInitializeLib();
     }
 
-
-// -----------------------------------------------------------------------------
-// CProfileImpl::ProfileExtraTones2
-//
-// (other items were commented in a header).
-// -----------------------------------------------------------------------------
-//
-const MProfileExtraTones2& CProfileImpl::ProfileExtraTones2() const 
-    {
-    return *iProfileExtraTones;
-    }
-
-// -----------------------------------------------------------------------------
-// CProfileImpl::ProfileSetExtraTones2
-//
-// (other items were commented in a header).
-// -----------------------------------------------------------------------------
-//
-MProfileSetExtraTones2& CProfileImpl::ProfileSetExtraTones2() 
-    {
-    return *iProfileExtraTones;
-    }
-
-// -----------------------------------------------------------------------------
-// CProfileImpl::ProfileVibraSettings
-//
-// (other items were commented in a header).
-// -----------------------------------------------------------------------------
-//
-const MProfileVibraSettings& CProfileImpl::ProfileVibraSettings() const
-    {
-    return  *iProfileVibraSettings;
-    }
-
-// -----------------------------------------------------------------------------
-// CProfileImpl::ProfileSetVibraSettings
-//
-// (other items were commented in a header).
-// -----------------------------------------------------------------------------
-//
-MProfileSetVibraSettings& CProfileImpl::ProfileSetVibraSettings()
-    {
-    return *iProfileVibraSettings;
-    }
-
 //  End of File