|
1 /* |
|
2 * Copyright (c) 2007-2008 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: Message header URL Factory |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "FreestyleMessageHeaderURLFactory.h" |
|
19 #include "CFSMailAddress.h" |
|
20 |
|
21 EXPORT_C CFreestyleMessageHeaderURL* FreestyleMessageHeaderURLFactory::CreateEmailAddressUrlL( TEmailAddressType aEmailType, |
|
22 const CFSMailAddress& aEmailAddress ) |
|
23 { |
|
24 HBufC* email = aEmailAddress.GetEmailAddress().AllocLC(); |
|
25 HBufC* scheme = KURLSchemeCmail().AllocLC(); |
|
26 HBufC* type = NULL; |
|
27 switch ( aEmailType ) |
|
28 { |
|
29 case FreestyleMessageHeaderURLFactory::EEmailAddressTypeFrom: |
|
30 type = KURLTypeFrom().AllocLC(); |
|
31 break; |
|
32 |
|
33 case FreestyleMessageHeaderURLFactory::EEmailAddressTypeTo: |
|
34 type = KURLTypeTo().AllocLC(); |
|
35 break; |
|
36 |
|
37 case FreestyleMessageHeaderURLFactory::EEmailAddressTypeCc: |
|
38 type = KURLTypeCc().AllocLC(); |
|
39 break; |
|
40 |
|
41 case FreestyleMessageHeaderURLFactory::EEmailAddressTypeBcc: |
|
42 type = KURLTypeBcc().AllocLC(); |
|
43 break; |
|
44 |
|
45 default: |
|
46 User::Leave( KErrNotSupported ); |
|
47 } |
|
48 |
|
49 CFreestyleMessageHeaderURL* url = CFreestyleMessageHeaderURL::NewL( scheme, type, email ); |
|
50 |
|
51 CleanupStack::Pop( type ); |
|
52 CleanupStack::Pop( scheme ); |
|
53 CleanupStack::Pop( email ); |
|
54 return url; |
|
55 } |
|
56 |
|
57 EXPORT_C CFreestyleMessageHeaderURL* FreestyleMessageHeaderURLFactory::CreateAttachmentUrlL( const TDesC& aAttachmentItemId ) |
|
58 { |
|
59 HBufC* scheme = KURLSchemeCmail().AllocLC(); |
|
60 HBufC* type = KURLTypeAttachment().AllocLC(); |
|
61 HBufC* itemId = aAttachmentItemId.AllocLC(); |
|
62 CFreestyleMessageHeaderURL *url = CFreestyleMessageHeaderURL::NewL( scheme, type, itemId ); |
|
63 CleanupStack::Pop( itemId ); |
|
64 CleanupStack::Pop( type ); |
|
65 CleanupStack::Pop( scheme ); |
|
66 |
|
67 return url; |
|
68 } |
|
69 |
|
70 |