917 delete iEntries->At(0); |
917 delete iEntries->At(0); |
918 CleanupStack::Pop(); // cEntry |
918 CleanupStack::Pop(); // cEntry |
919 iEntries->At(0) = cEntry; |
919 iEntries->At(0) = cEntry; |
920 iEntryPtr = &iEntries->At(0)->Entry(); |
920 iEntryPtr = &iEntries->At(0)->Entry(); |
921 } |
921 } |
|
922 |
|
923 /** |
|
924 Update a selection of children to read or Unread asynchronously of the context. |
|
925 The returned CMsvOperation object . |
|
926 |
|
927 @param aSelection |
|
928 The selectio of entry values for the context |
|
929 |
|
930 @param aMark |
|
931 True : Update selection to UnRead . |
|
932 False: Update selection to Read . |
|
933 |
|
934 @param aStatus The request status to be completed when the operation has finished . |
|
935 |
|
936 @leave KErrAccessDenied The entry is locked by another client |
|
937 |
|
938 @return |
|
939 An operation object controlling the change command |
|
940 */ |
|
941 EXPORT_C CMsvOperation* CMsvEntry::ChangeL(const CMsvEntrySelection& aSelection,TBool aMark, TRequestStatus& aStatus) |
|
942 { |
|
943 #ifndef _NO_SESSION_LOGGING_ |
|
944 Log(_L("Asynchronous ChangeL with selection of %d entries"), aSelection.Count()); |
|
945 #endif |
|
946 |
|
947 __ASSERT_DEBUG(aSelection.Count(), PanicServer(EMsvEmptySelection)); |
|
948 |
|
949 #if defined(_DEBUG) |
|
950 |
|
951 TInt aCount = aSelection.Count(); |
|
952 while (aCount--) |
|
953 { |
|
954 TMsvEntry aEntry; |
|
955 TMsvId aService; |
|
956 if (iMsvSession.Session().GetEntry(aSelection.At(aCount), aService, aEntry)==KErrNone) |
|
957 { |
|
958 __ASSERT_DEBUG(iState==EValid || iState==EInvalidDeletedContext, PanicServer(EMsvEntryAlreadyChangingContext)); |
|
959 __ASSERT_DEBUG(MsvUtils::ValidEntry(aEntry), PanicServer(EMsvChangingToInvalidEntry)); |
|
960 |
|
961 // can only change the current context |
|
962 if (!MsvUtils::ValidEntry(aEntry)) |
|
963 User::Leave(KErrArgument); |
|
964 } |
|
965 } |
|
966 #endif |
|
967 // cannot change standard folders |
|
968 if (iEntryPtr->StandardFolder()) |
|
969 User::Leave(KErrAccessDenied); |
|
970 |
|
971 //// create the operation |
|
972 CMsvEntryOperation* operation = CMsvEntryOperation::NewL(iMsvSession, aStatus); |
|
973 CleanupStack::PushL(operation); |
|
974 User::LeaveIfError(iMsvSession.Session().OperationMtmL(aSelection.At(0), operation->iMtm, operation->iService)); |
|
975 |
|
976 // start the change operation |
|
977 iMsvSession.Session().ChangeEntriesL(aSelection, aMark, operation->Id(), RProcess().SecureId(), operation->iStatus); |
|
978 |
|
979 operation->Start(); |
|
980 iState = EInvalidChangingContext; |
|
981 CleanupStack::Pop(1); // operation |
|
982 return operation; |
|
983 } |
922 |
984 |
923 |
985 |
924 EXPORT_C CMsvOperation* CMsvEntry::DeleteL(TMsvId aId, TRequestStatus& aStatus) |
986 EXPORT_C CMsvOperation* CMsvEntry::DeleteL(TMsvId aId, TRequestStatus& aStatus) |
925 // |
987 // |
926 // Deletes a child of the context |
988 // Deletes a child of the context |