engine/src/FeedEngine.cpp
branchsymbian1
changeset 189 d1539f926e3e
parent 167 4bfc2fcec5f6
child 219 3aa0b93477b5
child 239 7ded71db88f6
--- a/engine/src/FeedEngine.cpp	Thu Jul 15 22:07:33 2010 +0100
+++ b/engine/src/FeedEngine.cpp	Mon Jul 19 16:28:42 2010 +0100
@@ -27,9 +27,13 @@
 #include "PodcastUtils.h"
 #include <utf.h>
 #include "Podcatcher.pan"
+#include <centralrepository.h>
+#include <ProfileEngineSDKCRKeys.h>
+
 
 _LIT(KFeedParseStorePath, "feeds\\");
 
+
 CFeedEngine* CFeedEngine::NewL(CPodcastModel& aPodcastModel)
 	{
 	CFeedEngine* self = new (ELeave) CFeedEngine(aPodcastModel);
@@ -80,6 +84,10 @@
     	TRAP_IGNORE(ImportFeedsL(importFile));
 		}
     
+    
+    // offline profile support
+    iRepository = CRepository::NewL( KCRUidProfileEngine );
+    
 	RunFeedTimer();
 	}
 
@@ -102,6 +110,8 @@
 	delete iParser;
 	delete iFeedClient;
 	delete iOpmlParser;
+	//
+	delete iRepository;
 	}
 
 /**
@@ -148,9 +158,22 @@
 		{
 		User::Leave(KErrInUse);
 		}
-
+	// check for offline profile, done by polling here, perhpas CenRep notifier woudl be better
+	TInt currentProfileId = 0; // general profile
+	TBool isOfflineProfile = EFalse;
+	// Get ID of current profile
+	if(KErrNone == iRepository->Get( KProEngActiveProfile, currentProfileId ) ) // better to assume online then leave if CRep fails
+		{
+		// Check value to determine the active profile if no error
+		if ( 5 == currentProfileId)
+			{
+			// current profile is the offline profile
+			isOfflineProfile = ETrue;
+			}
+	    }
+	//
 	iAutoUpdatedInitiator = aAutoUpdate;
-	if (iFeedsUpdating.Count() > 0)
+	if ((iFeedsUpdating.Count() > 0) || (isOfflineProfile)) // cancel update if in offline mode
 		{
 		DP("Cancelling update");
 		iFeedClient->Stop();