author | Maximilian Odendahl <maxodendahl@gmail.com> |
Mon, 15 Feb 2010 16:38:49 +0100 | |
changeset 4 | c1a7ca8407fe |
parent 1 | 4927282092b4 |
child 6 | 5a04f2ceabfe |
permissions | -rw-r--r-- |
1
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1 |
/* |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2 |
* Copyright (c) 2010 Sun Microsystems, Inc. and/or its subsidiary(-ies). |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
3 |
* All rights reserved. |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
4 |
* This component and the accompanying materials are made available |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
5 |
* under the terms of "Eclipse Public License v1.0" |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
6 |
* which accompanies this distribution, and is available |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
8 |
* |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
9 |
* Initial Contributor: |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
10 |
* Maximilian Odendahl |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
11 |
* |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
12 |
* Contributors: |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
13 |
* |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
14 |
* Description: main Caldav class, all magic happens here |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
15 |
* one engine for each configured Caldav calendar |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
16 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
17 |
#include "caldavengine.h" |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
18 |
#include <f32file.h> |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
19 |
#include <S32FILE.H> |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
20 |
#include <S32MEM.H> |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
21 |
#include <avkon.rsg> |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
22 |
#include <UTF.H> |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
23 |
#include <agnexportobserver.h> |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
24 |
#include <calsession.h> |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
25 |
#include <caliterator.h> |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
26 |
#include <calentry.h> |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
27 |
#include <calentryview.h> |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
28 |
#include <caltime.h> |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
29 |
#include <calalarm.h> |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
30 |
#include <calcategory.h> |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
31 |
#include <caluser.h> |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
32 |
#include <calrrule.h> |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
33 |
#include <calinstance.h> |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
34 |
#include <calinstanceview.h> |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
35 |
#include <caleninterimutils2.h> |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
36 |
#include <calenexporter.h> |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
37 |
#include <calenimporter.h> |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
38 |
#include <calcalendarinfo.h> |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
39 |
#include "calenglobaldata.h" |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
40 |
#include <xmlengdocument.h> |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
41 |
#include <xmlengnode.h> |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
42 |
#include <xmlengelement.h> |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
43 |
#include <xmlengnodelist.h> |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
44 |
#include <xmlengtext.h> |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
45 |
#include "httpclient.h" |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
46 |
#include <e32math.h> // divmod |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
47 |
#define MULTIGETSPLIT 100 |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
48 |
#define ARRAYEXPAND 4 |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
49 |
#define URLMAX 500 |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
50 |
#define EXPANDSIZE_SMALL 512 |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
51 |
#define EXPANDSIZE_BIG 1024 |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
52 |
_LIT(KFormatString,"\"%F%Y%M%DT000000Z\""); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
53 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
54 |
/** |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
55 |
* SyncTickL |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
56 |
* timer for basic sync interval |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
57 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
58 |
TInt SyncTickL(TAny *aObject) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
59 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
60 |
CCalDavEngine* engine = ((CCalDavEngine*) aObject); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
61 |
CPeriodic* timer = engine->Timer(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
62 |
if (engine && timer) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
63 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
64 |
timer->Cancel(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
65 |
TRAP_IGNORE(engine->SyncL()); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
66 |
TInt ticktime = engine->SyncInterval().Int() == 0 ? 1 |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
67 |
: engine->SyncInterval().Int(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
68 |
const TUint64 tickInterval = 1000000 * 60 * ticktime; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
69 |
timer->Start(tickInterval, tickInterval, TCallBack(SyncTickL, engine)); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
70 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
71 |
return 0; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
72 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
73 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
74 |
#ifdef _DEBUG |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
75 |
void ExportToFileNameL(const TDesC8& aDes, const TDesC &aFilename) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
76 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
77 |
RFs fsSession; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
78 |
User::LeaveIfError(fsSession.Connect()); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
79 |
CleanupClosePushL(fsSession); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
80 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
81 |
TInt err = fsSession.MkDirAll(aFilename); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
82 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
83 |
RFile file; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
84 |
User::LeaveIfError(file.Replace(fsSession, aFilename, EFileWrite)); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
85 |
CleanupClosePushL(file); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
86 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
87 |
RFileWriteStream writeStream2; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
88 |
writeStream2.Attach(file); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
89 |
CleanupClosePushL(writeStream2); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
90 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
91 |
writeStream2 << aDes; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
92 |
writeStream2.CommitL(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
93 |
CleanupStack::PopAndDestroy(&writeStream2); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
94 |
CleanupStack::PopAndDestroy(&file); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
95 |
CleanupStack::PopAndDestroy(&fsSession); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
96 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
97 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
98 |
void ExportToFileL(CCalEntry* aEntry, CCalenExporter *iCalExporter) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
99 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
100 |
if (aEntry) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
101 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
102 |
_LIT(KFileName, "C:\\logs\\caldav\\testing_export.txt"); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
103 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
104 |
RFs fsSession; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
105 |
User::LeaveIfError(fsSession.Connect()); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
106 |
CleanupClosePushL(fsSession); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
107 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
108 |
TInt err = fsSession.MkDirAll(KFileName); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
109 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
110 |
RFile file; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
111 |
User::LeaveIfError(file.Replace(fsSession, KFileName, EFileWrite)); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
112 |
CleanupClosePushL(file); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
113 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
114 |
RFileWriteStream writeStream2; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
115 |
writeStream2.Attach(file); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
116 |
CleanupClosePushL(writeStream2); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
117 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
118 |
iCalExporter->ExportICalL(*aEntry, writeStream2); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
119 |
writeStream2.CommitL(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
120 |
CleanupStack::PopAndDestroy(&writeStream2); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
121 |
CleanupStack::PopAndDestroy(&file); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
122 |
CleanupStack::PopAndDestroy(&fsSession); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
123 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
124 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
125 |
#endif |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
126 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
127 |
/** |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
128 |
* SearchL |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
129 |
* search inside xml tree for a specific node |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
130 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
131 |
void SearchL(TXmlEngNode &aTopNode, const TDesC8 &aName, |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
132 |
const TDesC8 &aNamespace, TXmlEngNode & aReturnNode) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
133 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
134 |
RXmlEngNodeList<TXmlEngNode> List; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
135 |
aTopNode.GetChildNodes(List); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
136 |
while (List.HasNext() && aReturnNode.IsNull()) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
137 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
138 |
TXmlEngNode Node = List.Next(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
139 |
TXmlEngNode::TXmlEngDOMNodeType Type = Node.NodeType(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
140 |
if (Type == TXmlEngNode::EElement) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
141 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
142 |
//todo: compare namespace ? |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
143 |
if (Node.Name() == aName) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
144 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
145 |
aReturnNode = Node.CopyL(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
146 |
return; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
147 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
148 |
else |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
149 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
150 |
SearchL(Node, aName, aNamespace, aReturnNode); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
151 |
if (!aReturnNode.IsNull()) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
152 |
return; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
153 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
154 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
155 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
156 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
157 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
158 |
/** |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
159 |
* SearchL |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
160 |
* search inside xml tree for a specific node |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
161 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
162 |
void SearchL(TXmlEngNode &aTopNode, const TDesC8 &aName, |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
163 |
const TDesC8 &aNamespace, RBuf8 &aBuf) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
164 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
165 |
RXmlEngNodeList<TXmlEngNode> List; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
166 |
aTopNode.GetChildNodes(List); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
167 |
while (List.HasNext()) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
168 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
169 |
TXmlEngNode Node = List.Next(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
170 |
TXmlEngNode::TXmlEngDOMNodeType Type = Node.NodeType(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
171 |
if (Type == TXmlEngNode::EElement) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
172 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
173 |
//todo: compare namespace ? |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
174 |
if (Node.Name() == aName) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
175 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
176 |
if (Node.IsSimpleTextContents()) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
177 |
aBuf.Create(Node.Value()); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
178 |
else |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
179 |
Node.WholeTextContentsCopyL(aBuf); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
180 |
return; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
181 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
182 |
else |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
183 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
184 |
SearchL(Node, aName, aNamespace, aBuf); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
185 |
if (aBuf.Length()) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
186 |
return; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
187 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
188 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
189 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
190 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
191 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
192 |
/** |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
193 |
* SearchL |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
194 |
* search inside xml tree for a specific node |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
195 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
196 |
TPtrC8 SearchL(TXmlEngNode &aTopNode, const TDesC8 &aName, |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
197 |
const TDesC8 &aNamespace) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
198 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
199 |
RXmlEngNodeList<TXmlEngNode> List; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
200 |
aTopNode.GetChildNodes(List); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
201 |
while (List.HasNext()) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
202 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
203 |
TXmlEngNode Node = List.Next(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
204 |
TXmlEngNode::TXmlEngDOMNodeType Type = Node.NodeType(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
205 |
if (Type == TXmlEngNode::EElement) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
206 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
207 |
//todo: compare namespace ? |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
208 |
if (Node.Name() == aName) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
209 |
return Node.Value(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
210 |
else |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
211 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
212 |
TPtrC8 Return = SearchL(Node, aName, aNamespace); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
213 |
if (Return != KNullDesC8) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
214 |
return Return; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
215 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
216 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
217 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
218 |
return KNullDesC8(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
219 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
220 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
221 |
/** |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
222 |
* GetBoolFromPropertiesL |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
223 |
* get a boolean value from CCalCalendarInfo |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
224 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
225 |
TBool GetBoolFromPropertiesL(CCalCalendarInfo* info, const TDesC8 &aKey) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
226 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
227 |
TBool boolean; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
228 |
TPckgC<TBool> pckgboolean(boolean); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
229 |
pckgboolean.Set(info->PropertyValueL(aKey)); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
230 |
return pckgboolean(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
231 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
232 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
233 |
/** |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
234 |
* GetTimeFromPropertiesL |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
235 |
* get a time value from CCalCalendarInfo |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
236 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
237 |
TCalTime GetTimeFromPropertiesL(CCalCalendarInfo* info, const TDesC8 &aKey) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
238 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
239 |
TCalTime time; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
240 |
TPckgC<TCalTime> pckgtime(time); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
241 |
pckgtime.Set(info->PropertyValueL(aKey)); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
242 |
return pckgtime(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
243 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
244 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
245 |
/** |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
246 |
* PropertyExists |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
247 |
* finds a property from an array |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
248 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
249 |
TBool PropertyExists(CDesC8Array* aArray, const TDesC8 &aKey) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
250 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
251 |
TInt pos = 0; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
252 |
return aArray->Find(aKey, pos, ECmpNormal) == KErrNone; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
253 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
254 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
255 |
/** |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
256 |
* CCalDavEngine::SetCalendarInfoL |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
257 |
* set key and value pair at calendar session info |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
258 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
259 |
void CCalDavEngine::SetCalendarInfoL(const TDesC8 &aKey, const TDesC8 &aValue) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
260 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
261 |
TBool createdelete = !iCalSession; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
262 |
if (createdelete) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
263 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
264 |
iCalSession = CCalSession::NewL(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
265 |
TRAP_IGNORE(iCalSession->OpenL(*iCalendar)); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
266 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
267 |
CCalCalendarInfo* calendarInfo = iCalSession->CalendarInfoL(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
268 |
CleanupStack::PushL(calendarInfo); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
269 |
TPckgC<TBool> enabled(iEnabled); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
270 |
calendarInfo->SetPropertyL(KCaldavEnabled, enabled); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
271 |
if (aValue != KNullDesC8) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
272 |
calendarInfo->SetPropertyL(aKey, aValue); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
273 |
iCalSession->SetCalendarInfoL(*calendarInfo); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
274 |
CleanupStack::PopAndDestroy(calendarInfo); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
275 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
276 |
if (createdelete) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
277 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
278 |
delete iCalSession; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
279 |
iCalSession = NULL; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
280 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
281 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
282 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
283 |
/** |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
284 |
* CCalDavEngine::CCalDavEngine |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
285 |
* default constructor |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
286 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
287 |
CCalDavEngine::CCalDavEngine() : |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
288 |
iCalSession(0), iCalIter(0), iCalEntryView(0), iCalExporter(0), |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
289 |
iCalImporter(0), iCalIntermimUtils2(0), iCalendar(0), iUrl(0), |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
290 |
iBaseUrl(0), iHome(0), iHttp(0), iSynctoken(0), iCTag(0), |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
291 |
iSyncInterval(DEFAULT_SYNC_MINUTES), iPastDays(DEFAULT_PAST_DAYS), |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
292 |
iImmediateSync(DEFAULT_IMMEDIATE_SYNC), iKeepServerEntry( |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
293 |
DEFAULT_KEEP_SERVER_ENTRY), iEnabled(EFalse), iTimer(0) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
294 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
295 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
296 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
297 |
/** |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
298 |
* CCalDavEngine::~CCalDavEngine |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
299 |
* default destructor |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
300 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
301 |
CCalDavEngine::~CCalDavEngine() |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
302 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
303 |
iLocalUidArray.Close(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
304 |
iGlobalUidArray.Close(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
305 |
iDeletedEntries.Close(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
306 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
307 |
iDomParser.Close(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
308 |
iDomImpl.Close(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
309 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
310 |
if (iCalendar) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
311 |
delete iCalendar; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
312 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
313 |
if (iUrl) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
314 |
delete iUrl; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
315 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
316 |
if (iBaseUrl) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
317 |
delete iBaseUrl; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
318 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
319 |
if (iHttp) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
320 |
delete iHttp; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
321 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
322 |
DeleteCalObjects(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
323 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
324 |
if (iCalIntermimUtils2) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
325 |
delete iCalIntermimUtils2; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
326 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
327 |
if (iSynctoken) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
328 |
delete iSynctoken; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
329 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
330 |
if (iCTag) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
331 |
delete iCTag; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
332 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
333 |
if (iHome) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
334 |
delete iHome; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
335 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
336 |
if (iTimer) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
337 |
delete iTimer; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
338 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
339 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
340 |
/** |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
341 |
* CCalDavEngine::NewLC |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
342 |
* first phase construction |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
343 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
344 |
CCalDavEngine* CCalDavEngine::NewLC(const TDesC& aCalendar) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
345 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
346 |
CCalDavEngine* self = new (ELeave) CCalDavEngine(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
347 |
CleanupStack::PushL(self); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
348 |
self->ConstructL(aCalendar); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
349 |
return self; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
350 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
351 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
352 |
/** |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
353 |
* CCalDavEngine::NewL |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
354 |
* first phase construction |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
355 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
356 |
CCalDavEngine* CCalDavEngine::NewL(const TDesC& aCalendar) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
357 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
358 |
CCalDavEngine* self = CCalDavEngine::NewLC(aCalendar); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
359 |
CleanupStack::Pop(self); // self; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
360 |
return self; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
361 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
362 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
363 |
/** |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
364 |
* CCalDavEngine:: |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
365 |
* second phase construction |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
366 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
367 |
void CCalDavEngine::ConstructL(const TDesC& aCalendar) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
368 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
369 |
iManualSync = EFalse; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
370 |
iFirstInit = ETrue; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
371 |
iCalendar = aCalendar.AllocL(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
372 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
373 |
iHttp = CHttpClient::NewL(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
374 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
375 |
iDomImpl.OpenL(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
376 |
TInt err = iDomParser.Open(iDomImpl); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
377 |
if (KErrNone != err) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
378 |
User::Leave(err); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
379 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
380 |
iTimer = CPeriodic::NewL(EPriorityNormal); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
381 |
iCalIntermimUtils2 = CCalenInterimUtils2::NewL(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
382 |
iCalSession = CCalSession::NewL(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
383 |
TRAP_IGNORE(iCalSession->OpenL(aCalendar)); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
384 |
CalendarInfoL(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
385 |
// we can't close the file, so delete it completly |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
386 |
delete iCalSession; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
387 |
iCalSession = NULL; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
388 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
389 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
390 |
/** |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
391 |
* CCalDavEngine::Progress |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
392 |
* Progress callback |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
393 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
394 |
void CCalDavEngine::Progress(TInt /*aPercentageCompleted*/) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
395 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
396 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
397 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
398 |
/** |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
399 |
* CCalDavEngine::RegisterL |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
400 |
* register all neccessary notification callback |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
401 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
402 |
void CCalDavEngine::RegisterL() |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
403 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
404 |
TDateTime Start; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
405 |
TDateTime End; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
406 |
End.SetYear(2200); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
407 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
408 |
TCalTime StartCal; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
409 |
TCalTime EndCal; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
410 |
StartCal.SetTimeLocalL(Start); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
411 |
EndCal.SetTimeLocalL(End); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
412 |
CalCommon::TCalTimeRange Range(StartCal, EndCal); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
413 |
CCalChangeNotificationFilter *Filter = CCalChangeNotificationFilter::NewL( |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
414 |
MCalChangeCallBack2::EChangeEntryAll, true, Range); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
415 |
iCalSession->StartChangeNotification(*this, *Filter); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
416 |
iCalSession->StartFileChangeNotificationL(*this); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
417 |
delete Filter; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
418 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
419 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
420 |
/** |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
421 |
* CCalDavEngine::CalendarInfoL |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
422 |
* load all properties from CalendarInfo |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
423 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
424 |
void CCalDavEngine::CalendarInfoL() |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
425 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
426 |
CCalCalendarInfo* calendarInfo = iCalSession->CalendarInfoL(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
427 |
if (calendarInfo->IsValid()) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
428 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
429 |
CleanupStack::PushL(calendarInfo); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
430 |
CDesC8Array* propertyKeys = calendarInfo->PropertyKeysL(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
431 |
CleanupStack::PushL(propertyKeys); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
432 |
TInt pos = 0; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
433 |
if (propertyKeys->Find(KCaldavEnabled, pos, ECmpNormal) == KErrNone) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
434 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
435 |
iEnabled = GetBoolFromPropertiesL(calendarInfo, KCaldavEnabled); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
436 |
if (PropertyExists(propertyKeys, KCaldavFirstInit)) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
437 |
iFirstInit = GetBoolFromPropertiesL(calendarInfo, |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
438 |
KCaldavFirstInit); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
439 |
if (PropertyExists(propertyKeys, KCaldavSynctoken)) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
440 |
iSynctoken |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
441 |
= calendarInfo->PropertyValueL(KCaldavSynctoken).AllocL(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
442 |
if (PropertyExists(propertyKeys, KCaldavCtag)) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
443 |
iCTag = calendarInfo->PropertyValueL(KCaldavCtag).AllocL(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
444 |
if (PropertyExists(propertyKeys, KCaldavManualSync)) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
445 |
iManualSync = GetBoolFromPropertiesL(calendarInfo, |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
446 |
KCaldavManualSync); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
447 |
if (PropertyExists(propertyKeys, KCaldavTime)) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
448 |
iLastSyncTime = GetTimeFromPropertiesL(calendarInfo, |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
449 |
KCaldavTime); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
450 |
if (PropertyExists(propertyKeys, KCaldavUrl)) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
451 |
iUrl = calendarInfo->PropertyValueL(KCaldavUrl).AllocL(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
452 |
if (PropertyExists(propertyKeys, KCaldavUser)) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
453 |
iHttp->SetUserL(calendarInfo->PropertyValueL(KCaldavUser)); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
454 |
if (PropertyExists(propertyKeys, KCaldavPassword)) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
455 |
iHttp->SetPasswordL(calendarInfo->PropertyValueL( |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
456 |
KCaldavPassword)); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
457 |
if (PropertyExists(propertyKeys, KCaldavKeepServer)) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
458 |
iKeepServerEntry = GetBoolFromPropertiesL(calendarInfo, |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
459 |
KCaldavKeepServer); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
460 |
if (PropertyExists(propertyKeys, KCaldavImmediateSync)) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
461 |
iImmediateSync = GetBoolFromPropertiesL(calendarInfo, |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
462 |
KCaldavImmediateSync); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
463 |
if (PropertyExists(propertyKeys, KCaldavPastDays)) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
464 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
465 |
TPckgC<TTimeIntervalDays> pastdays(iPastDays); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
466 |
pastdays.Set(calendarInfo->PropertyValueL(KCaldavPastDays)); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
467 |
iPastDays = pastdays(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
468 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
469 |
if (PropertyExists(propertyKeys, KCaldavSyncInterval)) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
470 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
471 |
TPckgC<TTimeIntervalMinutes> syncinterval(iSyncInterval); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
472 |
syncinterval.Set(calendarInfo->PropertyValueL( |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
473 |
KCaldavSyncInterval)); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
474 |
iSyncInterval = syncinterval(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
475 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
476 |
// access point |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
477 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
478 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
479 |
CleanupStack::PopAndDestroy(propertyKeys); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
480 |
CleanupStack::Pop(calendarInfo); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
481 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
482 |
delete calendarInfo; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
483 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
484 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
485 |
/** |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
486 |
* CCalDavEngine::InitL |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
487 |
* check for correct url |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
488 |
* load most Caldav url properties |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
489 |
* do inital sync |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
490 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
491 |
TInt CCalDavEngine::InitL() |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
492 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
493 |
// this is only needed to find a GlobalUID from a LocalUID, used after an event was deleted |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
494 |
// also used now for uploading of local events when only GlobalUID is know |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
495 |
LocalLoopL(ELoopActionFillArray); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
496 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
497 |
if (iFirstInit) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
498 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
499 |
TInt err = GetCalendarUrlsL(NULL); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
500 |
if (err == KErrArgument) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
501 |
return KErrArgument; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
502 |
GetOptionsL(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
503 |
SetLastSyncTimeL(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
504 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
505 |
TBool success; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
506 |
// get all server items |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
507 |
if (iOptions.sync_collection) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
508 |
success = WebDavSyncL(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
509 |
else |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
510 |
success = ListL() == KErrNone; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
511 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
512 |
if (!success) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
513 |
return KErrGeneral; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
514 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
515 |
// upload all local entries of this calendar to server |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
516 |
LocalLoopL(ELoopActionUpload); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
517 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
518 |
if (iOptions.sync_collection) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
519 |
SetSyncTokenL(GetSyncTokenL()); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
520 |
else |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
521 |
SetCTagL(GetCTagL()); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
522 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
523 |
iFirstInit = EFalse; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
524 |
iEnabled = ETrue; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
525 |
TPckgC<TBool> firstInit(iFirstInit); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
526 |
SetCalendarInfoL(KCaldavFirstInit, firstInit); // this will set iEnabled as well |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
527 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
528 |
else |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
529 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
530 |
TInt err = GetCalendarUrlsL(NULL); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
531 |
if (err == KErrArgument) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
532 |
return KErrArgument; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
533 |
GetOptionsL(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
534 |
SetLastSyncTimeL(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
535 |
iEnabled = ETrue; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
536 |
SetCalendarInfoL(KCaldavEnabled, KNullDesC8); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
537 |
SyncL(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
538 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
539 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
540 |
return KErrNone; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
541 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
542 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
543 |
/** |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
544 |
* CCalDavEngine::Completed |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
545 |
* Completed callback |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
546 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
547 |
void CCalDavEngine::Completed(TInt aError) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
548 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
549 |
if (aError == KErrNone) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
550 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
551 |
CActiveScheduler::Stop(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
552 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
553 |
else |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
554 |
iManualSync = true; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
555 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
556 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
557 |
/** |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
558 |
* CCalDavEngine::NotifyProgress |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
559 |
* NotifyProgress callback |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
560 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
561 |
TBool CCalDavEngine::NotifyProgress() |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
562 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
563 |
return EFalse; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
564 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
565 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
566 |
/** |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
567 |
* CCalDavEngine::CalChangeNotification |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
568 |
* change item callback, sync to server |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
569 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
570 |
void CCalDavEngine::CalChangeNotification(RArray<TCalChangeEntry> &aChangeItems) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
571 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
572 |
for (TInt i = 0; i < aChangeItems.Count(); i++) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
573 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
574 |
TRAP_IGNORE(HandleChangeL(aChangeItems[i].iChangeType, aChangeItems[i].iEntryType, aChangeItems[i].iEntryId)); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
575 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
576 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
577 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
578 |
/** |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
579 |
* CCalDavEngine::CalendarInfoChangeNotificationL |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
580 |
* change callback, sync changed color or name to server |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
581 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
582 |
void CCalDavEngine::CalendarInfoChangeNotificationL(RPointerArray< |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
583 |
CCalFileChangeInfo>& aCalendarInfoChangeEntries) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
584 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
585 |
for (TInt i = 0; i < aCalendarInfoChangeEntries.Count(); i++) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
586 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
587 |
if ((aCalendarInfoChangeEntries[i]->FileNameL() == *iCalendar) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
588 |
&& (aCalendarInfoChangeEntries[i]->ChangeType() |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
589 |
== MCalFileChangeObserver::ECalendarInfoUpdated)) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
590 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
591 |
TRAP_IGNORE(HandleCalendarInfoChangeL()); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
592 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
593 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
594 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
595 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
596 |
/** |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
597 |
* CCalDavEngine::HandleCalendarInfoChangeL |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
598 |
* sync changed color or name to server |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
599 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
600 |
void CCalDavEngine::HandleCalendarInfoChangeL() |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
601 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
602 |
if (iHttp) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
603 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
604 |
CBufFlat* response = CBufFlat::NewL(EXPANDSIZE_SMALL); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
605 |
CleanupStack::PushL(response); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
606 |
CCalCalendarInfo* info = iCalSession->CalendarInfoL(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
607 |
CleanupStack::PushL(info); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
608 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
609 |
HBufC8* name = |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
610 |
CnvUtfConverter::ConvertFromUnicodeToUtf8L(info->NameL()); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
611 |
CleanupStack::PushL(name); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
612 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
613 |
TRgb color = info->Color(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
614 |
_LIT8(KColorformat,"#%02x%02x%02xFF"); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
615 |
TBuf8<9> colorbuf; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
616 |
colorbuf.Format(KColorformat, color.Red(), color.Green(), color.Blue()); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
617 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
618 |
HBufC8* patch = HBufC8::NewLC(KColorDisplayStart().Length() |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
619 |
+ colorbuf.Length() + KColorDisplayMiddle().Length() |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
620 |
+ name->Length() + KColorDisplayEnd().Length()); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
621 |
patch->Des().Append(KColorDisplayStart); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
622 |
patch->Des().Append(colorbuf); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
623 |
patch->Des().Append(KColorDisplayMiddle); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
624 |
patch->Des().Append(*name); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
625 |
patch->Des().Append(KColorDisplayEnd); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
626 |
iHttp->ProppatchL(*iUrl, *patch, response); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
627 |
CleanupStack::PopAndDestroy(4); // response, info, name, patch |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
628 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
629 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
630 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
631 |
/** |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
632 |
* CCalDavEngine::HandleChangeL |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
633 |
* change item callback, sync to server |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
634 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
635 |
void CCalDavEngine::HandleChangeL( |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
636 |
MCalChangeCallBack2::TChangeType &aChangeType, |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
637 |
MCalChangeCallBack2::TChangeEntryType &aEntryType, TCalLocalUid &aUid) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
638 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
639 |
switch (aChangeType) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
640 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
641 |
case MCalChangeCallBack2::EChangeAdd: |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
642 |
case MCalChangeCallBack2::EChangeModify: |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
643 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
644 |
if (iImmediateSync) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
645 |
UploadEntryL(aUid, aChangeType, aEntryType); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
646 |
else |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
647 |
// enable manual sync for the next sync interval |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
648 |
SyncFailedL(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
649 |
break; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
650 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
651 |
case MCalChangeCallBack2::EChangeDelete: |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
652 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
653 |
if (iImmediateSync) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
654 |
DeleteEntryL(aUid); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
655 |
else |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
656 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
657 |
iDeletedEntries.Append(aUid); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
658 |
SyncFailedL(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
659 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
660 |
break; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
661 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
662 |
case MCalChangeCallBack2::EChangeUndefined: |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
663 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
664 |
// upload new and modified entries to server |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
665 |
UploadModifiedSinceDateL(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
666 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
667 |
// Find locally deleted ones and delete on server |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
668 |
DeleteRemovedEntriesOnServerL(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
669 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
670 |
break; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
671 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
672 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
673 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
674 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
675 |
/** |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
676 |
* CCalDavEngine::EnableL |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
677 |
* enable Caldav sync |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
678 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
679 |
TInt CCalDavEngine::EnableL() |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
680 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
681 |
if (!iCalEntryView) //do not use iEnabled here,might be set already in ConstructL() |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
682 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
683 |
TInt aErr = CreateCalObjectsL(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
684 |
if ((aErr == KErrNone) && (InitL() == KErrNone)) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
685 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
686 |
iTimer->Cancel(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
687 |
TInt ticktime = iSyncInterval.Int() == 0 ? 1 : iSyncInterval.Int(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
688 |
const TUint64 tickInterval = 1000000 * 60 * ticktime; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
689 |
iTimer->Start(tickInterval, tickInterval, |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
690 |
TCallBack(SyncTickL, this)); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
691 |
// register change notification |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
692 |
RegisterL(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
693 |
return KErrNone; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
694 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
695 |
else |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
696 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
697 |
iEnabled = EFalse; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
698 |
SetCalendarInfoL(KCaldavEnabled, KNullDesC8); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
699 |
DeleteCalObjects(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
700 |
return KErrArgument; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
701 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
702 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
703 |
return KErrNone; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
704 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
705 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
706 |
/** |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
707 |
* CCalDavEngine::DeleteCalObjects |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
708 |
* delete all calendar objects |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
709 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
710 |
void CCalDavEngine::DeleteCalObjects() |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
711 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
712 |
delete iCalIter; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
713 |
iCalIter = NULL; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
714 |
delete iCalEntryView; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
715 |
iCalEntryView = NULL; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
716 |
delete iCalImporter; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
717 |
iCalImporter = NULL; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
718 |
delete iCalExporter; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
719 |
iCalExporter = NULL; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
720 |
if (iCalSession) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
721 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
722 |
iCalSession->StopChangeNotification(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
723 |
iCalSession->StopFileChangeNotification(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
724 |
delete iCalSession; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
725 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
726 |
iCalSession = NULL; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
727 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
728 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
729 |
/** |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
730 |
* CCalDavEngine::CreateCalObjectsL |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
731 |
* create all calendar objects |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
732 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
733 |
TInt CCalDavEngine::CreateCalObjectsL() |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
734 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
735 |
iCalSession = CCalSession::NewL(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
736 |
TRAPD(aErr,iCalSession->OpenL(*iCalendar)); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
737 |
iCalExporter = CCalenExporter::NewL(*iCalSession); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
738 |
iCalImporter = CCalenImporter::NewL(*iCalSession); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
739 |
iCalEntryView = CCalEntryView::NewL(*iCalSession); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
740 |
iCalIter = CCalIter::NewL(*iCalSession); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
741 |
return aErr; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
742 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
743 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
744 |
/** |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
745 |
* CCalDavEngine::DisableL |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
746 |
* disable sync |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
747 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
748 |
void CCalDavEngine::DisableL() |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
749 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
750 |
if (iEnabled) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
751 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
752 |
iTimer->Cancel(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
753 |
iEnabled = EFalse; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
754 |
SetCalendarInfoL(KCaldavEnabled, KNullDesC8); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
755 |
DeleteCalObjects(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
756 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
757 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
758 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
759 |
/** |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
760 |
* CCalDavEngine::EnabledSync |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
761 |
* check for enabled sync |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
762 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
763 |
TBool CCalDavEngine::EnabledSync() |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
764 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
765 |
return iEnabled; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
766 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
767 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
768 |
/** |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
769 |
* CCalDavEngine::TimeReportL |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
770 |
* do a CalDav time report |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
771 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
772 |
TInt CCalDavEngine::TimeReportL(TBool VEVENT, const TDesC8 &aStart, |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
773 |
TBool aDelete) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
774 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
775 |
CBufFlat* body = CBufFlat::NewL(EXPANDSIZE_BIG); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
776 |
CleanupStack::PushL(body); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
777 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
778 |
body->InsertL(body->Size(), VEVENT ? KTimeStartEVENT() : KTimeStartTODO()); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
779 |
body->InsertL(body->Size(), aStart); // "20090509T220000Z"/> |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
780 |
body->InsertL(body->Size(), KTimeEnd); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
781 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
782 |
CBufFlat* response = CBufFlat::NewL(EXPANDSIZE_BIG); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
783 |
CleanupStack::PushL(response); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
784 |
TInt ret = iHttp->ReportL(*iUrl, body->Ptr(0), response); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
785 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
786 |
if (ret == MULTISTATUS) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
787 |
ret = aDelete ? ParseResponsesDeleteL(response->Ptr(0)) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
788 |
: ParseResponsesL(response->Ptr(0)); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
789 |
else |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
790 |
ret = KErrGeneral; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
791 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
792 |
CleanupStack::PopAndDestroy(response); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
793 |
CleanupStack::PopAndDestroy(body); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
794 |
return ret; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
795 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
796 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
797 |
/** |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
798 |
* CCalDavEngine::ListL |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
799 |
* get events either using time report or basic propfind |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
800 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
801 |
TInt CCalDavEngine::ListL() |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
802 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
803 |
if (iOptions.calendar_access) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
804 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
805 |
TTime syncstart; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
806 |
syncstart.HomeTime(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
807 |
syncstart = syncstart - iPastDays; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
808 |
TBuf<100> nowStr; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
809 |
syncstart.FormatL(nowStr, KFormatString); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
810 |
TBuf8<100> nowStrAdd; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
811 |
nowStrAdd.Append(nowStr); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
812 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
813 |
TInt eventreturn = KErrNone; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
814 |
if (iOptions.VEVENT) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
815 |
eventreturn = TimeReportL(ETrue, nowStrAdd); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
816 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
817 |
TInt todoreturn = KErrNone; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
818 |
if (iOptions.VTODO) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
819 |
todoreturn = TimeReportL(EFalse, nowStrAdd); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
820 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
821 |
return (eventreturn == KErrNone) && (todoreturn == KErrNone) ? KErrNone |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
822 |
: KErrGeneral; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
823 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
824 |
else |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
825 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
826 |
// use PROPFIND report |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
827 |
CBufFlat* response = CBufFlat::NewL(EXPANDSIZE_SMALL); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
828 |
CleanupStack::PushL(response); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
829 |
TInt ret = iHttp->PropfindL(*iUrl, KPropList, response, EFalse); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
830 |
if (ret == MULTISTATUS) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
831 |
ret = ParseResponsesL(response->Ptr(0)); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
832 |
else |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
833 |
ret = KErrGeneral; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
834 |
CleanupStack::PopAndDestroy(response); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
835 |
return ret; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
836 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
837 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
838 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
839 |
/** |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
840 |
* CCalDavEngine::SyncL |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
841 |
* sync a calendar |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
842 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
843 |
TInt CCalDavEngine::SyncL() |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
844 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
845 |
if (iUrl) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
846 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
847 |
if (iOptions.sync_collection) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
848 |
return WebDavSyncL(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
849 |
else |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
850 |
return ManualSyncL(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
851 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
852 |
return KErrGeneral; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
853 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
854 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
855 |
/** |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
856 |
* CCalDavEngine::ManualSyncL |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
857 |
* if sync failed previously, try again manually |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
858 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
859 |
TBool CCalDavEngine::ManualSyncL() |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
860 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
861 |
TBool client = ClientChangesL(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
862 |
if (iOptions.sync_ctag) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
863 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
864 |
HBufC8 *newCTag = GetCTagL(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
865 |
TBool server = ETrue; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
866 |
if ((CTag() != *newCTag) && (*newCTag != KNullDesC8)) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
867 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
868 |
server = ServerChangesL(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
869 |
if (server) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
870 |
SetCTagL(newCTag); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
871 |
else |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
872 |
delete newCTag; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
873 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
874 |
else |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
875 |
delete newCTag; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
876 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
877 |
return client || server; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
878 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
879 |
else |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
880 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
881 |
TBool server = ServerChangesL(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
882 |
return client || server; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
883 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
884 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
885 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
886 |
/** |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
887 |
* CCalDavEngine::ServerChangesL |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
888 |
* sync server changes |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
889 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
890 |
TBool CCalDavEngine::ServerChangesL() |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
891 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
892 |
// loop over all server items to find new and modified entries |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
893 |
// uses either propfind or calendar-query |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
894 |
TInt ret = ListL(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
895 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
896 |
// loop over all local items to find deleted ones on the server |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
897 |
LocalLoopL(ELoopActionDeleteLocal); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
898 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
899 |
return ret == KErrNone; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
900 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
901 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
902 |
/** |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
903 |
* CCalDavEngine::LocalLoopL |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
904 |
* loop over local calendar store |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
905 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
906 |
TInt CCalDavEngine::LocalLoopL(TLocalLoopAction aAction) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
907 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
908 |
TBuf8<URLMAX> iter = iCalIter->FirstL(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
909 |
TBuf8<URLMAX> url; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
910 |
while (iter != KNullDesC8) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
911 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
912 |
url.Append(*iUrl); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
913 |
url.Append(iter); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
914 |
url.Append(KIcs); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
915 |
switch (aAction) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
916 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
917 |
case ELoopActionDeleteLocal: |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
918 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
919 |
if (HeadL(iter) == NOTFOUND) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
920 |
DeleteLocalEntryL(url); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
921 |
break; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
922 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
923 |
case ELoopActionFillArray: |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
924 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
925 |
RPointerArray<CCalEntry> entryArray; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
926 |
CleanupClosePushL(entryArray); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
927 |
iCalEntryView->FetchL(iter, entryArray); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
928 |
if (entryArray.Count()) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
929 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
930 |
iLocalUidArray.Append(entryArray[0]->LocalUidL()); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
931 |
iGlobalUidArray.Append(entryArray[0]->UidL()); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
932 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
933 |
entryArray.ResetAndDestroy(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
934 |
CleanupStack::PopAndDestroy(&entryArray); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
935 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
936 |
break; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
937 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
938 |
case ELoopActionUpload: |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
939 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
940 |
TInt pos = iGlobalUidArray.Find(iter); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
941 |
if ((pos != KErrNotFound) && (iLocalUidArray.Count() > pos)) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
942 |
UploadEntryL(iLocalUidArray[pos], |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
943 |
MCalChangeCallBack2::EChangeAdd, |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
944 |
MCalChangeCallBack2::EChangeEntryAll); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
945 |
break; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
946 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
947 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
948 |
url.Delete(0, url.Length()); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
949 |
iter = iCalIter->NextL(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
950 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
951 |
return KErrNone; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
952 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
953 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
954 |
/** |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
955 |
* CCalDavEngine::ParseResponsesDeleteL |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
956 |
* process a recieved multistatus response |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
957 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
958 |
TInt CCalDavEngine::ParseResponsesDeleteL(const TDesC8 &aDocument) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
959 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
960 |
TInt ret = KErrNone; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
961 |
RXmlEngDocument document = iDomParser.ParseL(aDocument); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
962 |
CleanupClosePushL(document); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
963 |
if (document.NotNull()) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
964 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
965 |
// this method works for response as well as sync-response |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
966 |
// do not use GetElementsByTagNameL for one specific responses directly |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
967 |
TXmlEngElement ResponseListTop; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
968 |
SearchL(document, KMultistatus, KNullDesC8, ResponseListTop); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
969 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
970 |
RXmlEngNodeList<TXmlEngNode> ResponseList; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
971 |
CleanupClosePushL(ResponseList); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
972 |
ResponseListTop.GetChildNodes(ResponseList); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
973 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
974 |
while (ResponseList.HasNext()) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
975 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
976 |
TXmlEngNode node = ResponseList.Next(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
977 |
if (node.NodeType() == TXmlEngNode::EElement) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
978 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
979 |
TPtrC8 href = SearchL(node, KHref, KNullDesC8); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
980 |
// don't do anything with home itself |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
981 |
if ((href.Right(KIcs().Length()) == KIcs)) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
982 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
983 |
if (!DoesEntryExistL(href)) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
984 |
DeleteEntryL(href); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
985 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
986 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
987 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
988 |
CleanupStack::PopAndDestroy(&ResponseList); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
989 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
990 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
991 |
else |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
992 |
ret = KErrArgument; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
993 |
CleanupStack::PopAndDestroy(&document); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
994 |
return ret; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
995 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
996 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
997 |
/** |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
998 |
* CCalDavEngine::ParseResponsesL |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
999 |
* process a recieved multistatus response |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1000 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1001 |
TInt CCalDavEngine::ParseResponsesL(RXmlEngDocument &aDocument, TBool aMultiget) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1002 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1003 |
TInt ret = KErrNone; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1004 |
if (aDocument.NotNull()) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1005 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1006 |
CDesC8ArrayFlat *multiget = NULL; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1007 |
if (iOptions.MULTIGET) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1008 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1009 |
multiget = new (ELeave) CDesC8ArrayFlat(ARRAYEXPAND); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1010 |
CleanupStack::PushL(multiget); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1011 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1012 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1013 |
// this method works for response as well as sync-response |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1014 |
// do not use GetElementsByTagNameL for one specific responses directly |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1015 |
TXmlEngElement ResponseListTop; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1016 |
SearchL(aDocument, KMultistatus, KNullDesC8, ResponseListTop); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1017 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1018 |
RXmlEngNodeList<TXmlEngNode> ResponseList; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1019 |
CleanupClosePushL(ResponseList); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1020 |
ResponseListTop.GetChildNodes(ResponseList); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1021 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1022 |
while (ResponseList.HasNext()) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1023 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1024 |
TXmlEngNode node = ResponseList.Next(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1025 |
if (node.NodeType() == TXmlEngNode::EElement) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1026 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1027 |
TPtrC8 href = SearchL(node, KHref, KNullDesC8); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1028 |
//do not use Search, only looking for first childs, |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1029 |
//as D:propstat has D:status as well |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1030 |
RXmlEngNodeList<TXmlEngElement> statuslist; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1031 |
CleanupClosePushL(statuslist); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1032 |
node.AsElement().GetElementsByTagNameL(statuslist, KStatus, |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1033 |
KDav); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1034 |
//only one or zero item |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1035 |
HBufC8* status = |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1036 |
statuslist.Count() ? statuslist.Next().Value().AllocL() |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1037 |
: KNullDesC8().AllocL(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1038 |
CleanupStack::PopAndDestroy(&statuslist); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1039 |
CleanupStack::PushL(status); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1040 |
status->Des().LowerCase(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1041 |
TPtrC8 etag = SearchL(node, KEtag, KNullDesC8); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1042 |
RBuf8 calendardata; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1043 |
SearchL(node, KCalendarData, KNullDesC8, calendardata); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1044 |
calendardata.CleanupClosePushL(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1045 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1046 |
// don't do anything with home itself |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1047 |
if (href.Right(KIcs().Length()) == KIcs) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1048 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1049 |
if ((*status == KHTTP200) || (*status == KHTTP201) || (*status == KNullDesC8)) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1050 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1051 |
if ((calendardata == KNullDesC8)) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1052 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1053 |
if (aMultiget) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1054 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1055 |
// ATTENTION: an empty response to a multiget should never happen |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1056 |
// data wrapped inside CDATA, e.g. bedework ?? |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1057 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1058 |
else |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1059 |
//TOOD: if this is a webdav sync response, we should skip the etag check |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1060 |
AddModifyLocalEntryL(href, etag, multiget); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1061 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1062 |
else |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1063 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1064 |
// response to a multiget or time-range report, we now already have everything we need |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1065 |
StoreEntryL(calendardata, etag); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1066 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1067 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1068 |
else if (*status == KHTTP404) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1069 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1070 |
if (iOptions.sync_collection) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1071 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1072 |
// if this is an initial sync without token, |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1073 |
// this should be ignored, Sun Server bug!!! |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1074 |
if (SyncToken() != KNullDesC8) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1075 |
DeleteLocalEntryL(href); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1076 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1077 |
else |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1078 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1079 |
//multiget answer, but deleted in the meantime, should delete locally as well |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1080 |
DeleteLocalEntryL(href); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1081 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1082 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1083 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1084 |
CleanupStack::PopAndDestroy(&calendardata); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1085 |
CleanupStack::PopAndDestroy(status); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1086 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1087 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1088 |
CleanupStack::PopAndDestroy(&ResponseList); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1089 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1090 |
if (iOptions.MULTIGET) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1091 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1092 |
if (multiget->Count()) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1093 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1094 |
DownloadEntryL(multiget); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1095 |
multiget->Reset(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1096 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1097 |
CleanupStack::PopAndDestroy(multiget); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1098 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1099 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1100 |
else |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1101 |
ret = KErrArgument; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1102 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1103 |
return ret; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1104 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1105 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1106 |
/** |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1107 |
* CCalDavEngine::ParseResponsesL |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1108 |
* process a recieved multistatus response |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1109 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1110 |
TInt CCalDavEngine::ParseResponsesL(const TDesC8 &aDocument, TBool aMultiget) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1111 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1112 |
#ifdef _DEBUG |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1113 |
_LIT(KFilename,"c:\\logs\\caldav\\parseresonseslatest.txt"); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1114 |
ExportToFileNameL(aDocument, KFilename); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1115 |
#endif |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1116 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1117 |
RXmlEngDocument document = iDomParser.ParseL(aDocument); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1118 |
CleanupClosePushL(document); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1119 |
TInt ret = ParseResponsesL(document, aMultiget); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1120 |
CleanupStack::PopAndDestroy(&document); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1121 |
return ret; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1122 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1123 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1124 |
/** |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1125 |
* CCalDavEngine::StoreEntryL |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1126 |
* store event in local store |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1127 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1128 |
#ifdef ETAG |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1129 |
TInt CCalDavEngine::StoreEntryL(const TDesC8 &aBuf, const TDesC8 &aEtag) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1130 |
#else |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1131 |
TInt CCalDavEngine::StoreEntryL(const TDesC8 &aBuf, const TDesC8 &/*aEtag*/) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1132 |
#endif |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1133 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1134 |
#ifdef _DEBUG |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1135 |
_LIT(KFileName2, "C:\\logs\\caldav\\testing_import.txt"); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1136 |
ExportToFileNameL(aBuf, KFileName2); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1137 |
#endif |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1138 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1139 |
HBufC8* buffer = HBufC8::NewL(aBuf.Length() + 500); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1140 |
buffer->Des().Append(aBuf); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1141 |
TPtr8 ptr = buffer->Des(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1142 |
CalDavUtils::FixImportIssues(ptr); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1143 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1144 |
RPointerArray<CCalEntry> Array; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1145 |
CleanupClosePushL(Array); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1146 |
RDesReadStream ReadStream; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1147 |
ReadStream.Open(ptr); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1148 |
CleanupClosePushL(ReadStream); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1149 |
#ifdef _DEBUG |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1150 |
_LIT(KFileName, "C:\\logs\\caldav\\testing_import_fixed.txt"); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1151 |
ExportToFileNameL(ptr, KFileName); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1152 |
#endif |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1153 |
TRAPD(error, iCalImporter->ImportICalendarL(ReadStream,Array)); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1154 |
CleanupStack::PopAndDestroy(&ReadStream); // calls close on rSteam |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1155 |
if ((error == KErrNone) && (Array.Count())) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1156 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1157 |
iCalIntermimUtils2->StoreL(*iCalEntryView, *Array[0], ETrue); // or should last one be EFalse?? |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1158 |
TInt pos = iLocalUidArray.Find(Array[0]->LocalUidL()); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1159 |
if (pos == KErrNotFound) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1160 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1161 |
iLocalUidArray.Append(Array[0]->LocalUidL()); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1162 |
iGlobalUidArray.Append(Array[0]->UidL()); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1163 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1164 |
#ifdef ETAG |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1165 |
Array[0]->SetETag(aEtag); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1166 |
#endif |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1167 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1168 |
Array.ResetAndDestroy(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1169 |
CleanupStack::PopAndDestroy(&Array); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1170 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1171 |
delete buffer; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1172 |
return error; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1173 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1174 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1175 |
/** |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1176 |
* CCalDavEngine::WebDavSyncReportL |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1177 |
* webdav sync report |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1178 |
* http://tools.ietf.org/html/draft-daboo-webdav-sync-02 |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1179 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1180 |
TInt CCalDavEngine::WebDavSyncReportL(TBool aSynctoken) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1181 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1182 |
HBufC8 *Buf = HBufC8::NewL(KSync().Length() + SyncToken().Length()); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1183 |
TPtrC8 token = SyncToken(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1184 |
if (aSynctoken) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1185 |
Buf->Des().Format(KSync, &token); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1186 |
else |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1187 |
Buf->Des().Format(KSync, &KNullDesC8()); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1188 |
CleanupStack::PushL(Buf); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1189 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1190 |
CBufFlat* response = CBufFlat::NewL(EXPANDSIZE_BIG); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1191 |
CleanupStack::PushL(response); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1192 |
TInt ret = iHttp->ReportL(*iUrl, *Buf, response); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1193 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1194 |
if (ret == MULTISTATUS) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1195 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1196 |
RXmlEngDocument document = iDomParser.ParseL(response->Ptr(0)); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1197 |
CleanupClosePushL(document); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1198 |
if (document.NotNull()) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1199 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1200 |
TPtrC8 Token = SearchL(document, KSynctoken, KNullDesC8); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1201 |
if ((Token != KNullDesC8) && (Token != SyncToken())) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1202 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1203 |
ret = ParseResponsesL(document); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1204 |
//store newest token |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1205 |
if (ret == KErrNone) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1206 |
SetSyncTokenL(Token.AllocL()); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1207 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1208 |
else |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1209 |
ret = KErrNone; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1210 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1211 |
else |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1212 |
ret = KErrGeneral; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1213 |
CleanupStack::PopAndDestroy(&document); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1214 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1215 |
CleanupStack::PopAndDestroy(response); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1216 |
CleanupStack::PopAndDestroy(Buf); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1217 |
return ret; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1218 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1219 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1220 |
/** |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1221 |
* CCalDavEngine::WebDavSyncL |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1222 |
* sync using webdav sync |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1223 |
* http://tools.ietf.org/html/draft-daboo-webdav-sync-02 |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1224 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1225 |
TBool CCalDavEngine::WebDavSyncL() |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1226 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1227 |
if (iHttp) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1228 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1229 |
// commit any left over client changes |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1230 |
TBool RetClient = ClientChangesL(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1231 |
// get all changes from server |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1232 |
TInt ret = WebDavSyncReportL(ETrue); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1233 |
if (ret == CONFLICT) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1234 |
ret = WebDavSyncReportL(EFalse); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1235 |
return (ret == KErrNone) && RetClient; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1236 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1237 |
return EFalse; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1238 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1239 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1240 |
/** |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1241 |
* CCalDavEngine::GetUIDByUrl |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1242 |
* parse url to find UID |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1243 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1244 |
TPtrC8 CCalDavEngine::GetUIDByUrl(const TDesC8 &aUrl) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1245 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1246 |
TPtrC8 UID; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1247 |
TInt Pos = aUrl.LocateReverse('/'); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1248 |
TInt Pos2 = aUrl.Find(KIcs); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1249 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1250 |
if ((Pos != KErrNotFound) && (Pos2 != KErrNotFound)) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1251 |
UID.Set(aUrl.Mid(Pos + 1, Pos2 - Pos - 1)); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1252 |
else |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1253 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1254 |
if (Pos != KErrNotFound) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1255 |
UID.Set(aUrl.Mid(Pos + 1, aUrl.Length() - Pos - 1)); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1256 |
else if (Pos2 != KErrNotFound) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1257 |
UID.Set(aUrl.Left(aUrl.Length() - KIcs().Length())); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1258 |
else |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1259 |
UID.Set(aUrl); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1260 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1261 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1262 |
return UID; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1263 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1264 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1265 |
/** |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1266 |
* CCalDavEngine::DoesEntryExistL |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1267 |
* check if entry exists in local store |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1268 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1269 |
unsigned long CCalDavEngine::DoesEntryExistL(const TDesC8 &aUrl) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1270 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1271 |
// check if we already have it locally by uid |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1272 |
RPointerArray<CCalEntry> entryArray; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1273 |
CleanupClosePushL(entryArray); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1274 |
iCalEntryView->FetchL(GetUIDByUrl(aUrl), entryArray); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1275 |
// get parent |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1276 |
CCalEntry *entry = entryArray.Count() ? entryArray[0] : NULL; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1277 |
TInt ret = entry ? entry->LocalUidL() : 0; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1278 |
entryArray.ResetAndDestroy(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1279 |
CleanupStack::PopAndDestroy(&entryArray); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1280 |
return ret; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1281 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1282 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1283 |
/** |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1284 |
* CCalDavEngine::ETagMatchL |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1285 |
* checks for equal ETag |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1286 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1287 |
TBool CCalDavEngine::ETagMatchL(const TDesC8& /*aUrl*/, const TDesC8& /*aETag*/) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1288 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1289 |
#ifdef ETAG |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1290 |
// check if we already have it locally by uid |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1291 |
RPointerArray<CCalEntry> entryArray; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1292 |
CleanupClosePushL(entryArray); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1293 |
iCalEntryView->FetchL(GetUIDByUrl(aUrl), entryArray); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1294 |
// get parent |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1295 |
CCalEntry *entry = entryArray.Count() ? entryArray[0] : NULL; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1296 |
TBool ret = entry ? entry->ETag() == aETag : EFalse; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1297 |
entryArray.ResetAndDestroy(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1298 |
CleanupStack::PopAndDestroy(&entryArray); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1299 |
return ret; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1300 |
#else |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1301 |
return EFalse; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1302 |
#endif |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1303 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1304 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1305 |
/** |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1306 |
* CCalDavEngine::AddModifyLocalEntryL |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1307 |
* add or modify existing event |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1308 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1309 |
TInt CCalDavEngine::AddModifyLocalEntryL(const TDesC8 &aUrl, |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1310 |
const TDesC8 &aETag, CDesC8ArrayFlat* aArray) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1311 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1312 |
// check if we have the entry locally |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1313 |
// check for etag if we have the latest version, if not, download and import or add to multiget request |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1314 |
if (!ETagMatchL(aUrl, aETag)) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1315 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1316 |
if (aArray) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1317 |
aArray->AppendL(aUrl); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1318 |
else |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1319 |
DownloadEntryL(aUrl); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1320 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1321 |
return KErrNone; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1322 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1323 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1324 |
/** |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1325 |
* CCalDavEngine::DownloadEntryL |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1326 |
* download entries using multiget from server |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1327 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1328 |
TInt CCalDavEngine::DownloadEntryL(CDesC8Array* aArray) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1329 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1330 |
TInt ret = KErrNone; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1331 |
TInt64 remainder; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1332 |
TInt64 result = Math::DivMod64(aArray->Count(), MULTIGETSPLIT, remainder); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1333 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1334 |
// split large multigets request into several smaller ones |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1335 |
for (TInt64 l = 0; l <= result; l++) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1336 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1337 |
// do the multiget request and pass it to parserepsonses again to read in the data |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1338 |
CBufFlat* body = CBufFlat::NewL(EXPANDSIZE_BIG); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1339 |
CleanupStack::PushL(body); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1340 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1341 |
body->InsertL(body->Size(), KMultistart); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1342 |
for (TInt64 i = 0; i <= ((l == result) ? remainder - 1 : MULTIGETSPLIT |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1343 |
- 1); i++) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1344 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1345 |
body->InsertL(body->Size(), KHrefstart); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1346 |
body->InsertL(body->Size(), (*aArray)[MULTIGETSPLIT * l + i]); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1347 |
body->InsertL(body->Size(), KHrefend); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1348 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1349 |
body->InsertL(body->Size(), KMultiend); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1350 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1351 |
CBufFlat* response = CBufFlat::NewL(EXPANDSIZE_BIG); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1352 |
CleanupStack::PushL(response); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1353 |
TInt Return = iHttp->ReportL(*iUrl, body->Ptr(0), response); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1354 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1355 |
if (Return == MULTISTATUS) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1356 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1357 |
TInt parsereturn = ParseResponsesL(response->Ptr(0), ETrue); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1358 |
// if it failed before, we do not want to override this error |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1359 |
ret = (ret == KErrNone) ? parsereturn : ret; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1360 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1361 |
else |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1362 |
ret = KErrGeneral; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1363 |
CleanupStack::PopAndDestroy(response); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1364 |
CleanupStack::PopAndDestroy(body); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1365 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1366 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1367 |
return ret; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1368 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1369 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1370 |
/** |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1371 |
* CCalDavEngine::DownloadEntryL |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1372 |
* download entry from server |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1373 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1374 |
TInt CCalDavEngine::DownloadEntryL(const TDesC8 &aUrl) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1375 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1376 |
TBuf8<URLMAX> url; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1377 |
url.Append(*iUrl); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1378 |
url.Append(GetUIDByUrl(aUrl)); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1379 |
url.Append(KIcs); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1380 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1381 |
CBufFlat* response = CBufFlat::NewL(EXPANDSIZE_SMALL); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1382 |
CleanupStack::PushL(response); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1383 |
TInt ret = iHttp->GetL(url, response); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1384 |
if (ret == OK) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1385 |
ret = StoreEntryL(response->Ptr(0), iHttp->ETag()); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1386 |
else |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1387 |
ret = KErrGeneral; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1388 |
CleanupStack::PopAndDestroy(response); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1389 |
return ret; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1390 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1391 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1392 |
/** |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1393 |
* CCalDavEngine::DeleteLocalEntryL |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1394 |
* delete an event from local store |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1395 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1396 |
TInt CCalDavEngine::DeleteLocalEntryL(const TDesC8 &aUID) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1397 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1398 |
CDesC8ArrayFlat * Array = new (ELeave) CDesC8ArrayFlat(ARRAYEXPAND); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1399 |
CleanupStack::PushL(Array); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1400 |
Array->AppendL(GetUIDByUrl(aUID)); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1401 |
// we could have delete it ourselves, so it is already gone |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1402 |
TRAPD(error, iCalEntryView->DeleteL(*Array)); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1403 |
Array->Reset(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1404 |
CleanupStack::PopAndDestroy(Array); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1405 |
return error; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1406 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1407 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1408 |
/** |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1409 |
* CCalDavEngine::DeleteRemovedEntriesOnServerL |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1410 |
* check for removed entries on server |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1411 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1412 |
TInt CCalDavEngine::DeleteRemovedEntriesOnServerL() |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1413 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1414 |
if (iOptions.calendar_access) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1415 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1416 |
TTime syncstart; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1417 |
syncstart.HomeTime(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1418 |
syncstart = syncstart - iPastDays; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1419 |
TBuf<100> nowStr; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1420 |
syncstart.FormatL(nowStr, KFormatString); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1421 |
TBuf8<100> nowStrAdd; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1422 |
nowStrAdd.Append(nowStr); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1423 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1424 |
TInt eventreturn = KErrNone; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1425 |
if (iOptions.VEVENT) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1426 |
eventreturn = TimeReportL(ETrue, nowStrAdd, ETrue); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1427 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1428 |
TInt todoreturn = KErrNone; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1429 |
if (iOptions.VTODO) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1430 |
todoreturn = TimeReportL(EFalse, nowStrAdd, ETrue); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1431 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1432 |
return (eventreturn == KErrNone) && (todoreturn == KErrNone) ? KErrNone |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1433 |
: KErrGeneral; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1434 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1435 |
else |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1436 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1437 |
// use PROPFIND report |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1438 |
CBufFlat* response = CBufFlat::NewL(EXPANDSIZE_SMALL); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1439 |
CleanupStack::PushL(response); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1440 |
TInt ret = iHttp->PropfindL(*iUrl, KPropList, response, EFalse); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1441 |
if (ret == MULTISTATUS) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1442 |
ret = ParseResponsesDeleteL(response->Ptr(0)); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1443 |
else |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1444 |
ret = KErrGeneral; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1445 |
CleanupStack::PopAndDestroy(response); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1446 |
return ret; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1447 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1448 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1449 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1450 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1451 |
/** |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1452 |
* CCalDavEngine::UploadModifiedSinceDateL |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1453 |
* check for any modified data after last sync time |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1454 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1455 |
TBool CCalDavEngine::UploadModifiedSinceDateL() |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1456 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1457 |
TBool manualsync = EFalse; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1458 |
// upload modified and newly create ones |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1459 |
RArray<TCalLocalUid> *Ids = new (ELeave) RArray<TCalLocalUid> (ARRAYEXPAND); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1460 |
iCalEntryView->GetIdsModifiedSinceDateL(iLastSyncTime, *Ids); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1461 |
for (TInt i = 0; i < Ids->Count(); i++) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1462 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1463 |
TCalLocalUid id = (*Ids)[i]; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1464 |
TInt ret = UploadEntryL(id, MCalChangeCallBack2::EChangeUndefined, |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1465 |
MCalChangeCallBack2::EChangeEntryAll); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1466 |
// TOOD: if it fails during upload, ignore |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1467 |
// if it fails due to internet connection, try again |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1468 |
if (ret != KErrNone) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1469 |
manualsync = ETrue; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1470 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1471 |
Ids->Reset(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1472 |
delete Ids; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1473 |
return manualsync; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1474 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1475 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1476 |
/** |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1477 |
* CCalDavEngine::ClientChangesL |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1478 |
* check for left over local client changes |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1479 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1480 |
TBool CCalDavEngine::ClientChangesL() |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1481 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1482 |
if (iCalEntryView && iManualSync) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1483 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1484 |
iManualSync = EFalse; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1485 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1486 |
// upload modified and newly create ones |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1487 |
iManualSync = UploadModifiedSinceDateL(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1488 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1489 |
// delete locally deleted entries on server |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1490 |
for (TInt i = iDeletedEntries.Count() - 1; i >= 0; --i) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1491 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1492 |
TInt ret = DeleteEntryL(iDeletedEntries[i]); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1493 |
if (ret == KErrNone) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1494 |
iDeletedEntries.Remove(i); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1495 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1496 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1497 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1498 |
iManualSync = iDeletedEntries.Count() ? ETrue : EFalse; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1499 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1500 |
TPckgC<TBool> manualSync(iManualSync); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1501 |
SetCalendarInfoL(KCaldavManualSync, manualSync); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1502 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1503 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1504 |
return ETrue; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1505 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1506 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1507 |
/** |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1508 |
* CCalDavEngine::MkcalendarL |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1509 |
* create a new calendar on the server |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1510 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1511 |
TInt CCalDavEngine::MkcalendarL(const TDesC8 &aName) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1512 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1513 |
if (iOptions.MKCALENDAR) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1514 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1515 |
TBuf8<URLMAX> url; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1516 |
url.Append(*iHome); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1517 |
url.Append(aName); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1518 |
url.Append(KSlash); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1519 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1520 |
CBufFlat* response = CBufFlat::NewL(EXPANDSIZE_SMALL); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1521 |
CleanupStack::PushL(response); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1522 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1523 |
// TOOD: initialize with name, body etc. |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1524 |
TInt ret = iHttp->MkCalendarL(url, KNullDesC8, response); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1525 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1526 |
if ((ret == CREATED) || (ret == OK)) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1527 |
ret = KErrNone; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1528 |
else if ((ret == NOTALLOWED) || (ret == FORBIDDEN)) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1529 |
ret = KErrArgument; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1530 |
else |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1531 |
ret = KErrGeneral; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1532 |
CleanupStack::PopAndDestroy(response); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1533 |
return ret; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1534 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1535 |
else |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1536 |
return KErrNotSupported; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1537 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1538 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1539 |
/** |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1540 |
* CCalDavEngine::DeleteCalendarL |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1541 |
* delete a calendar on the server |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1542 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1543 |
TInt CCalDavEngine::DeleteCalendarL(const TDesC8 &aName) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1544 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1545 |
if (iOptions.MKCALENDAR) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1546 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1547 |
TBuf8<URLMAX> url; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1548 |
url.Append(*iHome); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1549 |
url.Append(aName); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1550 |
url.Append(KSlash); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1551 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1552 |
CBufFlat* response = CBufFlat::NewL(EXPANDSIZE_SMALL); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1553 |
CleanupStack::PushL(response); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1554 |
TInt ret = iHttp->DeleteL(url); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1555 |
if ((ret == NOCONTENT) || (ret == OK)) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1556 |
ret = KErrNone; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1557 |
else |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1558 |
ret = KErrGeneral; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1559 |
CleanupStack::PopAndDestroy(response); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1560 |
return ret; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1561 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1562 |
else |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1563 |
return KErrNotSupported; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1564 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1565 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1566 |
/** |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1567 |
* CCalDavEngine::HeadL |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1568 |
* check for existence of an entry on server |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1569 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1570 |
TInt CCalDavEngine::HeadL(const TDesC8 &aUID) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1571 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1572 |
// special handing for yahoo neccessary |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1573 |
// after deleting an event, it is still there and findable with HEAD |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1574 |
_LIT8(KYahoo,"yahoo"); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1575 |
_LIT8(KTrash,"trash"); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1576 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1577 |
TBuf8<URLMAX> url; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1578 |
url.Append(*iUrl); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1579 |
url.Append(aUID); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1580 |
url.Append(KIcs); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1581 |
if (iUrl->Find(KYahoo) == KErrNotFound) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1582 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1583 |
TInt head = iHttp->HeadL(url); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1584 |
return (head == NOCONTENT) || (head == OK) ? OK : head; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1585 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1586 |
else |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1587 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1588 |
CBufFlat* response = CBufFlat::NewL(EXPANDSIZE_SMALL); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1589 |
CleanupStack::PushL(response); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1590 |
TInt ret = iHttp->PropfindL(url, KNullDesC8, response); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1591 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1592 |
if (ret == MULTISTATUS) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1593 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1594 |
RXmlEngDocument document = iDomParser.ParseL(response->Ptr(0)); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1595 |
CleanupClosePushL(document); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1596 |
if (document.NotNull()) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1597 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1598 |
HBufC8* href = SearchL(document, KHref, KNullDesC8).AllocL(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1599 |
href->Des().LowerCase(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1600 |
ret = href->Find(KTrash) == KErrNotFound ? OK : NOTFOUND; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1601 |
delete href; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1602 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1603 |
CleanupStack::PopAndDestroy(&document); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1604 |
CleanupStack::PopAndDestroy(response); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1605 |
return ret; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1606 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1607 |
else |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1608 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1609 |
CleanupStack::PopAndDestroy(response); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1610 |
return NOTFOUND; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1611 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1612 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1613 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1614 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1615 |
/** |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1616 |
* CCalDavEngine::DeleteEntryL |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1617 |
* delete entry on server |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1618 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1619 |
TInt CCalDavEngine::DeleteEntryL(const TDesC8 &aUid) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1620 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1621 |
TBuf8<URLMAX> url; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1622 |
url.Append(*iBaseUrl); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1623 |
url.Append(aUid); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1624 |
return iHttp->DeleteL(url); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1625 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1626 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1627 |
/** |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1628 |
* CCalDavEngine::DeleteEntryL |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1629 |
* delete entry on server |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1630 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1631 |
TInt CCalDavEngine::DeleteEntryL(const TCalLocalUid &aUid) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1632 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1633 |
TInt Ret = KErrNone; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1634 |
// find the filename for a given local UID |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1635 |
TInt aPos = iLocalUidArray.Find(aUid); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1636 |
if (aPos != KErrNotFound) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1637 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1638 |
TBuf8<URLMAX> url; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1639 |
url.Append(*iUrl); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1640 |
url.Append(iGlobalUidArray[aPos]); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1641 |
url.Append(KIcs); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1642 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1643 |
#ifdef ETAG |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1644 |
CCalEntry* entry = iCalEntryView->FetchL(aUid); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1645 |
CleanupStack::PushL(entry); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1646 |
TInt Return = entry ? iHttp->DeleteL(url, entry->ETag()) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1647 |
: iHttp->DeleteL(url); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1648 |
CleanupStack::PopAndDestroy(entry); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1649 |
#else |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1650 |
TInt Return = iHttp->DeleteL(url); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1651 |
#endif |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1652 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1653 |
if ((Return == NOCONTENT) || (Return == OK)) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1654 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1655 |
SetLastSyncTimeL(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1656 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1657 |
else if (Return == PRECONDFAILED) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1658 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1659 |
// someone modified this in the meantime |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1660 |
// ask user if he wants the new event or still delete it |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1661 |
TBool modify = EFalse; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1662 |
if (modify) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1663 |
DownloadEntryL(url); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1664 |
else |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1665 |
iHttp->DeleteL(url); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1666 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1667 |
else if (Return == NOTFOUND) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1668 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1669 |
// someone deleted this already |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1670 |
Ret = KErrGeneral; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1671 |
} |
4 | 1672 |
else if (Return == FORBIDDEN) |
1673 |
{ |
|
1674 |
// event read-only |
|
1675 |
Ret = KErrGeneral; |
|
1676 |
} |
|
1
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1677 |
else |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1678 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1679 |
Ret = KErrGeneral; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1680 |
SyncFailedL(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1681 |
TInt pos = iDeletedEntries.Find(aUid); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1682 |
if (pos == KErrNotFound) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1683 |
iDeletedEntries.Append(aUid); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1684 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1685 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1686 |
else |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1687 |
Ret = KErrGeneral; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1688 |
return Ret; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1689 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1690 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1691 |
/** |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1692 |
* CCalDavEngine::UploadEntryL |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1693 |
* upload entry to server |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1694 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1695 |
TInt CCalDavEngine::UploadEntryL(CCalEntry* aEntry, |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1696 |
MCalChangeCallBack2::TChangeType aChangeType, |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1697 |
MCalChangeCallBack2::TChangeEntryType aEntryType) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1698 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1699 |
if (aEntry) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1700 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1701 |
TInt ret = KErrNone; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1702 |
TBool upload = EFalse; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1703 |
switch (aEntryType) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1704 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1705 |
case MCalChangeCallBack2::EChangeEntryEvent: |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1706 |
case MCalChangeCallBack2::EChangeEntryTodo: |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1707 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1708 |
upload = aEntry && ((MCalChangeCallBack2::EChangeEntryEvent |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1709 |
&& iOptions.VEVENT) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1710 |
|| (MCalChangeCallBack2::EChangeEntryTodo |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1711 |
&& iOptions.VTODO)); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1712 |
break; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1713 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1714 |
case MCalChangeCallBack2::EChangeEntryAll: |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1715 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1716 |
if (aEntry) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1717 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1718 |
switch (aEntry->EntryTypeL()) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1719 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1720 |
case CCalEntry::EAppt: |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1721 |
case CCalEntry::EAnniv: |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1722 |
case CCalEntry::EEvent: |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1723 |
case CCalEntry::EReminder: |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1724 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1725 |
upload = iOptions.VEVENT; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1726 |
break; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1727 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1728 |
case CCalEntry::ETodo: |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1729 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1730 |
upload = iOptions.VTODO; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1731 |
break; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1732 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1733 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1734 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1735 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1736 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1737 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1738 |
if (upload) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1739 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1740 |
CBufFlat* BufFlat = CBufFlat::NewL(EXPANDSIZE_SMALL); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1741 |
CleanupStack::PushL(BufFlat); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1742 |
RBufWriteStream writeStream(*BufFlat); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1743 |
CleanupClosePushL(writeStream); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1744 |
iCalExporter->ExportICalL(*aEntry, writeStream); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1745 |
writeStream.CommitL(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1746 |
CleanupStack::PopAndDestroy(&writeStream); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1747 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1748 |
HBufC8* buffer = BufFlat->Ptr(0).AllocL(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1749 |
CleanupStack::PopAndDestroy(BufFlat); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1750 |
CleanupStack::PushL(buffer); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1751 |
TPtr8 ptr = buffer->Des(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1752 |
CalDavUtils::FixExportIssues(ptr); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1753 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1754 |
#ifdef _DEBUG |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1755 |
ExportToFileL(aEntry, iCalExporter); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1756 |
_LIT(KFileName, "C:\\logs\\caldav\\testing_export_fixed.txt"); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1757 |
ExportToFileNameL(ptr, KFileName); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1758 |
#endif |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1759 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1760 |
TBuf8<URLMAX> url; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1761 |
url.Append(*iUrl); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1762 |
url.Append(aEntry->UidL()); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1763 |
url.Append(KIcs); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1764 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1765 |
CBufFlat* response = CBufFlat::NewL(EXPANDSIZE_SMALL); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1766 |
CleanupStack::PushL(response); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1767 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1768 |
#ifdef ETAG |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1769 |
TPtrC8 etag = aEntry->GetETag(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1770 |
TBool newentry = (aChangeType == MCalChangeCallBack2::EChangeAdd) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1771 |
|| ((aChangeType == MCalChangeCallBack2::EChangeUndefined) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1772 |
&& (etag == KNullDesC8)); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1773 |
TInt Ret = newentry ? iHttp->PutL(url, *buffer, response) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1774 |
: iHttp->PutL(url, *buffer, response, etag); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1775 |
#else |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1776 |
TBool newentry = (aChangeType == MCalChangeCallBack2::EChangeAdd) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1777 |
|| (aChangeType == MCalChangeCallBack2::EChangeUndefined); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1778 |
TInt Ret = newentry ? iHttp->PutL(url, *buffer, response) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1779 |
: iHttp->PutL(url, *buffer, response, _L8("ETAG")); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1780 |
#endif |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1781 |
if ((Ret == CREATED) || (Ret == NOCONTENT) || (Ret == OK)) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1782 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1783 |
if (newentry) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1784 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1785 |
iLocalUidArray.Append(aEntry->LocalUidL()); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1786 |
iGlobalUidArray.Append(aEntry->UidL()); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1787 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1788 |
#ifdef ETAG |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1789 |
aEntry->SetETag(iHttp->ETag()); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1790 |
#endif |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1791 |
SetLastSyncTimeL(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1792 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1793 |
else if (Ret == PRECONDFAILED) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1794 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1795 |
if (newentry)// same filename already exists, use a different one and upload again |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1796 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1797 |
TBuf8<URLMAX> nextUrl; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1798 |
nextUrl.Append(*iUrl); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1799 |
nextUrl.Append(aEntry->UidL()); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1800 |
TTime time; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1801 |
time.HomeTime(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1802 |
_LIT(KTimeFormat,"%H%T%S"); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1803 |
TBuf<20> StringTime; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1804 |
time.FormatL(StringTime, KTimeFormat); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1805 |
nextUrl.Append(StringTime); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1806 |
nextUrl.Append(_L8(".ics")); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1807 |
response->Reset(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1808 |
TInt Ret = iHttp->PutL(nextUrl, *buffer, response); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1809 |
if ((Ret == CREATED) || (Ret == OK)) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1810 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1811 |
iLocalUidArray.Append(aEntry->LocalUidL()); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1812 |
iGlobalUidArray.Append(aEntry->UidL()); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1813 |
#ifdef ETAG |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1814 |
aEntry->SetETag(iHttp->ETag()); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1815 |
#endif |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1816 |
SetLastSyncTimeL(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1817 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1818 |
else |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1819 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1820 |
SyncFailedL(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1821 |
ret = KErrAbort; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1822 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1823 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1824 |
else |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1825 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1826 |
if (!iKeepServerEntry) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1827 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1828 |
response->Reset(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1829 |
// upload again without ETAG to overwrite server entry |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1830 |
TInt Ret = iHttp->PutL(url, *buffer, response); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1831 |
if ((Ret == CREATED) || (Ret == OK)) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1832 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1833 |
#ifdef ETAG |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1834 |
aEntry->SetETag(iHttp->ETag()); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1835 |
#endif |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1836 |
SetLastSyncTimeL(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1837 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1838 |
else |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1839 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1840 |
SyncFailedL(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1841 |
ret = KErrAbort; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1842 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1843 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1844 |
else |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1845 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1846 |
// download the server event and update local store |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1847 |
ret = DownloadEntryL(url); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1848 |
if (ret == KErrNone) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1849 |
SetLastSyncTimeL(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1850 |
else |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1851 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1852 |
SyncFailedL(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1853 |
ret = KErrAbort; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1854 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1855 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1856 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1857 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1858 |
else |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1859 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1860 |
SyncFailedL(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1861 |
ret = KErrAbort; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1862 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1863 |
CleanupStack::PopAndDestroy(response); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1864 |
CleanupStack::PopAndDestroy(buffer); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1865 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1866 |
return ret; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1867 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1868 |
return KErrArgument; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1869 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1870 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1871 |
/** |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1872 |
* CCalDavEngine::UploadEntryL |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1873 |
* upload entry to server |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1874 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1875 |
TInt CCalDavEngine::UploadEntryL(const TCalLocalUid &aUid, |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1876 |
MCalChangeCallBack2::TChangeType aChangeType, |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1877 |
MCalChangeCallBack2::TChangeEntryType aEntryType) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1878 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1879 |
CCalEntry * aEntry = iCalEntryView->FetchL(aUid); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1880 |
CleanupStack::PushL(aEntry); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1881 |
TInt ret = UploadEntryL(aEntry, aChangeType, aEntryType); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1882 |
CleanupStack::PopAndDestroy(aEntry); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1883 |
return ret; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1884 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1885 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1886 |
/** |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1887 |
* CCalDavEngine::GetSyncTokenL |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1888 |
* get latest Webdav Sync token |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1889 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1890 |
HBufC8* CCalDavEngine::GetSyncTokenL() |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1891 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1892 |
HBufC8 *aBuf = HBufC8::NewL(KSync().Length()); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1893 |
aBuf->Des().Format(KSync, &KNullDesC8()); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1894 |
CleanupStack::PushL(aBuf); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1895 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1896 |
CBufFlat* response = CBufFlat::NewL(EXPANDSIZE_SMALL); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1897 |
CleanupStack::PushL(response); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1898 |
TInt RetServer = iHttp->ReportL(*iUrl, *aBuf, response); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1899 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1900 |
if (RetServer) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1901 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1902 |
RXmlEngDocument document = iDomParser.ParseL(response->Ptr(0)); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1903 |
CleanupClosePushL(document); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1904 |
if (document.NotNull()) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1905 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1906 |
HBufC8* ret = SearchL(document, KSynctoken, KNullDesC8).AllocL(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1907 |
CleanupStack::PopAndDestroy(&document); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1908 |
CleanupStack::PopAndDestroy(response); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1909 |
CleanupStack::PopAndDestroy(aBuf); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1910 |
return ret; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1911 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1912 |
CleanupStack::PopAndDestroy(&document); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1913 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1914 |
CleanupStack::PopAndDestroy(response); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1915 |
CleanupStack::PopAndDestroy(aBuf); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1916 |
return KNullDesC8().AllocL(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1917 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1918 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1919 |
/** |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1920 |
* CCalDavEngine::CheckCalendarInfoL |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1921 |
* check for new calendar displayname and color |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1922 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1923 |
void CCalDavEngine::CheckCalendarInfoL(RXmlEngDocument &aDocument) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1924 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1925 |
TBool change = EFalse; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1926 |
CCalCalendarInfo* info = iCalSession->CalendarInfoL(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1927 |
CleanupStack::PushL(info); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1928 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1929 |
HBufC8* color = SearchL(aDocument, KCalendar_Color, KNullDesC8).AllocLC(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1930 |
if ((*color != KNullDesC8) && (color->Length() > 6)) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1931 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1932 |
TLex8 lexred(color->Des().Mid(1, 2)); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1933 |
TInt red; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1934 |
lexred.Val(red); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1935 |
TLex8 lexgreen(color->Des().Mid(3, 2)); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1936 |
TInt green; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1937 |
lexgreen.Val(green); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1938 |
TLex8 lexblue(color->Des().Mid(5, 2)); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1939 |
TInt blue; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1940 |
lexblue.Val(blue); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1941 |
TRgb newcolor(red, green, blue); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1942 |
if (info->Color() != newcolor) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1943 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1944 |
info->SetColor(newcolor); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1945 |
change = ETrue; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1946 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1947 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1948 |
CleanupStack::PopAndDestroy(color); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1949 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1950 |
HBufC8* displayname = |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1951 |
SearchL(aDocument, KDisplayname, KNullDesC8).AllocLC(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1952 |
if (*displayname != KNullDesC8) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1953 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1954 |
HBufC16* name = |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1955 |
CnvUtfConverter::ConvertToUnicodeFromUtf8L(*displayname); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1956 |
CleanupStack::PushL(name); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1957 |
if (info->NameL() != *name) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1958 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1959 |
info->SetNameL(*name); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1960 |
change = ETrue; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1961 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1962 |
CleanupStack::PopAndDestroy(name); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1963 |
change = ETrue; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1964 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1965 |
CleanupStack::PopAndDestroy(displayname); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1966 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1967 |
if (change) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1968 |
iCalSession->SetCalendarInfoL(*info); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1969 |
CleanupStack::PopAndDestroy(info); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1970 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1971 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1972 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1973 |
/** |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1974 |
* CCalDavEngine::GetCTagL |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1975 |
* get latest CTag |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1976 |
* https://trac.calendarserver.org/browser/CalendarServer/trunk/doc/Extensions/caldav-ctag.txt |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1977 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1978 |
HBufC8* CCalDavEngine::GetCTagL() |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1979 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1980 |
if (iHttp) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1981 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1982 |
CBufFlat* response = CBufFlat::NewL(EXPANDSIZE_SMALL); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1983 |
CleanupStack::PushL(response); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1984 |
TInt ret = iHttp->PropfindL(*iUrl, KCtag, response); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1985 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1986 |
if (ret == MULTISTATUS) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1987 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1988 |
RXmlEngDocument document = iDomParser.ParseL(response->Ptr(0)); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1989 |
CleanupClosePushL(document); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1990 |
if (document.NotNull()) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1991 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1992 |
HBufC8* status = |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1993 |
SearchL(document, KStatus, KNullDesC8).AllocLC(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1994 |
HBufC8* ctag = |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1995 |
SearchL(document, KGetctag, KNullDesC8).AllocLC(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1996 |
status->Des().LowerCase(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1997 |
if ((*ctag != KNullDesC8) && (*status == KHTTP200)) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1998 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
1999 |
CleanupStack::Pop(ctag); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2000 |
CleanupStack::PopAndDestroy(status); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2001 |
CleanupStack::PopAndDestroy(&document); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2002 |
CleanupStack::PopAndDestroy(response); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2003 |
return ctag; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2004 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2005 |
else |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2006 |
CleanupStack::PopAndDestroy(ctag); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2007 |
CleanupStack::PopAndDestroy(status); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2008 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2009 |
CleanupStack::PopAndDestroy(&document); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2010 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2011 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2012 |
CleanupStack::PopAndDestroy(response); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2013 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2014 |
return KNullDesC8().AllocL(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2015 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2016 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2017 |
/** |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2018 |
* CCalDavEngine::GetOptionsL |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2019 |
* get OPTIONS from server |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2020 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2021 |
TBool CCalDavEngine::GetOptionsL() |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2022 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2023 |
if (iHttp) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2024 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2025 |
// check DAV and allow headers |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2026 |
iHttp->GetServerOptionsL(*iUrl, iOptions); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2027 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2028 |
// check ctag extension |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2029 |
HBufC8* ctag = GetCTagL(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2030 |
if (*ctag != KNullDesC8) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2031 |
iOptions.sync_ctag = true; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2032 |
delete ctag; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2033 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2034 |
// check supported elements |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2035 |
CBufFlat* response = CBufFlat::NewL(EXPANDSIZE_SMALL); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2036 |
CleanupStack::PushL(response); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2037 |
TInt Ret = iHttp->PropfindL(*iUrl, KSupportedSet, response); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2038 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2039 |
if (Ret == MULTISTATUS) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2040 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2041 |
RXmlEngDocument document = iDomParser.ParseL(response->Ptr(0)); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2042 |
CleanupClosePushL(document); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2043 |
if (document.NotNull()) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2044 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2045 |
CheckCalendarInfoL(document); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2046 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2047 |
//<C:supported-calendar-component-set/> |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2048 |
TXmlEngElement supportedelement; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2049 |
SearchL(document, KSupportedCalendarComponentSet, KNullDesC8, |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2050 |
supportedelement); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2051 |
if (supportedelement.NotNull()) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2052 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2053 |
RXmlEngNodeList<TXmlEngElement> supportedelements; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2054 |
CleanupClosePushL(supportedelements); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2055 |
supportedelement.GetChildElements(supportedelements); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2056 |
while (supportedelements.HasNext()) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2057 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2058 |
TXmlEngElement element = supportedelements.Next(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2059 |
TPtrC8 value = element.AttributeValueL(KName); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2060 |
if (value == KNullDesC8) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2061 |
value.Set(element.AttributeValueL(KName, KCalDav)); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2062 |
if (value == KVEVENT) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2063 |
iOptions.VEVENT = ETrue; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2064 |
else if (value == KVTODO) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2065 |
iOptions.VTODO = ETrue; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2066 |
else if (value == KVFREBUSY) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2067 |
iOptions.VFREEBUSY = ETrue; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2068 |
else if (value == KVJOURNAL) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2069 |
iOptions.VJOURNAL = ETrue; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2070 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2071 |
CleanupStack::PopAndDestroy(&supportedelements); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2072 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2073 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2074 |
CleanupStack::PopAndDestroy(&document); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2075 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2076 |
CleanupStack::PopAndDestroy(response); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2077 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2078 |
return ETrue; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2079 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2080 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2081 |
/** |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2082 |
* CCalDavEngine::SetSyncTokenL |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2083 |
* set sync token |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2084 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2085 |
void CCalDavEngine::SetSyncTokenL(HBufC8* aToken) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2086 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2087 |
if (iSynctoken) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2088 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2089 |
delete iSynctoken; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2090 |
iSynctoken = NULL; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2091 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2092 |
iSynctoken = aToken; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2093 |
SetCalendarInfoL(KCaldavSynctoken, *iSynctoken); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2094 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2095 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2096 |
/** |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2097 |
* CCalDavEngine::SyncToken |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2098 |
* get synctoken |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2099 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2100 |
TPtrC8 CCalDavEngine::SyncToken() |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2101 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2102 |
return iSynctoken ? *iSynctoken : KNullDesC8(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2103 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2104 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2105 |
/** |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2106 |
* CCalDavEngine::SetCTagL |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2107 |
* set ctag |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2108 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2109 |
void CCalDavEngine::SetCTagL(HBufC8* aToken) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2110 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2111 |
if (iCTag) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2112 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2113 |
delete iCTag; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2114 |
iCTag = NULL; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2115 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2116 |
iCTag = aToken; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2117 |
SetCalendarInfoL(KCaldavCtag, *iCTag); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2118 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2119 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2120 |
/** |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2121 |
* CCalDavEngine::CTag |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2122 |
* get ctag |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2123 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2124 |
TPtrC8 CCalDavEngine::CTag() |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2125 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2126 |
return iCTag ? *iCTag : KNullDesC8(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2127 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2128 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2129 |
/** |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2130 |
* CCalDavEngine::SetLastSyncTimeL |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2131 |
* set last sync time |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2132 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2133 |
void CCalDavEngine::SetLastSyncTimeL() |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2134 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2135 |
// only set a new last sync time, if we did not have a failed one before |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2136 |
// otherwise, the old one would be lost |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2137 |
if (!iManualSync) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2138 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2139 |
TTime time; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2140 |
time.UniversalTime(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2141 |
iLastSyncTime.SetTimeUtcL(time); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2142 |
TPckgC<TCalTime> lasttime(iLastSyncTime); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2143 |
SetCalendarInfoL(KCaldavTime, lasttime); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2144 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2145 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2146 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2147 |
/** |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2148 |
* CCalDavEngine::SyncFailedL |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2149 |
* sync failed, enable manual sync |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2150 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2151 |
void CCalDavEngine::SyncFailedL() |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2152 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2153 |
if (!iManualSync) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2154 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2155 |
iManualSync = ETrue; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2156 |
TPckgC<TBool> manualSync(iManualSync); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2157 |
SetCalendarInfoL(KCaldavManualSync, manualSync); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2158 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2159 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2160 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2161 |
/** |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2162 |
* CCalDavEngine::GetBaseUrl |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2163 |
* get base domain url |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2164 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2165 |
void CCalDavEngine::GetBaseUrl(const TDesC8 &aUrl) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2166 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2167 |
_LIT8(http,"http://"); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2168 |
_LIT8(https,"https://"); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2169 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2170 |
if (iBaseUrl) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2171 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2172 |
delete iBaseUrl; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2173 |
iBaseUrl = NULL; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2174 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2175 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2176 |
if (aUrl.Length() > http().Length()) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2177 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2178 |
TInt length = aUrl.Find(https) != KErrNotFound ? https().Length() |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2179 |
: http().Length(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2180 |
TInt pos = aUrl.Mid(length).Locate('/'); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2181 |
iBaseUrl = aUrl.Left(pos + length).Alloc(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2182 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2183 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2184 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2185 |
/** |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2186 |
* CCalDavEngine::FindUrlsL |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2187 |
* find home, inbox and outbox property |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2188 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2189 |
void CCalDavEngine::FindUrlsL(const TDesC8 &aDes, HBufC8 *&home, |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2190 |
HBufC8 *&inbox, HBufC8 *&outbox) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2191 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2192 |
RXmlEngDocument document = iDomParser.ParseL(aDes); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2193 |
CleanupClosePushL(document); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2194 |
if (document.NotNull()) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2195 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2196 |
HBufC8* status = SearchL(document, KStatus, KNullDesC8).AllocLC(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2197 |
status->Des().LowerCase(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2198 |
if (*status == KHTTP200) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2199 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2200 |
TXmlEngElement calendarhome, inboxhome, outboxhome; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2201 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2202 |
SearchL(document, KCalendarHomeSet, KNullDesC8, calendarhome); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2203 |
if (calendarhome.NotNull()) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2204 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2205 |
TPtrC8 homeend = SearchL(calendarhome, KHref, KNullDesC8); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2206 |
home = HBufC8::NewL(iBaseUrl->Length() + homeend.Length()); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2207 |
home->Des().Append(*iBaseUrl); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2208 |
home->Des().Append(homeend); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2209 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2210 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2211 |
SearchL(document, KInbox, KNullDesC8, inboxhome); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2212 |
if (inboxhome.NotNull()) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2213 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2214 |
TPtrC8 inboxend = SearchL(inboxhome, KHref, KNullDesC8); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2215 |
inbox = HBufC8::NewL(iBaseUrl->Length() + inboxend.Length()); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2216 |
inbox->Des().Append(*iBaseUrl); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2217 |
inbox->Des().Append(inboxend); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2218 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2219 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2220 |
SearchL(document, KOutbox, KNullDesC8, outboxhome); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2221 |
if (outboxhome.NotNull()) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2222 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2223 |
TPtrC8 outboxend = SearchL(outboxhome, KHref, KNullDesC8); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2224 |
outbox = HBufC8::NewL(iBaseUrl->Length() + outboxend.Length()); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2225 |
outbox->Des().Append(*iBaseUrl); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2226 |
outbox->Des().Append(outboxend); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2227 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2228 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2229 |
CleanupStack::PopAndDestroy(status); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2230 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2231 |
CleanupStack::PopAndDestroy(&document); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2232 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2233 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2234 |
/** |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2235 |
* CCalDavEngine::FindCalendarCollectionL |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2236 |
* find all calendar collections under home url |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2237 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2238 |
HBufC8* CCalDavEngine::FindCalendarCollectionL(const TDesC8 &aUrl, |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2239 |
CDesC8ArrayFlat *aArray) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2240 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2241 |
HBufC8* homecalendar = 0; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2242 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2243 |
// do propfind depth:1 and find all calendar collections |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2244 |
// right now, take the first one as default |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2245 |
CBufFlat* response = CBufFlat::NewL(EXPANDSIZE_SMALL); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2246 |
CleanupStack::PushL(response); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2247 |
TInt retcode = iHttp->PropfindL(aUrl, KCalendarurl, response, EFalse); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2248 |
if (retcode == MULTISTATUS) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2249 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2250 |
RXmlEngDocument document = iDomParser.ParseL(response->Ptr(0)); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2251 |
CleanupClosePushL(document); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2252 |
if (document.NotNull() && document.DocumentElement().NotNull()) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2253 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2254 |
RXmlEngNodeList<TXmlEngElement> ResponseList; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2255 |
CleanupClosePushL(ResponseList); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2256 |
document.DocumentElement().GetElementsByTagNameL(ResponseList, |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2257 |
KResponse, KDav); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2258 |
TBool FirstOneDone = EFalse; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2259 |
while (ResponseList.HasNext()) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2260 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2261 |
TXmlEngElement node = ResponseList.Next(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2262 |
TPtrC8 href = SearchL(node, KHref, KNullDesC8); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2263 |
TPtrC8 status = SearchL(node, KStatus, KNullDesC8); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2264 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2265 |
TXmlEngElement calendar; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2266 |
TXmlEngElement vevent_collection; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2267 |
TXmlEngElement vtodo_collection; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2268 |
SearchL(node, KCalendar, KNullDesC8, calendar); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2269 |
SearchL(node, KVEventCollection, KNullDesC8, vevent_collection); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2270 |
SearchL(node, KVTodoCollection, KNullDesC8, vtodo_collection); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2271 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2272 |
if (calendar.NotNull() || vevent_collection.NotNull() |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2273 |
|| vtodo_collection.NotNull()) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2274 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2275 |
if (!FirstOneDone) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2276 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2277 |
homecalendar = HBufC8::NewL(iBaseUrl->Length() |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2278 |
+ href.Length()); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2279 |
homecalendar->Des().Append(*iBaseUrl); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2280 |
homecalendar->Des().Append(href); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2281 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2282 |
iOptions.VEVENT = vevent_collection.NotNull(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2283 |
iOptions.VTODO = vtodo_collection.NotNull(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2284 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2285 |
FirstOneDone = ETrue; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2286 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2287 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2288 |
if (aArray) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2289 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2290 |
TBuf8<URLMAX> url; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2291 |
url.Append(*iBaseUrl); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2292 |
url.Append(href); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2293 |
aArray->AppendL(url); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2294 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2295 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2296 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2297 |
CleanupStack::PopAndDestroy(&ResponseList); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2298 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2299 |
CleanupStack::PopAndDestroy(&document); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2300 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2301 |
CleanupStack::PopAndDestroy(response); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2302 |
return homecalendar; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2303 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2304 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2305 |
/** |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2306 |
* CCalDavEngine::GetCalendarUrlsL |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2307 |
* find calendar url based on any url |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2308 |
* could be principal url, home or direct calendar url |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2309 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2310 |
TInt CCalDavEngine::GetCalendarUrlsL(CDesC8ArrayFlat *aArray) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2311 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2312 |
if (iHttp && iUrl) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2313 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2314 |
HBufC8 *principal = 0; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2315 |
HBufC8 *home = 0; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2316 |
HBufC8 *homecalendar = 0; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2317 |
HBufC8 *inbox = 0; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2318 |
HBufC8 *outbox = 0; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2319 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2320 |
GetBaseUrl(*iUrl); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2321 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2322 |
// TODO: does this really find groupdav collection? |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2323 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2324 |
// find out if this is a caldav or groupdav calendar collection |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2325 |
CBufFlat* response = CBufFlat::NewL(EXPANDSIZE_SMALL); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2326 |
CleanupStack::PushL(response); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2327 |
TInt retcode = iHttp->PropfindL(*iUrl, KCalendarurl, response); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2328 |
if (retcode == MULTISTATUS) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2329 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2330 |
RXmlEngDocument document = iDomParser.ParseL(response->Ptr(0)); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2331 |
CleanupClosePushL(document); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2332 |
if (document.NotNull()) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2333 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2334 |
HBufC8* status = |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2335 |
SearchL(document, KStatus, KNullDesC8).AllocLC(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2336 |
status->Des().LowerCase(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2337 |
TXmlEngElement calendar; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2338 |
SearchL(document, KCalendar, KNullDesC8, calendar); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2339 |
// it should be <owner><href>value</href></owner> |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2340 |
// but oracle beehive server does <owner>value</owner> |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2341 |
TXmlEngElement owner; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2342 |
SearchL(document, KOwner, KNullDesC8, owner); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2343 |
TPtrC8 ownerref1 = SearchL(owner, KHref, KNullDesC8); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2344 |
TPtrC8 ownerref2 = owner.Value(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2345 |
TPtrC8 ownerref; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2346 |
ownerref.Set(ownerref1 != KNullDesC8 ? ownerref1 : ownerref2); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2347 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2348 |
if (calendar.NotNull() && (ownerref != KNullDesC8) && (*status |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2349 |
== KHTTP200)) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2350 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2351 |
// this is a calendar collection and we know the principal as well now |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2352 |
homecalendar = iUrl->AllocL(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2353 |
_LIT8(KHTTP,"http"); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2354 |
HBufC8* http = ownerref.Left(KHTTP().Length()).AllocLC(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2355 |
if (*http == KHTTP) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2356 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2357 |
// sogo server does not return relative, but principal url |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2358 |
principal = ownerref.AllocL(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2359 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2360 |
else |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2361 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2362 |
principal = HBufC8::NewL(iBaseUrl->Length() |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2363 |
+ ownerref.Length()); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2364 |
principal->Des().Append(*iBaseUrl); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2365 |
principal->Des().Append(ownerref); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2366 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2367 |
CleanupStack::PopAndDestroy(http); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2368 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2369 |
CleanupStack::PopAndDestroy(status); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2370 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2371 |
CleanupStack::PopAndDestroy(&document); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2372 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2373 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2374 |
// if we have principal, ask for home, otherwise see if principal was given in the first place |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2375 |
if (principal) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2376 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2377 |
response->Reset(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2378 |
TInt retcode = |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2379 |
iHttp->PropfindL(*principal, KPrincipalurl, response); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2380 |
if (retcode == MULTISTATUS) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2381 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2382 |
FindUrlsL(response->Ptr(0), home, inbox, outbox); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2383 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2384 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2385 |
else |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2386 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2387 |
response->Reset(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2388 |
TInt retcode = iHttp->PropfindL(*iUrl, KPrincipalurl, response); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2389 |
if (retcode == MULTISTATUS) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2390 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2391 |
FindUrlsL(response->Ptr(0), home, inbox, outbox); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2392 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2393 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2394 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2395 |
home = CalDavUtils::EnsureSlashL(home); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2396 |
inbox = CalDavUtils::EnsureSlashL(inbox); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2397 |
outbox = CalDavUtils::EnsureSlashL(outbox); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2398 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2399 |
// find out all calendar collections under home |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2400 |
if (home) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2401 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2402 |
// TODO: temporary? we already have homecalendar... |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2403 |
if (!homecalendar) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2404 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2405 |
homecalendar = FindCalendarCollectionL(*home, aArray); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2406 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2407 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2408 |
else |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2409 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2410 |
// have not found out home nor a groupdav collection, maybe we are home ourselves |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2411 |
homecalendar = FindCalendarCollectionL(*iUrl, aArray); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2412 |
if (homecalendar) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2413 |
home = iUrl->AllocL(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2414 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2415 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2416 |
CleanupStack::PopAndDestroy(response); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2417 |
delete principal; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2418 |
delete inbox; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2419 |
delete outbox; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2420 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2421 |
if (home) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2422 |
iHome = CalDavUtils::EnsureSlashL(home); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2423 |
if (homecalendar) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2424 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2425 |
delete iUrl; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2426 |
iUrl = NULL; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2427 |
iUrl = CalDavUtils::EnsureSlashL(homecalendar); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2428 |
return KErrNone; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2429 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2430 |
else |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2431 |
return KErrArgument; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2432 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2433 |
return KErrArgument; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2434 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2435 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2436 |
/** |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2437 |
* CCalDavEngine::CalendarName |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2438 |
* get calendar name |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2439 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2440 |
TPtrC CCalDavEngine::CalendarName() const |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2441 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2442 |
return iCalendar ? *iCalendar : KNullDesC(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2443 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2444 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2445 |
/** |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2446 |
* CCalDavEngine::Home |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2447 |
* get home |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2448 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2449 |
TPtrC8 CCalDavEngine::Home() const |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2450 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2451 |
return iHome ? *iHome : KNullDesC8(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2452 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2453 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2454 |
/** |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2455 |
* CCalDavEngine::Url |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2456 |
* get url |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2457 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2458 |
TPtrC8 CCalDavEngine::Url() const |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2459 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2460 |
return iUrl ? *iUrl : KNullDesC8(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2461 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2462 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2463 |
/** |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2464 |
* CCalDavEngine::SetUrlL |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2465 |
* set url |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2466 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2467 |
void CCalDavEngine::SetUrlL(const TDesC8 &aUrl) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2468 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2469 |
if (iUrl ? *iUrl != aUrl : ETrue) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2470 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2471 |
DisableL(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2472 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2473 |
if (iUrl) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2474 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2475 |
delete iUrl; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2476 |
iUrl = NULL; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2477 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2478 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2479 |
iUrl = CalDavUtils::EnsureSlashL(aUrl); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2480 |
SetCalendarInfoL(KCaldavUrl, *iUrl); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2481 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2482 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2483 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2484 |
/** |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2485 |
* CCalDavEngine::User |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2486 |
* get user |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2487 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2488 |
TPtrC8 CCalDavEngine::User() const |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2489 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2490 |
return iHttp->User(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2491 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2492 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2493 |
/** |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2494 |
* CCalDavEngine::SetUserL |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2495 |
* set user |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2496 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2497 |
void CCalDavEngine::SetUserL(const TDesC8 &aUser) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2498 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2499 |
if (iHttp->User() != aUser) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2500 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2501 |
DisableL(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2502 |
SetCalendarInfoL(KCaldavUser, aUser); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2503 |
iHttp->SetUserL(aUser); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2504 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2505 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2506 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2507 |
/** |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2508 |
* CCalDavEngine::Password |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2509 |
* get password |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2510 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2511 |
TPtrC8 CCalDavEngine::Password() const |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2512 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2513 |
return iHttp->Password(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2514 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2515 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2516 |
/** |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2517 |
* CCalDavEngine::SetPasswordL |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2518 |
* set password |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2519 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2520 |
void CCalDavEngine::SetPasswordL(const TDesC8 &aPassword) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2521 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2522 |
if (iHttp->Password() != aPassword) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2523 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2524 |
DisableL(); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2525 |
iHttp->SetPasswordL(aPassword); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2526 |
SetCalendarInfoL(KCaldavPassword, aPassword); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2527 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2528 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2529 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2530 |
/** |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2531 |
* CCalDavEngine::SyncInterval |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2532 |
* get SyncInterval |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2533 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2534 |
TTimeIntervalMinutes CCalDavEngine::SyncInterval() const |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2535 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2536 |
return iSyncInterval; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2537 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2538 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2539 |
/** |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2540 |
* CCalDavEngine::SetSyncIntervalL |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2541 |
* set SetSyncIntervalL |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2542 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2543 |
void CCalDavEngine::SetSyncIntervalL(TTimeIntervalMinutes aSyncInterval) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2544 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2545 |
iSyncInterval = aSyncInterval; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2546 |
TPckgC<TTimeIntervalMinutes> minutes(iSyncInterval); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2547 |
SetCalendarInfoL(KCaldavSyncInterval, minutes); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2548 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2549 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2550 |
/** |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2551 |
* CCalDavEngine::PastDays |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2552 |
* get past days |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2553 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2554 |
TTimeIntervalDays CCalDavEngine::PastDays() const |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2555 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2556 |
return iPastDays; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2557 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2558 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2559 |
/** |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2560 |
* CCalDavEngine::SetPastDaysL |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2561 |
* Set PastDaysL |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2562 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2563 |
void CCalDavEngine::SetPastDaysL(TTimeIntervalDays aDays) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2564 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2565 |
iPastDays = aDays; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2566 |
TPckgC<TTimeIntervalDays> days(iPastDays); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2567 |
SetCalendarInfoL(KCaldavPastDays, days); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2568 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2569 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2570 |
/** |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2571 |
* CCalDavEngine::ImmediateSync |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2572 |
* get ImmediateSyncL |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2573 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2574 |
TBool CCalDavEngine::ImmediateSync() const |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2575 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2576 |
return iImmediateSync; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2577 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2578 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2579 |
/** |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2580 |
* CCalDavEngine::SetImmediateSyncL |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2581 |
* Set ImmediateSyncL |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2582 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2583 |
void CCalDavEngine::SetImmediateSyncL(TBool aImmediateSyc) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2584 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2585 |
iImmediateSync = aImmediateSyc; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2586 |
TPckgC<TBool> immediatesync(iImmediateSync); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2587 |
SetCalendarInfoL(KCaldavImmediateSync, immediatesync); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2588 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2589 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2590 |
/** |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2591 |
* CCalDavEngine::KeepServerEntry |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2592 |
* get KeepServerEntryL |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2593 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2594 |
TBool CCalDavEngine::KeepServerEntry() const |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2595 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2596 |
return iKeepServerEntry; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2597 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2598 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2599 |
/** |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2600 |
* CCalDavEngine::SetKeepServerEntryL |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2601 |
* Set KeepServerEntryL |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2602 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2603 |
void CCalDavEngine::SetKeepServerEntryL(TBool aKeepServerEntry) |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2604 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2605 |
iKeepServerEntry = aKeepServerEntry; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2606 |
TPckgC<TBool> keepserver(iKeepServerEntry); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2607 |
SetCalendarInfoL(KCaldavKeepServer, keepserver); |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2608 |
} |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2609 |
|
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2610 |
/** |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2611 |
* CCalDavEngine::Timer |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2612 |
* get timer |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2613 |
*/ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2614 |
CPeriodic* CCalDavEngine::Timer() |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2615 |
{ |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2616 |
return iTimer; |
4927282092b4
Bug 208: inital CalDAV support for Symbian
Maximilian Odendahl <maximilian.odendahl@sun.com>
parents:
diff
changeset
|
2617 |
} |