|
1 /* |
|
2 * Copyright (c) 2002 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 the License "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: Declaration of CPushMtmUtil. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef PUSHMTMUTIL_H |
|
21 #define PUSHMTMUTIL_H |
|
22 |
|
23 // INCLUDE FILES |
|
24 |
|
25 #include <e32base.h> |
|
26 #include <e32std.h> |
|
27 #include <msvstd.h> |
|
28 |
|
29 // CONSTANTS |
|
30 |
|
31 /** |
|
32 * Defines for masking values used to extract information from iMtmData2. |
|
33 * Note that iMtmData1 is used by CPushMsgEntryBase and derived classes! |
|
34 */ |
|
35 const TUint32 KPushMtmMaskOnlyAttrs = 0x000000FF; |
|
36 const TUint32 KPushMtmShiftOnlyAttrs = 0; |
|
37 const TUint32 KPushMtmMaskEverythingButAttrs = 0xFFFFFF00; |
|
38 /** |
|
39 * Attributes. The maximum number of attribute is determined by |
|
40 * **************** KPushMtmMaskOnlyAttrs ****************** |
|
41 * Each attribute can be set (1) or reseted (0). |
|
42 */ |
|
43 const TUint32 EPushMtmAttrHasHref = 0x00000001; |
|
44 const TUint32 EPushMtmReadButContentChanged = 0x00000002; |
|
45 const TUint32 EPushMtmNotUsed1 = 0x00000004; |
|
46 const TUint32 EPushMtmNotUsed2 = 0x00000008; |
|
47 const TUint32 EPushMtmNotUsed3 = 0x00000010; |
|
48 const TUint32 EPushMtmNotUsed4 = 0x00000020; |
|
49 const TUint32 EPushMtmNotUsed5 = 0x00000040; |
|
50 const TUint32 EPushMtmNotUsed6 = 0x00000080; |
|
51 |
|
52 // FORWARD DECLARATIONS |
|
53 |
|
54 class CMsvSession; |
|
55 |
|
56 // CLASS DECLARATION |
|
57 |
|
58 /** |
|
59 * Utility class. |
|
60 */ |
|
61 class CPushMtmUtil : public CBase |
|
62 { |
|
63 public: // Constructors and destructor |
|
64 |
|
65 /** |
|
66 * Two-phased constructor. Leaves on failure. |
|
67 * @param aMsvSession Message Server Session to be used by this operation. |
|
68 * @return The constructed object. |
|
69 */ |
|
70 IMPORT_C static CPushMtmUtil* NewL( CMsvSession& aMsvSession ); |
|
71 |
|
72 /** |
|
73 * Destructor. |
|
74 */ |
|
75 IMPORT_C virtual ~CPushMtmUtil(); |
|
76 |
|
77 public: // New functions |
|
78 |
|
79 /** |
|
80 * Mark the given entry unread and new. |
|
81 * @param aEntryId The entry id to use. |
|
82 * @param aUnread ETrue=mark unread, EFalse=mark read. |
|
83 * @return None. |
|
84 */ |
|
85 IMPORT_C void MarkServiceUnreadL( TMsvId aEntryId, TBool aUnread ); |
|
86 |
|
87 /** |
|
88 * Find all the push messages of the specified type in the given folder |
|
89 * and its subfolders recursively (if specified). |
|
90 * @param aFolderId The given folder. |
|
91 * @param aMsgType Push message type. |
|
92 * @param aRecursive Is recursive search desired. |
|
93 * @return TMsvIds of the messages. |
|
94 */ |
|
95 IMPORT_C CMsvEntrySelection* FindMessagesL( TMsvId aFolderId, |
|
96 TUid aMsgType, |
|
97 TBool aRecursive ); |
|
98 |
|
99 /** |
|
100 * Find all the push messages of the specified type in the given folders. |
|
101 * @param aFolders Selection of folders. |
|
102 * @param aMsgType Push message type. |
|
103 * @return TMsvIds of the messages. |
|
104 */ |
|
105 IMPORT_C CMsvEntrySelection* FindMessagesL |
|
106 ( const CMsvEntrySelection& aFolders, TUid aMsgType ); |
|
107 |
|
108 /** |
|
109 * Find all the push messages of the specified type in the 'push' folders. |
|
110 * @param aMsgType Push message type. |
|
111 * @return TMsvIds of the messages. |
|
112 */ |
|
113 IMPORT_C CMsvEntrySelection* FindMessagesL( TUid aMsgType ); |
|
114 |
|
115 /** |
|
116 * Find all the folders that may contain push messages. |
|
117 * @return TMsvIds of the folders. |
|
118 */ |
|
119 IMPORT_C CMsvEntrySelection* FindPushFoldersL(); |
|
120 |
|
121 /** |
|
122 * Locates SI entries with the specified SI-ID. Search is made in the |
|
123 * 'push' folders returned by FindPushFoldersL(). |
|
124 * @param aSiId Id of SI message to locate. |
|
125 * @return Selection of entry IDs found. |
|
126 */ |
|
127 IMPORT_C CMsvEntrySelection* FindSiIdLC( const TDesC& aSiId ); |
|
128 |
|
129 /** |
|
130 * Finds SI or SL entries with the specified Url and Push Message Type. |
|
131 * Search is made in the 'push' folders returned by FindPushFoldersL(). |
|
132 * @param aUrl URL to find |
|
133 * @param aPushType Push Message type to filter entries by. |
|
134 * @return Selection of entry IDs found. |
|
135 */ |
|
136 IMPORT_C CMsvEntrySelection* FindUrlLC( const TDesC& aUrl, |
|
137 TUid aPushType ); |
|
138 |
|
139 /** |
|
140 * Delete the given entry. |
|
141 * @param aId Id of the message to locate. |
|
142 * @return None. |
|
143 */ |
|
144 IMPORT_C void DeleteEntryL( TMsvId aId ); |
|
145 |
|
146 /** |
|
147 * Convert the "From" information to the format required by the UI spec: |
|
148 * it extracts the Host part of the URI. If it is ampty string, then |
|
149 * it returns the copy of the original string. |
|
150 * @param aFrom The sender information of a push message. |
|
151 * @return The converted string in unicode. |
|
152 */ |
|
153 IMPORT_C HBufC* ConvertDetailsL( const TDesC8& aFrom ) const; |
|
154 |
|
155 /** |
|
156 * Sets the given attributes of the context |
|
157 * @param aContext Context entry that is modified. |
|
158 * @param aAttr Attributes to be set. |
|
159 * @return None. |
|
160 */ |
|
161 IMPORT_C static void SetAttrs( TMsvEntry& aContext, TUint32 aAttrs ); |
|
162 |
|
163 /** |
|
164 * Resets the given attributes of the context. |
|
165 * @param aContext Context entry that is modified. |
|
166 * @param aAttr Attributes to be reset. |
|
167 * @return None. |
|
168 */ |
|
169 IMPORT_C static void ResetAttrs( TMsvEntry& aContext, TUint32 aAttrs ); |
|
170 |
|
171 /** |
|
172 * Get the value of the attributes of the context. |
|
173 * @param aContext Context entry. |
|
174 * @return The attributes. |
|
175 */ |
|
176 IMPORT_C static TUint32 Attrs( const TMsvEntry& aContext ); |
|
177 |
|
178 /** |
|
179 * Convert the given URI to an appropriate form to be displayed. |
|
180 * See UriUtils::ConvertToDisplayFormL for more information. |
|
181 * @param aUri URI to be converted. |
|
182 * @return The converted URI. |
|
183 */ |
|
184 IMPORT_C static HBufC* ConvertUriToDisplayFormL( const TDesC& aUri ); |
|
185 |
|
186 protected: // Constructors |
|
187 |
|
188 /** |
|
189 * Constructor. |
|
190 * @param aMsvSession Message server session. |
|
191 */ |
|
192 CPushMtmUtil( CMsvSession& aMsvSession ); |
|
193 |
|
194 /** |
|
195 * Symbian OS constructor. |
|
196 */ |
|
197 void ConstructL(); |
|
198 |
|
199 protected: // New functions |
|
200 |
|
201 /** |
|
202 * Find all the push messages of the specified type in the given folder |
|
203 * and its subfolders recursively (if specified). |
|
204 * @param aFolderId The given folder. |
|
205 * @param aMsgType Push message type. |
|
206 * @param aRecursive Is recursive search desired. |
|
207 * @param aResult The result (TMsvIds of the messages) is appended to |
|
208 * this array. |
|
209 * @return None. |
|
210 */ |
|
211 void FindMessagesL( TMsvId aFolderId, |
|
212 TUid aMsgType, |
|
213 TBool aRecursive, |
|
214 CMsvEntrySelection& aResult ); |
|
215 |
|
216 private: // Data |
|
217 |
|
218 CMsvSession& iMsvSession; ///< Message Server session. |
|
219 }; |
|
220 |
|
221 #endif // PUSHMTMUTIL_H |
|
222 |
|
223 // End of file. |