pimappservices/calendar/server/src/agsentrymodel.cpp
branchRCL_3
changeset 30 d68a4b5d5885
parent 13 0f07cd1b5772
child 86 ed599363c2d7
--- a/pimappservices/calendar/server/src/agsentrymodel.cpp	Tue May 11 16:12:24 2010 +0300
+++ b/pimappservices/calendar/server/src/agsentrymodel.cpp	Tue May 25 12:41:10 2010 +0300
@@ -85,6 +85,10 @@
 		iAttachmentIndex = new (ELeave) CAgnAttachmentIndex;
 		CreateAlarmForServerL();
 		}
+	
+	User::LeaveIfError(iFs.Connect());
+    User::LeaveIfError( iFs.ShareProtected() );
+    
 	iIndexFileIsDirty = ETrue; 	// for safety assume that the index
 					// file is out of date. We can correct this
 					// when we read the file
@@ -113,6 +117,7 @@
 	delete iModelStreamIdSet;
 	delete iEntryManager;
 	delete iCalConverter;
+	iFs.Close();
 	}
 
 const CAgnServFile& CAgnEntryModel::AgnServFile()
@@ -1415,12 +1420,8 @@
             if (!GenerateIndexFileName(idxfilename))
                 {
                 User::Leave(KErrBadName);
-                }
-            
-            TInt connectErr = iFs.Connect();
-            User::LeaveIfError(connectErr);
-            
-            iFs.Delete(idxfilename); // ignore return as there is nothing we can do with it
+                }           
+            iFs.Delete(idxfilename); // ignore return as there is nothing we can do with it           
         }        
 	iIndexFileIsDirty = ETrue;
 	}
@@ -1455,9 +1456,6 @@
 		User::Leave(KErrBadName);
 		}
 	
-	TInt connectErr = iFs.Connect();
-	User::LeaveIfError(connectErr);
-	
 	RFile idxFile;
 	TInt errReadIdx = idxFile.Open(iFs, idxfilename, EFileRead);
 	CleanupClosePushL(idxFile);
@@ -1531,10 +1529,7 @@
         {
         User::Leave(KErrBadName);
         }
-    
-    TInt connectErr = iFs.Connect();
-    User::LeaveIfError(connectErr);
-    
+   
     RFile idxFile;
     TInt errReadIdx = idxFile.Open(iFs, idxfilename, EFileRead);
     CleanupClosePushL(idxFile);
@@ -1558,9 +1553,7 @@
 		{
 		User::Leave(KErrBadName);
 		}
-	TInt connectErr = iFs.Connect();
-	User::LeaveIfError(connectErr);
-
+	
 	RFile idxFile;
 	TInt errWriteIdx = idxFile.Replace(iFs, idxfilename, EFileWrite);
 	User::LeaveIfError(errWriteIdx);
@@ -2712,6 +2705,15 @@
 
 	NotifyingL(MCalChangeCallBack2::EChangeModify, aEntry, instanceInfoBefore);
 	
+	if(iChangeFilter && iTzRuleIndex)
+        {
+        //Remove the tz rule from tz rule index
+        //we have to do it after CAgnEntryModel::NotifyingL that is indirectly using the
+        //tz rule in oldEntry.
+        iTzRuleIndex->RemoveTzRuleL(*oldEntry);
+        }
+  
+	
 	CleanupStack::PopAndDestroy(instanceInfoBefore);
 	CleanupStack::PopAndDestroy(oldEntry);