|
1 /* |
|
2 * Copyright (c) 2007-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: ESMR FS mailbox utilities definition |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef CESMRFSMAILBOXUTILS_H |
|
19 #define CESMRFSMAILBOXUTILS_H |
|
20 |
|
21 #include <e32base.h> |
|
22 #include <cmrmailboxutils.h> |
|
23 #include <calcommon.h> |
|
24 |
|
25 #include "esmrdef.h" |
|
26 #include "cfsmailcommon.h" |
|
27 |
|
28 class CFSMailClient; |
|
29 class CFSMailMessage; |
|
30 class CFSMailBox; |
|
31 class CCalUser; |
|
32 |
|
33 |
|
34 /** |
|
35 * Utility class for FS mailbox |
|
36 */ |
|
37 NONSHARABLE_CLASS( CESMRFsMailboxUtils ): public CBase |
|
38 { |
|
39 public: |
|
40 |
|
41 /** |
|
42 * Enumeration for mailbox capabilities |
|
43 */ |
|
44 enum TMRMailboxCapability |
|
45 { |
|
46 EMRCapabilityAttachment |
|
47 }; |
|
48 |
|
49 public: // Constructors and destructors |
|
50 |
|
51 /** |
|
52 * Constructs CESMRFsMailboxUtils object. |
|
53 * |
|
54 * @param aMailboxUtils Reference to S60 mailbox utils |
|
55 * @return instantiated object, ownership transferred |
|
56 */ |
|
57 IMPORT_C static CESMRFsMailboxUtils* NewL( |
|
58 CMRMailboxUtils& aMailboxUtils ); |
|
59 |
|
60 /** |
|
61 * C++ Destructor. |
|
62 */ |
|
63 IMPORT_C ~CESMRFsMailboxUtils(); |
|
64 |
|
65 public: // New functions |
|
66 |
|
67 /** |
|
68 * If phone owner field hasn't been set so far, this method compares |
|
69 * organizer field to the mailboxes in the device, and if no match |
|
70 * was found compares each attendee to the mailboxes. If match was found, |
|
71 * phone owner field is set, otherwise KErrNotFound is returned. |
|
72 * If aPrimaryBox is given, then that is used in matching before any |
|
73 * other mailbox. If not given, then default MR mailbox will have |
|
74 * the highest presedence followed by other MR-capable mailboxes. |
|
75 * |
|
76 * @param aCalEntry entry to modify |
|
77 * @param aPrimaryBox primary mailbox for matching, if applicable |
|
78 * @return KErrNone or a system wide error code |
|
79 */ |
|
80 IMPORT_C TInt SetPhoneOwnerL( |
|
81 CCalEntry& aCalEntry, |
|
82 TMsvId aPrimaryBox = KMsvNullIndexEntryId ); |
|
83 |
|
84 /** |
|
85 * If phone owner field hasn't been set so far, this method compares |
|
86 * mailboxowner's email address to organizer field and if no match |
|
87 * was found compares each attendee to the mailboxowner's email address. |
|
88 * If match was found, phone owner field is set, otherwise KErrNotFound |
|
89 * is returned. |
|
90 * |
|
91 * @param aCalEntry entry to modify |
|
92 * @param aPrimaryBox primary mailbox for matching, if applicable |
|
93 * @return KErrNone or a system wide error code |
|
94 */ |
|
95 IMPORT_C TInt SetPhoneOwnerL( |
|
96 CCalEntry& aCalEntry, |
|
97 CFSMailClient& aMailClient, |
|
98 CFSMailMessage& aMailMessage ); |
|
99 |
|
100 /** |
|
101 * Resolves the plugin to be used to current calendar entry. |
|
102 * Method retrieves phone owner from calendar entry and loops all |
|
103 * FS Email mailboxes. |
|
104 * @param aEntry Reference to calendar entry. |
|
105 * @return Plugin ID for FS Email mailbox |
|
106 */ |
|
107 IMPORT_C TESMRMailPlugin FSEmailPluginForEntryL( |
|
108 const CCalEntry& aEntry ); |
|
109 |
|
110 /** |
|
111 * Tests if default mailbox supports certain capability. |
|
112 * @param aCapability Capability to be tested |
|
113 * @return ETrue if success, EFalse otherwise |
|
114 */ |
|
115 IMPORT_C TBool DefaultMailboxSupportCapabilityL( |
|
116 TMRMailboxCapability aCapability ); |
|
117 |
|
118 /** |
|
119 * Gets the calendar database id used by mail plugin |
|
120 * |
|
121 * @param aPlugin mail plugin in use |
|
122 * @param aDbId on return contains the database id or KNullFileId |
|
123 * if plugin does not provide database id information. |
|
124 */ |
|
125 void GetCalendarDatabaseIdL( |
|
126 TESMRMailPlugin aPlugin, |
|
127 TCalFileId& aDbId ); |
|
128 |
|
129 private: // Implementation |
|
130 CESMRFsMailboxUtils( |
|
131 CMRMailboxUtils& aMailboxUtils ); |
|
132 void ConstructL(); |
|
133 CCalUser* PhoneOwnerL( |
|
134 const CCalEntry& aCalEntry, |
|
135 const RPointerArray<CFSMailBox>& aMailBoxes, |
|
136 TInt& aMatchIndex ); |
|
137 TBool IsPhoneOwnerL( |
|
138 const CCalUser& aUser, |
|
139 const RPointerArray<CFSMailBox>& aMailBoxes, |
|
140 TInt& aMatchIndex ); |
|
141 |
|
142 CFSMailClient& MailClientL(); |
|
143 CFSMailBox* DefaultMailboxL(); |
|
144 |
|
145 private: // Data |
|
146 /// Ref: Reference to S60 mailbox utilities |
|
147 CMRMailboxUtils& iMRMailboxUtils; |
|
148 /// Own: Mail client object |
|
149 CFSMailClient* iMailClient; |
|
150 }; |
|
151 |
|
152 #endif // CESMRFSMAILBOXUTILS_H |
|
153 |
|
154 // EOF |
|
155 |