792 |
792 |
793 iOperationObserver.RequestResponseL( progress, iRequestId ); |
793 iOperationObserver.RequestResponseL( progress, iRequestId ); |
794 |
794 |
795 __LOG_EXIT; |
795 __LOG_EXIT; |
796 } |
796 } |
|
797 |
|
798 |
|
799 /////////////////////////////////////////////////// |
|
800 // CDelayedAddNewOrRemoveChildPartOp // |
|
801 /////////////////////////////////////////////////// |
|
802 |
|
803 /** |
|
804 * |
|
805 */ |
|
806 /*public static */ CDelayedAddNewOrRemoveChildPartOp* CDelayedAddNewOrRemoveChildPartOp::NewLC( |
|
807 const TFSMailMsgId& aMailBoxId, |
|
808 const TFSMailMsgId& aParentFolderId , |
|
809 const TFSMailMsgId& aMessageId, |
|
810 const TFSMailMsgId& aParentPartId , |
|
811 const TDesC& aContentType, |
|
812 const TDesC& aFilePath, |
|
813 MFSMailRequestObserver& aOperationObserver, |
|
814 const TInt aRequestId) |
|
815 { |
|
816 CDelayedAddNewOrRemoveChildPartOp* self = new (ELeave) CDelayedAddNewOrRemoveChildPartOp( |
|
817 aMailBoxId, aParentFolderId, aMessageId,aParentPartId, |
|
818 aOperationObserver,aRequestId); |
|
819 CleanupStack::PushL( self ); |
|
820 self->ConstructL( aContentType, aFilePath ); |
|
821 return self; |
|
822 } |
|
823 |
|
824 /** |
|
825 * |
|
826 */ |
|
827 /*public static */ CDelayedAddNewOrRemoveChildPartOp* CDelayedAddNewOrRemoveChildPartOp::NewLC( |
|
828 const TFSMailMsgId& aMailBoxId, |
|
829 const TFSMailMsgId& aParentFolderId , |
|
830 const TFSMailMsgId& aMessageId, |
|
831 const TFSMailMsgId& aParentPartId , |
|
832 const TFSMailMsgId& aPartId , |
|
833 MFSMailRequestObserver& aOperationObserver, |
|
834 const TInt aRequestId) |
|
835 { |
|
836 CDelayedAddNewOrRemoveChildPartOp* self = new (ELeave) CDelayedAddNewOrRemoveChildPartOp( |
|
837 aMailBoxId, aParentFolderId, aMessageId,aParentPartId, |
|
838 aPartId,aOperationObserver, aRequestId); |
|
839 CleanupStack::PushL( self ); |
|
840 return self; |
|
841 } |
|
842 |
|
843 /** |
|
844 * |
|
845 */ |
|
846 /*public virtual*/ CDelayedAddNewOrRemoveChildPartOp::CDelayedAddNewOrRemoveChildPartOp( |
|
847 const TFSMailMsgId& aMailBoxId, |
|
848 const TFSMailMsgId& aParentFolderId , |
|
849 const TFSMailMsgId& aMessageId, |
|
850 const TFSMailMsgId& aParentPartId , |
|
851 MFSMailRequestObserver& aOperationObserver, |
|
852 const TInt aRequestId) : |
|
853 iMailBoxId( aMailBoxId ), |
|
854 iParentFolderId( aParentFolderId ), |
|
855 iMessageId( aMessageId ), |
|
856 iParentPartId( aParentPartId ), |
|
857 iOperationObserver( aOperationObserver ), |
|
858 iRequestId( aRequestId ), |
|
859 iActionType( AddNewChild) |
|
860 { |
|
861 } |
|
862 |
|
863 /** |
|
864 * |
|
865 */ |
|
866 /*public virtual*/ CDelayedAddNewOrRemoveChildPartOp::CDelayedAddNewOrRemoveChildPartOp( |
|
867 const TFSMailMsgId& aMailBoxId, |
|
868 const TFSMailMsgId& aParentFolderId , |
|
869 const TFSMailMsgId& aMessageId, |
|
870 const TFSMailMsgId& aParentPartId , |
|
871 const TFSMailMsgId& aPartId , |
|
872 MFSMailRequestObserver& aOperationObserver, |
|
873 const TInt aRequestId) : |
|
874 iMailBoxId( aMailBoxId ), |
|
875 iParentFolderId( aParentFolderId ), |
|
876 iMessageId( aMessageId ), |
|
877 iParentPartId( aParentPartId ), |
|
878 iPartId( aPartId ), |
|
879 iOperationObserver( aOperationObserver ), |
|
880 iRequestId( aRequestId ), |
|
881 iActionType( RemoveChild) |
|
882 { |
|
883 } |
|
884 |
|
885 /** |
|
886 * |
|
887 */ |
|
888 /*public virtual*/ CDelayedAddNewOrRemoveChildPartOp::~CDelayedAddNewOrRemoveChildPartOp() |
|
889 { |
|
890 __LOG_DESTRUCT |
|
891 if ( iContentType ) |
|
892 { |
|
893 delete iContentType; |
|
894 } |
|
895 if ( iFilePath ) |
|
896 { |
|
897 delete iFilePath; |
|
898 } |
|
899 } |
|
900 |
|
901 /** |
|
902 * |
|
903 */ |
|
904 /*private*/ |
|
905 void CDelayedAddNewOrRemoveChildPartOp::ConstructL( const TDesC& aContentType, const TDesC& aFilePath ) |
|
906 { |
|
907 __LOG_CONSTRUCT( "baseplugin", "CDelayedAddNewOrRemoveChildPartOp" ); |
|
908 iContentType = aContentType.AllocL(); |
|
909 iFilePath = aFilePath.AllocL(); |
|
910 } |
|
911 |
|
912 /** |
|
913 * |
|
914 */ |
|
915 /*private*/ void CDelayedAddNewOrRemoveChildPartOp::ExecuteOpL() |
|
916 { |
|
917 __LOG_ENTER( "ExecuteOpL" ); |
|
918 |
|
919 TFSProgress progress = { TFSProgress::EFSStatus_RequestCancelled, 0, 0, 0 }; |
|
920 progress.iError = KErrNotFound; |
|
921 TInt err(KErrNone); |
|
922 |
|
923 if( iActionType == AddNewChild) |
|
924 { |
|
925 CFSMailMessagePart* tmp = NULL; |
|
926 TRAP(err, tmp = GetPlugin().NewChildPartFromFileL(iMailBoxId,iParentFolderId, |
|
927 iMessageId,iParentPartId,iContentType->Des(),iFilePath->Des())); |
|
928 if(err == KErrNone ) |
|
929 { |
|
930 tmp->SetAttachmentNameL( iFilePath->Des() ); |
|
931 tmp->SaveL(); |
|
932 } |
|
933 //iOperationObserver will make a copy of pointer "tmp" and will own the memory. |
|
934 progress.iParam = tmp; |
|
935 } |
|
936 else |
|
937 { |
|
938 TRAP(err, GetPlugin().RemoveChildPartL(iMailBoxId,iParentFolderId, |
|
939 iMessageId,iParentPartId,iPartId)); |
|
940 } |
|
941 |
|
942 if( err == KErrNone ) |
|
943 { |
|
944 //clear plugin cache so that childparts of message can be updated next time with proper count |
|
945 GetPlugin().ResetCache(); |
|
946 progress.iError = KErrNone; |
|
947 progress.iProgressStatus = TFSProgress::EFSStatus_RequestComplete; |
|
948 } |
|
949 |
|
950 iOperationObserver.RequestResponseL( progress, iRequestId ); |
|
951 |
|
952 __LOG_EXIT; |
|
953 } |
797 //</qmail> |
954 //</qmail> |