emailservices/emailclientapi/inc/emailmailbox.h
author hgs
Mon, 23 Aug 2010 23:32:31 +0300
changeset 62 a8c646b56683
parent 47 f83bd4ae1fe3
permissions -rw-r--r--
201033
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
47
hgs
parents:
diff changeset
     1
/*
hgs
parents:
diff changeset
     2
* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). 
hgs
parents:
diff changeset
     3
* All rights reserved.
hgs
parents:
diff changeset
     4
* This component and the accompanying materials are made available
hgs
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
hgs
parents:
diff changeset
     6
* which accompanies this distribution, and is available
hgs
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
hgs
parents:
diff changeset
     8
*
hgs
parents:
diff changeset
     9
* Initial Contributors:
hgs
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
hgs
parents:
diff changeset
    11
*
hgs
parents:
diff changeset
    12
* Contributors:
hgs
parents:
diff changeset
    13
*
hgs
parents:
diff changeset
    14
* Description: This file implements class CEmailMailbox.
hgs
parents:
diff changeset
    15
*
hgs
parents:
diff changeset
    16
*/
hgs
parents:
diff changeset
    17
hgs
parents:
diff changeset
    18
#ifndef EMAILMAILBOX_H
hgs
parents:
diff changeset
    19
#define EMAILMAILBOX_H
hgs
parents:
diff changeset
    20
62
hgs
parents: 47
diff changeset
    21
#include "CFSMailCommon.h"
47
hgs
parents:
diff changeset
    22
#include <memailmailbox.h>
62
hgs
parents: 47
diff changeset
    23
#include "MFSMailEventObserver.h"
hgs
parents: 47
diff changeset
    24
#include "MFSMailRequestObserver.h"
47
hgs
parents:
diff changeset
    25
#include "mmailboxcontentobserver.h"
hgs
parents:
diff changeset
    26
hgs
parents:
diff changeset
    27
using namespace EmailInterface;
hgs
parents:
diff changeset
    28
hgs
parents:
diff changeset
    29
class CFSMailBox;
hgs
parents:
diff changeset
    30
class CFSMailAddress;
hgs
parents:
diff changeset
    31
class CFSMailPlugin;
hgs
parents:
diff changeset
    32
class CPluginData;
hgs
parents:
diff changeset
    33
class CEmailAddress;
hgs
parents:
diff changeset
    34
hgs
parents:
diff changeset
    35
NONSHARABLE_CLASS( CEmailMailbox ) : 
hgs
parents:
diff changeset
    36
    public CBase, 
hgs
parents:
diff changeset
    37
    public MEmailMailbox
hgs
parents:
diff changeset
    38
{
hgs
parents:
diff changeset
    39
public:
hgs
parents:
diff changeset
    40
    
hgs
parents:
diff changeset
    41
    static CEmailMailbox* NewL( 
hgs
parents:
diff changeset
    42
        CPluginData& aPluginData,
hgs
parents:
diff changeset
    43
        const TMailboxId& aMailboxId );
hgs
parents:
diff changeset
    44
    
hgs
parents:
diff changeset
    45
    ~CEmailMailbox();           
hgs
parents:
diff changeset
    46
hgs
parents:
diff changeset
    47
public: // from MEmailInterface
hgs
parents:
diff changeset
    48
    TEmailTypeId InterfaceId() const;
hgs
parents:
diff changeset
    49
    
hgs
parents:
diff changeset
    50
    void Release();
hgs
parents:
diff changeset
    51
    
hgs
parents:
diff changeset
    52
public:    // from MEmailMailbox
hgs
parents:
diff changeset
    53
    /**@see MEmailMailbox */
hgs
parents:
diff changeset
    54
    TMailboxId MailboxId() const;
hgs
parents:
diff changeset
    55
    
hgs
parents:
diff changeset
    56
    /**@see MEmailMailbox */
hgs
parents:
diff changeset
    57
    MEmailAddress* AddressL() const;
hgs
parents:
diff changeset
    58
    
hgs
parents:
diff changeset
    59
    /**@see MEmailMailbox */
hgs
parents:
diff changeset
    60
    TPtrC MailboxName() const;
hgs
parents:
diff changeset
    61
    
hgs
parents:
diff changeset
    62
    /**@see MEmailMailbox */
hgs
parents:
diff changeset
    63
    TInt GetFoldersL( RFolderArray& aFolders ) const;
hgs
parents:
diff changeset
    64
hgs
parents:
diff changeset
    65
    /**@see MEmailMailbox */
hgs
parents:
diff changeset
    66
    MEmailFolder* FolderL( const TFolderId& aFolderId ) const;
hgs
parents:
diff changeset
    67
    
hgs
parents:
diff changeset
    68
    /**@see MEmailMailbox */
hgs
parents:
diff changeset
    69
    MEmailFolder* FolderByTypeL( 
hgs
parents:
diff changeset
    70
        const TFolderType aFolderType ) const;
hgs
parents:
diff changeset
    71
        
hgs
parents:
diff changeset
    72
    /**@see MEmailMailbox */
hgs
parents:
diff changeset
    73
    MEmailMessage* MessageL( const TMessageId& aMessageId );
hgs
parents:
diff changeset
    74
    
hgs
parents:
diff changeset
    75
    /**@see MEmailMailbox */
hgs
parents:
diff changeset
    76
    MEmailMessage* CreateDraftMessageL() const;
hgs
parents:
diff changeset
    77
    
hgs
parents:
diff changeset
    78
    /**@see MEmailMailbox */
hgs
parents:
diff changeset
    79
    MEmailMessage* CreateReplyMessageL( const TMessageId& aMessageId, const TBool aReplyToAll = ETrue ) const;
hgs
parents:
diff changeset
    80
    
hgs
parents:
diff changeset
    81
    /**@see MEmailMailbox */
hgs
parents:
diff changeset
    82
    MEmailMessage* CreateForwardMessageL( const TMessageId& aMessageId ) const;
hgs
parents:
diff changeset
    83
    
hgs
parents:
diff changeset
    84
    /**@see MEmailMailbox */
hgs
parents:
diff changeset
    85
    void SynchroniseL( MMailboxSyncObserver& aObserver );
hgs
parents:
diff changeset
    86
        
hgs
parents:
diff changeset
    87
    /**@see MEmailMailbox */
hgs
parents:
diff changeset
    88
    void CancelSynchronise();
hgs
parents:
diff changeset
    89
    
hgs
parents:
diff changeset
    90
    /**@see MEmailMailbox */
hgs
parents:
diff changeset
    91
    void RegisterObserverL( MMailboxContentObserver& aObserver );
hgs
parents:
diff changeset
    92
        
hgs
parents:
diff changeset
    93
    /**@see MEmailMailbox */
hgs
parents:
diff changeset
    94
    void UnregisterObserver( MMailboxContentObserver& aObserver );
hgs
parents:
diff changeset
    95
    
hgs
parents:
diff changeset
    96
    /**@see MEmailMailbox */
hgs
parents:
diff changeset
    97
    MEmailMessageSearchAsync* MessageSearchL();
hgs
parents:
diff changeset
    98
hgs
parents:
diff changeset
    99
    /**@see MEmailMailbox */
hgs
parents:
diff changeset
   100
    void ShowInboxL();
hgs
parents:
diff changeset
   101
hgs
parents:
diff changeset
   102
    /**@see MEmailMailbox */
hgs
parents:
diff changeset
   103
    void EditNewMessageL();
hgs
parents:
diff changeset
   104
    
hgs
parents:
diff changeset
   105
hgs
parents:
diff changeset
   106
public: // new methods
hgs
parents:
diff changeset
   107
hgs
parents:
diff changeset
   108
private:       
hgs
parents:
diff changeset
   109
    TFSMailMsgId FsMailboxId() const;
hgs
parents:
diff changeset
   110
    
hgs
parents:
diff changeset
   111
private: // constructors
hgs
parents:
diff changeset
   112
    CEmailMailbox( CPluginData& aPluginData, const TMailboxId& aPlugin );
hgs
parents:
diff changeset
   113
    
hgs
parents:
diff changeset
   114
    void ConstructL();
hgs
parents:
diff changeset
   115
hgs
parents:
diff changeset
   116
private: // inner class for mailbox event handling
hgs
parents:
diff changeset
   117
    class TObserverEventMapper : public MFSMailEventObserver
hgs
parents:
diff changeset
   118
    {
hgs
parents:
diff changeset
   119
    public:
hgs
parents:
diff changeset
   120
        TObserverEventMapper( CFSMailPlugin* aPlugin, TUid aPluginUid, const TMailboxId& aMailboxId );
hgs
parents:
diff changeset
   121
        ~TObserverEventMapper();
hgs
parents:
diff changeset
   122
        void AddObserverL( MMailboxContentObserver& aObserver );
hgs
parents:
diff changeset
   123
        void RemoveObserver( MMailboxContentObserver& aObserver );
hgs
parents:
diff changeset
   124
    public: // from MFSMailEventObserver
hgs
parents:
diff changeset
   125
        virtual void EventL( TFSMailEvent aEvent, TFSMailMsgId aMailbox, TAny* aParam1, TAny* aParam2, TAny* aParam3 );
hgs
parents:
diff changeset
   126
        typedef void ( CEmailMailbox::TObserverEventMapper::*TEventMapFunc)( TMailboxId, TAny*, TAny*, TAny* );
hgs
parents:
diff changeset
   127
    private: // mappers, so say we all!
hgs
parents:
diff changeset
   128
        void ConvertParamsL( TMailboxId aMailbox, TAny* aParam1, TAny* aParam2, REmailMessageIdArray& aMessageIds, TFolderId& aFolderId );
hgs
parents:
diff changeset
   129
        void IgnoreEventL( TMailboxId aMailbox, TAny* aParam1, TAny* aParam2, TAny* aParam3 );
hgs
parents:
diff changeset
   130
        void NewMessageL( TMailboxId aMailbox, TAny* aParam1, TAny* aParam2, TAny* aParam3 );
hgs
parents:
diff changeset
   131
        void MessageChangedL( TMailboxId aMailbox, TAny* aParam1, TAny* aParam2, TAny* aParam3 );
hgs
parents:
diff changeset
   132
        void MessageDeletedL( TMailboxId aMailbox, TAny* aParam1, TAny* aParam2, TAny* aParam3 );
hgs
parents:
diff changeset
   133
        void MessageMoved( TMailboxId aMailbox, TAny* aParam1, TAny* aParam2, TAny* aParam3 );
hgs
parents:
diff changeset
   134
        void MessageCopiedL( TMailboxId aMailbox, TAny* aParam1, TAny* aParam2, TAny* aParam3 );
hgs
parents:
diff changeset
   135
        void NewFolderL( TMailboxId aMailbox, TAny* aParam1, TAny* aParam2, TAny* aParam3 );
hgs
parents:
diff changeset
   136
        void FolderChangeL( TMailboxId aMailbox, TAny* aParam1, TAny* aParam2, TAny* aParam3 );
hgs
parents:
diff changeset
   137
        void FoldersDeletedL( TMailboxId aMailbox, TAny* aParam1, TAny* aParam2, TAny* aParam3 );
hgs
parents:
diff changeset
   138
        void FoldersMovedL( TMailboxId aMailbox, TAny* aParam1, TAny* aParam2, TAny* aParam3 );
hgs
parents:
diff changeset
   139
        void ExceptionL( TMailboxId aMailbox, TAny* aParam1, TAny* aParam2, TAny* aParam3 );
hgs
parents:
diff changeset
   140
    
hgs
parents:
diff changeset
   141
    private:                                                                                                                         
hgs
parents:
diff changeset
   142
        static TBool Equals( const MMailboxContentObserver& a1, const MMailboxContentObserver& a2 );
hgs
parents:
diff changeset
   143
    private:
hgs
parents:
diff changeset
   144
        CFSMailPlugin*  iPlugin;
hgs
parents:
diff changeset
   145
        TFSMailMsgId    iFsMailboxId;
hgs
parents:
diff changeset
   146
        RPointerArray<MMailboxContentObserver> iClientObservers;
hgs
parents:
diff changeset
   147
    };
hgs
parents:
diff changeset
   148
    class CEmailRequestObserver: public CBase,
hgs
parents:
diff changeset
   149
                                 public MFSMailRequestObserver                                 
hgs
parents:
diff changeset
   150
        {
hgs
parents:
diff changeset
   151
    public:
hgs
parents:
diff changeset
   152
        CEmailRequestObserver();
hgs
parents:
diff changeset
   153
        
hgs
parents:
diff changeset
   154
        void RequestResponseL( TFSProgress aEvent, TInt aRequestId );
hgs
parents:
diff changeset
   155
        void SetObserverL( MMailboxSyncObserver* aObserver );
hgs
parents:
diff changeset
   156
    private:
hgs
parents:
diff changeset
   157
        MMailboxSyncObserver* iObserver;
hgs
parents:
diff changeset
   158
        };
hgs
parents:
diff changeset
   159
        
hgs
parents:
diff changeset
   160
private:        
hgs
parents:
diff changeset
   161
hgs
parents:
diff changeset
   162
    CPluginData&    iPluginData;
hgs
parents:
diff changeset
   163
    
hgs
parents:
diff changeset
   164
    CFSMailPlugin*  iPlugin;
hgs
parents:
diff changeset
   165
hgs
parents:
diff changeset
   166
    TMailboxId      iMailboxId;
hgs
parents:
diff changeset
   167
    
hgs
parents:
diff changeset
   168
    TObserverEventMapper* iEventMapper;
hgs
parents:
diff changeset
   169
hgs
parents:
diff changeset
   170
    mutable CEmailAddress* iAddress;
hgs
parents:
diff changeset
   171
hgs
parents:
diff changeset
   172
    CFSMailBox*     iFsMailbox;
hgs
parents:
diff changeset
   173
    
hgs
parents:
diff changeset
   174
    CEmailRequestObserver* iSyncObserver;    
hgs
parents:
diff changeset
   175
    
hgs
parents:
diff changeset
   176
    TInt iRequestId;
hgs
parents:
diff changeset
   177
};
hgs
parents:
diff changeset
   178
    
hgs
parents:
diff changeset
   179
#endif // EMAILMAILBOX_H
hgs
parents:
diff changeset
   180
hgs
parents:
diff changeset
   181
// End of file