|
1 // Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // This file contains the API definition for the class CMailtoSchemeHandler. |
|
15 // This class parses a descriptor Url into the component fields of a mailto |
|
16 // scheme as described in RFC2368 |
|
17 // and launches the mailto editor with the field values filled in. |
|
18 // |
|
19 // |
|
20 |
|
21 /** |
|
22 @file |
|
23 */ |
|
24 |
|
25 #ifndef __MTSCHEME_H__ |
|
26 #define __MTSCHEME_H__ |
|
27 |
|
28 // Local includes |
|
29 // |
|
30 #include "MSGBASE.H" |
|
31 |
|
32 /** |
|
33 @class |
|
34 Dependencies : CMsgSchemeHandlerBase, EscapeUtils, TMailtoUrlParser, |
|
35 TDelimitedAddressParser, TDelimitedBodyParser, TextUtils, |
|
36 CSendAs, TMsvId |
|
37 Comments : Parses a descriptor into the component fields of a mailto scheme |
|
38 as described in RFC2368 |
|
39 and launches the mailto editor with the field values filled in. |
|
40 There are 5 fields; to, cc, bcc, subject and body. |
|
41 |
|
42 Format of a typical mailto url is: |
|
43 mailto:<address>,<address>?cc=<address>&subject=<subject>&body=<body> |
|
44 |
|
45 @since 7.0 |
|
46 */ |
|
47 class CMailtoSchemeHandler : public CMsgSchemeHandlerBase |
|
48 /** |
|
49 @internalComponent |
|
50 @released |
|
51 */ |
|
52 { |
|
53 |
|
54 public: // Methods |
|
55 |
|
56 /** |
|
57 @fn NewLC() |
|
58 Intended Usage : Static factory constructor. Uses two phase construction and |
|
59 leaves a pointer to created object on the CleanupStack. |
|
60 @since 7.0 |
|
61 @leave KErrNoMemory. |
|
62 @return A pointer to the newly created CMailtoSchemeHandler object |
|
63 @pre None |
|
64 @post A fully constructed and initialised CSmsSchemeHandler object. |
|
65 */ |
|
66 static CMailtoSchemeHandler* NewLC(); |
|
67 |
|
68 /** |
|
69 @fn NewL() |
|
70 Intended Usage : Static factory constructor. Uses two phase construction and |
|
71 leaves nothing on the CleanupStack. |
|
72 @since 7.0 |
|
73 @leave KErrNoMemory. |
|
74 @return A pointer to the newly created CMailtoSchemeHandler object. |
|
75 @pre None |
|
76 @post A fully constructed and initialised CMailtoSchemeHandler object. |
|
77 */ |
|
78 static CMailtoSchemeHandler* NewL(); |
|
79 |
|
80 /** |
|
81 @fn ~CMailtoSchemeHandler() |
|
82 Intended Usage : Destructor. |
|
83 @since 7.0 |
|
84 */ |
|
85 ~CMailtoSchemeHandler(); |
|
86 |
|
87 |
|
88 private: // Methods |
|
89 |
|
90 /** |
|
91 @fn CMailtoSchemeHandler() |
|
92 Intended Usage : Constructor. First phase of two-phase construction method. |
|
93 Does non-allocating construction. |
|
94 @since 7.0 |
|
95 */ |
|
96 CMailtoSchemeHandler(); |
|
97 |
|
98 /** |
|
99 @fn ConstructL() |
|
100 Intended Usage : Second phase of two-phase construction method. Does any |
|
101 allocations required to fully construct the object. |
|
102 @since 7.0 |
|
103 @leave KErrNoMemory. |
|
104 @pre First phase of construction is complete |
|
105 @post The object is fully constructed and initialised. |
|
106 */ |
|
107 void ConstructL(); |
|
108 |
|
109 /** |
|
110 @fn ParseUrlL(const TDesC& aUrl) |
|
111 Intended Usage : Parses a descriptor into the component fields of a mailto scheme |
|
112 as described in RFC2368. |
|
113 @since 7.0 |
|
114 @param aUrl A descriptor with the mailto url. |
|
115 @pre None |
|
116 @post The mailto url descriptor has been parsed and field values are set. |
|
117 */ |
|
118 virtual void ParseUrlL(const TDesC& aUrl); |
|
119 |
|
120 |
|
121 /** |
|
122 @enum TField |
|
123 Enum defining the mailto url fields |
|
124 @since 7.0 |
|
125 */ |
|
126 enum TField |
|
127 { |
|
128 /** Specifies 'To' field */ |
|
129 ETo, |
|
130 /** Specifies 'Body' field */ |
|
131 EBody, |
|
132 /** Specifies 'Subject' field */ |
|
133 ESubject, |
|
134 /** Specifies 'Cc' field */ |
|
135 ECc, |
|
136 /** Specifies 'Bcc' field */ |
|
137 EBcc, |
|
138 /** Specifies unknown field */ |
|
139 EUnknown |
|
140 }; |
|
141 |
|
142 /** |
|
143 @fn SetFieldL(TField aField, const TDesC& aFieldValue) |
|
144 Intended Usage : Sets the field values. |
|
145 @since 7.0 |
|
146 @param aField The enum specifiying the mailto field. |
|
147 @param aFieldValue A descriptor with the mailto field value. |
|
148 @pre None |
|
149 @post Field values have been set. |
|
150 */ |
|
151 void SetFieldL(TField aField, const TDesC& aFieldValue); |
|
152 |
|
153 /** |
|
154 @fn GetFieldAndValue(const TDesC& aComponent, TPtrC& aFieldValue) |
|
155 Intended Usage : Returns the field and field value of the component |
|
156 @since 7.0 |
|
157 @param aComponent a descriptor with the mailto component. |
|
158 @param aFieldValue This is an output argument that is set to the |
|
159 field value. |
|
160 @return The enum specifying the field of the component. |
|
161 @pre None |
|
162 @post The field and field value of the component have been returned. |
|
163 */ |
|
164 TField GetFieldAndValue(const TDesC& aComponent, TPtrC& aFieldValue) const; |
|
165 |
|
166 |
|
167 /** |
|
168 @fn SendL() |
|
169 Intended Usage : Creates the email message with the field values filled in |
|
170 and launches the mailto editor. |
|
171 @since 7.0 |
|
172 @pre None |
|
173 @post Email message have been created and mailto editor has been launched. |
|
174 */ |
|
175 virtual void SendL(); |
|
176 |
|
177 private: // Attributes |
|
178 |
|
179 /** The descriptor array that contains the addresses */ |
|
180 RArray<TPtrC> iTo; |
|
181 /** The descriptor pointer that contains the subject */ |
|
182 TPtrC iSubject; |
|
183 /** The descriptor pointer that contains the body */ |
|
184 TPtrC iBody; |
|
185 |
|
186 /** The descriptor buffer that contains the mailto part of the url |
|
187 i.e mailto:<mailto part> |
|
188 This provides the storage for the text pointed to by iTo & iSubject. |
|
189 */ |
|
190 HBufC* iMailtoPart; |
|
191 |
|
192 // To access the private members for testing. |
|
193 friend class TMailtoSchemeHandler_StateAccessor; |
|
194 }; |
|
195 |
|
196 #endif |