emailservices/emailframework/inc/CFSMailPlugin.h
branchRCL_3
changeset 24 d189ee25cf9d
parent 22 d620048b4810
child 25 3533d4323edc
equal deleted inserted replaced
23:dcf0eedfc1a3 24:d189ee25cf9d
    16 */
    16 */
    17 
    17 
    18 #ifndef CFSFWMAILPLUGIN_H
    18 #ifndef CFSFWMAILPLUGIN_H
    19 #define CFSFWMAILPLUGIN_H
    19 #define CFSFWMAILPLUGIN_H
    20 
    20 
    21 #include <ecom/ecom.h>
    21 #include <ecom.h>
    22 
    22 
    23 #include "mfsmailrequestobserver.h"
    23 //<cmail>
    24 #include "mfsmaileventobserver.h"
    24 #include "MFSMailRequestObserver.h"
    25 #include "cfsmailbox.h"
    25 #include "MFSMailEventObserver.h"
    26 #include "cfsmailplugin.hrh"
    26 #include "CFSMailBox.h"
       
    27 #include "CFSMailPlugin.hrh"
    27 #include "cemailextensionbase.h"
    28 #include "cemailextensionbase.h"
       
    29 //</cmail>
       
    30 
    28 // constants
    31 // constants
    29 const TUid KFSMailPluginInterface = { FSMAILPLUGININTERFACE };
    32 const TUid KFSMailPluginInterface = { FSMAILPLUGININTERFACE };
    30 _LIT8( KFSPluginInterfaceImplementationType, "Plug-In Interface / Freestyle Email Framework");
    33 _LIT8( KFSPluginInterfaceImplementationType, "Plug-In Interface / Freestyle Email Framework");
       
    34 
       
    35 class MFSMailIterator;
    31 
    36 
    32 /**
    37 /**
    33  *  Freestyle Email Framework Plugin Interface
    38  *  Freestyle Email Framework Plugin Interface
    34  *
    39  *
    35  *  class MFSMailPlugin defines functions used by email framework
    40  *  class MFSMailPlugin defines functions used by email framework
    36  *  and implemented by plugin implementor.
    41  *  and implemented by plugin implementor.
    37  *
    42  *
    38  *  Plugin implementor inherits from class CFSMailPlugin,
    43  *  Plugin implementor inherits from class CFSMailPlugin,
    39  *  but plugin load medhods are provided by framework in file cfsmailplugin.inl
    44  *  but plugin load medhods are provided by framework in file CFSMailPlugin.inl
    40  *  CFSMailPlugin,cfsmailplugin.inl are exported by framework
    45  *  CFSMailPlugin,CFSMailPlugin.inl are exported by framework
    41  *
    46  *
    42  *  @lib FSFWCommonLib
    47  *  @lib FSFWCommonLib
    43  *
    48  *
    44  */
    49  */
    45 class CFSMailPlugin : public CExtendableEmail
    50 NONSHARABLE_CLASS ( CFSMailPlugin ) : public CExtendableEmail
    46     {
    51     {
    47 
    52 
    48 public: // Methods
    53 public: // Methods
    49 
    54 
    50     /**
    55     /**
   126      * @param aMailBoxId defines mailbox
   131      * @param aMailBoxId defines mailbox
   127      * @param aOperationObserver is client provided observer that
   132      * @param aOperationObserver is client provided observer that
   128      *        will receive progress notifications during the operation.
   133      *        will receive progress notifications during the operation.
   129      * @param aRequestId identifies asynchronous request if parallel
   134      * @param aRequestId identifies asynchronous request if parallel
   130      * requests exist
   135      * requests exist
       
   136      * @param aSilentConnection defines if connection is needed to be 
       
   137      *        silent connection or non-silent one (default).
   131      */
   138      */
   132      virtual void RefreshNowL( const TFSMailMsgId& aMailBoxId,
   139      virtual void RefreshNowL( const TFSMailMsgId& aMailBoxId,
   133                                MFSMailRequestObserver& aOperationObserver,
   140                                MFSMailRequestObserver& aOperationObserver,
   134                                TInt aRequestId ) = 0;
   141                                TInt aRequestId,
       
   142                                const TBool aSilentConnection=EFalse ) = 0;
   135 
   143 
   136     /**
   144     /**
   137      * Returns last synchronization operation status.
   145      * Returns last synchronization operation status.
   138      *
   146      *
   139      * @param aMailBoxId mailbox id
   147      * @param aMailBoxId mailbox id
   522      * @param aMessages ids of messages to be deleted
   530      * @param aMessages ids of messages to be deleted
   523      */
   531      */
   524      virtual void DeleteMessagesByUidL( const TFSMailMsgId& aMailBoxId,
   532      virtual void DeleteMessagesByUidL( const TFSMailMsgId& aMailBoxId,
   525                                         const TFSMailMsgId& aFolderId,
   533                                         const TFSMailMsgId& aFolderId,
   526                                         const RArray<TFSMailMsgId>& aMessages ) = 0;
   534                                         const RArray<TFSMailMsgId>& aMessages ) = 0;
   527 
   535      
       
   536 // <qmail>
       
   537      /**
       
   538       * deletes email defined by message id
       
   539       *
       
   540       * @param aMailBoxId id of the mailbox containing email
       
   541       * @param aFolderId email parent folder id
       
   542       * @param aMessages ids of messages to be deleted
       
   543       * @param aOperationObserver Observer for the operation 
       
   544       * @param aRequestId id of the operation
       
   545       * @return KErrNone if this method is supported, KErrNotSupported if not
       
   546       */
       
   547       virtual void DeleteMessagesByUidL( const TFSMailMsgId& aMailBoxId,
       
   548                                          const TFSMailMsgId& aFolderId,
       
   549                                          const RArray<TFSMailMsgId>& aMessages,
       
   550                                          MFSMailRequestObserver& aOperationObserver,
       
   551                                          const TInt aRequestId );
       
   552 // </qmail>
       
   553       
   528     /**
   554     /**
   529      * creates new email template into drafts folder
   555      * creates new email template into drafts folder
   530      *
   556      *
   531      * @param aMailBoxId id of the mailbox where new email is created
   557      * @param aMailBoxId id of the mailbox where new email is created
   532      * @return email object to be modified by user, ownership is transferred to user
   558      * @return email object to be modified by user, ownership is transferred to user
   533      */
   559      */
   534      virtual CFSMailMessage* CreateMessageToSendL( const TFSMailMsgId& aMailBoxId ) = 0;
   560      virtual CFSMailMessage* CreateMessageToSendL( const TFSMailMsgId& aMailBoxId ) = 0;
       
   561 
       
   562 // <qmail>
       
   563      /**
       
   564       * Asynchronous creation of new email template into drafts folder. When the operation
       
   565       * finishes, RequestResponseL is called on the observer and the created message is 
       
   566       * passed along with the TFSProgress data. It is not necessary for a plugin to 
       
   567 	  * implement this method if using the synchronous version does not cause performance
       
   568 	  * problems for the UI or general problems for the application. UI uses these methods
       
   569 	  * via an operation class NmMessageCreationOperation (see NmailUiEngine). If a plugin
       
   570 	  * doesn't implement this method the operation class automatically selects the
       
   571 	  * synchronous version.
       
   572       *
       
   573       * @param aMailBoxId id of the mailbox where new email is created
       
   574       * @param aOperationObserver Observer for the operation 
       
   575       * @param aRequestId id of the operation
       
   576 	  * @return KErrNone if this method is supported, KErrNotSupported if not
       
   577       */
       
   578      virtual void CreateMessageToSendL(
       
   579 	     const TFSMailMsgId& aMailBoxId,
       
   580          MFSMailRequestObserver& aOperationObserver,
       
   581          const TInt aRequestId );
       
   582 // </qmail>
   535 
   583 
   536     /**
   584     /**
   537      * creates new email template to drafts folder to be forwarded
   585      * creates new email template to drafts folder to be forwarded
   538      *
   586      *
   539      * @param aMailBoxId id of the mailbox where new email is created
   587      * @param aMailBoxId id of the mailbox where new email is created
   541      * @return email object to be modified by user, ownership is transferred to user
   589      * @return email object to be modified by user, ownership is transferred to user
   542      */
   590      */
   543      virtual CFSMailMessage* CreateForwardMessageL( const TFSMailMsgId& aMailBoxId,
   591      virtual CFSMailMessage* CreateForwardMessageL( const TFSMailMsgId& aMailBoxId,
   544                                                     const TFSMailMsgId& aOriginalMessageId,
   592                                                     const TFSMailMsgId& aOriginalMessageId,
   545                                                     const TDesC& aHeaderDescriptor = KNullDesC ) = 0;
   593                                                     const TDesC& aHeaderDescriptor = KNullDesC ) = 0;
       
   594 	 
       
   595 // <qmail>
       
   596      /**
       
   597       * Asynchronous creation of new forwarded email into drafts folder. When the operation
       
   598       * finishes, RequestResponseL is called on the observer and the created message is 
       
   599       * passed along with the TFSProgress data.
       
   600       *
       
   601       * @param aMailBoxId id of the mailbox where new email is created
       
   602       * @param aOriginalMessageId if of the (original) message,which is forwarded
       
   603       * @param aOperationObserver Observer for the operation 
       
   604       * @param aRequestId id of the operation
       
   605       * @param aHeaderDescriptor user can give quote headers data to plugin as
       
   606       *  parameter if needed
       
   607       * @return email object to be modified by user, ownership is transferred to user
       
   608       */
       
   609       virtual void CreateForwardMessageL( const TFSMailMsgId& aMailBoxId,
       
   610                                           const TFSMailMsgId& aOriginalMessageId,
       
   611                                           MFSMailRequestObserver& aOperationObserver,
       
   612                                           const TInt aRequestId,
       
   613                                           const TDesC& aHeaderDescriptor = KNullDesC );
       
   614 // </qmail>
   546 
   615 
   547     /**
   616     /**
   548      * creates new email template to drafts folder to be replied
   617      * creates new email template to drafts folder to be replied
   549      *
   618      *
   550      * @param aMailBoxId id of the mailbox where new email is created
   619      * @param aMailBoxId id of the mailbox where new email is created
   558      virtual CFSMailMessage* CreateReplyMessageL( const TFSMailMsgId& aMailBoxId,
   627      virtual CFSMailMessage* CreateReplyMessageL( const TFSMailMsgId& aMailBoxId,
   559                                                   const TFSMailMsgId& aOriginalMessageId,
   628                                                   const TFSMailMsgId& aOriginalMessageId,
   560                                                   const TBool aReplyToAll,
   629                                                   const TBool aReplyToAll,
   561                                                   const TDesC& aHeaderDescriptor = KNullDesC) = 0;
   630                                                   const TDesC& aHeaderDescriptor = KNullDesC) = 0;
   562 
   631 
       
   632 // <qmail>	 
       
   633      /**
       
   634       * Asynchronous creation of new mail template to drafts folder to be replied. When the operation
       
   635       * finishes, RequestResponseL is called on the observer and the created message is 
       
   636       * passed along with the TFSProgress data.
       
   637       *
       
   638       * @param aMailBoxId id of the mailbox where new email is created
       
   639       * @param aOriginalMessageId id of original email,which is replied to
       
   640       * @param aReplyToAll true if reply to all is wanted
       
   641       * @param aOperationObserver Observer for the operation 
       
   642       * @param aRequestId id of the operation
       
   643       * @param aHeaderDescriptor user can give quote headers data to plugin as
       
   644       *        parameter if needed
       
   645       *
       
   646       * @return email object to be modified by user, ownership is transferred to user
       
   647       */
       
   648      virtual void CreateReplyMessageL( const TFSMailMsgId& aMailBoxId,
       
   649                                        const TFSMailMsgId& aOriginalMessageId,
       
   650                                        const TBool aReplyToAll,
       
   651                                        MFSMailRequestObserver& aOperationObserver,
       
   652                                        const TInt aRequestId,
       
   653                                        const TDesC& aHeaderDescriptor = KNullDesC);
       
   654 // </qmail>	 
       
   655 
   563     /**
   656     /**
   564      * stores email object data to message store after modifications (commit)
   657      * stores email object data to message store after modifications (commit)
   565      *
   658      *
   566      * @param aMailBoxId id of the mailbox where email is stored
   659      * @param aMailBoxId id of the mailbox where email is stored
   567      * @param aMessage email data to be stored by plugin
   660      * @param aMessage email data to be stored by plugin
   568      */
   661      */
   569      virtual void StoreMessageL( const TFSMailMsgId& aMailBoxId,
   662      virtual void StoreMessageL( const TFSMailMsgId& aMailBoxId,
   570                                  CFSMailMessage& aMessage ) = 0;
   663                                  CFSMailMessage& aMessage ) = 0;
   571 
   664 
       
   665 
       
   666     // <qmail>
       
   667     /**
       
   668     * Asynchronous message storing
       
   669     *
       
   670     * @param aMailBoxId id of the mailbox where the messages are
       
   671     * @param aOperationObserver Observer for the operation 
       
   672     * @param aRequestId id of the operation
       
   673     */
       
   674     virtual void StoreMessagesL(
       
   675         const TFSMailMsgId& aMailBoxId,
       
   676         RPointerArray<CFSMailMessage> &messages,
       
   677         MFSMailRequestObserver& aOperationObserver,
       
   678         const TInt aRequestId ) = 0;
       
   679     // </qmail>
       
   680     
   572     /**
   681     /**
   573      * starts email fetching from email server
   682      * starts email fetching from email server
   574      *
   683      *
   575      * @param aMailBoxId id of the mailbox where email is located
   684      * @param aMailBoxId id of the mailbox where email is located
   576      * @param aFolderId id of the parent folder containing email
   685      * @param aFolderId id of the parent folder containing email
   696                                                         const TFSMailMsgId& aMessageId,
   805                                                         const TFSMailMsgId& aMessageId,
   697                                                         const TFSMailMsgId& aParentPartId,
   806                                                         const TFSMailMsgId& aParentPartId,
   698                                                         const TDesC& aContentType,
   807                                                         const TDesC& aContentType,
   699                                                         const TDesC& aFilePath) = 0;
   808                                                         const TDesC& aFilePath) = 0;
   700 
   809 
   701 
   810 // <qmail>
   702      /**
   811 	    /**
   703       * Creates and adds a new child part from file to given email part.
   812 	     * Creates and adds a new child part from file to given email part.
   704       *
   813 	     * 
   705       * @param aMailBoxId id of the mailbox where parent part is located
   814 	     * @param aMailBoxId id of the mailbox where parent part is located
   706       * @param aParentFolderId id of the parent folder where email is located
   815 	     * @param aParentFolderId id of the parent folder where email is located
   707       * @param aMessageId id of the email parent part belongs to
   816 	     * @param aMessageId id of the email parent part belongs to
   708       * @param aParentPartId id of the parent part of the new part
   817 	     * @param aParentPartId id of the parent part of the new part
   709       * @param aInsertBefore id of existing part that new part should precede.
   818 	     * @param aInsertBefore id of existing part that new part should precede.
   710       * If aInsertBefore is NULL id then new part is added as last.
   819 	     * If aInsertBefore is NULL id then new part is added as last.
   711       * @param aContentType content type of the new message part
   820 	     * @param aContentType content type of the new message part
   712       * @param aFile access to file containing new child part contents,
   821 	     * @param aFilePath file containing new child part contents
   713       *  ownership is transferred
   822          * @param aOperationObserver Observer for the operation 
   714       *
   823          * @param aRequestId id of the operation
   715       * return new child part object, ownership is transferred to user
   824 	     *
   716       */
   825 	     * return new child part object, ownership is transferred to user
   717       virtual CFSMailMessagePart* NewChildPartFromFileL( const TFSMailMsgId& aMailBoxId,
   826 	     */        
   718                                                          const TFSMailMsgId& aParentFolderId,
   827         virtual void NewChildPartFromFileL( const TFSMailMsgId& aMailBoxId,
   719                                                          const TFSMailMsgId& aMessageId,
   828 	                                        const TFSMailMsgId& aParentFolderId,
   720                                                          const TFSMailMsgId& aParentPartId,
   829 	                                        const TFSMailMsgId& aMessageId,
   721                                                          const TDesC& aContentType,
   830 	                                        const TFSMailMsgId& aParentPartId,
   722                                                          RFile& aFile ) = 0;
   831 	                                        const TDesC& aContentType,
       
   832 	                                        const TDesC& aFilePath,
       
   833 	                                        MFSMailRequestObserver& aOperationObserver,
       
   834 	                                        const TInt aRequestId );
       
   835 // </qmail>
       
   836 	 
       
   837 	 /**
       
   838 	  * Creates and adds a new child part from file to given email part.
       
   839 	  * 
       
   840 	  * @param aMailBoxId id of the mailbox where parent part is located
       
   841 	  * @param aParentFolderId id of the parent folder where email is located
       
   842 	  * @param aMessageId id of the email parent part belongs to
       
   843 	  * @param aParentPartId id of the parent part of the new part
       
   844 	  * @param aInsertBefore id of existing part that new part should precede.
       
   845 	  * If aInsertBefore is NULL id then new part is added as last.
       
   846 	  * @param aContentType content type of the new message part
       
   847 	  * @param aFile access to file containing new child part contents,
       
   848 	  *  ownership is transferred
       
   849 	  *
       
   850 	  * return new child part object, ownership is transferred to user
       
   851 	  */        
       
   852 	  virtual CFSMailMessagePart* NewChildPartFromFileL( const TFSMailMsgId& aMailBoxId, 
       
   853 	                                                     const TFSMailMsgId& aParentFolderId, 
       
   854 	                                                     const TFSMailMsgId& aMessageId, 
       
   855 	                                                     const TFSMailMsgId& aParentPartId, 
       
   856 	                                                     const TDesC& aContentType, 
       
   857 	                                                     RFile& aFile ) = 0; 
   723 
   858 
   724 
   859 
   725     /**
   860     /**
   726      * Copies given email as new child part to given email part.
   861      * Copies given email as new child part to given email part.
   727      *
   862      *
   755                                     const TFSMailMsgId& aParentFolderId,
   890                                     const TFSMailMsgId& aParentFolderId,
   756                                     const TFSMailMsgId& aMessageId,
   891                                     const TFSMailMsgId& aMessageId,
   757                                     const TFSMailMsgId& aParentPartId,
   892                                     const TFSMailMsgId& aParentPartId,
   758                                     const TFSMailMsgId& aPartId) = 0;
   893                                     const TFSMailMsgId& aPartId) = 0;
   759 
   894 
       
   895 // <qmail>
       
   896      /**
       
   897       * Removes child part (and its children, if any) from given email part
       
   898       * 
       
   899       * @param aMailBoxId id of the mailbox where email is located
       
   900       * @param aParentFolderId id of the parent folder where email is located
       
   901       * @param aMessageId id of the email parent part belongs to
       
   902       * @param aParentPartId id of the parent of the part
       
   903       * @param aPartId id of the part to removed
       
   904       * @param aOperationObserver Observer for the operation 
       
   905       * @param aRequestId id of the operation
       
   906       */        
       
   907       virtual void RemoveChildPartL( const TFSMailMsgId& aMailBoxId,
       
   908                                      const TFSMailMsgId& aParentFolderId,
       
   909                                      const TFSMailMsgId& aMessageId,
       
   910                                      const TFSMailMsgId& aParentPartId,
       
   911                                      const TFSMailMsgId& aPartId,
       
   912                                      MFSMailRequestObserver& aOperationObserver,
       
   913                                      const TInt aRequestId);
       
   914 // </qmail>
       
   915       
   760     /**
   916     /**
   761      * Returns given message part. Ownership of object is transferred to caller.
   917      * Returns given message part. Ownership of object is transferred to caller.
   762      *
   918      *
   763      * @param aMailBoxId id of the mailbox where email is located
   919      * @param aMailBoxId id of the mailbox where email is located
   764      * @param aParentFolderId id of the parent folder where email is located
   920      * @param aParentFolderId id of the parent folder where email is located
   882      */
  1038      */
   883      virtual void StoreMessagePartL( const TFSMailMsgId& aMailBoxId,
  1039      virtual void StoreMessagePartL( const TFSMailMsgId& aMailBoxId,
   884                                      const TFSMailMsgId& aParentFolderId,
  1040                                      const TFSMailMsgId& aParentFolderId,
   885                                      const TFSMailMsgId& aMessageId,
  1041                                      const TFSMailMsgId& aMessageId,
   886                                      CFSMailMessagePart& aMessagePart) = 0;
  1042                                      CFSMailMessagePart& aMessagePart) = 0;
       
  1043      
       
  1044     // <qmail>
       
  1045     /**
       
  1046      * Asynchronous message parts storing
       
  1047      *
       
  1048      * @param aMessagePart email parts data to be stored
       
  1049      * @param aOperationObserver Observer for the operation 
       
  1050      * @param aRequestId id of the operation
       
  1051      */
       
  1052     virtual void StoreMessagePartsL( RPointerArray<CFSMailMessagePart>& aMessagePart,
       
  1053                                     MFSMailRequestObserver& aOperationObserver,
       
  1054                                     const TInt aRequestId ) = 0;
       
  1055     // <//qmail>
   887 
  1056 
   888     /**
  1057     /**
   889      * unregisters request observer to cancel pending events
  1058      * unregisters request observer to cancel pending events
   890      *
  1059      *
   891      * @param aRequestId request id of the pending asynchronous request
  1060      * @param aRequestId request id of the pending asynchronous request
   897      * cancellation is deleting the message from outbox.
  1066      * cancellation is deleting the message from outbox.
   898      *
  1067      *
   899      * @param aMessage email to be sent
  1068      * @param aMessage email to be sent
   900      */
  1069      */
   901      virtual void SendMessageL( CFSMailMessage& aMessage ) = 0;
  1070      virtual void SendMessageL( CFSMailMessage& aMessage ) = 0;
       
  1071 
       
  1072 // <qmail>
       
  1073     /**
       
  1074      * Launches email sending in plugin,
       
  1075      * @param aMessage email to be sent
       
  1076      * @param aOperationObserver Operation observer
       
  1077      * @param aRequestId Request id
       
  1078      */
       
  1079      virtual void SendMessageL( CFSMailMessage& aMessage,
       
  1080                                 MFSMailRequestObserver& aOperationObserver,
       
  1081                                 const TInt aRequestId );
       
  1082 // </qmail>
   902 
  1083 
   903     /**
  1084     /**
   904      * Returns pending asynchronous request status, request is identified
  1085      * Returns pending asynchronous request status, request is identified
   905      * by request id if parallel requests exists
  1086      * by request id if parallel requests exists
   906      *
  1087      *
  1028      */     
  1209      */     
  1029     virtual void PrepareMrDescriptionL( const TFSMailMsgId& /*aMailBoxId*/,
  1210     virtual void PrepareMrDescriptionL( const TFSMailMsgId& /*aMailBoxId*/,
  1030                                         const TFSMailMsgId& /*aMessageId*/ )
  1211                                         const TFSMailMsgId& /*aMessageId*/ )
  1031                                         { return; };
  1212                                         { return; };
  1032 
  1213 
       
  1214 
       
  1215     /**
       
  1216      * Gets the signature for the given mailbox. Returns NULL if there is no signature defined for
       
  1217      * the given mailbox.
       
  1218      *
       
  1219      * @param aMailboxId mailbox id
       
  1220      */     
       
  1221     virtual HBufC* GetSignatureL( const TFSMailMsgId& aMailBoxId );
       
  1222     
  1033 protected:
  1223 protected:
  1034 
  1224 
  1035     /**
  1225     /**
  1036      * C++ default constructor.
  1226      * C++ default constructor.
  1037      */
  1227      */
  1052     TUid        iDtor_ID_Key;
  1242     TUid        iDtor_ID_Key;
  1053 
  1243 
  1054     };
  1244     };
  1055 
  1245 
  1056 //<cmail>
  1246 //<cmail>
  1057 #include "cfsmailplugin.inl"
  1247 #include "CFSMailPlugin.inl"
  1058 //</cmail>
  1248 //</cmail>
  1059 
  1249 
  1060 #endif // CFSFW_MAIL_PLUGIN_H
  1250 #endif // CFSFW_MAIL_PLUGIN_H
  1061 
  1251 
  1062 // End of File
  1252 // End of File