email_plat/email_client_api/inc/memailmailbox.h
branchRCL_3
changeset 64 3533d4323edc
equal deleted inserted replaced
63:d189ee25cf9d 64:3533d4323edc
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: Email message API
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef MEMAILMAILBOX_H
       
    19 #define MEMAILMAILBOX_H
       
    20 
       
    21 #include <memailfolder.h>
       
    22 
       
    23 namespace EmailInterface {
       
    24 
       
    25 class MEmailAddress;
       
    26 class MEmailMessage;
       
    27 class MMailboxContentObserver;
       
    28 class MEmailMessageSearchAsync;
       
    29 class MMailboxSyncObserver;
       
    30 
       
    31 /**
       
    32 * Email mailbox interface.
       
    33 * MEmailMailbox cannot be instantiated with factory method. Use
       
    34 * MEmailClientApi::MailboxL to obtain a configured mailbox.
       
    35 * @since S60 v5.0
       
    36 */
       
    37 class MEmailMailbox : public MEmailInterface
       
    38 {
       
    39 public:
       
    40     /**
       
    41     * Returns mailbox identifier
       
    42     * @return mailbox id
       
    43     */
       
    44     virtual TMailboxId MailboxId() const = 0;
       
    45 
       
    46     /**
       
    47     * Returns own address of the mailbox. Role is set to ESender
       
    48     * @return address, ownership not transferred
       
    49     */
       
    50     virtual MEmailAddress* AddressL() const = 0;
       
    51 
       
    52     /**
       
    53     * Returns mailbox name
       
    54     * @return mailbox name
       
    55     */
       
    56     virtual TPtrC MailboxName() const = 0;
       
    57 
       
    58     /** returns root level folders of this mailbox, to get subfolders of specific
       
    59      * folder, use MEmailFolder::GetSubfolders
       
    60      * @param aFolders pointer array of folders, ownership of folders is
       
    61      * transferred
       
    62      * @return number of folders in aFolders or Symbian OS error code
       
    63      */
       
    64     virtual TInt GetFoldersL( RFolderArray& aFolders ) const = 0;
       
    65 
       
    66     /**
       
    67     * Returns folder by folder id
       
    68     * @param folder id
       
    69     * @return pointer to folder, ownership is transferred
       
    70     */
       
    71     virtual MEmailFolder* FolderL( const TFolderId& aFolderId ) const = 0;
       
    72 
       
    73     /**
       
    74     * Returns folder by type
       
    75     * @param type other than EOther because it is ambiguous
       
    76     * @return pointer to folder, ownership is transferred
       
    77     * @exception KErrNotFound if folder of requested type is not found
       
    78     */
       
    79     virtual MEmailFolder* FolderByTypeL(
       
    80         const TFolderType aFolderType ) const = 0;
       
    81 
       
    82     /**
       
    83     * Returns existing message in this mailbox.
       
    84     * @param aMessageId a message id returned by GetMessagesIdsL()
       
    85     * @return new message object, ownership transferred.
       
    86     * @exception
       
    87     */
       
    88     virtual MEmailMessage* MessageL( const TMessageId& aMessageId ) = 0;
       
    89 
       
    90     /**
       
    91      * Creates new message in 'drafts' folder. Ownership is transferred
       
    92      * @return new draft message
       
    93      */
       
    94     virtual MEmailMessage* CreateDraftMessageL() const = 0;
       
    95 
       
    96     /**
       
    97      * Creates reply message. Ownership is transferred
       
    98      * @param aMessageId original message
       
    99      * @param aReplyToAll If ETrue, all recipients of the original message are
       
   100      *        added to reply message.
       
   101      * @return new draft message
       
   102      */
       
   103     virtual MEmailMessage* CreateReplyMessageL(
       
   104         const TMessageId& aMessageId,
       
   105         const TBool aReplyToAll = ETrue  ) const = 0;
       
   106 
       
   107     /**
       
   108      * Creates forward message. Ownership is transferred
       
   109      * @param aMessageId original message
       
   110      * @return new draft message
       
   111      */
       
   112     virtual MEmailMessage* CreateForwardMessageL(
       
   113         const TMessageId& aMessageId ) const = 0;
       
   114 
       
   115     /**
       
   116      * Starts synchronising this mailbox
       
   117      * @param aObserver observer called back when sync is complete
       
   118      */
       
   119     virtual void SynchroniseL( MMailboxSyncObserver& aObserver ) = 0;
       
   120 
       
   121     /**
       
   122      * Cancels mailbox synchronisation.
       
   123      */
       
   124     virtual void CancelSynchronise() = 0;
       
   125 
       
   126     /**
       
   127     * Returns interface for searching messages from this mailbox. Ownership
       
   128     * is transferred.
       
   129     * @return message search interface pointer
       
   130     */
       
   131     virtual MEmailMessageSearchAsync* MessageSearchL() = 0;
       
   132 
       
   133     /**
       
   134      * Launches Email application and shows inbox.
       
   135      * The method follows "fire and forget" pattern, returns immediately.
       
   136      */
       
   137     virtual void ShowInboxL() = 0;
       
   138 
       
   139     /** Launches email editor and returns immediately.
       
   140      * The method follows "fire and forget" pattern, returns immediately.
       
   141      */
       
   142     virtual void EditNewMessageL() = 0;
       
   143     
       
   144     /** Register mailbox observer 
       
   145      * @param aObserver observer called back when changes in mailbox (new message,
       
   146      * messages changes or messages deleted).
       
   147      * */
       
   148     virtual void RegisterObserverL( MMailboxContentObserver& aObserver ) = 0;
       
   149         
       
   150     /** 
       
   151      * Unregister mailbox observe.r 
       
   152      */
       
   153     virtual void UnregisterObserver( MMailboxContentObserver& aObserver ) = 0;
       
   154 
       
   155 };
       
   156 
       
   157 } // namespace EmailInterface
       
   158 
       
   159 #endif // MEMAILMAILBOX_H