mtpdataproviders/mtpimagedp/src/cmtpimagedp.cpp
branchRCL_3
changeset 58 142dacf7b30e
parent 45 74aa6861c87d
--- a/mtpdataproviders/mtpimagedp/src/cmtpimagedp.cpp	Wed Sep 15 13:07:27 2010 +0300
+++ b/mtpdataproviders/mtpimagedp/src/cmtpimagedp.cpp	Wed Oct 13 15:29:02 2010 +0300
@@ -96,6 +96,8 @@
     {
     __FLOG_OPEN(KMTPSubsystem, KComponent);
     __FLOG(_L8(">> CMTPImageDataProvider::ConstructL"));
+    
+    iThumbnailManager = CMTPImageDpThumbnailCreator::NewL(*this);
     iNewPicNotifier = CMTPImageDpNewPicturesNotifier::NewL();
     
     //Setup central repository connection
@@ -118,10 +120,8 @@
         }     
     
     //Define RProperty of new pictures for status data provider
-	RProcess process;
-	TUid tSid = process.SecureId();
     _LIT_SECURITY_POLICY_PASS(KAllowReadAll);
-    TInt error = RProperty::Define(tSid, KMTPNewPicKey, RProperty::EInt, KAllowReadAll, KAllowReadAll);
+    TInt error = RProperty::Define(TUid::Uid(KMTPServerUID), KMTPNewPicKey, RProperty::EInt, KAllowReadAll, KAllowReadAll);
     if (error != KErrNone && error != KErrAlreadyExists)
         {
         __FLOG_1(_L8("CMTPImageDataProvider::ConstructL - RProperty define error:%d"), error);
@@ -165,7 +165,6 @@
     //Try to delete objects in array
     HandleDeleteObjectsArray();
     iDeleteObjectsArray.ResetAndDestroy();
-    iNewPicHandles.Reset();
     
     __FLOG(_L8("<< ~CMTPImageDataProvider"));
     __FLOG_CLOSE;
@@ -452,14 +451,11 @@
     __FLOG(_L8("<< NotifyStorageEnumerationCompleteL"));        
     }
 
-CMTPImageDpThumbnailCreator* CMTPImageDataProvider::ThumbnailManager()
-    {
-    if(NULL == iThumbnailManager)
-        {
-        TRAP_IGNORE(iThumbnailManager = CMTPImageDpThumbnailCreator::NewL(*this));
-        }
-    return iThumbnailManager;
-    }
+CMTPImageDpThumbnailCreator& CMTPImageDataProvider::ThumbnailManager() const
+	{
+    __ASSERT_DEBUG(iThumbnailManager, User::Invariant());
+	return *iThumbnailManager;
+	}
 
 CMTPImageDpObjectPropertyMgr& CMTPImageDataProvider::PropertyMgr()const
 	{
@@ -614,7 +610,8 @@
         /**
          * Get image object count from framework and calculate the new pictures
          */
-        TUint newPictures = QueryImageObjectCountL();        
+        TUint newPictures = QueryImageObjectCountL();
+        RProperty::Set(TUid::Uid(KMTPServerUID), KMTPNewPicKey, newPictures);
         iNewPicNotifier->SetNewPictures(newPictures);
         __FLOG_1(_L16("CMTPImageDpEnumerator::CompleteEnumeration - New Pics: %d"), newPictures);        
         iEnumerated = EFalse;
@@ -696,8 +693,6 @@
     CleanupClosePushL(context);
     CleanupClosePushL(handles);    
     
-    iNewPicHandles.Reset();
-    
     do
         {
         /*
@@ -717,7 +712,6 @@
         if (MTPImageDpUtilits::IsNewPicture(*objMetadata))
             {
             ++newPictures;
-            iNewPicHandles.Append(handles[i]);
             }
         }
     
@@ -771,32 +765,6 @@
     __FLOG(_L8("<< DecreaseNewPictures "));    
     }
 
-void CMTPImageDataProvider::ResetNewPictures()
-	{
-	__FLOG(_L8(">> ResetNewPictures "));
-
-	iNewPicNotifier->SetNewPictures(0);
-	
-	TInt count = iNewPicHandles.Count();
-	if (!count)
-		{
-		return;
-		}
-
-	CMTPObjectMetaData* objMetadata = CMTPObjectMetaData::NewLC();
-	
-	for (TInt i(0); i<count; ++i)
-	{
-		Framework().ObjectMgr().ObjectL(iNewPicHandles[i], *objMetadata);
-		MTPImageDpUtilits::UpdateObjectStatusToOldL(Framework(), *objMetadata);
-	}
-	
-	iNewPicHandles.Reset();
-	CleanupStack::PopAndDestroy(objMetadata);
-	
-	__FLOG(_L8("<< ResetNewPictures "));
-	}
-
 void CMTPImageDataProvider::HandleMdeSessionCompleteL(TInt aError)
     {
     __FLOG(_L8(">> HandleMdeSessionComplete"));