5
|
1 |
/*
|
|
2 |
* Copyright (c) 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 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:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#ifndef ALARMSERVERTEST_H
|
|
19 |
#define ALARMSERVERTEST_H
|
|
20 |
#include "startconsolealarmserver.h"
|
|
21 |
|
|
22 |
#include <calalarm.h>
|
|
23 |
#include <caluser.h>
|
|
24 |
#include<LiwCommon.h>
|
|
25 |
#include<LiwVariant.h>
|
|
26 |
#include<LiwServiceHandler.h>
|
|
27 |
|
|
28 |
#include "calendarconstants.h"
|
|
29 |
#include "calendarheader.h"
|
|
30 |
#include "EntryAttributes.h"
|
|
31 |
#include "calendarservice.h"
|
|
32 |
|
|
33 |
extern void GetGlobalUid( const TDesC& aGlobalUid, TDes8& aOutGlobalUid );
|
|
34 |
extern void GetLocalUid( const TDesC& aLocalUid, TCalLocalUid& aOutLocalUid );
|
|
35 |
TInt RemoveProvCalendar(CLiwGenericParamList* inparam, CLiwGenericParamList* outparam, MLiwInterface* interface, const TDesC& aCalendar)
|
|
36 |
{
|
|
37 |
inparam->Reset();
|
|
38 |
outparam->Reset();
|
|
39 |
|
|
40 |
CLiwDefaultMap* map = CLiwDefaultMap::NewL();
|
|
41 |
CleanupStack::PushL(map);
|
|
42 |
|
|
43 |
TLiwVariant content(_L("Calendar"));
|
|
44 |
TLiwGenericParam element1;
|
|
45 |
element1.SetNameAndValueL(_L8("Type"),content);
|
|
46 |
inparam->AppendL(element1);
|
|
47 |
content.Reset();
|
|
48 |
element1.Reset();
|
|
49 |
|
|
50 |
map->InsertL(_L8("CalendarName"), TLiwVariant(aCalendar));
|
|
51 |
|
|
52 |
TLiwVariant filterparam(map);
|
|
53 |
TLiwGenericParam element ;
|
|
54 |
element.SetNameAndValueL(_L8("Data"),filterparam);
|
|
55 |
filterparam.Reset();
|
|
56 |
|
|
57 |
inparam->AppendL(element);
|
|
58 |
element.Reset();
|
|
59 |
map->DecRef();
|
|
60 |
CleanupStack::Pop(map);
|
|
61 |
|
|
62 |
TRAPD(err, interface->ExecuteCmdL( KCmdDelete ,*inparam,*outparam ));
|
|
63 |
TInt pos = 0 ;
|
|
64 |
|
|
65 |
const TLiwGenericParam* output = outparam->FindFirst( pos,_L8("ErrorCode"));
|
|
66 |
|
|
67 |
if(output)
|
|
68 |
{
|
|
69 |
err = output->Value().AsTInt32();
|
|
70 |
}
|
|
71 |
|
|
72 |
inparam->Reset();
|
|
73 |
outparam->Reset();
|
|
74 |
|
|
75 |
return err;
|
|
76 |
}
|
|
77 |
|
|
78 |
TInt AddProvCalendar(CLiwGenericParamList* inparam, CLiwGenericParamList* outparam, MLiwInterface* interface, const TDesC& aCalendar)
|
|
79 |
{
|
|
80 |
inparam->Reset();
|
|
81 |
outparam->Reset();
|
|
82 |
|
|
83 |
CLiwDefaultMap* map = CLiwDefaultMap::NewL();
|
|
84 |
CleanupStack::PushL(map);
|
|
85 |
|
|
86 |
TLiwVariant content(_L("Calendar"));
|
|
87 |
TLiwGenericParam element1;
|
|
88 |
element1.SetNameAndValueL(_L8("Type"),content);
|
|
89 |
inparam->AppendL(element1);
|
|
90 |
content.Reset();
|
|
91 |
element1.Reset();
|
|
92 |
|
|
93 |
|
|
94 |
map->InsertL(_L8("CalendarName"), TLiwVariant(aCalendar) );
|
|
95 |
|
|
96 |
TLiwGenericParam element;
|
|
97 |
element.SetNameAndValueL(_L8("Item"),TLiwVariant(map));
|
|
98 |
|
|
99 |
inparam->AppendL(element);
|
|
100 |
element.Reset();
|
|
101 |
map->DecRef();
|
|
102 |
CleanupStack::Pop(map);
|
|
103 |
|
|
104 |
TRAPD(err, interface->ExecuteCmdL( KCmdAdd, *inparam,*outparam ));
|
|
105 |
TInt pos = 0 ;
|
|
106 |
|
|
107 |
const TLiwGenericParam* output = outparam->FindFirst( pos,_L8("ErrorCode"));
|
|
108 |
|
|
109 |
if(output)
|
|
110 |
{
|
|
111 |
err = output->Value().AsTInt32();
|
|
112 |
}
|
|
113 |
|
|
114 |
inparam->Reset();
|
|
115 |
outparam->Reset();
|
|
116 |
|
|
117 |
return err;
|
|
118 |
};
|
|
119 |
|
|
120 |
void GetLocalUid( const TDesC& aLocalUid, TCalLocalUid& aOutLocalUid )
|
|
121 |
{
|
|
122 |
aOutLocalUid = 0;
|
|
123 |
if( aLocalUid.Length() )
|
|
124 |
{
|
|
125 |
TInt sepPos = aLocalUid.Locate( TChar(KUidSeparator ));
|
|
126 |
TPtrC temp;
|
|
127 |
if( sepPos == KErrNotFound )
|
|
128 |
{
|
|
129 |
temp.Set(aLocalUid.Mid(0));
|
|
130 |
}
|
|
131 |
else
|
|
132 |
{
|
|
133 |
temp.Set(aLocalUid.Mid(0, sepPos));
|
|
134 |
}
|
|
135 |
|
|
136 |
TLex lex(temp);
|
|
137 |
TInt32 num;
|
|
138 |
|
|
139 |
if(lex.Val(num) == KErrNone)
|
|
140 |
aOutLocalUid = TCalLocalUid(num);
|
|
141 |
}
|
|
142 |
}
|
|
143 |
|
|
144 |
void GetGlobalUid( const TDesC& aGlobalUid, TDes8& aOutGlobalUid )
|
|
145 |
{
|
|
146 |
if( aGlobalUid.Length() )
|
|
147 |
{
|
|
148 |
/*TInt sepPos = aGlobalUid.Locate( TChar(KUidSeparator ));
|
|
149 |
|
|
150 |
if( sepPos == KErrNotFound )
|
|
151 |
{
|
|
152 |
aOutGlobalUid.Copy( aGlobalUid.Mid(0) );
|
|
153 |
}
|
|
154 |
else
|
|
155 |
{
|
|
156 |
aOutGlobalUid.Copy( aGlobalUid.Mid( sepPos + 1 ) );
|
|
157 |
}*/
|
|
158 |
aOutGlobalUid.Copy( aGlobalUid );
|
|
159 |
}
|
|
160 |
}
|
|
161 |
|
|
162 |
TInt AddProvAppointmentDailyRepeat(CLiwGenericParamList* inparam, CLiwGenericParamList* outparam, MLiwInterface* interface, const TDesC& aCalendar, TUIDSet*& uidset)
|
|
163 |
{
|
|
164 |
inparam->Reset();
|
|
165 |
outparam->Reset();
|
|
166 |
|
|
167 |
CLiwDefaultMap* map = CLiwDefaultMap::NewL();
|
|
168 |
CleanupStack::PushL(map);
|
|
169 |
|
|
170 |
TLiwVariant content(_L("CalendarEntry"));
|
|
171 |
TLiwGenericParam element1;
|
|
172 |
element1.SetNameAndValueL(_L8("Type"),content);
|
|
173 |
inparam->AppendL(element1);
|
|
174 |
content.Reset();
|
|
175 |
element1.Reset();
|
|
176 |
|
|
177 |
|
|
178 |
map->InsertL(_L8("CalendarName"), TLiwVariant(aCalendar) );
|
|
179 |
map->InsertL(_L8("Type"), TLiwVariant( KEntryAppt ));
|
|
180 |
map->InsertL(_L8("StartTime"), TLiwVariant(TTime(TDateTime(2007,EOctober,23,10,0,0,0))));
|
|
181 |
map->InsertL(_L8("EndTime"), TLiwVariant(TTime(TDateTime(2007,EOctober,23,10,30,0,0))));
|
|
182 |
map->InsertL(_L8("Replication"), TLiwVariant(_L("Open")));
|
|
183 |
map->InsertL(_L8("Description"), TLiwVariant(_L("Meeting")));
|
|
184 |
map->InsertL(_L8("Status"), TLiwVariant(_L("Confirmed")));
|
|
185 |
map->InsertL(_L8("Method"), TLiwVariant(_L("None")));
|
|
186 |
|
|
187 |
CLiwDefaultMap* repeatmap = CLiwDefaultMap::NewL();
|
|
188 |
CleanupStack::PushL(repeatmap);
|
|
189 |
repeatmap->InsertL(_L8("Type"), TLiwVariant(TInt32(1)));
|
|
190 |
repeatmap->InsertL(_L8("StartDate"), TLiwVariant(TTime(TDateTime(2007,EOctober,23,10,0,0,0))));
|
|
191 |
repeatmap->InsertL(_L8("UntilDate"), TLiwVariant(TTime(TDateTime(2007,EOctober,30,10,0,0,0))));
|
|
192 |
map->InsertL(_L8("RepeatRule"), TLiwVariant(repeatmap));
|
|
193 |
CleanupStack::Pop(repeatmap);
|
|
194 |
repeatmap->DecRef();
|
|
195 |
|
|
196 |
|
|
197 |
TLiwGenericParam element;
|
|
198 |
element.SetNameAndValueL(_L8("Item"),TLiwVariant(map));
|
|
199 |
|
|
200 |
inparam->AppendL(element);
|
|
201 |
element.Reset();
|
|
202 |
map->DecRef();
|
|
203 |
CleanupStack::Pop(map);
|
|
204 |
|
|
205 |
TRAPD(err, interface->ExecuteCmdL( KCmdAdd, *inparam,*outparam ));
|
|
206 |
TInt pos = 0 ;
|
|
207 |
|
|
208 |
const TLiwGenericParam* output = outparam->FindFirst( pos,_L8("ErrorCode"));
|
|
209 |
|
|
210 |
if(output)
|
|
211 |
{
|
|
212 |
err = output->Value().AsTInt32();
|
|
213 |
if ( err == KErrNone )
|
|
214 |
{
|
|
215 |
output = outparam->FindFirst( pos,_L8("ReturnValue"));
|
|
216 |
if(output)
|
|
217 |
{
|
|
218 |
uidset = new (ELeave) TUIDSet;
|
|
219 |
TPtrC uidval = (TPtrC)(output->Value().AsDes());
|
|
220 |
//GetLocalUid( uidval, uidset->iLocalUID );
|
|
221 |
|
|
222 |
uidset->iGlobalUID = HBufC8::NewL(uidval.Length());
|
|
223 |
TPtr8 tmp = uidset->iGlobalUID->Des();
|
|
224 |
GetGlobalUid( uidval, tmp );
|
|
225 |
|
|
226 |
/*TLiwVariant luid;
|
|
227 |
if(res->FindL(_L8("LocalUid"), luid))
|
|
228 |
{
|
|
229 |
localuid = luid.AsTUint();
|
|
230 |
}
|
|
231 |
else
|
|
232 |
err = -1;
|
|
233 |
TLiwVariant guid;
|
|
234 |
if(res->FindL(_L8("GlobalUid"), guid))
|
|
235 |
{
|
|
236 |
globaluid = guid.AsData().AllocL();
|
|
237 |
}
|
|
238 |
else
|
|
239 |
err = -1;
|
|
240 |
|
|
241 |
luid.Reset();
|
|
242 |
guid.Reset(); */
|
|
243 |
|
|
244 |
}
|
|
245 |
else
|
|
246 |
err = -1;
|
|
247 |
}
|
|
248 |
}
|
|
249 |
|
|
250 |
inparam->Reset();
|
|
251 |
outparam->Reset();
|
|
252 |
return err;
|
|
253 |
};
|
|
254 |
|
|
255 |
TInt AddProvAppointmentWeeklyRepeat(CLiwGenericParamList* inparam, CLiwGenericParamList* outparam, MLiwInterface* interface, const TDesC& aCalendar, TUIDSet*& uidset)
|
|
256 |
{
|
|
257 |
inparam->Reset();
|
|
258 |
outparam->Reset();
|
|
259 |
|
|
260 |
CLiwDefaultMap* map = CLiwDefaultMap::NewL();
|
|
261 |
CleanupStack::PushL(map);
|
|
262 |
|
|
263 |
TLiwVariant content(_L("CalendarEntry"));
|
|
264 |
TLiwGenericParam element1;
|
|
265 |
element1.SetNameAndValueL(_L8("Type"),content);
|
|
266 |
inparam->AppendL(element1);
|
|
267 |
content.Reset();
|
|
268 |
element1.Reset();
|
|
269 |
|
|
270 |
|
|
271 |
map->InsertL(_L8("CalendarName"), TLiwVariant(aCalendar) );
|
|
272 |
map->InsertL(_L8("Type"), TLiwVariant( KEntryAppt ));
|
|
273 |
map->InsertL(_L8("StartTime"), TLiwVariant(TTime(TDateTime(2007,EOctober,23,10,0,0,0))));
|
|
274 |
map->InsertL(_L8("EndTime"), TLiwVariant(TTime(TDateTime(2007,EOctober,23,10,30,0,0))));
|
|
275 |
map->InsertL(_L8("Replication"), TLiwVariant(_L("Open")));
|
|
276 |
map->InsertL(_L8("Description"), TLiwVariant(_L("Meeting")));
|
|
277 |
map->InsertL(_L8("Status"), TLiwVariant(_L("Confirmed")));
|
|
278 |
map->InsertL(_L8("Method"), TLiwVariant(_L("None")));
|
|
279 |
|
|
280 |
CLiwDefaultMap* repeatmap = CLiwDefaultMap::NewL();
|
|
281 |
CleanupStack::PushL(repeatmap);
|
|
282 |
repeatmap->InsertL(_L8("Type"), TLiwVariant(TInt32(2)));
|
|
283 |
repeatmap->InsertL(_L8("UntilDate"), TLiwVariant(TTime(TDateTime(2007,EOctober,30,10,0,0,0))));
|
|
284 |
map->InsertL(_L8("RepeatRule"), TLiwVariant(repeatmap));
|
|
285 |
CleanupStack::Pop(repeatmap);
|
|
286 |
repeatmap->DecRef();
|
|
287 |
|
|
288 |
|
|
289 |
TLiwGenericParam element;
|
|
290 |
element.SetNameAndValueL(_L8("Item"),TLiwVariant(map));
|
|
291 |
|
|
292 |
inparam->AppendL(element);
|
|
293 |
element.Reset();
|
|
294 |
map->DecRef();
|
|
295 |
CleanupStack::Pop(map);
|
|
296 |
|
|
297 |
TRAPD(err, interface->ExecuteCmdL( KCmdAdd, *inparam,*outparam ));
|
|
298 |
TInt pos = 0 ;
|
|
299 |
|
|
300 |
const TLiwGenericParam* output = outparam->FindFirst( pos,_L8("ErrorCode"));
|
|
301 |
|
|
302 |
if(output)
|
|
303 |
{
|
|
304 |
err = output->Value().AsTInt32();
|
|
305 |
if ( err == KErrNone )
|
|
306 |
{
|
|
307 |
output = outparam->FindFirst( pos,_L8("ReturnValue"));
|
|
308 |
if(output)
|
|
309 |
{
|
|
310 |
uidset = new (ELeave) TUIDSet;
|
|
311 |
TPtrC uidval = (TPtrC)(output->Value().AsDes());
|
|
312 |
//GetLocalUid( uidval, uidset->iLocalUID );
|
|
313 |
|
|
314 |
uidset->iGlobalUID = HBufC8::NewL(uidval.Length());
|
|
315 |
TPtr8 tmp = uidset->iGlobalUID->Des();
|
|
316 |
GetGlobalUid( uidval, tmp );
|
|
317 |
|
|
318 |
/*TLiwVariant luid;
|
|
319 |
if(res->FindL(_L8("LocalUid"), luid))
|
|
320 |
{
|
|
321 |
localuid = luid.AsTUint();
|
|
322 |
}
|
|
323 |
else
|
|
324 |
err = -1;
|
|
325 |
TLiwVariant guid;
|
|
326 |
if(res->FindL(_L8("GlobalUid"), guid))
|
|
327 |
{
|
|
328 |
globaluid = guid.AsData().AllocL();
|
|
329 |
}
|
|
330 |
else
|
|
331 |
err = -1;
|
|
332 |
|
|
333 |
luid.Reset();
|
|
334 |
guid.Reset(); */
|
|
335 |
|
|
336 |
}
|
|
337 |
else
|
|
338 |
err = -1;
|
|
339 |
}
|
|
340 |
}
|
|
341 |
|
|
342 |
inparam->Reset();
|
|
343 |
outparam->Reset();
|
|
344 |
return err;
|
|
345 |
};
|
|
346 |
TInt AddProvAppointmentMonthlyRepeat(CLiwGenericParamList* inparam, CLiwGenericParamList* outparam, MLiwInterface* interface, const TDesC& aCalendar, TUIDSet*& uidset)
|
|
347 |
{
|
|
348 |
inparam->Reset();
|
|
349 |
outparam->Reset();
|
|
350 |
|
|
351 |
CLiwDefaultMap* map = CLiwDefaultMap::NewL();
|
|
352 |
CleanupStack::PushL(map);
|
|
353 |
|
|
354 |
TLiwVariant content(_L("CalendarEntry"));
|
|
355 |
TLiwGenericParam element1;
|
|
356 |
element1.SetNameAndValueL(_L8("Type"),content);
|
|
357 |
inparam->AppendL(element1);
|
|
358 |
content.Reset();
|
|
359 |
element1.Reset();
|
|
360 |
|
|
361 |
|
|
362 |
map->InsertL(_L8("CalendarName"), TLiwVariant(aCalendar) );
|
|
363 |
map->InsertL(_L8("Type"), TLiwVariant( KEntryAppt ));
|
|
364 |
map->InsertL(_L8("StartTime"), TLiwVariant(TTime(TDateTime(2007,EOctober,23,10,0,0,0))));
|
|
365 |
map->InsertL(_L8("EndTime"), TLiwVariant(TTime(TDateTime(2007,EOctober,23,10,30,0,0))));
|
|
366 |
map->InsertL(_L8("Replication"), TLiwVariant(_L("Open")));
|
|
367 |
map->InsertL(_L8("Description"), TLiwVariant(_L("Meeting")));
|
|
368 |
map->InsertL(_L8("Status"), TLiwVariant(_L("Confirmed")));
|
|
369 |
map->InsertL(_L8("Method"), TLiwVariant(_L("None")));
|
|
370 |
|
|
371 |
CLiwDefaultMap* repeatmap = CLiwDefaultMap::NewL();
|
|
372 |
CleanupStack::PushL(repeatmap);
|
|
373 |
repeatmap->InsertL(_L8("Type"), TLiwVariant(TInt32(3)));
|
|
374 |
repeatmap->InsertL(_L8("UntilDate"), TLiwVariant(TTime(TDateTime(2009,EDecember,30,10,0,0,0))));
|
|
375 |
|
|
376 |
CLiwDefaultList* daysofmonthlist = CLiwDefaultList::NewL();
|
|
377 |
CLiwDefaultMap* map3 = CLiwDefaultMap::NewL();
|
|
378 |
map3->InsertL(_L8("Day"), TLiwVariant(TInt32(0)) );
|
|
379 |
map3->InsertL(_L8("WeekNum"), TLiwVariant( TInt32(1)));
|
|
380 |
daysofmonthlist->AppendL(TLiwVariant(map3));
|
|
381 |
map3->DecRef();
|
|
382 |
|
|
383 |
CLiwDefaultMap* map2 = CLiwDefaultMap::NewL();
|
|
384 |
map2->InsertL(_L8("Day"), TLiwVariant(TInt32(2)) );
|
|
385 |
map2->InsertL(_L8("WeekNum"), TLiwVariant( TInt32(3)));
|
|
386 |
daysofmonthlist->AppendL(TLiwVariant(map2));
|
|
387 |
map2->DecRef();
|
|
388 |
|
|
389 |
repeatmap->InsertL(_L8("DaysOfMonth"),TLiwVariant(daysofmonthlist));
|
|
390 |
daysofmonthlist->DecRef();
|
|
391 |
|
|
392 |
map->InsertL(_L8("RepeatRule"), TLiwVariant(repeatmap));
|
|
393 |
CleanupStack::Pop(repeatmap);
|
|
394 |
repeatmap->DecRef();
|
|
395 |
|
|
396 |
TLiwGenericParam element;
|
|
397 |
element.SetNameAndValueL(_L8("Item"),TLiwVariant(map));
|
|
398 |
|
|
399 |
inparam->AppendL(element);
|
|
400 |
element.Reset();
|
|
401 |
map->DecRef();
|
|
402 |
CleanupStack::Pop(map);
|
|
403 |
|
|
404 |
TRAPD(err, interface->ExecuteCmdL( KCmdAdd, *inparam,*outparam ));
|
|
405 |
TInt pos = 0 ;
|
|
406 |
|
|
407 |
const TLiwGenericParam* output = outparam->FindFirst( pos,_L8("ErrorCode"));
|
|
408 |
|
|
409 |
if(output)
|
|
410 |
{
|
|
411 |
err = output->Value().AsTInt32();
|
|
412 |
if ( err == KErrNone )
|
|
413 |
{
|
|
414 |
output = outparam->FindFirst( pos,_L8("ReturnValue"));
|
|
415 |
if(output)
|
|
416 |
{
|
|
417 |
uidset = new (ELeave) TUIDSet;
|
|
418 |
TPtrC uidval = (TPtrC)(output->Value().AsDes());
|
|
419 |
//GetLocalUid( uidval, uidset->iLocalUID );
|
|
420 |
|
|
421 |
uidset->iGlobalUID = HBufC8::NewL(uidval.Length());
|
|
422 |
TPtr8 tmp = uidset->iGlobalUID->Des();
|
|
423 |
GetGlobalUid( uidval, tmp );
|
|
424 |
|
|
425 |
/*TLiwVariant luid;
|
|
426 |
if(res->FindL(_L8("LocalUid"), luid))
|
|
427 |
{
|
|
428 |
localuid = luid.AsTUint();
|
|
429 |
}
|
|
430 |
else
|
|
431 |
err = -1;
|
|
432 |
TLiwVariant guid;
|
|
433 |
if(res->FindL(_L8("GlobalUid"), guid))
|
|
434 |
{
|
|
435 |
globaluid = guid.AsData().AllocL();
|
|
436 |
}
|
|
437 |
else
|
|
438 |
err = -1;
|
|
439 |
|
|
440 |
luid.Reset();
|
|
441 |
guid.Reset(); */
|
|
442 |
|
|
443 |
}
|
|
444 |
else
|
|
445 |
err = -1;
|
|
446 |
}
|
|
447 |
}
|
|
448 |
|
|
449 |
inparam->Reset();
|
|
450 |
outparam->Reset();
|
|
451 |
return err;
|
|
452 |
};
|
|
453 |
|
|
454 |
TInt AddProvAppointmentWithoutRepeat(CLiwGenericParamList* inparam, CLiwGenericParamList* outparam, MLiwInterface* interface, const TDesC& aCalendar, TUIDSet*& uidset)
|
|
455 |
{
|
|
456 |
inparam->Reset();
|
|
457 |
outparam->Reset();
|
|
458 |
|
|
459 |
CLiwDefaultMap* map = CLiwDefaultMap::NewL();
|
|
460 |
CleanupStack::PushL(map);
|
|
461 |
|
|
462 |
TLiwVariant content(_L("CalendarEntry"));
|
|
463 |
TLiwGenericParam element1;
|
|
464 |
element1.SetNameAndValueL(_L8("Type"),content);
|
|
465 |
inparam->AppendL(element1);
|
|
466 |
content.Reset();
|
|
467 |
element1.Reset();
|
|
468 |
|
|
469 |
|
|
470 |
map->InsertL(_L8("CalendarName"), TLiwVariant(aCalendar) );
|
|
471 |
map->InsertL(_L8("Type"), TLiwVariant( KEntryAppt ));
|
|
472 |
map->InsertL(_L8("StartTime"), TLiwVariant(TTime(TDateTime(2007,EOctober,3,10,0,0,0))));
|
|
473 |
map->InsertL(_L8("EndTime"), TLiwVariant(TTime(TDateTime(2007,EOctober,3,10,30,0,0))));
|
|
474 |
map->InsertL(_L8("Replication"), TLiwVariant(_L("Open")));
|
|
475 |
map->InsertL(_L8("Description"), TLiwVariant(_L("Meeting")));
|
|
476 |
map->InsertL(_L8("Status"), TLiwVariant(_L("Confirmed")));
|
|
477 |
map->InsertL(_L8("Method"), TLiwVariant(_L("None")));
|
|
478 |
|
|
479 |
TLiwGenericParam element;
|
|
480 |
element.SetNameAndValueL(_L8("Item"),TLiwVariant(map));
|
|
481 |
|
|
482 |
inparam->AppendL(element);
|
|
483 |
element.Reset();
|
|
484 |
map->DecRef();
|
|
485 |
CleanupStack::Pop(map);
|
|
486 |
|
|
487 |
TRAPD(err, interface->ExecuteCmdL( KCmdAdd, *inparam,*outparam ));
|
|
488 |
TInt pos = 0 ;
|
|
489 |
|
|
490 |
const TLiwGenericParam* output = outparam->FindFirst( pos,_L8("ErrorCode"));
|
|
491 |
|
|
492 |
if(output)
|
|
493 |
{
|
|
494 |
err = output->Value().AsTInt32();
|
|
495 |
if ( err == KErrNone )
|
|
496 |
{
|
|
497 |
output = outparam->FindFirst( pos,_L8("ReturnValue"));
|
|
498 |
if(output)
|
|
499 |
{
|
|
500 |
uidset = new (ELeave) TUIDSet;
|
|
501 |
TPtrC uidval = (TPtrC)(output->Value().AsDes());
|
|
502 |
//GetLocalUid( uidval, uidset->iLocalUID );
|
|
503 |
|
|
504 |
uidset->iGlobalUID = HBufC8::NewL(uidval.Length());
|
|
505 |
TPtr8 tmp = uidset->iGlobalUID->Des();
|
|
506 |
GetGlobalUid( uidval, tmp );
|
|
507 |
|
|
508 |
/*TLiwVariant luid;
|
|
509 |
if(res->FindL(_L8("LocalUid"), luid))
|
|
510 |
{
|
|
511 |
localuid = luid.AsTUint();
|
|
512 |
}
|
|
513 |
else
|
|
514 |
err = -1;
|
|
515 |
TLiwVariant guid;
|
|
516 |
if(res->FindL(_L8("GlobalUid"), guid))
|
|
517 |
{
|
|
518 |
globaluid = guid.AsData().AllocL();
|
|
519 |
}
|
|
520 |
else
|
|
521 |
err = -1;
|
|
522 |
|
|
523 |
luid.Reset();
|
|
524 |
guid.Reset(); */
|
|
525 |
|
|
526 |
}
|
|
527 |
else
|
|
528 |
err = -1;
|
|
529 |
}
|
|
530 |
}
|
|
531 |
|
|
532 |
inparam->Reset();
|
|
533 |
outparam->Reset();
|
|
534 |
return err;
|
|
535 |
};
|
|
536 |
|
|
537 |
TInt AddProvToDo(CLiwGenericParamList* inparam, CLiwGenericParamList* outparam, MLiwInterface* interface, const TDesC& aCalendar, TUIDSet*& uidset)
|
|
538 |
{
|
|
539 |
inparam->Reset();
|
|
540 |
outparam->Reset();
|
|
541 |
|
|
542 |
|
|
543 |
CLiwDefaultMap* map = CLiwDefaultMap::NewL();
|
|
544 |
CleanupStack::PushL(map);
|
|
545 |
|
|
546 |
TLiwVariant content(_L("CalendarEntry"));
|
|
547 |
TLiwGenericParam element1;
|
|
548 |
element1.SetNameAndValueL(_L8("Type"),content);
|
|
549 |
inparam->AppendL(element1);
|
|
550 |
content.Reset();
|
|
551 |
element1.Reset();
|
|
552 |
|
|
553 |
|
|
554 |
map->InsertL(_L8("CalendarName"), TLiwVariant(aCalendar) );
|
|
555 |
map->InsertL(_L8("Type"), TLiwVariant( KEntryTodo ));
|
|
556 |
map->InsertL(_L8("EndTime"), TLiwVariant(TTime(TDateTime(2007,EAugust,20,0,0,0,0))));
|
|
557 |
map->InsertL(_L8("Replication"), TLiwVariant(_L("Open")));
|
|
558 |
map->InsertL(_L8("Description"), TLiwVariant(_L("New todo entry created")));
|
|
559 |
//map->InsertL(_L8("Method"), TLiwVariant(_L("None")));
|
|
560 |
|
|
561 |
TLiwGenericParam element;
|
|
562 |
element.SetNameAndValueL(_L8("Item"),TLiwVariant(map));
|
|
563 |
|
|
564 |
inparam->AppendL(element);
|
|
565 |
element.Reset();
|
|
566 |
map->DecRef();
|
|
567 |
CleanupStack::Pop(map);
|
|
568 |
|
|
569 |
TRAPD(err, interface->ExecuteCmdL( KCmdAdd, *inparam,*outparam ));
|
|
570 |
TInt pos = 0 ;
|
|
571 |
|
|
572 |
const TLiwGenericParam* output = outparam->FindFirst( pos,_L8("ErrorCode"));
|
|
573 |
|
|
574 |
if(output)
|
|
575 |
{
|
|
576 |
err = output->Value().AsTInt32();
|
|
577 |
if ( err == KErrNone )
|
|
578 |
{
|
|
579 |
output = outparam->FindFirst( pos,_L8("ReturnValue"));
|
|
580 |
if(output)
|
|
581 |
{
|
|
582 |
uidset = new (ELeave) TUIDSet;
|
|
583 |
TPtrC uidval = (TPtrC)(output->Value().AsDes());
|
|
584 |
//GetLocalUid( uidval, uidset->iLocalUID );
|
|
585 |
|
|
586 |
uidset->iGlobalUID = HBufC8::NewL(uidval.Length());
|
|
587 |
TPtr8 tmp = uidset->iGlobalUID->Des();
|
|
588 |
GetGlobalUid( uidval, tmp );
|
|
589 |
|
|
590 |
/* TLiwVariant luid;
|
|
591 |
if(res->FindL(_L8("LocalUid"), luid))
|
|
592 |
{
|
|
593 |
localuid = luid.AsTUint();
|
|
594 |
}
|
|
595 |
else
|
|
596 |
err = -1;
|
|
597 |
TLiwVariant guid;
|
|
598 |
if(res->FindL(_L8("GlobalUid"), guid))
|
|
599 |
{
|
|
600 |
globaluid = guid.AsData().AllocL();
|
|
601 |
}
|
|
602 |
else
|
|
603 |
err = -1;
|
|
604 |
|
|
605 |
luid.Reset();
|
|
606 |
guid.Reset();*/
|
|
607 |
}
|
|
608 |
else
|
|
609 |
err = -1;
|
|
610 |
}
|
|
611 |
}
|
|
612 |
|
|
613 |
inparam->Reset();
|
|
614 |
outparam->Reset();
|
|
615 |
|
|
616 |
|
|
617 |
return err;
|
|
618 |
};
|
|
619 |
|
|
620 |
TInt AddProvAnni(CLiwGenericParamList* inparam, CLiwGenericParamList* outparam, MLiwInterface* interface, const TDesC& aCalendar, TUIDSet*& uidset)
|
|
621 |
{
|
|
622 |
inparam->Reset();
|
|
623 |
outparam->Reset();
|
|
624 |
|
|
625 |
|
|
626 |
CLiwDefaultMap* map = CLiwDefaultMap::NewL();
|
|
627 |
CleanupStack::PushL(map);
|
|
628 |
|
|
629 |
TLiwVariant content(_L("CalendarEntry"));
|
|
630 |
TLiwGenericParam element1;
|
|
631 |
element1.SetNameAndValueL(_L8("Type"),content);
|
|
632 |
inparam->AppendL(element1);
|
|
633 |
content.Reset();
|
|
634 |
element1.Reset();
|
|
635 |
|
|
636 |
|
|
637 |
map->InsertL(_L8("CalendarName"), TLiwVariant(aCalendar) );
|
|
638 |
map->InsertL(_L8("Type"), TLiwVariant( KEntryAnniv ));
|
|
639 |
map->InsertL(_L8("StartTime"), TLiwVariant(TTime(TDateTime(2007,EDecember,30,0,0,0,0))));
|
|
640 |
map->InsertL(_L8("Replication"), TLiwVariant(_L("Open")));
|
|
641 |
map->InsertL(_L8("Description"), TLiwVariant(_L("Anniversary")));
|
|
642 |
//map->InsertL(_L8("Method"), TLiwVariant(_L("None")));
|
|
643 |
|
|
644 |
TLiwGenericParam element;
|
|
645 |
element.SetNameAndValueL(_L8("Item"),TLiwVariant(map));
|
|
646 |
|
|
647 |
inparam->AppendL(element);
|
|
648 |
element.Reset();
|
|
649 |
map->DecRef();
|
|
650 |
CleanupStack::Pop(map);
|
|
651 |
|
|
652 |
TRAPD(err, interface->ExecuteCmdL( KCmdAdd, *inparam,*outparam ));
|
|
653 |
TInt pos = 0 ;
|
|
654 |
|
|
655 |
const TLiwGenericParam* output = outparam->FindFirst( pos,_L8("ErrorCode"));
|
|
656 |
|
|
657 |
if(output)
|
|
658 |
{
|
|
659 |
err = output->Value().AsTInt32();
|
|
660 |
if ( err == KErrNone )
|
|
661 |
{
|
|
662 |
output = outparam->FindFirst( pos,_L8("ReturnValue"));
|
|
663 |
if(output)
|
|
664 |
{
|
|
665 |
uidset = new (ELeave) TUIDSet;
|
|
666 |
TPtrC uidval = (TPtrC)(output->Value().AsDes());
|
|
667 |
//GetLocalUid( uidval, uidset->iLocalUID );
|
|
668 |
|
|
669 |
uidset->iGlobalUID = HBufC8::NewL(uidval.Length());
|
|
670 |
TPtr8 tmp = uidset->iGlobalUID->Des();
|
|
671 |
GetGlobalUid( uidval, tmp );
|
|
672 |
|
|
673 |
/*const CLiwMap* res = output->Value().AsMap();
|
|
674 |
if ( res )
|
|
675 |
{
|
|
676 |
TLiwVariant luid;
|
|
677 |
if(res->FindL(_L8("LocalUid"), luid))
|
|
678 |
{
|
|
679 |
localuid = luid.AsTUint();
|
|
680 |
}
|
|
681 |
else
|
|
682 |
err = -1;
|
|
683 |
luid.Reset();
|
|
684 |
}
|
|
685 |
else
|
|
686 |
err = -1;*/
|
|
687 |
}
|
|
688 |
else
|
|
689 |
err = -1;
|
|
690 |
}
|
|
691 |
}
|
|
692 |
|
|
693 |
inparam->Reset();
|
|
694 |
outparam->Reset();
|
|
695 |
|
|
696 |
return err;
|
|
697 |
};
|
|
698 |
|
|
699 |
TInt AddProvDayEvent(CLiwGenericParamList* inparam, CLiwGenericParamList* outparam, MLiwInterface* interface, const TDesC& aCalendar, TUIDSet*& uidset)
|
|
700 |
{
|
|
701 |
inparam->Reset();
|
|
702 |
outparam->Reset();
|
|
703 |
|
|
704 |
|
|
705 |
CLiwDefaultMap* map = CLiwDefaultMap::NewL();
|
|
706 |
CleanupStack::PushL(map);
|
|
707 |
|
|
708 |
TLiwVariant content(_L("CalendarEntry"));
|
|
709 |
TLiwGenericParam element1;
|
|
710 |
element1.SetNameAndValueL(_L8("Type"),content);
|
|
711 |
inparam->AppendL(element1);
|
|
712 |
content.Reset();
|
|
713 |
element1.Reset();
|
|
714 |
|
|
715 |
|
|
716 |
map->InsertL(_L8("CalendarName"), TLiwVariant(aCalendar) );
|
|
717 |
map->InsertL(_L8("Type"), TLiwVariant( KEntryEvent ));
|
|
718 |
map->InsertL(_L8("StartTime"), TLiwVariant(TTime(TDateTime(2007,EJuly,25,0,0,0,0))));
|
|
719 |
map->InsertL(_L8("Replication"), TLiwVariant(_L("Open")));
|
|
720 |
map->InsertL(_L8("Description"), TLiwVariant(_L("New Event entry created")));
|
|
721 |
//map->InsertL(_L8("Method"), TLiwVariant(_L("None")));
|
|
722 |
|
|
723 |
TLiwGenericParam element;
|
|
724 |
element.SetNameAndValueL(_L8("Item"),TLiwVariant(map));
|
|
725 |
|
|
726 |
inparam->AppendL(element);
|
|
727 |
element.Reset();
|
|
728 |
map->DecRef();
|
|
729 |
CleanupStack::Pop(map);
|
|
730 |
|
|
731 |
TRAPD(err, interface->ExecuteCmdL( KCmdAdd, *inparam,*outparam ));
|
|
732 |
TInt pos = 0 ;
|
|
733 |
|
|
734 |
const TLiwGenericParam* output = outparam->FindFirst( pos,_L8("ErrorCode"));
|
|
735 |
|
|
736 |
if(output)
|
|
737 |
{
|
|
738 |
err = output->Value().AsTInt32();
|
|
739 |
if ( err == KErrNone )
|
|
740 |
{
|
|
741 |
output = outparam->FindFirst( pos,_L8("ReturnValue"));
|
|
742 |
if(output)
|
|
743 |
{
|
|
744 |
uidset = new (ELeave) TUIDSet;
|
|
745 |
TPtrC uidval = (TPtrC)(output->Value().AsDes());
|
|
746 |
//GetLocalUid( uidval, uidset->iLocalUID );
|
|
747 |
|
|
748 |
uidset->iGlobalUID = HBufC8::NewL(uidval.Length());
|
|
749 |
TPtr8 tmp = uidset->iGlobalUID->Des();
|
|
750 |
GetGlobalUid( uidval, tmp );
|
|
751 |
|
|
752 |
/* const CLiwMap* res = output->Value().AsMap();
|
|
753 |
if ( res )
|
|
754 |
{
|
|
755 |
|
|
756 |
TLiwVariant luid;
|
|
757 |
if(res->FindL(_L8("LocalUid"), luid))
|
|
758 |
{
|
|
759 |
localuid = luid.AsTUint();
|
|
760 |
}
|
|
761 |
else
|
|
762 |
err = -1;
|
|
763 |
TLiwVariant guid;
|
|
764 |
if(res->FindL(_L8("GlobalUid"), guid))
|
|
765 |
{
|
|
766 |
globaluid = guid.AsData().AllocL();
|
|
767 |
}
|
|
768 |
else
|
|
769 |
err = -1;
|
|
770 |
|
|
771 |
luid.Reset();
|
|
772 |
guid.Reset();
|
|
773 |
}
|
|
774 |
else
|
|
775 |
err = -1; */
|
|
776 |
}
|
|
777 |
else
|
|
778 |
err = -1;
|
|
779 |
}
|
|
780 |
}
|
|
781 |
|
|
782 |
inparam->Reset();
|
|
783 |
outparam->Reset();
|
|
784 |
|
|
785 |
return err;
|
|
786 |
};
|
|
787 |
|
|
788 |
TInt AddProvReminder(CLiwGenericParamList* inparam, CLiwGenericParamList* outparam, MLiwInterface* interface, const TDesC& aCalendar, TUIDSet*& uidset)
|
|
789 |
{
|
|
790 |
inparam->Reset();
|
|
791 |
outparam->Reset();
|
|
792 |
|
|
793 |
CLiwDefaultMap* map = CLiwDefaultMap::NewL();
|
|
794 |
CleanupStack::PushL(map);
|
|
795 |
|
|
796 |
TLiwVariant content(_L("CalendarEntry"));
|
|
797 |
TLiwGenericParam element1;
|
|
798 |
element1.SetNameAndValueL(_L8("Type"),content);
|
|
799 |
inparam->AppendL(element1);
|
|
800 |
content.Reset();
|
|
801 |
element1.Reset();
|
|
802 |
|
|
803 |
|
|
804 |
map->InsertL(_L8("CalendarName"), TLiwVariant(aCalendar) );
|
|
805 |
map->InsertL(_L8("Type"), TLiwVariant( KEntryReminder ));
|
|
806 |
map->InsertL(_L8("StartTime"), TLiwVariant(TTime(TDateTime(2007,EJuly,22,10,30,0,0))));
|
|
807 |
map->InsertL(_L8("Replication"), TLiwVariant(_L("Open")));
|
|
808 |
map->InsertL(_L8("Description"), TLiwVariant(_L("New Reminder entry created")));
|
|
809 |
//map->InsertL(_L8("Method"), TLiwVariant(_L("None")));
|
|
810 |
|
|
811 |
TLiwGenericParam element;
|
|
812 |
element.SetNameAndValueL(_L8("Item"),TLiwVariant(map));
|
|
813 |
|
|
814 |
inparam->AppendL(element);
|
|
815 |
element.Reset();
|
|
816 |
map->DecRef();
|
|
817 |
CleanupStack::Pop(map);
|
|
818 |
|
|
819 |
TRAPD(err, interface->ExecuteCmdL( KCmdAdd, *inparam,*outparam ));
|
|
820 |
TInt pos = 0 ;
|
|
821 |
|
|
822 |
const TLiwGenericParam* output = outparam->FindFirst( pos,_L8("ErrorCode"));
|
|
823 |
|
|
824 |
if(output)
|
|
825 |
{
|
|
826 |
err = output->Value().AsTInt32();
|
|
827 |
if ( err == KErrNone )
|
|
828 |
{
|
|
829 |
output = outparam->FindFirst( pos,_L8("ReturnValue"));
|
|
830 |
if(output)
|
|
831 |
{
|
|
832 |
uidset = new (ELeave) TUIDSet;
|
|
833 |
TPtrC uidval = (TPtrC)(output->Value().AsDes());
|
|
834 |
//GetLocalUid( uidval, uidset->iLocalUID );
|
|
835 |
|
|
836 |
uidset->iGlobalUID = HBufC8::NewL(uidval.Length());
|
|
837 |
TPtr8 tmp = uidset->iGlobalUID->Des();
|
|
838 |
GetGlobalUid( uidval, tmp );
|
|
839 |
|
|
840 |
/* const CLiwMap* res = output->Value().AsMap();
|
|
841 |
if ( res )
|
|
842 |
{
|
|
843 |
TLiwVariant luid;
|
|
844 |
if(res->FindL(_L8("LocalUid"), luid))
|
|
845 |
{
|
|
846 |
localuid = luid.AsTUint();
|
|
847 |
}
|
|
848 |
else
|
|
849 |
err = -1;
|
|
850 |
luid.Reset();
|
|
851 |
}
|
|
852 |
else
|
|
853 |
err = -1;*/
|
|
854 |
}
|
|
855 |
else
|
|
856 |
err = -1;
|
|
857 |
}
|
|
858 |
}
|
|
859 |
|
|
860 |
inparam->Reset();
|
|
861 |
outparam->Reset();
|
|
862 |
return err;
|
|
863 |
};
|
|
864 |
|
|
865 |
TInt AddProvAppointmentDailyRepeatAndAttendees(CLiwGenericParamList* inparam, CLiwGenericParamList* outparam, MLiwInterface* interface, const TDesC& aCalendar, TUIDSet*& uidset)
|
|
866 |
{
|
|
867 |
inparam->Reset();
|
|
868 |
outparam->Reset();
|
|
869 |
|
|
870 |
CLiwDefaultMap* map = CLiwDefaultMap::NewL();
|
|
871 |
CleanupStack::PushL(map);
|
|
872 |
|
|
873 |
TLiwVariant content(_L("CalendarEntry"));
|
|
874 |
TLiwGenericParam element1;
|
|
875 |
element1.SetNameAndValueL(_L8("Type"),content);
|
|
876 |
inparam->AppendL(element1);
|
|
877 |
content.Reset();
|
|
878 |
element1.Reset();
|
|
879 |
|
|
880 |
|
|
881 |
map->InsertL(_L8("CalendarName"), TLiwVariant(aCalendar) );
|
|
882 |
map->InsertL(_L8("Type"), TLiwVariant( KEntryAppt ));
|
|
883 |
map->InsertL(_L8("StartTime"), TLiwVariant(TTime(TDateTime(2007,EOctober,23,10,0,0,0))));
|
|
884 |
map->InsertL(_L8("EndTime"), TLiwVariant(TTime(TDateTime(2007,EOctober,23,10,30,0,0))));
|
|
885 |
map->InsertL(_L8("Replication"), TLiwVariant(_L("Open")));
|
|
886 |
map->InsertL(_L8("Description"), TLiwVariant(_L("Meeting")));
|
|
887 |
map->InsertL(_L8("Status"), TLiwVariant(_L("Confirmed")));
|
|
888 |
map->InsertL(_L8("Method"), TLiwVariant(_L("None")));
|
|
889 |
|
|
890 |
CLiwDefaultList* attlist = CLiwDefaultList::NewL();
|
|
891 |
CleanupStack::PushL(attlist);
|
|
892 |
|
|
893 |
CLiwDefaultMap* attmap = CLiwDefaultMap::NewL();
|
|
894 |
CleanupStack::PushL(attmap);
|
|
895 |
attmap->InsertL(_L8("CommonName"), TLiwVariant(_L("sapi")));
|
|
896 |
attmap->InsertL(_L8("Address"), TLiwVariant(_L("h2s@nokia.com")));
|
|
897 |
attlist->AppendL( TLiwVariant(attmap));
|
|
898 |
CleanupStack::Pop(attmap);
|
|
899 |
attmap->DecRef();
|
|
900 |
map->InsertL(_L8("Attendees"), TLiwVariant(attlist));
|
|
901 |
map->InsertL(_L8("PhoneOwner"), TLiwVariant(_L("h2s@nokia.com")));
|
|
902 |
CLiwDefaultMap* orgmap = CLiwDefaultMap::NewL();
|
|
903 |
CleanupStack::PushL(orgmap);
|
|
904 |
orgmap->InsertL(_L8("CommonName"), TLiwVariant(_L("sapi")));
|
|
905 |
orgmap->InsertL(_L8("Address"), TLiwVariant(_L("mdc@nokia.com")));
|
|
906 |
map->InsertL(_L8("Organizer"), TLiwVariant(orgmap));
|
|
907 |
CleanupStack::Pop(orgmap);
|
|
908 |
orgmap->DecRef();
|
|
909 |
|
|
910 |
CleanupStack::Pop(attlist);
|
|
911 |
attlist->DecRef();
|
|
912 |
CLiwDefaultMap* repeatmap = CLiwDefaultMap::NewL();
|
|
913 |
CleanupStack::PushL(repeatmap);
|
|
914 |
repeatmap->InsertL(_L8("Type"), TLiwVariant(TInt32(1)));
|
|
915 |
repeatmap->InsertL(_L8("StartDate"), TLiwVariant(TTime(TDateTime(2007,EOctober,23,10,0,0,0))));
|
|
916 |
repeatmap->InsertL(_L8("UntilDate"), TLiwVariant(TTime(TDateTime(2007,EOctober,30,10,0,0,0))));
|
|
917 |
map->InsertL(_L8("RepeatRule"), TLiwVariant(repeatmap));
|
|
918 |
CleanupStack::Pop(repeatmap);
|
|
919 |
repeatmap->DecRef();
|
|
920 |
|
|
921 |
|
|
922 |
TLiwGenericParam element;
|
|
923 |
element.SetNameAndValueL(_L8("Item"),TLiwVariant(map));
|
|
924 |
|
|
925 |
inparam->AppendL(element);
|
|
926 |
element.Reset();
|
|
927 |
map->DecRef();
|
|
928 |
CleanupStack::Pop(map);
|
|
929 |
|
|
930 |
TRAPD(err, interface->ExecuteCmdL( KCmdAdd, *inparam,*outparam ));
|
|
931 |
TInt pos = 0 ;
|
|
932 |
|
|
933 |
const TLiwGenericParam* output = outparam->FindFirst( pos,_L8("ErrorCode"));
|
|
934 |
|
|
935 |
if(output)
|
|
936 |
{
|
|
937 |
err = output->Value().AsTInt32();
|
|
938 |
if ( err == KErrNone )
|
|
939 |
{
|
|
940 |
output = outparam->FindFirst( pos,_L8("ReturnValue"));
|
|
941 |
if(output)
|
|
942 |
{
|
|
943 |
uidset = new (ELeave) TUIDSet;
|
|
944 |
TPtrC uidval = (TPtrC)(output->Value().AsDes());
|
|
945 |
//GetLocalUid( uidval, uidset->iLocalUID );
|
|
946 |
|
|
947 |
uidset->iGlobalUID = HBufC8::NewL(uidval.Length());
|
|
948 |
TPtr8 tmp = uidset->iGlobalUID->Des();
|
|
949 |
GetGlobalUid( uidval, tmp );
|
|
950 |
|
|
951 |
/*TLiwVariant luid;
|
|
952 |
if(res->FindL(_L8("LocalUid"), luid))
|
|
953 |
{
|
|
954 |
localuid = luid.AsTUint();
|
|
955 |
}
|
|
956 |
else
|
|
957 |
err = -1;
|
|
958 |
TLiwVariant guid;
|
|
959 |
if(res->FindL(_L8("GlobalUid"), guid))
|
|
960 |
{
|
|
961 |
globaluid = guid.AsData().AllocL();
|
|
962 |
}
|
|
963 |
else
|
|
964 |
err = -1;
|
|
965 |
|
|
966 |
luid.Reset();
|
|
967 |
guid.Reset(); */
|
|
968 |
|
|
969 |
}
|
|
970 |
else
|
|
971 |
err = -1;
|
|
972 |
}
|
|
973 |
}
|
|
974 |
|
|
975 |
inparam->Reset();
|
|
976 |
outparam->Reset();
|
|
977 |
return err;
|
|
978 |
};
|
|
979 |
|
|
980 |
TDesC& GetEntry(MLiwInterface* interface, CLiwGenericParamList* inparam, CLiwGenericParamList* outparam, TPtrC globaluid, const TDesC& calname)
|
|
981 |
{
|
|
982 |
inparam->Reset();
|
|
983 |
outparam->Reset();
|
|
984 |
|
|
985 |
TLiwGenericParam dsNameParam(KContentType, TLiwVariant(_L("CalendarEntry")));
|
|
986 |
inparam->AppendL(dsNameParam);
|
|
987 |
|
|
988 |
CLiwDefaultMap *filterMap = CLiwDefaultMap::NewL();
|
|
989 |
TLiwGenericParam filterParam(KFilter, TLiwVariant(filterMap));
|
|
990 |
inparam->AppendL(filterParam);
|
|
991 |
filterMap->DecRef();
|
|
992 |
|
|
993 |
if(calname.Length())
|
|
994 |
filterMap->InsertL(KCalendarName,TLiwVariant(calname));
|
|
995 |
filterMap->InsertL(_L8("id"),TLiwVariant(globaluid));
|
|
996 |
|
|
997 |
TRAPD(err,interface->ExecuteCmdL( _L8("GetList") ,*inparam ,*outparam));
|
|
998 |
TInt pos = 0 ;
|
|
999 |
TBuf<10> result;
|
|
1000 |
const TLiwGenericParam* output = outparam->FindFirst( pos,_L8("ErrorCode"));
|
|
1001 |
|
|
1002 |
if(output)
|
|
1003 |
{
|
|
1004 |
err = output->Value().AsTInt32();
|
|
1005 |
if( err == KErrNone )
|
|
1006 |
{
|
|
1007 |
pos = 0;
|
|
1008 |
output = outparam->FindFirst( pos,_L8("ReturnValue"));
|
|
1009 |
CLiwMap* map;
|
|
1010 |
TInt retvalue = KErrNone;
|
|
1011 |
|
|
1012 |
if ( output )
|
|
1013 |
{
|
|
1014 |
CLiwIterable* iterlist = output->Value().AsIterable();
|
|
1015 |
if(iterlist)
|
|
1016 |
{
|
|
1017 |
TLiwVariant data1;
|
|
1018 |
while(iterlist->NextL(data1) )
|
|
1019 |
{
|
|
1020 |
const CLiwMap* res = data1.AsMap();
|
|
1021 |
if ( res )
|
|
1022 |
{
|
|
1023 |
TLiwVariant data;
|
|
1024 |
if(res->FindL(_L8("LocalId"), data))
|
|
1025 |
result = data.AsDes();
|
|
1026 |
data.Reset();
|
|
1027 |
}
|
|
1028 |
}
|
|
1029 |
data1.Reset();
|
|
1030 |
}
|
|
1031 |
}
|
|
1032 |
}
|
|
1033 |
}
|
|
1034 |
|
|
1035 |
inparam->Reset();
|
|
1036 |
outparam->Reset();
|
|
1037 |
|
|
1038 |
return result;
|
|
1039 |
}
|
|
1040 |
|
|
1041 |
#endif |