|
1 /* |
|
2 * Copyright (c) 2007 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: Interface to Importing the contents to a Calender |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CALENDARIMPORTEXPORT_H_ |
|
20 #define CALENDARIMPORTEXPORT_H_ |
|
21 |
|
22 |
|
23 //System Includes |
|
24 #include <e32base.h> |
|
25 |
|
26 |
|
27 //Forward Declarations |
|
28 class CCalSession; |
|
29 class CCalEntryView; |
|
30 class CCalenImporter; |
|
31 class CCalendarSessionInfo; |
|
32 class MCalCallbackBase; |
|
33 |
|
34 /** |
|
35 * This class provides functionality for Calendar Import |
|
36 * provides four versions of Import Functionality Sync and Async |
|
37 * @since S60_3_2_200726 |
|
38 */ |
|
39 class CCalendarImport : public CCalendarASyncRequest/*, public CActive*/ |
|
40 { |
|
41 |
|
42 |
|
43 public: //*********************Public Members(Behaviours)******************************************/ |
|
44 |
|
45 /** |
|
46 * Static Method which either returns the Two Phase constructed Object or Leave |
|
47 * |
|
48 * @param CCalendarSessionInfo to set the iCalenderSessionInfo which is used to access various resources |
|
49 * like CCalSession, CCalEntryView etc |
|
50 * @param aFormat used to set the iFormat it can be either ICAL or VCAL, two popular Calendar formats |
|
51 * |
|
52 * @param aInputBuffer contains the data to be imported to the specified calendar |
|
53 * |
|
54 * @param CAsyncRequestObserver For ASyncronous usage of this Object this paramater is set / Default is NULL |
|
55 * Set in case of Asynchronous call only |
|
56 * @param MCalCallbackBase For Asyncronous usage of this Object this paramater is set |
|
57 * |
|
58 * NOTE: Ownership of any of the parameters is not taken through this function call |
|
59 * NOTE: Therefore the User of this function needs to take care of neccessary cleanup of passed parameters |
|
60 * @return CCalendarExport |
|
61 */ |
|
62 static CCalendarImport* NewL ( CCalendarSessionInfo* aCalSessionInfo, |
|
63 const TDesC8& aFormat, |
|
64 const TDesC8& aInputBuffer, |
|
65 CAsyncRequestObserver* aAsyncRequestObserver = NULL, |
|
66 MCalCallbackBase* aCallBack = NULL ); |
|
67 |
|
68 static CCalendarImport* NewL ( CCalendarSessionInfo* aCalSessionInfo, |
|
69 const TDesC8& aFormat, |
|
70 const TDesC& aImportFile, |
|
71 CAsyncRequestObserver* aAsyncRequestObserver = NULL, |
|
72 MCalCallbackBase* aCallBack = NULL ); |
|
73 |
|
74 /** |
|
75 * Destructor. |
|
76 */ |
|
77 ~CCalendarImport(); |
|
78 |
|
79 /** |
|
80 * Synchronous Version of Import which takes InputBuffer set at the time of Construction of this object through NewL |
|
81 * and Imports them to the Calender opened in CalSession of CalendarSessionInfoL object passed to this object |
|
82 * It sets the LUids and GUids in the aOutputLocalUidArray, this object is not the owner of aOutputLocalUidArray |
|
83 * @since S60_3_2_200726 |
|
84 * |
|
85 * @param aOutputLocalUidArray Output which is the array of LocalUIDs after StoreL on the Calender file |
|
86 * |
|
87 * @return void |
|
88 */ |
|
89 void ImportL( RPointerArray<TUIDSet>& aOutputLocalUidArray ); |
|
90 |
|
91 /** |
|
92 * ASynchronous Version of Import which takes InputBuffer set at the time of Construction of this object through NewL |
|
93 * and Imports to the Calender(outputis passed through callback) |
|
94 * |
|
95 * @since S60_3_2_200726 |
|
96 * |
|
97 * @return void |
|
98 */ |
|
99 void ImportL(); |
|
100 |
|
101 private: //*********************Private Member(Behaviours)******************************************/ |
|
102 |
|
103 /** |
|
104 * Constructor. |
|
105 * @param CCalendarSessionInfo to set the iCalenderSessionInfo which is used to access various resources |
|
106 * like CCalSession, CCalEntryView etc |
|
107 * @param CAsyncRequestObserver For Asyncronous usage of this Object this paramater is set / Default is NULL |
|
108 * @param MCalCallbackBase For Asyncronous usage of this Object this paramater is set |
|
109 */ |
|
110 CCalendarImport( CCalendarSessionInfo* aCalSessionInfo, |
|
111 CAsyncRequestObserver* aAsyncRequestObserver = NULL, |
|
112 MCalCallbackBase* aCallBack = NULL ); |
|
113 |
|
114 /** |
|
115 * 2nd Phase of Two Phase Construction |
|
116 * @param aFormat used to set the iFormat it can be either ICAL or VCAL, two popular Calendar formats |
|
117 * |
|
118 * @param aInputBuffer contains the data to be imported to the specified calendar |
|
119 * @return void |
|
120 */ |
|
121 void ConstructL( const TDesC8& aFormat, const TDesC8& aInputBuffer ); |
|
122 void ConstructL( const TDesC8& aFormat, const TDesC& aImportFile ); |
|
123 |
|
124 /** |
|
125 * Inherited from CActive class...Active Object for Aynchronous Support |
|
126 */ |
|
127 virtual void DoCancel(); |
|
128 |
|
129 /** |
|
130 * Inherited from CActive class...Active Object for Aynchronous Support |
|
131 */ |
|
132 virtual void RunL(); |
|
133 |
|
134 /** |
|
135 * Service Functions to activate the Asynchronous Request by activating the Active Object using SetActive() |
|
136 * @param aReason Give the reason it can be KErrNone or any error |
|
137 * |
|
138 * @return void |
|
139 */ |
|
140 void ActivateRequest( TInt aReason ); |
|
141 |
|
142 /** |
|
143 * Service Functions to Enable Proper Completion of Asynchronous Request called at the end of RUNL to send output |
|
144 * @param aReason Give the reason it can be KErrNone or any error |
|
145 * |
|
146 * @return void |
|
147 */ |
|
148 void NotifyRequestResult( TInt aReason ); |
|
149 |
|
150 void ImportFromStreamL(RReadStream& aStream, RPointerArray<TUIDSet>& aOutputUIDArray ); |
|
151 |
|
152 |
|
153 |
|
154 private: //*********************Private Member(Properties)******************************************/ |
|
155 |
|
156 /** |
|
157 * This is the handle to CCalendarSessionInfo Service class which is used to access various resources |
|
158 * like CCalSession, CCalEntryView etc |
|
159 * Pure USES A Relalationship...This class doesnot own this and So, it wont delete it |
|
160 */ |
|
161 CCalendarSessionInfo* iCalSessionInfo; |
|
162 |
|
163 /** |
|
164 * For Syncronous usage of this Object this paramater is set / Default is NULL |
|
165 * Own. This class is responsible for deleting it. HAS A Relationship |
|
166 */ |
|
167 MCalCallbackBase* iCallBack; |
|
168 |
|
169 |
|
170 /** |
|
171 * For Syncronous usage of this Object this paramater is set / Default is NULL |
|
172 * Own. This class is responsible for deleting it. HAS A Relationship |
|
173 */ |
|
174 |
|
175 CAsyncRequestObserver* iAsyncRequestObserver; |
|
176 |
|
177 /** |
|
178 * Handle to the Library Class Object which provies the Conversion functionality i.e.., Import |
|
179 * Own. This class is responsible for deleting it. HAS A Relationship |
|
180 */ |
|
181 CCalenImporter *iCalenImporter; |
|
182 |
|
183 /** |
|
184 * Handle to the Library Class Object which provies the Conversion functionality i.e.., export |
|
185 * Own. This class is responsible for deleting it. HAS A Relationship |
|
186 */ |
|
187 HBufC8* iFormat; |
|
188 |
|
189 |
|
190 /** |
|
191 * InputBuffer used in case of Asynchronous calls |
|
192 * Own. This class takes the responsibility for deleting it. HAS A Relationship |
|
193 */ |
|
194 HBufC8* iInputBuffer; |
|
195 |
|
196 HBufC* iImportFile; |
|
197 |
|
198 /** |
|
199 * Output Local(TUint) and Global UID(TDesC8) array used in case of Asynchronous calls |
|
200 * Own. This class takes the responsibility for deleting it. HAS A Relationship |
|
201 */ |
|
202 RPointerArray<TUIDSet> iOutputUIDArray; |
|
203 }; |
|
204 |
|
205 |
|
206 #endif CALENDARIMPORTEXPORT_H_ |