# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1282202640 -10800 # Node ID e5b3a2155e1a063d4a2bb97675c4aeacf0a16e40 # Parent e4175d61d967f21f0fc646c6257717c7e84407da Revision: 201031 Kit: 201033 diff -r e4175d61d967 -r e5b3a2155e1a messagingfw/msgsrvnstore/server/bwins/v2_MSGSU.DEF --- a/messagingfw/msgsrvnstore/server/bwins/v2_MSGSU.DEF Thu Jul 15 19:11:10 2010 +0300 +++ b/messagingfw/msgsrvnstore/server/bwins/v2_MSGSU.DEF Thu Aug 19 10:24:00 2010 +0300 @@ -719,4 +719,6 @@ ?UnpackL@TMsvPackedDriveIdOperation@@QAEXAAV?$RArray@W4TDriveNumber@@@@@Z @ 718 NONAME ABSENT ; void TMsvPackedDriveIdOperation::UnpackL(class RArray &) ?UpdateDrivePriorityL@CMsvSession@@QAEXW4TDriveNumber@@AAI@Z @ 719 NONAME ABSENT ; void CMsvSession::UpdateDrivePriorityL(enum TDriveNumber, unsigned int &) ?UpdateDrivePriorityL@RMsvServerSession@@QAEXW4TDriveNumber@@AAI@Z @ 720 NONAME ABSENT ; void RMsvServerSession::UpdateDrivePriorityL(enum TDriveNumber, unsigned int &) + ?ChangeEntriesL@CBaseServerMtm@@UAEHABVCMsvEntrySelection@@HAAVTRequestStatus@@@Z @ 721 NONAME ; int CBaseServerMtm::ChangeEntriesL(class CMsvEntrySelection const &, int, class TRequestStatus &) + ?ChangeL@CMsvEntry@@QAEPAVCMsvOperation@@ABVCMsvEntrySelection@@HAAVTRequestStatus@@@Z @ 722 NONAME ; class CMsvOperation * CMsvEntry::ChangeL(class CMsvEntrySelection const &, int, class TRequestStatus &) diff -r e4175d61d967 -r e5b3a2155e1a messagingfw/msgsrvnstore/server/eabi/v2_msgsU.def --- a/messagingfw/msgsrvnstore/server/eabi/v2_msgsU.def Thu Jul 15 19:11:10 2010 +0300 +++ b/messagingfw/msgsrvnstore/server/eabi/v2_msgsU.def Thu Aug 19 10:24:00 2010 +0300 @@ -1022,4 +1022,8 @@ _ZN26TMsvPackedDriveIdOperationC2ERP6HBufC8 @ 1021 NONAME ABSENT _ZNK9CMsvEntry26ChildrenOfAvailableDrivesLEv @ 1022 NONAME ABSENT _ZN28CMsvSearchsortOpOnHeaderBody4NewLER11CMsvSessioni @ 1023 NONAME + _ZN14CBaseServerMtm14ChangeEntriesLERK18CMsvEntrySelectioniR14TRequestStatus @ 1024 NONAME + _ZN9CMsvEntry7ChangeLERK18CMsvEntrySelectioniR14TRequestStatus @ 1025 NONAME + _ZTI31CMsvLocalChangeEntriesOperation @ 1026 NONAME + _ZTV31CMsvLocalChangeEntriesOperation @ 1027 NONAME diff -r e4175d61d967 -r e5b3a2155e1a messagingfw/msgsrvnstore/server/group/messageserver.iby --- a/messagingfw/msgsrvnstore/server/group/messageserver.iby Thu Jul 15 19:11:10 2010 +0300 +++ b/messagingfw/msgsrvnstore/server/group/messageserver.iby Thu Aug 19 10:24:00 2010 +0300 @@ -26,18 +26,18 @@ #define MSGHEAPMAX 0x400000 #endif -file=ABI_DIR\BUILD_DIR\MSexe.exe System\Programs\MSexe.exe heapmax=MSGHEAPMAX -file=ABI_DIR\BUILD_DIR\MSGS.dll System\Libs\MSGS.dll +file=ABI_DIR\BUILD_DIR\msexe.exe System\Programs\MSexe.exe heapmax=MSGHEAPMAX +file=ABI_DIR\BUILD_DIR\msgs.dll System\Libs\MSGS.dll -data=EPOCROOT##epoc32\data\Z\private\1000484b\backup_registration.xml private\1000484b\backup_registration.xml +data=EPOCROOT##epoc32\data\z\private\1000484b\backup_registration.xml private\1000484b\backup_registration.xml #include "messageserver.hby" -data=EPOCROOT##epoc32\data\Z\private\1000484b\msgcache.ini private\1000484b\msgcache.ini +data=EPOCROOT##epoc32\data\z\private\1000484b\msgcache.ini private\1000484b\msgcache.ini #ifdef SYMBIAN_MSGS_ENHANCED_REMOVABLE_MEDIA_SUPPORT -data=EPOCROOT##epoc32\data\Z\private\1000484b\msgPriorityDriveList.ini private\1000484b\msgprioritydrivelist.ini -data=EPOCROOT##epoc32\data\Z\private\10202BE9\10286a26.txt private\10202BE9\10286a26.txt +data=EPOCROOT##epoc32\data\z\private\1000484b\msgprioritydriveList.ini private\1000484b\msgprioritydrivelist.ini +data=EPOCROOT##epoc32\data\z\private\10202BE9\10286a26.txt private\10202BE9\10286a26.txt #endif #endif diff -r e4175d61d967 -r e5b3a2155e1a messagingfw/msgsrvnstore/server/inc/MCLIENT.H --- a/messagingfw/msgsrvnstore/server/inc/MCLIENT.H Thu Jul 15 19:11:10 2010 +0300 +++ b/messagingfw/msgsrvnstore/server/inc/MCLIENT.H Thu Aug 19 10:24:00 2010 +0300 @@ -99,6 +99,8 @@ // Asynchronous messages IMPORT_C void CreateEntryL(const TMsvEntry& aEntry, TMsvOp aOperationId, TSecureId aOwnerId, TRequestStatus& aRequestStatus); IMPORT_C void ChangeEntryL(const TMsvEntry& aEntry, TMsvOp aOperationId, TSecureId aOwnerId, TRequestStatus& aRequestStatus); + void ChangeEntriesL(const CMsvEntrySelection& aSelection,TBool aMark, TMsvOp aOperationId, TSecureId aOwnerId, TRequestStatus& aRequestStatus); + IMPORT_C void DeleteEntriesL(const CMsvEntrySelection& aSelection, TMsvOp aOperationId, TRequestStatus& aRequestStatus); IMPORT_C void MoveEntriesL(const CMsvEntrySelection& aSelection, TMsvId aTarget, TMsvOp aOperationId, TRequestStatus& aRequestStatus); IMPORT_C void CopyEntriesL(const CMsvEntrySelection& aSelection, TMsvId aTarget, TMsvOp aOperationId, TRequestStatus& aRequestStatus); diff -r e4175d61d967 -r e5b3a2155e1a messagingfw/msgsrvnstore/server/inc/MSERVER.H --- a/messagingfw/msgsrvnstore/server/inc/MSERVER.H Thu Jul 15 19:11:10 2010 +0300 +++ b/messagingfw/msgsrvnstore/server/inc/MSERVER.H Thu Aug 19 10:24:00 2010 +0300 @@ -148,7 +148,7 @@ EMsvIdWithSortFiled=89, EMsvGetSearchSortProgress=90, EMsvCancelSearchSortOp=91, - EMsvUpdateAndSort=92 + EMsvUpdateAndSort=92, // Code added for PREQ 557. // Macros for preferred drive list APIs. #if (defined SYMBIAN_MSGS_ENHANCED_REMOVABLE_MEDIA_SUPPORT) @@ -162,7 +162,7 @@ EMsvGetChildIdsALL=101 #if (defined SYMBIAN_MESSAGESTORE_UNIT_TESTCODE) ,EMsvResetRepository=102, - EMsvPrintCache=103 + EMsvPrintCache=103, #endif #endif // #if (defined SYMBIAN_MSGS_ENHANCED_REMOVABLE_MEDIA_SUPPORT) @@ -180,8 +180,9 @@ EMsvConvertMessageStore=113, EMsvCancelConversionRequest=114, EMsvGetConvertibleDriveList=115, - EMsvGetConversionStatus=116 + EMsvGetConversionStatus=116, #endif + EMsvChangeEntries = 117 }; diff -r e4175d61d967 -r e5b3a2155e1a messagingfw/msgsrvnstore/server/inc/MSVAPI.H --- a/messagingfw/msgsrvnstore/server/inc/MSVAPI.H Thu Jul 15 19:11:10 2010 +0300 +++ b/messagingfw/msgsrvnstore/server/inc/MSVAPI.H Thu Aug 19 10:24:00 2010 +0300 @@ -928,6 +928,7 @@ // --- Asynchronous Current Entry functions --- IMPORT_C CMsvOperation* ChangeL(const TMsvEntry& aEntry, TRequestStatus& aStatus); IMPORT_C CMsvOperation* ChangeL(const TMsvEntry& aEntry, TSecureId aOwnerId, TRequestStatus& aStatus); + IMPORT_C CMsvOperation* ChangeL(const CMsvEntrySelection& aSelection, TBool aMark,TRequestStatus& aStatus); // // --- Asynchronous Child Entry functions --- IMPORT_C CMsvOperation* CreateL(const TMsvEntry& aEntry, TRequestStatus& aStatus); diff -r e4175d61d967 -r e5b3a2155e1a messagingfw/msgsrvnstore/server/inc/MSVLOPS.H --- a/messagingfw/msgsrvnstore/server/inc/MSVLOPS.H Thu Jul 15 19:11:10 2010 +0300 +++ b/messagingfw/msgsrvnstore/server/inc/MSVLOPS.H Thu Aug 19 10:24:00 2010 +0300 @@ -197,7 +197,43 @@ TMsvId iId; TMsvId iParent; }; +/// +//********************************** +// CMsvLocalChangeOperation +//********************************** +// +// Operation used to control server side local change od selection of ids. +// +class CMsvLocalChangeEntriesOperation : public CMsvLocalOperation +/** +@internalComponent +@released +*/ + { +public: + CMsvLocalChangeEntriesOperation(const RMessage2& aMessage, TMsvOp aId, CMsvEntrySelection* aSelection, CMsvServer& aMsvServer, TInt aMark); + ~CMsvLocalChangeEntriesOperation(); + // + void StartL(TSecureId aOwnerId, TBool aForcedUpdate); + // +private: + void DoCancel(); + void RunL(); + void Completed(); + // +private: + CMsvEntrySelection* iSelection; + CMsvEntrySelection* iWorkSelection1; + CMsvEntrySelection* iWorkSelection2; + CMsvDelete* iDelete; + TMsvId iId; + TMsvId iParent; + TInt iMark; + }; + + +/// //********************************** // CMsvLocalCreateOperation //********************************** diff -r e4175d61d967 -r e5b3a2155e1a messagingfw/msgsrvnstore/server/inc/MSVROPS.H --- a/messagingfw/msgsrvnstore/server/inc/MSVROPS.H Thu Jul 15 19:11:10 2010 +0300 +++ b/messagingfw/msgsrvnstore/server/inc/MSVROPS.H Thu Aug 19 10:24:00 2010 +0300 @@ -49,7 +49,8 @@ EMtmOpDeleteAll, EMtmOpCreate, EMtmOpChange, - EMtmOpCommand}; + EMtmOpCommand, + EMtmOpChangeEntries}; public: static CMsvMtmOperation* NewL(const RMessage2& aMessage, TMsvOp aId, TUid aMtmUid, TMsvId aServiceId, TInt aSessionId, MMsvOperationObserver& aOpObserver); ~CMsvMtmOperation(); @@ -70,6 +71,7 @@ inline void DeleteAll(CMsvEntrySelection* aSelection); inline void CreateL(const TMsvEntry& aNewEntry); inline void ChangeL(const TMsvEntry& aNewEntry); + inline void ChangeEntriesL(CMsvEntrySelection* aSelection, TInt aMark); inline void StartCommand(CMsvEntrySelection* aSelection, TInt aCommand, HBufC8* aParameter); #if (defined SYMBIAN_USER_PROMPT_SERVICE) inline void SetThreadId(TThreadId aThreadId); diff -r e4175d61d967 -r e5b3a2155e1a messagingfw/msgsrvnstore/server/inc/MSVROPS.INL --- a/messagingfw/msgsrvnstore/server/inc/MSVROPS.INL Thu Jul 15 19:11:10 2010 +0300 +++ b/messagingfw/msgsrvnstore/server/inc/MSVROPS.INL Thu Aug 19 10:24:00 2010 +0300 @@ -60,6 +60,11 @@ StoreParametersL(EMtmOpChange, aNewEntry); } +inline void CMsvMtmOperation::ChangeEntriesL(CMsvEntrySelection* aSelection, TInt aMark) + { + StoreParameters(EMtmOpChangeEntries, aSelection ,aMark, NULL); + } + inline void CMsvMtmOperation::StartCommand(CMsvEntrySelection* aSelection, TInt aCommand, HBufC8* aParameter) { StoreParameters(EMtmOpCommand ,aSelection ,aCommand, aParameter); diff -r e4175d61d967 -r e5b3a2155e1a messagingfw/msgsrvnstore/server/inc/MSVSERV.H --- a/messagingfw/msgsrvnstore/server/inc/MSVSERV.H Thu Jul 15 19:11:10 2010 +0300 +++ b/messagingfw/msgsrvnstore/server/inc/MSVSERV.H Thu Aug 19 10:24:00 2010 +0300 @@ -108,7 +108,8 @@ EMsvProgressBufferExceeds256=12, EMsvNoEntriesInMoveSelection=13, EMsvNoEntriesInCopySelection=14, - EMsvNoEntriesInChangeAttributesSelection=15 + EMsvNoEntriesInChangeAttributesSelection=15, + EMsvNoEntriesInChangeSelection=16 }; const TInt KMsvMessageDriveStreamVersionNumber = 3; @@ -558,8 +559,11 @@ void OperationMtmL(const RMessage2 &aMessage); // void ChangeEntryL(const RMessage2 &aMessage); + void ChangeEntriesL(const RMessage2 &aMessage); void DoChangeLocalEntryL(const TMsvEntry& aEntry, TMsvOp aOpId, const RMessage2 &aMessage, TSecureId aOwnerId); void DoChangeRemoteEntryL(const TMsvEntry& aEntry, TMsvOp aOpId, const RMessage2 &aMessage); + void DoChangeLocalEntriesL(CMsvEntrySelection*& aSelection, TMsvOp aOpId, const RMessage2 &aMessage, TSecureId aOwnerId, TInt aMark); + void DoChangeRemoteEntriesL(CMsvEntrySelection*& aSelection, TMsvOp aOpId, const RMessage2 &aMessage,TInt aMark); // void CreateEntryL(const RMessage2 &aMessage); void DoCreateLocalEntryL(const TMsvEntry& aEntry, TMsvOp aOpId, const RMessage2 &aMessage, TSecureId aOwnerId); diff -r e4175d61d967 -r e5b3a2155e1a messagingfw/msgsrvnstore/server/inc/MTSR.H --- a/messagingfw/msgsrvnstore/server/inc/MTSR.H Thu Jul 15 19:11:10 2010 +0300 +++ b/messagingfw/msgsrvnstore/server/inc/MTSR.H Thu Aug 19 10:24:00 2010 +0300 @@ -384,6 +384,40 @@ TInt GetNonOperationMtmData(TNonOperationMtmDataType& aMtmDataType, TPtrC8& aResultBuffer); + + /** Updates a remote selection of id with relevant data when called by the Message Server. + + Implementations should provide this function if the messaging protocol supports + updating of remote entries. If this is not supported, implementations should + leave with KErrNotSupported. + + The Server-side MTM implementation must decide what information in the TMsvEntry + is relevant to the remote entry, and translate it appropriately for the specific + protocol. Most of the data contained in the TMsvEntry is specific to the Symbian + OS Message Server, and would probably have no direct correlation with the + protocol's own storage format. Some entry data may however be useful. For + example, if the protocol supports remote renaming of folders, the implementation + could: + + 1. check for a folder type entry + + 2. extract the folder name from aNewEntry.iDetails + + 3. check if the folder name has changed by comparing the new name with iDetails + in the index entry currently; if not, complete with KErrNone + + 4. initiate a protocol-specific action to rename the remote folder + + The implementation should also always update the local Message Server index + through CMsvServerEntry::ChangeL(). + + @param aSelection Selection of TMsvId which to update + @param aMark Read and Unread mark value. + @param aStatus Asynchronous completion word for the operation. + + @leave KErrNotSupported The Server-side MTM does not support this operation + @leave Other leave codes Dependent on implementation */ + IMPORT_C virtual TInt ChangeEntriesL( const CMsvEntrySelection& aSelection,TInt aMark, TRequestStatus& aStatus ); protected: IMPORT_C CBaseServerMtm(CRegisteredMtmDll& aRegisteredMtmDll, CMsvServerEntry* aServerEntry); /** Handles the completion of any asynchronous requests that it makes. It is called diff -r e4175d61d967 -r e5b3a2155e1a messagingfw/msgsrvnstore/server/src/CMsvPlainBodyText.cpp --- a/messagingfw/msgsrvnstore/server/src/CMsvPlainBodyText.cpp Thu Jul 15 19:11:10 2010 +0300 +++ b/messagingfw/msgsrvnstore/server/src/CMsvPlainBodyText.cpp Thu Aug 19 10:24:00 2010 +0300 @@ -1120,7 +1120,7 @@ void CMsvPlainBodyText::RevertL() { iFile.Close(); - if(!iIsCommitted) + if(!iIsCommitted && iMsvFileStatus == EMsvFileWriting) { iMsvStoreManager.DeletePlainTextFileL(iMessageId); } diff -r e4175d61d967 -r e5b3a2155e1a messagingfw/msgsrvnstore/server/src/MCLENTRY.CPP --- a/messagingfw/msgsrvnstore/server/src/MCLENTRY.CPP Thu Jul 15 19:11:10 2010 +0300 +++ b/messagingfw/msgsrvnstore/server/src/MCLENTRY.CPP Thu Aug 19 10:24:00 2010 +0300 @@ -920,6 +920,68 @@ iEntryPtr = &iEntries->At(0)->Entry(); } +/** +Update a selection of children to read or Unread asynchronously of the context. +The returned CMsvOperation object . + +@param aSelection +The selectio of entry values for the context + +@param aMark +True : Update selection to UnRead . +False: Update selection to Read . + +@param aStatus The request status to be completed when the operation has finished . + +@leave KErrAccessDenied The entry is locked by another client + +@return +An operation object controlling the change command +*/ +EXPORT_C CMsvOperation* CMsvEntry::ChangeL(const CMsvEntrySelection& aSelection,TBool aMark, TRequestStatus& aStatus) + { +#ifndef _NO_SESSION_LOGGING_ + Log(_L("Asynchronous ChangeL with selection of %d entries"), aSelection.Count()); +#endif + + __ASSERT_DEBUG(aSelection.Count(), PanicServer(EMsvEmptySelection)); + +#if defined(_DEBUG) + + TInt aCount = aSelection.Count(); + while (aCount--) + { + TMsvEntry aEntry; + TMsvId aService; + if (iMsvSession.Session().GetEntry(aSelection.At(aCount), aService, aEntry)==KErrNone) + { + __ASSERT_DEBUG(iState==EValid || iState==EInvalidDeletedContext, PanicServer(EMsvEntryAlreadyChangingContext)); + __ASSERT_DEBUG(MsvUtils::ValidEntry(aEntry), PanicServer(EMsvChangingToInvalidEntry)); + + // can only change the current context + if (!MsvUtils::ValidEntry(aEntry)) + User::Leave(KErrArgument); + } + } +#endif + // cannot change standard folders + if (iEntryPtr->StandardFolder()) + User::Leave(KErrAccessDenied); + + //// create the operation + CMsvEntryOperation* operation = CMsvEntryOperation::NewL(iMsvSession, aStatus); + CleanupStack::PushL(operation); + User::LeaveIfError(iMsvSession.Session().OperationMtmL(aSelection.At(0), operation->iMtm, operation->iService)); + + // start the change operation + iMsvSession.Session().ChangeEntriesL(aSelection, aMark, operation->Id(), RProcess().SecureId(), operation->iStatus); + + operation->Start(); + iState = EInvalidChangingContext; + CleanupStack::Pop(1); // operation + return operation; + } + EXPORT_C CMsvOperation* CMsvEntry::DeleteL(TMsvId aId, TRequestStatus& aStatus) // diff -r e4175d61d967 -r e5b3a2155e1a messagingfw/msgsrvnstore/server/src/MCLIENT.CPP --- a/messagingfw/msgsrvnstore/server/src/MCLIENT.CPP Thu Jul 15 19:11:10 2010 +0300 +++ b/messagingfw/msgsrvnstore/server/src/MCLIENT.CPP Thu Aug 19 10:24:00 2010 +0300 @@ -457,6 +457,25 @@ User::LeaveIfError(SendReceive(EMsvChangeEntry, TIpcArgs(aOperationId, aOwnerId))); } +/** +Update the specified Changes to selection of TMsvId (asynchronously). + +@param aSelection The IDs of the entry to Change. +@param aMark The read/Unread value. +@param aOperationId Operation identifier +@param aOwnerId The ID of the owning process +@param aRequestStatus Asynchronous request status + +*/ + +void RMsvServerSession::ChangeEntriesL(const CMsvEntrySelection& aSelection, TBool aMark ,TMsvOp aOperationId, TSecureId aOwnerId, TRequestStatus& aRequestStatus) + { + TestSlotAvailableL(); + TInt markvalue = (TInt)aMark; + SendOperationDataL(aOperationId, aSelection, markvalue); + aRequestStatus=KRequestPending; + SendReceive(EMsvChangeEntries, TIpcArgs(aOperationId, aOwnerId), aRequestStatus); + } /** Gets the index entry with the specified unique id. diff -r e4175d61d967 -r e5b3a2155e1a messagingfw/msgsrvnstore/server/src/MSVLOCAL.CPP --- a/messagingfw/msgsrvnstore/server/src/MSVLOCAL.CPP Thu Jul 15 19:11:10 2010 +0300 +++ b/messagingfw/msgsrvnstore/server/src/MSVLOCAL.CPP Thu Aug 19 10:24:00 2010 +0300 @@ -686,6 +686,125 @@ SetState(EMsvOperationCompleted); iMessage.Complete(KErrNone); } +//********************************** +// CMsvLocalChangeEntriesOperation +//********************************** + + +CMsvLocalChangeEntriesOperation::CMsvLocalChangeEntriesOperation(const RMessage2& aMessage, TMsvOp aId, CMsvEntrySelection* aSelection, CMsvServer& aMsvServer, TInt aMark) +: CMsvLocalOperation(aMessage, aId, aMsvServer), iSelection(aSelection), iMark(aMark) + { + __DECLARE_NAME(_S("CMsvLocalChangeEntriesOperation")); + // set up the progress + iProgress().iType = TMsvLocalOperationProgress::ELocalChanged; + iProgress().iTotalNumberOfEntries = iSelection->Count();; + iProgress().iNumberRemaining = iProgress().iTotalNumberOfEntries; + CActiveScheduler::Add(this); + } + +CMsvLocalChangeEntriesOperation::~CMsvLocalChangeEntriesOperation() +// +// +// + { + Cancel(); + delete iSelection; + delete iDelete; + delete iWorkSelection1; + delete iWorkSelection2; + } + +void CMsvLocalChangeEntriesOperation::DoCancel() +// +// +// + { + __ASSERT_DEBUG(iDelete!=NULL, PanicServer(EMsvChangeEntryBadState)); + iDelete->Cancel(); + iProgress().iError = KErrCancel; + Completed(); + } + +void CMsvLocalChangeEntriesOperation::RunL() +// +// +// + { + if (iStatus.Int()==KErrNone) + { + iProgress().iNumberCompleted++; + } + else + { + iProgress().iNumberFailed++; + iProgress().iError = iStatus.Int(); + } + + Completed(); + } + + +void CMsvLocalChangeEntriesOperation::StartL(TSecureId aOwnerId, TBool aForcedUpdate) +// +// +// + { + TMsvEntry* entry1; + + TInt count = iSelection->Count(); + while (count--) + { + iMsvServer.IndexAdapter().GetEntry(iSelection->At(count),entry1); + iId = entry1->Id(); + iParent = entry1->Parent(); + // check if this is actually a deletion + if (entry1->Deleted() && entry1->PcSyncCount()==0) + { + iDelete = CMsvDelete::NewL(iMsvServer); + iWorkSelection1 = new(ELeave)CMsvEntrySelection; + iWorkSelection2 = new(ELeave)CMsvEntrySelection; + + iDelete->StartL(entry1->Id(), *iWorkSelection1, *iWorkSelection2, iStatus, ETrue); + SetActive(); + return; + } + } + + TInt error = KErrNone; + TMsvEntry* entry; + count = iSelection->Count(); + while (count--) + { + error = iMsvServer.IndexAdapter().GetEntry(iSelection->At(count),entry); + if (error==KErrNone) + { + error = iMsvServer.IndexAdapter().LockEntry(iSelection->At(count)); + error = iMsvServer.ChangeEntry(*entry, aOwnerId, aForcedUpdate); + error = iMsvServer.IndexAdapter().ReleaseEntry(iSelection->At(count)); // error ignored + } + } + + if (error==KErrNone) + iProgress().iNumberCompleted++; + else + { + iProgress().iNumberFailed++; + iProgress().iError = error; + } + Completed(); + } + +void CMsvLocalChangeEntriesOperation::Completed() +// +// +// + { + + if (iProgress().iError==KErrNone) + iMsvServer.NotifyChanged(iDelete==NULL ? EMsvEntriesChanged : EMsvEntriesDeleted, iId, iParent); + SetState(EMsvOperationCompleted); + iMessage.Complete(KErrNone); + } //********************************** diff -r e4175d61d967 -r e5b3a2155e1a messagingfw/msgsrvnstore/server/src/MSVOPERT.CPP --- a/messagingfw/msgsrvnstore/server/src/MSVOPERT.CPP Thu Jul 15 19:11:10 2010 +0300 +++ b/messagingfw/msgsrvnstore/server/src/MSVOPERT.CPP Thu Aug 19 10:24:00 2010 +0300 @@ -164,6 +164,9 @@ case EMtmOpCommand: iServerMtm->StartCommandL(*iSelection, iIntParam, *iDesParam, iStatus); break; + case EMtmOpChangeEntries: + iServerMtm->ChangeEntriesL(*iSelection,iIntParam,iStatus); + break; default: PanicServer(EMsvUnknownMtmOpType); break; diff -r e4175d61d967 -r e5b3a2155e1a messagingfw/msgsrvnstore/server/src/MSVSESS.CPP --- a/messagingfw/msgsrvnstore/server/src/MSVSESS.CPP Thu Jul 15 19:11:10 2010 +0300 +++ b/messagingfw/msgsrvnstore/server/src/MSVSESS.CPP Thu Aug 19 10:24:00 2010 +0300 @@ -578,6 +578,9 @@ CancelConversionRequestL(aMessage); break; #endif // #if (defined SYMBIAN_MESSAGESTORE_HEADER_BODY_USING_SQLDB) + case EMsvChangeEntries: + ChangeEntriesL(aMessage); + break; default: PanicClient(aMessage, EMsvBadRequest); break; @@ -944,6 +947,112 @@ CleanupStack::PopAndDestroy(); // opData } +// +// Changes the selection of id. +// + +void CMsvServerSession::ChangeEntriesL(const RMessage2 &aMessage) + { + // Recover the operation data + TMsvOp operationId = aMessage.Int0(); + HBufC8* opData = RecoverOperationData(operationId); + // Check for NULL data entry to be changed, must have been given incorrect id for argument. + if(opData == NULL) + { + aMessage.Complete(KErrArgument); + return; + } + CleanupStack::PushL(opData); + + // unpack the data + TMsvPackedOperation packedOperation(opData); + + CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection; + CleanupStack::PushL(selection); + TInt target,temp; + packedOperation.UnpackL(*selection, target, temp); + + if (selection->Count() == 0) + { + PanicClient(aMessage, EMsvNoEntriesInChangeSelection); + aMessage.Complete(KErrNotFound); + return; + } + // Find the first entry in the selection which exists + TInt count=selection->Count(); + while (count--) + { + TBool entryExsists = EFalse; + entryExsists = iMsvServer.IndexAdapter().EntryExists(selection->At(count)); + if (entryExsists) + break; + } + + // Check if the entry is local or the entry is a service + TBool local=ETrue; + TMsvEntry* entry=NULL; + User::LeaveIfError(iMsvServer.IndexAdapter().GetEntry(selection->At(0), entry)); + + // Police request - client must be able to modify the entry. + iMsvServer.PoliceModifyEntryL(aMessage, *entry, local, __PLATSEC_DIAGNOSTIC_STRING("Checked by CMsvServerSession::ChangeEntryL")); + + // For purpose of changing a service entry, it is considered local as an MTM + // is not required to do the work. + if( entry->iType == KUidMsvServiceEntry ) + local = ETrue; + + // start the change for local or remote entries + if (local) + { + // Extract the owner ID from the message. + TSecureId ownerId = aMessage.Int1(); + + DoChangeLocalEntriesL(selection, operationId, aMessage, ownerId, target); + } + else + DoChangeRemoteEntriesL(selection, operationId, aMessage,target); + + CleanupStack::PopAndDestroy(); // opData + } + +void CMsvServerSession::DoChangeLocalEntriesL(CMsvEntrySelection*& aSelection, TMsvOp aOpId, const RMessage2 &aMessage, TSecureId aOwnerId, TInt mark) + { + CMsvLocalChangeEntriesOperation* operation = new(ELeave) CMsvLocalChangeEntriesOperation(aMessage, aOpId, aSelection, iMsvServer,mark); + CleanupStack::Pop(); // selection + CleanupStack::PushL(operation); + + TBool forcedUpdate = (aOwnerId != aMessage.SecureId()); + operation->StartL(aOwnerId, forcedUpdate); + + iOperations.AppendL(operation); + CleanupStack::Pop(); // operation + + + } + +void CMsvServerSession::DoChangeRemoteEntriesL(CMsvEntrySelection*& aSelection, TMsvOp aOpId, const RMessage2 &aMessage,TInt mark) +// +// Change a selection of entry under a remote service +// + { + // make sure that the operation can be added to the list + iOperations.SetReserveL(iOperations.Count()+1); + + TMsvEntry* entry=NULL; + User::LeaveIfError(iMsvServer.IndexAdapter().GetEntry(aSelection->At(0), entry)); + + // create the operation + CMsvMtmOperation* operation = CMsvMtmOperation::NewL(aMessage, aOpId, entry->iMtm, entry->iServiceId, iSessionId, iMsvServer); + CleanupStack::Pop(); // aSelection + CleanupStack::PushL(operation); + operation->ChangeEntriesL(aSelection,mark); + + iMsvServer.StartOperationL(*operation, iSessionId, aMessage, ETrue); + iOperations.AppendL(operation); // will not fail - see start of function + CleanupStack::Pop(); // operation + } + + void CMsvServerSession::DoChangeLocalEntryL(const TMsvEntry& aEntry, TMsvOp aOpId, const RMessage2 &aMessage, TSecureId aOwnerId) // // Create a local entry in the index diff -r e4175d61d967 -r e5b3a2155e1a messagingfw/msgsrvnstore/server/src/MTSR.CPP --- a/messagingfw/msgsrvnstore/server/src/MTSR.CPP Thu Jul 15 19:11:10 2010 +0300 +++ b/messagingfw/msgsrvnstore/server/src/MTSR.CPP Thu Aug 19 10:24:00 2010 +0300 @@ -175,6 +175,16 @@ } return ret; } +// Empty declaration +EXPORT_C TInt CBaseServerMtm::ChangeEntriesL( const CMsvEntrySelection& /*aSelection*/,TInt /*aMark*/, TRequestStatus& aStatus ) + { + //Empty declaration. Respective MTM implementation should be call . + TRequestStatus aEmptyStatus; + aEmptyStatus = aStatus ; + + return KErrNotSupported; // Specific to MTM. Base return Not supported. + } + EXPORT_C CServerMtmDllRegistry* CServerMtmDllRegistry::NewL(RFs& aFs,TTimeIntervalMicroSeconds32 aTimeoutMicroSeconds32) { diff -r e4175d61d967 -r e5b3a2155e1a messagingfw/senduiservices/bwinscw/SENDUIU.DEF --- a/messagingfw/senduiservices/bwinscw/SENDUIU.DEF Thu Jul 15 19:11:10 2010 +0300 +++ b/messagingfw/senduiservices/bwinscw/SENDUIU.DEF Thu Aug 19 10:24:00 2010 +0300 @@ -82,4 +82,5 @@ ?NewL@CSendUiSingleton@@SAPAV1@XZ @ 81 NONAME ; class CSendUiSingleton * CSendUiSingleton::NewL(void) ?OpaqueData@CMessageData@@QBE?BVTPtrC8@@XZ @ 82 NONAME ; class TPtrC8 const CMessageData::OpaqueData(void) const ?SetOpaqueDataL@CMessageData@@QAEXPBVTDesC8@@VTUid@@@Z @ 83 NONAME ; void CMessageData::SetOpaqueDataL(class TDesC8 const *, class TUid) + ?AddSendMenuItemToMenuPaneL@CSendUi@@QAEXAAHAAVCEikMenuPane@@HHVTSendingCapabilities@@@Z @ 84 NONAME ; void CSendUi::AddSendMenuItemToMenuPaneL(int &, class CEikMenuPane &, int, int, class TSendingCapabilities) diff -r e4175d61d967 -r e5b3a2155e1a messagingfw/senduiservices/eabi/SENDUIU.DEF --- a/messagingfw/senduiservices/eabi/SENDUIU.DEF Thu Jul 15 19:11:10 2010 +0300 +++ b/messagingfw/senduiservices/eabi/SENDUIU.DEF Thu Aug 19 10:24:00 2010 +0300 @@ -121,4 +121,5 @@ _ZN16CSendUiSingleton4NewLEv @ 120 NONAME _ZN12CMessageData14SetOpaqueDataLEPK6TDesC84TUid @ 121 NONAME _ZNK12CMessageData10OpaqueDataEv @ 122 NONAME + _ZN7CSendUi26AddSendMenuItemToMenuPaneLERiR12CEikMenuPaneii20TSendingCapabilities @ 123 NONAME diff -r e4175d61d967 -r e5b3a2155e1a messagingfw/senduiservices/inc/SendUiImpl.h --- a/messagingfw/senduiservices/inc/SendUiImpl.h Thu Jul 15 19:11:10 2010 +0300 +++ b/messagingfw/senduiservices/inc/SendUiImpl.h Thu Aug 19 10:24:00 2010 +0300 @@ -70,7 +70,13 @@ /** * Adds menu item of given type to menupane. - * + * No menu item is added, if services are not found. + * This can happen if asyncronous sending service update is not + * yet finished. This API will not provide any result of + * requested operation. New API AddTypedMenuItemToMenuPaneL + * with aResult param is added. Caller application can use this + * new API to know the API operation result. + * * @since Series 60 3.0 * @param aMenuType Type of the menu, e.g. "ESendMenu" or "EWriteMenu" * @param aMenuPane Menupane where the menu item should be added. @@ -338,16 +344,33 @@ TBool IsEmailAppendableL(TMsvEntry tentry); /** - * Validates if all the attachments are DRM protected - * - * @since S60 v5.0 - * @param TBool - * @return ETrue, if it atleast one of the attachments can be sent - * EFalse, if no attachment can be sent - */ - - TBool ValidateAttachmentsL(const CMessageData* aMessageData); - + * Adds menu item of given type to menupane and know the opeation + * result. + * No menu item is added, if services are not found. + * This can happen if asyncronous sending service update is not + * yet finished. Caller application can use this API to know the + * API operation result. + * + * @since Series 60 9.2 + * @param aResult API opeartion result. ETrue, if item is added successfully + * EFalse , if failed to add item. * + * @param aMenuType Type of the menu, e.g. "ESendMenu" or "EWriteMenu" + * @param aMenuPane Menupane where the menu item should be added. + * @param aIndex The place of the menu item in menupane. + * @param aCommandId Command id for the menu item. + * @param aRequiredCapabilities Capabilities required by services to be + * shown in "Send" list query. If no capabilities are required + * (KCapabilitiesForAllServices), all available services are + * shown in "Send" list query. + * @return None. + */ + void AddTypedMenuItemToMenuPaneL( + TBool& aResult, + CSendUi::TSendUiMenuType aMenuType, + CEikMenuPane& aMenuPane, + TInt aIndex, + TInt aCommandId, + TSendingCapabilities aRequiredCapabilities = KCapabilitiesForAllServices ); private: diff -r e4175d61d967 -r e5b3a2155e1a messagingfw/senduiservices/src/SendUi.cpp --- a/messagingfw/senduiservices/src/SendUi.cpp Thu Jul 15 19:11:10 2010 +0300 +++ b/messagingfw/senduiservices/src/SendUi.cpp Thu Aug 19 10:24:00 2010 +0300 @@ -303,6 +303,28 @@ return iSendUiImpl->TechnologyType( aServiceUid ); } +// ----------------------------------------------------------------------------- +// CSendUi::AddSendMenuItemToMenuPaneL +// +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +EXPORT_C void CSendUi::AddSendMenuItemToMenuPaneL( + TBool& aResult, + CEikMenuPane& aMenuPane, + TInt aIndex, + TInt aCommandId, + TSendingCapabilities aRequiredCapabilities) + { + iSendUiImpl->AddTypedMenuItemToMenuPaneL( + aResult, + ESendMenu, + aMenuPane, + aIndex, + aCommandId, + aRequiredCapabilities + ); + } // ========================== OTHER EXPORTED FUNCTIONS ========================= diff -r e4175d61d967 -r e5b3a2155e1a messagingfw/senduiservices/src/SendUiImpl.cpp --- a/messagingfw/senduiservices/src/SendUiImpl.cpp Thu Jul 15 19:11:10 2010 +0300 +++ b/messagingfw/senduiservices/src/SendUiImpl.cpp Thu Aug 19 10:24:00 2010 +0300 @@ -56,8 +56,7 @@ #include "propertyobserver.h" #include "senduilauncher.h" #include "SendUiInternalConsts.h" -#include "SendUiFileRightsEngine.h" -#include "CSendUiAttachment.h" + const TInt KArrayGranularity = 2; const TInt KSendUiServiceOrderArrayGranularity = 6; @@ -208,14 +207,7 @@ CArrayFix* aServicesToDim, const TDesC& aTitleText ) { - if(aMessageData) - { - TBool continueSending = ValidateAttachmentsL(aMessageData); - if(!continueSending) - { - return KNullUid; - } - } + //validation of attachments is costly operation and hence better be done after showing services popup. // Implemented for CR # 401-1806 >> // This section to enable/disable features (supported by feature manager) at run time, is to be revised, // once an observer class is available from feature manager side to intimate about feature state @@ -1374,43 +1366,63 @@ return appendEmail; } // ----------------------------------------------------------------------------- -// ValidateAttachmentsL -// Validates if all the attachments are DRM protected +// AddTypedMenuItemToMenuPaneL +// +// No menu item is added, if services are not found. This can happen if +// asyncronous sending service update is not yet finished. +// To inform caller about the API result, aResult param is added. +// so that caller application will know that its request is not succesfully +// completed due to above reason. // ----------------------------------------------------------------------------- // -TBool CSendUiImpl::ValidateAttachmentsL(const CMessageData* aMessageData) +void CSendUiImpl::AddTypedMenuItemToMenuPaneL( + TBool& aResult, + CSendUi::TSendUiMenuType aMenuType, + CEikMenuPane& aMenuPane, + TInt aIndex, + TInt aCommandId, + TSendingCapabilities aRequiredCapabilities) { - CArrayPtrFlat* attachments = NULL; - TInt cleanupItems(0); - TBool okToSend = EFalse; - CSendUiFileRightsEngine* fileRightsEngine = CSendUiFileRightsEngine::NewLC( iCoeEnv->FsSession() ); - cleanupItems++; - // Get attachments - attachments = CSendUiAttachment::InitAttachmentArrayLCC( - aMessageData->AttachmentArray(), - aMessageData->AttachmentHandleArray(), - iCoeEnv->FsSession() ); - cleanupItems += 2; + TInt i(0); + TBuf menuItemName; + aResult=EFalse; + + // Read the resources + aMenuType == CSendUi::ESendMenu ? + i = R_SENDUI_MENUITEM_SEND : + i = R_SENDUI_MENUITEM_WRITE; // CSendUi::EWriteMenu - if ( attachments->Count() == 0 ) - { - //there are no attachments, so no point in checking the file rights at all. - CleanupStack::PopAndDestroy( cleanupItems ); - return ETrue; - } - fileRightsEngine->ConfirmDrmFileRightsL( attachments ); - if ( attachments->Count() <= 0 ) + iCoeEnv->ReadResourceL( menuItemName, i ); + + for ( i = 0; i < iSendingServices.Count(); i++ ) + { + TUid serviceUid = iSendingServices[i]->ServiceId(); + if ( QueryCapabilities( i, aRequiredCapabilities ) ) { - fileRightsEngine->ShowDrmAndMmsInfoL(); + CEikMenuPaneItem::SData data; + data.iCascadeId = NULL; + data.iText = menuItemName; + data.iCommandId = aCommandId; + data.iFlags = 0; + + if ( aIndex == aMenuPane.NumberOfItemsInPane() ) + { + aMenuPane.AddMenuItemL( data ); + } + else + { + aMenuPane.InsertMenuItemL( data, aIndex ); + } + + aResult = ETrue; + break; } - else + } + // Hide menu item if sending is already in progress. + if ( aResult ) { - // there are one or more files that can be sent, so dont shown error note now. - okToSend = ETrue; - } - CleanupStack::PopAndDestroy( cleanupItems ); - - return okToSend; + aMenuPane.SetItemDimmed( aCommandId, iIsSending); + } } // end of file diff -r e4175d61d967 -r e5b3a2155e1a msgfw_pub/send_ui_api/inc/SendUi.h --- a/msgfw_pub/send_ui_api/inc/SendUi.h Thu Jul 15 19:11:10 2010 +0300 +++ b/msgfw_pub/send_ui_api/inc/SendUi.h Thu Aug 19 10:24:00 2010 +0300 @@ -72,6 +72,12 @@ /** * Adds "Send" menu item to menupane. + * No menu item is added, if services are not found. + * This can happen if asyncronous sending service update is not + * yet finished. This API will not provide any result of + * requested operation. New API AddSendMenuItemToMenuPaneL + * with aResult param is added. Caller application can use + * this new API to know the API operation result. * * @since Series 60 3.0 * @param aMenuPane Menupane where the "Send" menu item should be added. @@ -362,6 +368,35 @@ * service doesn't exist or service is ECOM based. */ IMPORT_C TUid TechnologyType( TUid aServiceUid ) const; + + /** + * Adds "Send" menu item to menupane and know the opeation + * result. + * No menu item is added, if services are not found. + * This can happen if asyncronous sending service update is not + * yet finished. Caller application can use this API to know the + * API operation result. + * + * @since Series 60 9.2 + * @param aResult API opeartion result. ETrue, if item is added successfully + * EFalse , if failed to add item. + * @param aMenuPane Menupane where the "Send" menu item should be added. + * @param aIndex The place of the "Send" menu item in menupane. + * @param aCommandId Command id for the "Send" menu item. + * @param aRequiredCapabilities Capabilities required by services to be + * shown in "Send" list query. If no capabilities are required + * (KCapabilitiesForAllServices), all available services are + * shown in "Send" list query. + * + * @return None. + */ + IMPORT_C void AddSendMenuItemToMenuPaneL( + TBool& aResult, + CEikMenuPane& aMenuPane, + TInt aIndex, + TInt aCommandId, + TSendingCapabilities aRequiredCapabilities = KCapabilitiesForAllServices + ); private: