|
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: This file implements class CEmailMailbox. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef EMAILMAILBOX_H |
|
19 #define EMAILMAILBOX_H |
|
20 |
|
21 #include "cfsmailcommon.h" |
|
22 #include <memailmailbox.h> |
|
23 #include "mfsmaileventobserver.h" |
|
24 #include "mfsmailrequestobserver.h" |
|
25 |
|
26 using namespace EmailInterface; |
|
27 |
|
28 class CFSMailBox; |
|
29 class CFSMailAddress; |
|
30 class CFSMailPlugin; |
|
31 class CPluginData; |
|
32 class CEmailAddress; |
|
33 |
|
34 NONSHARABLE_CLASS( CEmailMailbox ) : |
|
35 public CBase, |
|
36 public MEmailMailbox |
|
37 { |
|
38 public: |
|
39 |
|
40 static CEmailMailbox* NewL( |
|
41 CPluginData& aPluginData, |
|
42 const TMailboxId& aMailboxId ); |
|
43 |
|
44 ~CEmailMailbox(); |
|
45 |
|
46 public: // from MEmailInterface |
|
47 virtual TEmailTypeId InterfaceId() const; |
|
48 |
|
49 virtual void Release(); |
|
50 |
|
51 public: // from MEmailMailbox |
|
52 /**@see MEmailMailbox */ |
|
53 virtual TMailboxId MailboxId() const; |
|
54 |
|
55 /**@see MEmailMailbox */ |
|
56 virtual MEmailAddress* AddressL() const; |
|
57 |
|
58 /**@see MEmailMailbox */ |
|
59 virtual TPtrC MailboxName() const; |
|
60 |
|
61 /**@see MEmailMailbox */ |
|
62 virtual TInt GetFoldersL( RFolderArray& aFolders ) const; |
|
63 |
|
64 /**@see MEmailMailbox */ |
|
65 virtual MEmailFolder* FolderL( const TFolderId& aFolderId ) const; |
|
66 |
|
67 /**@see MEmailMailbox */ |
|
68 virtual MEmailFolder* FolderByTypeL( |
|
69 const TFolderType aFolderType ) const; |
|
70 |
|
71 /**@see MEmailMailbox */ |
|
72 virtual MEmailMessage* MessageL( const TMessageId& aMessageId ); |
|
73 |
|
74 /**@see MEmailMailbox */ |
|
75 virtual MEmailMessage* CreateDraftMessageL() const; |
|
76 |
|
77 /**@see MEmailMailbox */ |
|
78 virtual MEmailMessage* CreateReplyMessageL( const TMessageId& aMessageId, const TBool aReplyToAll = ETrue ) const; |
|
79 |
|
80 /**@see MEmailMailbox */ |
|
81 virtual MEmailMessage* CreateForwardMessageL( const TMessageId& aMessageId ) const; |
|
82 |
|
83 /**@see MEmailMailbox */ |
|
84 virtual void SynchroniseL( MMailboxSyncObserver& aObserver ); |
|
85 |
|
86 /**@see MEmailMailbox */ |
|
87 virtual void CancelSynchronise(); |
|
88 |
|
89 /**@see MEmailMailbox */ |
|
90 virtual void RegisterObserverL( MMailboxContentObserver& aObserver ); |
|
91 |
|
92 /**@see MEmailMailbox */ |
|
93 virtual void UnregisterObserver( MMailboxContentObserver& aObserver ); |
|
94 |
|
95 /**@see MEmailMailbox */ |
|
96 virtual MEmailMessageSearchAsync* MessageSearchL(); |
|
97 |
|
98 /**@see MEmailMailbox */ |
|
99 virtual void ShowInboxL(); |
|
100 |
|
101 /**@see MEmailMailbox */ |
|
102 virtual void EditNewMessageL(); |
|
103 |
|
104 |
|
105 public: // new methods |
|
106 |
|
107 private: |
|
108 TFSMailMsgId FsMailboxId() const; |
|
109 |
|
110 private: // constructors |
|
111 CEmailMailbox( CPluginData& aPluginData, const TMailboxId& aPlugin ); |
|
112 |
|
113 void ConstructL(); |
|
114 |
|
115 private: // inner class for mailbox event handling |
|
116 class TObserverEventMapper : public MFSMailEventObserver |
|
117 { |
|
118 public: |
|
119 TObserverEventMapper( CFSMailPlugin* aPlugin, TUid aPluginUid, const TMailboxId& aMailboxId ); |
|
120 ~TObserverEventMapper(); |
|
121 void AddObserverL( MMailboxContentObserver& aObserver ); |
|
122 void RemoveObserver( MMailboxContentObserver& aObserver ); |
|
123 public: // from MFSMailEventObserver |
|
124 virtual void EventL(TFSMailEvent aEvent, TFSMailMsgId aMailbox, TAny* aParam1, TAny* aParam2, TAny* aParam3 ); |
|
125 typedef void (CEmailMailbox::TObserverEventMapper::*TEventMapFunc)( TMailboxId, TAny*, TAny*, TAny* ); |
|
126 private: // mappers, so say we all! |
|
127 void IgnoreEventL( TMailboxId aMailbox, TAny* aParam1, TAny* aParam2, TAny* aParam3 ); |
|
128 void NewMessageL( TMailboxId aMailbox, TAny* aParam1, TAny* aParam2, TAny* aParam3 ); |
|
129 void MessageChangedL( TMailboxId aMailbox, TAny* aParam1, TAny* aParam2, TAny* aParam3 ); |
|
130 void MessageDeletedL( TMailboxId aMailbox, TAny* aParam1, TAny* aParam2, TAny* aParam3 ); |
|
131 void MessageMoved( TMailboxId aMailbox, TAny* aParam1, TAny* aParam2, TAny* aParam3 ); |
|
132 void MessageCopiedL( TMailboxId aMailbox, TAny* aParam1, TAny* aParam2, TAny* aParam3 ); |
|
133 void NewFolderL( TMailboxId aMailbox, TAny* aParam1, TAny* aParam2, TAny* aParam3 ); |
|
134 void FolderChangeL( TMailboxId aMailbox, TAny* aParam1, TAny* aParam2, TAny* aParam3 ); |
|
135 void FoldersDeletedL( TMailboxId aMailbox, TAny* aParam1, TAny* aParam2, TAny* aParam3 ); |
|
136 void FoldersMovedL( TMailboxId aMailbox, TAny* aParam1, TAny* aParam2, TAny* aParam3 ); |
|
137 void ExceptionL( TMailboxId aMailbox, TAny* aParam1, TAny* aParam2, TAny* aParam3 ); |
|
138 |
|
139 private: |
|
140 static TBool Equals( const MMailboxContentObserver& a1, const MMailboxContentObserver& a2 ); |
|
141 private: |
|
142 CFSMailPlugin* iPlugin; |
|
143 //const TUid iUid; |
|
144 TFSMailMsgId iFsMailboxId; |
|
145 RPointerArray<MMailboxContentObserver> iClientObservers; |
|
146 }; |
|
147 class CEmailRequestObserver: public CBase, |
|
148 public MFSMailRequestObserver |
|
149 { |
|
150 public: |
|
151 CEmailRequestObserver(); |
|
152 |
|
153 virtual void RequestResponseL( TFSProgress aEvent, TInt aRequestId ); |
|
154 void SetObserverL( MMailboxSyncObserver* aObserver ); |
|
155 private: |
|
156 MMailboxSyncObserver* iObserver; |
|
157 }; |
|
158 |
|
159 private: |
|
160 |
|
161 CPluginData& iPluginData; |
|
162 |
|
163 CFSMailPlugin* iPlugin; |
|
164 |
|
165 TMailboxId iMailboxId; |
|
166 |
|
167 TObserverEventMapper* iEventMapper; |
|
168 |
|
169 mutable CEmailAddress* iAddress; |
|
170 |
|
171 CFSMailBox* iFsMailbox; |
|
172 |
|
173 CEmailRequestObserver* iSyncObserver; |
|
174 |
|
175 TInt iRequestId; |
|
176 }; |
|
177 |
|
178 #endif // EMAILMAILBOX_H |
|
179 |
|
180 // End of file |