|
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: VCal exporter for send ui wrapper |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 //debug |
|
20 // INCLUDE FILES |
|
21 #include "emailtrace.h" |
|
22 #include "esmrvcalexport.h" |
|
23 |
|
24 #include <esmrgui.rsg> // r_qtn_meet_req_conflict_unnamed |
|
25 #include <calentry.h> |
|
26 #include <calenexporter.h> |
|
27 #include <bldvariant.hrh> // For FeatureIds |
|
28 #include <eikenv.h> |
|
29 #include <featmgr.h> |
|
30 #include <stringloader.h> |
|
31 #include <vtoken.h> |
|
32 #include <s32mem.h> |
|
33 |
|
34 namespace { |
|
35 |
|
36 // LOCAL CONSTANTS AND MACROS |
|
37 const TInt KDynBufExpandSize(100); |
|
38 |
|
39 // This flag definition should match EUTCTime flag |
|
40 // in \s60\AgnVersit\inc\S60AgnVersit.h |
|
41 #define S60AGNVERSIT_EUTCTIME 0x1000 |
|
42 #define S60AGNVERSIT_EJAPAN 0x2000 |
|
43 |
|
44 }//namespace |
|
45 |
|
46 // ======== MEMBER FUNCTIONS ======== |
|
47 |
|
48 // --------------------------------------------------------------------------- |
|
49 // TESMRVCalExport::TESMRVCalExport() |
|
50 // --------------------------------------------------------------------------- |
|
51 // |
|
52 TESMRVCalExport::TESMRVCalExport( |
|
53 CCalSession& aCalSession, |
|
54 RFs& aFileServerSession): |
|
55 iSession(aCalSession), |
|
56 iFs(aFileServerSession) |
|
57 { |
|
58 FUNC_LOG; |
|
59 // Do nothing |
|
60 } |
|
61 |
|
62 // --------------------------------------------------------------------------- |
|
63 // TESMRVCalExport::ExportVCalLC() |
|
64 // --------------------------------------------------------------------------- |
|
65 // |
|
66 HBufC8* TESMRVCalExport::ExportVCalLC(CCalEntry& aEntry) |
|
67 { |
|
68 FUNC_LOG; |
|
69 |
|
70 const TDesC& subject=aEntry.SummaryL(); |
|
71 |
|
72 TBool emptySubject = subject.Length() ==0; |
|
73 if (emptySubject) |
|
74 { |
|
75 // If subject is empty, we add <unnamed> text to it |
|
76 HBufC* unnamed = |
|
77 StringLoader::LoadLC( |
|
78 R_QTN_MEET_REQ_CONFLICT_UNNAMED, |
|
79 CEikonEnv::Static()); // codescanner::eikonenvstatic |
|
80 |
|
81 aEntry.SetSummaryL(*unnamed); |
|
82 CleanupStack::PopAndDestroy(unnamed); |
|
83 } |
|
84 |
|
85 CBufFlat* buf = CBufFlat::NewL( KDynBufExpandSize ); |
|
86 CleanupStack::PushL(buf); |
|
87 ConvertVCalL(buf, aEntry); |
|
88 |
|
89 HBufC8* result = HBufC8::NewL( buf->Size() ); |
|
90 result->Des().Copy(buf->Ptr(0)); |
|
91 CleanupStack::PopAndDestroy(buf); |
|
92 CleanupStack::PushL(result); |
|
93 |
|
94 return result; |
|
95 } |
|
96 |
|
97 // --------------------------------------------------------------------------- |
|
98 // TESMRVCalExport::ConvertVCalL() |
|
99 // --------------------------------------------------------------------------- |
|
100 // |
|
101 void TESMRVCalExport::ConvertVCalL(CBufFlat* aBuf, CCalEntry& aEntry) |
|
102 { |
|
103 FUNC_LOG; |
|
104 |
|
105 // CCalEntry is converted to VCal |
|
106 RBufWriteStream writeStream; |
|
107 writeStream.Open(*aBuf); |
|
108 CleanupClosePushL(writeStream); |
|
109 CCalenExporter* exporter=CCalenExporter::NewL(iSession); |
|
110 CleanupStack::PushL(exporter); |
|
111 exporter->ExportVCalL( aEntry, writeStream); |
|
112 CleanupStack::PopAndDestroy(exporter); |
|
113 CleanupStack::PopAndDestroy(&writeStream); |
|
114 |
|
115 } |
|
116 |
|
117 // --------------------------------------------------------------------------- |
|
118 // TESMRVCalExport::ConvertICalL() |
|
119 // --------------------------------------------------------------------------- |
|
120 // |
|
121 void TESMRVCalExport::ConvertICalL(CBufFlat* aBuf, CCalEntry& aEntry) |
|
122 { |
|
123 FUNC_LOG; |
|
124 |
|
125 // CCalEntry is converted to iCal |
|
126 RBufWriteStream writeStream; |
|
127 writeStream.Open(*aBuf); |
|
128 CleanupClosePushL(writeStream); |
|
129 CCalenExporter* exporter=CCalenExporter::NewL(iSession); |
|
130 CleanupStack::PushL(exporter); |
|
131 exporter->ExportICalL( aEntry, writeStream); |
|
132 CleanupStack::PopAndDestroy(exporter); |
|
133 CleanupStack::PopAndDestroy(&writeStream); |
|
134 |
|
135 } |
|
136 |
|
137 |
|
138 // End of File |
|
139 |