--- a/activityfw/storage/server/src/afstoragesynctask.cpp Fri Jul 23 14:03:00 2010 +0300
+++ b/activityfw/storage/server/src/afstoragesynctask.cpp Fri Aug 06 13:40:46 2010 +0300
@@ -41,6 +41,9 @@
case UpdateActivity:
UpdateActivityL(dataStorage, msg);
break;
+ case SaveActivity:
+ SaveActivityL(dataStorage, msg);
+ break;
case RemoveActivity:
DeleteActivityL(dataStorage, msg);
break;
@@ -51,7 +54,10 @@
//this code shouldn't be called. fatal error: means wrong session implementation
User::Panic(KUnsupportedStorageSyncTask, KErrGeneral);
};
- msg.Complete(KErrNone);
+ if(SaveActivity != msg.Function()) {
+ //function SaveActivityL complete message. DON'T DO THIS HERE
+ msg.Complete(KErrNone);
+ }
NotifyChangeL(observers, msg);
}
@@ -80,7 +86,6 @@
entry->SetImageSrcL(thumbnailPath);
dataStorage.AddActivityL(*entry);
CleanupStack::PopAndDestroy(&thumbnailPath);
-
CleanupStack::PopAndDestroy(entry);
}
@@ -102,7 +107,6 @@
DeleteActivityScreenshotL(dataStorage,
entry->ApplicationId(),
entry->ActivityId());
-
dataStorage.ThumbnailPathL(thumbnailPath,
dataStorage.Fs(),
entry->ApplicationId(),
@@ -117,6 +121,38 @@
// -----------------------------------------------------------------------------
/**
+ * Handle saving activiy
+ * @param dataStorage - data storage
+ * @param msg - request message
+ */
+void AfStorageSyncTask::SaveActivityL(CAfStorage& dataStorage, const RMessage2& msg)
+{
+ TPckgBuf<TInt> bitmapHdl(0);
+ CAfEntry *entry = CAfEntry::NewLC(msg);
+ msg.ReadL(1, bitmapHdl);
+
+ RBuf thumbnailPath;
+ CleanupClosePushL(thumbnailPath);
+ DeleteActivityScreenshotL(dataStorage,
+ entry->ApplicationId(),
+ entry->ActivityId());
+
+ dataStorage.ThumbnailPathL(thumbnailPath,
+ dataStorage.Fs(),
+ entry->ApplicationId(),
+ entry->ActivityId(),
+ entry->Flags() & CAfEntry::Persistent);
+ CreateThumbnailL(thumbnailPath, bitmapHdl());
+ //all data is retrieved. compleate message to improve response time
+ msg.Complete(KErrNone);
+ TRAP_IGNORE(entry->SetImageSrcL(thumbnailPath);
+ dataStorage.SaveActivityL(*entry);)
+ CleanupStack::PopAndDestroy(&thumbnailPath);
+ CleanupStack::PopAndDestroy(entry);
+}
+
+// -----------------------------------------------------------------------------
+/**
* Handle removing activity.
* @param dataStorage - data storage
* @param msg - request message