--- a/calendarengines/caldav/group/CalDavClient.mmp Mon Mar 08 21:43:23 2010 +0000
+++ b/calendarengines/caldav/group/CalDavClient.mmp Sun Mar 14 13:09:26 2010 +0000
@@ -1,33 +1,33 @@
-/*
-* Copyright (c) 2010 Sun Microsystems, Inc. and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributor:
-* Maximilian Odendahl
-*
-* Contributors:
-*
-* Description: This is the project specification file for the
-* Caldav client library
-*/
-
-TARGET CalDavClient.dll
-TARGETTYPE dll
-UID 0 0x2002B71F
-
-SOURCEPATH ..\src
-SOURCE CalDavClient.cpp caldavsession.cpp caldavsessionimpl.cpp caldavutils.cpp
-
-USERINCLUDE ..\inc
-SYSTEMINCLUDE \Epoc32\include
-
-LIBRARY euser.lib
-LIBRARY bafl.lib
-
-EXPORTUNFROZEN
-
+/*
+* Copyright (c) 2010 Sun Microsystems, Inc. and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributor:
+* Maximilian Odendahl
+*
+* Contributors:
+*
+* Description: This is the project specification file for the
+* Caldav client library
+*/
+
+TARGET CalDavClient.dll
+TARGETTYPE dll
+UID 0 0x2002B71F
+
+SOURCEPATH ..\src
+SOURCE CalDavClient.cpp caldavsession.cpp caldavsessionimpl.cpp caldavutils.cpp
+
+USERINCLUDE ..\inc
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY euser.lib
+LIBRARY bafl.lib
+
+EXPORTUNFROZEN
+
CAPABILITY CAP_APPLICATION
\ No newline at end of file
--- a/calendarengines/caldav/group/CalDavServer.mmp Mon Mar 08 21:43:23 2010 +0000
+++ b/calendarengines/caldav/group/CalDavServer.mmp Sun Mar 14 13:09:26 2010 +0000
@@ -1,45 +1,40 @@
-/*
-* Copyright (c) 2010 Sun Microsystems, Inc. and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributor:
-* Maximilian Odendahl
-*
-* Contributors:
-*
-* Description: This is the project specification file for the
-* Caldav server
-*/
-
-TARGET !CalDavServer.exe
-TARGETTYPE exe
-UID 0 0x2002B71E
-
-SOURCEPATH ../src
-SOURCE CalDavServer.cpp caldavutils.cpp httpclient.cpp CalDavServerSession.cpp caldavengine.cpp caldavenginemgr.cpp
-
-USERINCLUDE ../inc
-USERINCLUDE ../../../calendarui/globaldata/inc
-
-SYSTEMINCLUDE /Epoc32/include
-SYSTEMINCLUDE /Epoc32/include/app
-SYSTEMINCLUDE /Epoc32/include/mw
-SYSTEMINCLUDE /Epoc32/include/platform
-SYSTEMINCLUDE /Epoc32/include/platform/mw
-SYSTEMINCLUDE /Epoc32/include/platform/app
-
-LIBRARY euser.lib apparc.lib cone.lib eikcore.lib avkon.lib charconv.lib
-LIBRARY commonengine.lib efsrv.lib estor.lib eikcoctl.lib eikdlg.lib
-LIBRARY eikctl.lib bafl.lib fbscli.lib aknnotify.lib aknicon.lib
-LIBRARY etext.lib gdi.lib egul.lib insock.lib
-LIBRARY ecom.lib InetProtUtil.lib http.lib esock.lib xmlengineDOM.lib calinterimapi.lib calenimp.lib CalenInterimUtils2.lib commdb.lib calenglobaldata.lib
-LIBRARY extendedconnpref.lib netmeta.lib
-
-EPOCHEAPSIZE 0x5000 0x400000
-EPOCSTACKSIZE 0x5000
-
-CAPABILITY ReadDeviceData ReadUserData WriteDeviceData WriteUserData ProtServ NetworkServices
+/*
+* Copyright (c) 2010 Sun Microsystems, Inc. and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributor:
+* Maximilian Odendahl
+*
+* Contributors:
+*
+* Description: This is the project specification file for the
+* Caldav server
+*/
+
+TARGET !CalDavServer.exe
+TARGETTYPE exe
+UID 0 0x2002B71E
+
+SOURCEPATH ../src
+SOURCE CalDavServer.cpp caldavutils.cpp httpclient.cpp CalDavServerSession.cpp caldavengine.cpp caldavenginemgr.cpp
+
+USERINCLUDE ../inc
+USERINCLUDE ../../../calendarui/globaldata/inc
+
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY euser.lib apparc.lib cone.lib eikcore.lib avkon.lib charconv.lib
+LIBRARY commonengine.lib efsrv.lib estor.lib eikcoctl.lib eikdlg.lib
+LIBRARY eikctl.lib bafl.lib fbscli.lib aknnotify.lib aknicon.lib
+LIBRARY etext.lib gdi.lib egul.lib insock.lib
+LIBRARY ecom.lib InetProtUtil.lib http.lib esock.lib xmlengineDOM.lib calinterimapi.lib calenimp.lib CalenInterimUtils2.lib commdb.lib calenglobaldata.lib
+LIBRARY extendedconnpref.lib netmeta.lib
+
+EPOCHEAPSIZE 0x5000 0x400000
+EPOCSTACKSIZE 0x5000
+
+CAPABILITY ReadDeviceData ReadUserData WriteDeviceData WriteUserData ProtServ NetworkServices
--- a/calendarengines/caldav/group/CalDavTest.mmp Mon Mar 08 21:43:23 2010 +0000
+++ b/calendarengines/caldav/group/CalDavTest.mmp Sun Mar 14 13:09:26 2010 +0000
@@ -1,50 +1,45 @@
-/*
-* Copyright (c) 2010 Sun Microsystems, Inc. and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributor:
-* Maximilian Odendahl
-*
-* Contributors:
-*
-* Description: This is the project specification file for the
-* Caldav test application
-*/
-
-TARGET CalDavTest.exe
-TARGETTYPE exe
-UID 0 0x2002B81C
-
-USERINCLUDE ..\inc
-USERINCLUDE ..\..\..\calendarui\globaldata\inc
-
-SYSTEMINCLUDE \Epoc32\include
-SYSTEMINCLUDE \Epoc32\include\app
-SYSTEMINCLUDE \Epoc32\include\mw
-SYSTEMINCLUDE \Epoc32\include\platform
-SYSTEMINCLUDE \Epoc32\include\platform\mw
-SYSTEMINCLUDE \Epoc32\include\platform\app
-
-SOURCEPATH ..\src
-SOURCE caldavengine.cpp httpclient.cpp caldavutils.cpp
-
-SOURCEPATH ..\tsrc
-SOURCE CalDavTest.cpp
-
-LIBRARY euser.lib apparc.lib cone.lib eikcore.lib avkon.lib charconv.lib
-LIBRARY commonengine.lib efsrv.lib estor.lib eikcoctl.lib eikdlg.lib
-LIBRARY eikctl.lib bafl.lib fbscli.lib aknnotify.lib aknicon.lib
-LIBRARY etext.lib gdi.lib egul.lib insock.lib
-LIBRARY ecom.lib InetProtUtil.lib http.lib esock.lib xmlengineDOM.lib calinterimapi.lib calenimp.lib CalenInterimUtils2.lib commdb.lib flogger.lib
-LIBRARY caldavclient.lib
-LIBRARY calenglobaldata.lib
-LIBRARY extendedconnpref.lib netmeta.lib
-
-EPOCHEAPSIZE 0x5000 0x400000
-EPOCSTACKSIZE 0x5000
-
-CAPABILITY NetworkServices ReadDeviceData ReadUserData WriteDeviceData WriteUserData
+/*
+* Copyright (c) 2010 Sun Microsystems, Inc. and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributor:
+* Maximilian Odendahl
+*
+* Contributors:
+*
+* Description: This is the project specification file for the
+* Caldav test application
+*/
+
+TARGET CalDavTest.exe
+TARGETTYPE exe
+UID 0 0x2002B81C
+
+USERINCLUDE ..\inc
+USERINCLUDE ..\..\..\calendarui\globaldata\inc
+
+APP_LAYER_SYSTEMINCLUDE
+
+SOURCEPATH ..\src
+SOURCE caldavengine.cpp httpclient.cpp caldavutils.cpp
+
+SOURCEPATH ..\tsrc
+SOURCE CalDavTest.cpp
+
+LIBRARY euser.lib apparc.lib cone.lib eikcore.lib avkon.lib charconv.lib
+LIBRARY commonengine.lib efsrv.lib estor.lib eikcoctl.lib eikdlg.lib
+LIBRARY eikctl.lib bafl.lib fbscli.lib aknnotify.lib aknicon.lib
+LIBRARY etext.lib gdi.lib egul.lib insock.lib
+LIBRARY ecom.lib InetProtUtil.lib http.lib esock.lib xmlengineDOM.lib calinterimapi.lib calenimp.lib CalenInterimUtils2.lib commdb.lib flogger.lib
+LIBRARY caldavclient.lib
+LIBRARY calenglobaldata.lib
+LIBRARY extendedconnpref.lib netmeta.lib
+
+EPOCHEAPSIZE 0x5000 0x400000
+EPOCSTACKSIZE 0x5000
+
+CAPABILITY NetworkServices ReadDeviceData ReadUserData WriteDeviceData WriteUserData
--- a/calendarengines/caldav/group/bld.inf Mon Mar 08 21:43:23 2010 +0000
+++ b/calendarengines/caldav/group/bld.inf Sun Mar 14 13:09:26 2010 +0000
@@ -1,27 +1,27 @@
-/*
-* Copyright (c) 2010 Sun Microsystems, Inc. and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributor:
-* Maximilian Odendahl
-*
-* Contributors:
-*
-* Description: provides the information required for building
-* caldav engine
-*/
-
-PRJ_PLATFORMS
-DEFAULT
-
-PRJ_MMPFILES
-CalDavClient.mmp
-CalDavServer.mmp
-CalDavTest.mmp
-
-PRJ_EXPORTS
-../inc/caldavsession.h
+/*
+* Copyright (c) 2010 Sun Microsystems, Inc. and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributor:
+* Maximilian Odendahl
+*
+* Contributors:
+*
+* Description: provides the information required for building
+* caldav engine
+*/
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_MMPFILES
+CalDavClient.mmp
+CalDavServer.mmp
+CalDavTest.mmp
+
+PRJ_EXPORTS
+../inc/caldavsession.h
--- a/calendarengines/caldav/inc/CalDavTest.h Mon Mar 08 21:43:23 2010 +0000
+++ b/calendarengines/caldav/inc/CalDavTest.h Sun Mar 14 13:09:26 2010 +0000
@@ -1,103 +1,103 @@
-/*
-* Copyright (c) 2010 Sun Microsystems, Inc. and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributor:
-* Maximilian Odendahl
-*
-* Contributors:
-*
-* Description: Caldav Test Suite
-*
-*/
-
-#ifndef __CALDAVTEST_H__
-#define __CALDAVTEST_H__
-
-// Include Files
-
-#include <e32base.h>
-#include <e32cons.h> // Console
-#include <flogger.h>
-
-class CCalDavEngine;
-class CCalDavSession;
-
-class CalDavTest
- {
-public:
- CalDavTest(CConsoleBase* console);
- ~CalDavTest();
-
- void TestGeneralEngineL();
- void TestEngineL(TInt aSucces, const TDesC8 &aUrl, const TDesC8 &aUser,
- const TDesC8 &aPassword, TBool aWebdavsync, TBool aCtag,
- TBool aEvent, TBool aTodo, TBool aFreeBusy, TBool aJournal);
- void TestClientServerL(TInt aSucces, const TDesC8 &aUrl,
- const TDesC8 &aUser, const TDesC8 &aPassword);
-private:
- // test client server
-
- TInt ConfigureSessionL(TInt aSucces, const TDesC8 &aUrl,
- const TDesC8 &aUser, const TDesC8 &aPassword);
- void OptionSession();
-
- void Enabled(TBool aEnabled);
-
- // test engine
- TInt EnableL(TInt aSucces, const TDesC8 &aUrl, const TDesC8 &aUser,
- const TDesC8 &aPassword);
- // use caldav engine
- void SendL(const unsigned long localuid);
- // use http call
- void SendL(TBool aVEvent);
-
- void DownloadLGetL(const unsigned long localuid);
- void DownloadLMultiGetL(const unsigned long localuid);
-
- // use http call
- void DeleteServerL();
- // use caldav engine
- void DeleteServerL(const unsigned long localuid);
- void DeleteClientL(const TDesC8 &aUid);
-
- void HeadL(TBool aExists, const TDesC8 &aUid);
- void OptionsL();
- void SyncL();
- void DoesExistL(TBool aExists, const unsigned long localuid);
- void DoesExistL(TBool aExists, const TDesC8 &aUID);
- void CTagL(TBool aEqual);
- void SynctokenL(TBool aEqual);
-
- void MkCalendarL(TBool aSuccess, const TDesC8 &aName);
- void DeleteCalendarL(const TDesC8 &aName);
-
- void CalendarInfoL();
- void GetUIDByUrl();
- void GetBaseUrl();
-
- void Write(const TDesC &aMessage);
- void Write(TBool aSuccess, const char* aMessage);
- void Write(TBool aSuccess, const TDesC &aMessage);
-
- TBool iWebdavSync;
- TBool iCtag;
-
- TBool iVEVENT;
- TBool iVTODO;
- TBool iVJOURNAL;
- TBool iVFREEBUSY;
-
- CCalDavEngine* iEngine;
- CCalDavSession* iSession;
- CConsoleBase* iConsole;
- RFileLogger iFileLogger;
- };
-
-GLDEF_C TInt E32Main();
-
-#endif // __CALDAVTEST_H__
+/*
+* Copyright (c) 2010 Sun Microsystems, Inc. and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributor:
+* Maximilian Odendahl
+*
+* Contributors:
+*
+* Description: Caldav Test Suite
+*
+*/
+
+#ifndef __CALDAVTEST_H__
+#define __CALDAVTEST_H__
+
+// Include Files
+
+#include <e32base.h>
+#include <e32cons.h> // Console
+#include <flogger.h>
+
+class CCalDavEngine;
+class CCalDavSession;
+
+class CalDavTest
+ {
+public:
+ CalDavTest(CConsoleBase* console);
+ ~CalDavTest();
+
+ void TestGeneralEngineL();
+ void TestEngineL(TInt aSucces, const TDesC8 &aUrl, const TDesC8 &aUser,
+ const TDesC8 &aPassword, TBool aWebdavsync, TBool aCtag,
+ TBool aEvent, TBool aTodo, TBool aFreeBusy, TBool aJournal);
+ void TestClientServerL(TInt aSucces, const TDesC8 &aUrl,
+ const TDesC8 &aUser, const TDesC8 &aPassword);
+private:
+ // test client server
+
+ TInt ConfigureSessionL(TInt aSucces, const TDesC8 &aUrl,
+ const TDesC8 &aUser, const TDesC8 &aPassword);
+ void OptionSession();
+
+ void Enabled(TBool aEnabled);
+
+ // test engine
+ TInt EnableL(TInt aSucces, const TDesC8 &aUrl, const TDesC8 &aUser,
+ const TDesC8 &aPassword);
+ // use caldav engine
+ void SendL(const unsigned long localuid);
+ // use http call
+ void SendL(TBool aVEvent);
+
+ void DownloadLGetL(const unsigned long localuid);
+ void DownloadLMultiGetL(const unsigned long localuid);
+
+ // use http call
+ void DeleteServerL();
+ // use caldav engine
+ void DeleteServerL(const unsigned long localuid);
+ void DeleteClientL(const TDesC8 &aUid);
+
+ void HeadL(TBool aExists, const TDesC8 &aUid);
+ void OptionsL();
+ void SyncL();
+ void DoesExistL(TBool aExists, const unsigned long localuid);
+ void DoesExistL(TBool aExists, const TDesC8 &aUID);
+ void CTagL(TBool aEqual);
+ void SynctokenL(TBool aEqual);
+
+ void MkCalendarL(TBool aSuccess, const TDesC8 &aName);
+ void DeleteCalendarL(const TDesC8 &aName);
+
+ void CalendarInfoL();
+ void GetUIDByUrl();
+ void GetBaseUrl();
+
+ void Write(const TDesC &aMessage);
+ void Write(TBool aSuccess, const char* aMessage);
+ void Write(TBool aSuccess, const TDesC &aMessage);
+
+ TBool iWebdavSync;
+ TBool iCtag;
+
+ TBool iVEVENT;
+ TBool iVTODO;
+ TBool iVJOURNAL;
+ TBool iVFREEBUSY;
+
+ CCalDavEngine* iEngine;
+ CCalDavSession* iSession;
+ CConsoleBase* iConsole;
+ RFileLogger iFileLogger;
+ };
+
+GLDEF_C TInt E32Main();
+
+#endif // __CALDAVTEST_H__
--- a/calendarengines/caldav/inc/caldavclient.h Mon Mar 08 21:43:23 2010 +0000
+++ b/calendarengines/caldav/inc/caldavclient.h Sun Mar 14 13:09:26 2010 +0000
@@ -1,74 +1,74 @@
-/*
-* Copyright (c) 2010 Sun Microsystems, Inc. and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributor:
-* Maximilian Odendahl
-*
-* Contributors:
-*
-* Description: provides a client API for Caldav server
-*
-*/
-
-#ifndef _CALDAVCLIENT_H
-#define _CALDAVCLIENT_H
-
-#include <e32base.h>
-
-//**********************************
-//RCalDavServer
-//**********************************
-
-static TInt StartServer();
-
-class RCalDavServer : public RSessionBase
- {
-public:
- RCalDavServer();
- TInt Connect();
-
- TInt Enable(const TDesC &aCalendar);
- TInt Disable(const TDesC &aCalendar);
-
- TInt EnabledSync(const TDesC &aCalendar, TBool &aEnabled);
-
- TInt Sync(const TDesC &aCalendar);
- TInt SyncAll();
-
- TInt Url(const TDesC &aCalendar, TDes8 &aUrl);
- TInt SetUrl(const TDesC &aCalendar, const TDesC8 &aUrl);
-
- TInt Username(const TDesC &aCalendar, TDes8 &aUsername);
- TInt SetUsername(const TDesC &aCalendar, const TDesC8 &aUsername);
-
- TInt Password(const TDesC &aCalendar, TDes8 &aPassword);
- TInt SetPassword(const TDesC &aCalendar, const TDesC8 &aPassword);
-
- TInt SyncInterval(const TDesC &aCalendar,
- TTimeIntervalMinutes& aSyncInterval);
- TInt SetSyncInterval(const TDesC &aCalendar,
- TTimeIntervalMinutes aSyncInterval);
-
- TInt PastDays(const TDesC &aCalendar, TTimeIntervalDays &aDays);
- TInt SetPastDays(const TDesC &aCalendar, TTimeIntervalDays aDays);
-
- TInt ImmediateSync(const TDesC &aCalendar, TBool &aImmediateSyc);
- TInt SetImmediateSync(const TDesC &aCalendar, TBool aImmediateSyc);
-
- TInt KeepServerEntry(const TDesC &aCalendar, TBool &aKeepServerEntry);
- TInt SetKeepServerEntry(const TDesC &aCalendar, TBool aKeepServerEntry);
-
- TVersion Version() const;
- TInt UnsupportedRequest();
- void BadRequest();
-
-private:
- };
-
-#endif
-
+/*
+* Copyright (c) 2010 Sun Microsystems, Inc. and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributor:
+* Maximilian Odendahl
+*
+* Contributors:
+*
+* Description: provides a client API for Caldav server
+*
+*/
+
+#ifndef _CALDAVCLIENT_H
+#define _CALDAVCLIENT_H
+
+#include <e32base.h>
+
+//**********************************
+//RCalDavServer
+//**********************************
+
+static TInt StartServer();
+
+class RCalDavServer : public RSessionBase
+ {
+public:
+ RCalDavServer();
+ TInt Connect();
+
+ TInt Enable(const TDesC &aCalendar);
+ TInt Disable(const TDesC &aCalendar);
+
+ TInt EnabledSync(const TDesC &aCalendar, TBool &aEnabled);
+
+ TInt Sync(const TDesC &aCalendar);
+ TInt SyncAll();
+
+ TInt Url(const TDesC &aCalendar, TDes8 &aUrl);
+ TInt SetUrl(const TDesC &aCalendar, const TDesC8 &aUrl);
+
+ TInt Username(const TDesC &aCalendar, TDes8 &aUsername);
+ TInt SetUsername(const TDesC &aCalendar, const TDesC8 &aUsername);
+
+ TInt Password(const TDesC &aCalendar, TDes8 &aPassword);
+ TInt SetPassword(const TDesC &aCalendar, const TDesC8 &aPassword);
+
+ TInt SyncInterval(const TDesC &aCalendar,
+ TTimeIntervalMinutes& aSyncInterval);
+ TInt SetSyncInterval(const TDesC &aCalendar,
+ TTimeIntervalMinutes aSyncInterval);
+
+ TInt PastDays(const TDesC &aCalendar, TTimeIntervalDays &aDays);
+ TInt SetPastDays(const TDesC &aCalendar, TTimeIntervalDays aDays);
+
+ TInt ImmediateSync(const TDesC &aCalendar, TBool &aImmediateSyc);
+ TInt SetImmediateSync(const TDesC &aCalendar, TBool aImmediateSyc);
+
+ TInt KeepServerEntry(const TDesC &aCalendar, TBool &aKeepServerEntry);
+ TInt SetKeepServerEntry(const TDesC &aCalendar, TBool aKeepServerEntry);
+
+ TVersion Version() const;
+ TInt UnsupportedRequest();
+ void BadRequest();
+
+private:
+ };
+
+#endif
+
--- a/calendarengines/caldav/inc/caldavengine.h Mon Mar 08 21:43:23 2010 +0000
+++ b/calendarengines/caldav/inc/caldavengine.h Sun Mar 14 13:09:26 2010 +0000
@@ -1,239 +1,239 @@
-/*
-* Copyright (c) 2010 Sun Microsystems, Inc. and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributor:
-* Maximilian Odendahl
-*
-* Contributors:
-*
-* Description: main Caldav class, all magic happens here
-*
-*/
-
-#ifndef _CALSTORE_H
-#define _CALSTORE_H
-
-#include <e32base.h>
-#include <BADESCA.H>
-
-#include <calchangecallback.h>
-#include <calprogresscallback.h>
-#include <calfilechangenotification.h>
-
-#include <xmlengdomimplementation.h>
-#include <xmlengdomparser.h>
-
-#include "caldavutils.h"
-
-class CCalSession;
-class CCalEntry;
-class CCalIter;
-class CCalEntryView;
-class CCalenExporter;
-class CCalenImporter;
-class CCalenInterimUtils2;
-
-class RXmlEngDOMImplementation;
-class RXmlEngDOMParser;
-class RXmlEngDocument;
-
-class CHttpClient;
-class CalDavTest;
-
-// sync interval of 0 correspons to one minute
-// 0 actually means to enable push connectivity once supported
-#define DEFAULT_SYNC_MINUTES 0
-#define DEFAULT_PAST_DAYS 14
-#define DEFAULT_IMMEDIATE_SYNC ETrue
-#define DEFAULT_KEEP_SERVER_ENTRY EFalse
-
-
-enum TLocalLoopAction
- {
- ELoopActionUpload, ELoopActionFillArray, ELoopActionDeleteLocal
- };
-
-/**
- * CCalDavEngine
- *
- */
-class CCalDavEngine : public CBase, MCalProgressCallBack, MCalChangeCallBack2, MCalFileChangeObserver
- {
-public:
-
- friend class CalDavTest;
-
- ~CCalDavEngine();
-
- static CCalDavEngine* NewL(const TDesC& aCalendar);
- static CCalDavEngine* NewLC(const TDesC& aCalendar);
-
- TInt EnableL();
- void DisableL();
- TBool EnabledSync();
-
- TInt SyncL();
-
- TInt MkcalendarL(const TDesC8 &aName);
- TInt DeleteCalendarL(const TDesC8 &aName);
-
- TPtrC CalendarName() const;
- TPtrC8 Home() const;
-
- TPtrC8 Url() const;
- void SetUrlL(const TDesC8 &aUrl);
-
- TPtrC8 User() const;
- void SetUserL(const TDesC8 &aUser);
-
- TPtrC8 Password() const;
- void SetPasswordL(const TDesC8 &aPassword);
-
- TTimeIntervalMinutes SyncInterval() const;
- void SetSyncIntervalL(TTimeIntervalMinutes aSyncInterval);
-
- TTimeIntervalDays PastDays() const;
- void SetPastDaysL(TTimeIntervalDays aDays);
-
- TBool ImmediateSync() const;
- void SetImmediateSyncL(TBool aImmediateSyc);
-
- TBool KeepServerEntry() const;
- void SetKeepServerEntryL(TBool aKeepServerEntry);
-
- CPeriodic* Timer();
-
- TPtrC8 SyncToken();
- TPtrC8 CTag();
-
-private:
-
- CCalDavEngine();
- void ConstructL(const TDesC& aCalendar);
-
- void RegisterL();
- HBufC8* GetCTagL();
- HBufC8* GetSyncTokenL();
-
- TInt InitL();
-
- // Called during calendar entry view creation
- void Progress(TInt aPercentageCompleted);
- void Completed(TInt aError);
- TBool NotifyProgress();
- void CalChangeNotification(RArray<TCalChangeEntry> &aChangeItems);
- void CalendarInfoChangeNotificationL(RPointerArray<CCalFileChangeInfo>& aCalendarInfoChangeEntries);
-
- void CalendarInfoL();
- void SetCalendarInfoL(const TDesC8 &aKey, const TDesC8 &aValue);
-
- void HandleCalendarInfoChangeL();
- void HandleChangeL(MCalChangeCallBack2::TChangeType &aChangeType,
- MCalChangeCallBack2::TChangeEntryType &aEntryType,
- TCalLocalUid &aUid);
-
- TBool ManualSyncL();
- TBool WebDavSyncL();
- TInt WebDavSyncReportL(TBool aSynctoken);
- TBool UploadModifiedSinceDateL();
- TBool ClientChangesL();
- TBool ServerChangesL();
- TInt DeleteRemovedEntriesOnServerL();
- TInt LocalLoopL(TLocalLoopAction aAction);
-
- TInt ListL();
- TInt TimeReportL(TBool VEVENT, const TDesC8 &aStart, TBool aDelete = EFalse);
-
- // server actions
- TInt UploadEntryL(const TCalLocalUid &aUid,
- MCalChangeCallBack2::TChangeType aChangeType,
- MCalChangeCallBack2::TChangeEntryType aEntryType);
- TInt UploadEntryL(CCalEntry* aEntry,
- MCalChangeCallBack2::TChangeType aChangeType,
- MCalChangeCallBack2::TChangeEntryType aEntryType);
- TInt DownloadEntryL(const TDesC8 &aUrl);
- TInt DownloadEntryL(CDesC8Array* aArray);
- TInt DeleteEntryL(const TCalLocalUid &aUid);
- TInt DeleteEntryL(const TDesC8 &aUid);
- TInt HeadL(const TDesC8 &aUID);
-
- // local actions
- TInt AddModifyLocalEntryL(const TDesC8 &aUrl, const TDesC8 &aETag,
- CDesC8ArrayFlat* aArray);
- TInt DeleteLocalEntryL(const TDesC8 &aUID);
-
- TInt ParseResponsesDeleteL(const TDesC8 &aDocument);
- TInt ParseResponsesL(RXmlEngDocument &aDocument, TBool aMultiget = EFalse);
- TInt ParseResponsesL(const TDesC8 &aDocument, TBool aMultiget = EFalse);
-
- unsigned long DoesEntryExistL(const TDesC8 &aUrl);
- TPtrC8 GetUIDByUrl(const TDesC8 &aUrl);
- TBool ETagMatchL(const TDesC8& aUrl, const TDesC8& aETag);
- TInt StoreEntryL(const TDesC8 &aBuf, const TDesC8 &aEtag);
-
- void SyncFailedL();
- void SetLastSyncTimeL();
- void SetSyncTokenL(HBufC8* aToken);
- void SetCTagL(HBufC8* aToken);
-
- void CheckCalendarInfoL(RXmlEngDocument &aDocument);
-
- TBool GetOptionsL();
- TInt GetCalendarUrlsL(CDesC8ArrayFlat *aArray);
- void FindUrlsL(const TDesC8 &aDes, HBufC8 *&home, HBufC8 *&inbox,
- HBufC8 *&outbox);
- void GetBaseUrl(const TDesC8 &aUrl);
- HBufC8 * FindCalendarCollectionL(const TDesC8 &aUrl,
- CDesC8ArrayFlat *aArray);
-
- void DeleteCalObjects();
- TInt CreateCalObjectsL();
-
- CCalSession* iCalSession;
- CCalIter* iCalIter;
- CCalEntryView* iCalEntryView;
- CCalenExporter* iCalExporter;
- CCalenImporter* iCalImporter;
- CCalenInterimUtils2* iCalIntermimUtils2;
- HBufC *iCalendar;
- HBufC8 *iUrl;
- HBufC8 *iBaseUrl;
- HBufC8 *iHome;
-
- TCalDAVOptions iOptions;
- CHttpClient* iHttp;
-
- RXmlEngDOMImplementation iDomImpl;
- RXmlEngDOMParser iDomParser;
-
- // when we get a callback with a localuid, the corresponding entry is already deleted
- // we therefore need a different way to map from localuid to global uid/filename
- // this can be completly removed when introducing a new callback,
- // which includes the to be deleted localuid
- RArray<TCalLocalUid> iLocalUidArray;
- RArray<TBuf8<100> > iGlobalUidArray;
- //
- RArray<TCalLocalUid> iDeletedEntries;
-
- HBufC8 *iSynctoken;
- HBufC8 *iCTag;
- TBool iManualSync;
- TCalTime iLastSyncTime;
- TBool iFirstInit;
-
- // Options
- TTimeIntervalMinutes iSyncInterval;
- TTimeIntervalDays iPastDays;
- TBool iImmediateSync;
- TBool iKeepServerEntry;
- TBool iEnabled;
-
- CPeriodic* iTimer;
- };
-
-#endif // CALSTORE_H
+/*
+* Copyright (c) 2010 Sun Microsystems, Inc. and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributor:
+* Maximilian Odendahl
+*
+* Contributors:
+*
+* Description: main Caldav class, all magic happens here
+*
+*/
+
+#ifndef _CALSTORE_H
+#define _CALSTORE_H
+
+#include <e32base.h>
+#include <BADESCA.H>
+
+#include <calchangecallback.h>
+#include <calprogresscallback.h>
+#include <calfilechangenotification.h>
+
+#include <xmlengdomimplementation.h>
+#include <xmlengdomparser.h>
+
+#include "caldavutils.h"
+
+class CCalSession;
+class CCalEntry;
+class CCalIter;
+class CCalEntryView;
+class CCalenExporter;
+class CCalenImporter;
+class CCalenInterimUtils2;
+
+class RXmlEngDOMImplementation;
+class RXmlEngDOMParser;
+class RXmlEngDocument;
+
+class CHttpClient;
+class CalDavTest;
+
+// sync interval of 0 correspons to one minute
+// 0 actually means to enable push connectivity once supported
+#define DEFAULT_SYNC_MINUTES 0
+#define DEFAULT_PAST_DAYS 14
+#define DEFAULT_IMMEDIATE_SYNC ETrue
+#define DEFAULT_KEEP_SERVER_ENTRY EFalse
+
+
+enum TLocalLoopAction
+ {
+ ELoopActionUpload, ELoopActionFillArray, ELoopActionDeleteLocal
+ };
+
+/**
+ * CCalDavEngine
+ *
+ */
+class CCalDavEngine : public CBase, MCalProgressCallBack, MCalChangeCallBack2, MCalFileChangeObserver
+ {
+public:
+
+ friend class CalDavTest;
+
+ ~CCalDavEngine();
+
+ static CCalDavEngine* NewL(const TDesC& aCalendar);
+ static CCalDavEngine* NewLC(const TDesC& aCalendar);
+
+ TInt EnableL();
+ void DisableL();
+ TBool EnabledSync();
+
+ TInt SyncL();
+
+ TInt MkcalendarL(const TDesC8 &aName);
+ TInt DeleteCalendarL(const TDesC8 &aName);
+
+ TPtrC CalendarName() const;
+ TPtrC8 Home() const;
+
+ TPtrC8 Url() const;
+ void SetUrlL(const TDesC8 &aUrl);
+
+ TPtrC8 User() const;
+ void SetUserL(const TDesC8 &aUser);
+
+ TPtrC8 Password() const;
+ void SetPasswordL(const TDesC8 &aPassword);
+
+ TTimeIntervalMinutes SyncInterval() const;
+ void SetSyncIntervalL(TTimeIntervalMinutes aSyncInterval);
+
+ TTimeIntervalDays PastDays() const;
+ void SetPastDaysL(TTimeIntervalDays aDays);
+
+ TBool ImmediateSync() const;
+ void SetImmediateSyncL(TBool aImmediateSyc);
+
+ TBool KeepServerEntry() const;
+ void SetKeepServerEntryL(TBool aKeepServerEntry);
+
+ CPeriodic* Timer();
+
+ TPtrC8 SyncToken();
+ TPtrC8 CTag();
+
+private:
+
+ CCalDavEngine();
+ void ConstructL(const TDesC& aCalendar);
+
+ void RegisterL();
+ HBufC8* GetCTagL();
+ HBufC8* GetSyncTokenL();
+
+ TInt InitL();
+
+ // Called during calendar entry view creation
+ void Progress(TInt aPercentageCompleted);
+ void Completed(TInt aError);
+ TBool NotifyProgress();
+ void CalChangeNotification(RArray<TCalChangeEntry> &aChangeItems);
+ void CalendarInfoChangeNotificationL(RPointerArray<CCalFileChangeInfo>& aCalendarInfoChangeEntries);
+
+ void CalendarInfoL();
+ void SetCalendarInfoL(const TDesC8 &aKey, const TDesC8 &aValue);
+
+ void HandleCalendarInfoChangeL();
+ void HandleChangeL(MCalChangeCallBack2::TChangeType &aChangeType,
+ MCalChangeCallBack2::TChangeEntryType &aEntryType,
+ TCalLocalUid &aUid);
+
+ TBool ManualSyncL();
+ TBool WebDavSyncL();
+ TInt WebDavSyncReportL(TBool aSynctoken);
+ TBool UploadModifiedSinceDateL();
+ TBool ClientChangesL();
+ TBool ServerChangesL();
+ TInt DeleteRemovedEntriesOnServerL();
+ TInt LocalLoopL(TLocalLoopAction aAction);
+
+ TInt ListL();
+ TInt TimeReportL(TBool VEVENT, const TDesC8 &aStart, TBool aDelete = EFalse);
+
+ // server actions
+ TInt UploadEntryL(const TCalLocalUid &aUid,
+ MCalChangeCallBack2::TChangeType aChangeType,
+ MCalChangeCallBack2::TChangeEntryType aEntryType);
+ TInt UploadEntryL(CCalEntry* aEntry,
+ MCalChangeCallBack2::TChangeType aChangeType,
+ MCalChangeCallBack2::TChangeEntryType aEntryType);
+ TInt DownloadEntryL(const TDesC8 &aUrl);
+ TInt DownloadEntryL(CDesC8Array* aArray);
+ TInt DeleteEntryL(const TCalLocalUid &aUid);
+ TInt DeleteEntryL(const TDesC8 &aUid);
+ TInt HeadL(const TDesC8 &aUID);
+
+ // local actions
+ TInt AddModifyLocalEntryL(const TDesC8 &aUrl, const TDesC8 &aETag,
+ CDesC8ArrayFlat* aArray);
+ TInt DeleteLocalEntryL(const TDesC8 &aUID);
+
+ TInt ParseResponsesDeleteL(const TDesC8 &aDocument);
+ TInt ParseResponsesL(RXmlEngDocument &aDocument, TBool aMultiget = EFalse);
+ TInt ParseResponsesL(const TDesC8 &aDocument, TBool aMultiget = EFalse);
+
+ unsigned long DoesEntryExistL(const TDesC8 &aUrl);
+ TPtrC8 GetUIDByUrl(const TDesC8 &aUrl);
+ TBool ETagMatchL(const TDesC8& aUrl, const TDesC8& aETag);
+ TInt StoreEntryL(const TDesC8 &aBuf, const TDesC8 &aEtag);
+
+ void SyncFailedL();
+ void SetLastSyncTimeL();
+ void SetSyncTokenL(HBufC8* aToken);
+ void SetCTagL(HBufC8* aToken);
+
+ void CheckCalendarInfoL(RXmlEngDocument &aDocument);
+
+ TBool GetOptionsL();
+ TInt GetCalendarUrlsL(CDesC8ArrayFlat *aArray);
+ void FindUrlsL(const TDesC8 &aDes, HBufC8 *&home, HBufC8 *&inbox,
+ HBufC8 *&outbox);
+ void GetBaseUrl(const TDesC8 &aUrl);
+ HBufC8 * FindCalendarCollectionL(const TDesC8 &aUrl,
+ CDesC8ArrayFlat *aArray);
+
+ void DeleteCalObjects();
+ TInt CreateCalObjectsL();
+
+ CCalSession* iCalSession;
+ CCalIter* iCalIter;
+ CCalEntryView* iCalEntryView;
+ CCalenExporter* iCalExporter;
+ CCalenImporter* iCalImporter;
+ CCalenInterimUtils2* iCalIntermimUtils2;
+ HBufC *iCalendar;
+ HBufC8 *iUrl;
+ HBufC8 *iBaseUrl;
+ HBufC8 *iHome;
+
+ TCalDAVOptions iOptions;
+ CHttpClient* iHttp;
+
+ RXmlEngDOMImplementation iDomImpl;
+ RXmlEngDOMParser iDomParser;
+
+ // when we get a callback with a localuid, the corresponding entry is already deleted
+ // we therefore need a different way to map from localuid to global uid/filename
+ // this can be completly removed when introducing a new callback,
+ // which includes the to be deleted localuid
+ RArray<TCalLocalUid> iLocalUidArray;
+ RArray<TBuf8<100> > iGlobalUidArray;
+ //
+ RArray<TCalLocalUid> iDeletedEntries;
+
+ HBufC8 *iSynctoken;
+ HBufC8 *iCTag;
+ TBool iManualSync;
+ TCalTime iLastSyncTime;
+ TBool iFirstInit;
+
+ // Options
+ TTimeIntervalMinutes iSyncInterval;
+ TTimeIntervalDays iPastDays;
+ TBool iImmediateSync;
+ TBool iKeepServerEntry;
+ TBool iEnabled;
+
+ CPeriodic* iTimer;
+ };
+
+#endif // CALSTORE_H
--- a/calendarengines/caldav/inc/caldavenginemgr.h Mon Mar 08 21:43:23 2010 +0000
+++ b/calendarengines/caldav/inc/caldavenginemgr.h Sun Mar 14 13:09:26 2010 +0000
@@ -1,86 +1,86 @@
-/*
-* Copyright (c) 2010 Sun Microsystems, Inc. and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributor:
-* Maximilian Odendahl
-*
-* Contributors:
-*
-* Description: provides a manager to keep track of all available engines
-*
-*/
-
-#ifndef CCALDAVENGINEMGR_H
-#define CCALDAVENGINEMGR_H
-
-// INCLUDES
-#include <e32std.h>
-#include <e32base.h>
-
-#include <calprogresscallback.h>
-
-class CCalDavEngine;
-/**
- * CCalDavEngineMgr
- *
- */
-class CCalDavEngineMgr : public CBase, MCalProgressCallBack
- {
-public:
-
- ~CCalDavEngineMgr();
-
- static CCalDavEngineMgr* NewL();
- static CCalDavEngineMgr* NewLC();
-
- void Progress(TInt aPercentageCompleted);
- void Completed(TInt aError);
- TBool NotifyProgress();
-
- TInt SyncL(const TDesC &aCalendar);
- TInt SyncAllL();
-
- TInt EnableL(const TDesC &aCalendar);
- TInt DisableL(const TDesC &aCalendar);
-
- TBool EnabledSyncL(const TDesC &aCalendar);
-
- TPtrC8 UrlL(const TDesC &aCalendar);
- void SetUrlL(const TDesC &aCalendar, const TDesC8 &aUrl);
-
- TPtrC8 UsernameL(const TDesC &aCalendar);
- void SetUsernameL(const TDesC &aCalendar, const TDesC8 &aUsername);
-
- TPtrC8 PasswordL(const TDesC &aCalendar);
- void SetPasswordL(const TDesC &aCalendar, const TDesC8 &aPassword);
-
- // TODO do also if enable was not called yet? if yes, create CalDavEngine and store settings
- TTimeIntervalMinutes SyncIntervalL(const TDesC &aCalendar);
- void SetSyncIntervalL(const TDesC &aCalendar,
- TTimeIntervalMinutes aSyncInterval);
-
- TTimeIntervalDays PastDaysL(const TDesC &aCalendar);
- void SetPastDaysL(const TDesC &aCalendar, TTimeIntervalDays aDays);
-
- TBool ImmediateSyncL(const TDesC &aCalendar);
- void SetImmediateSyncL(const TDesC &aCalendar, TBool aImmediateSyc);
-
- TBool KeepServerEntryL(const TDesC &aCalendar);
- void SetKeepServerEntryL(const TDesC &aCalendar, TBool aKeepServerEntry);
-
-private:
-
- CCalDavEngineMgr();
- void ConstructL();
-
- TInt FindEngineL(const TDesC &aName, TBool aCreate = EFalse);
- RPointerArray<CCalDavEngine> iEngines;
-
- };
-
-#endif // CCALDAVENGINEMGR_H
+/*
+* Copyright (c) 2010 Sun Microsystems, Inc. and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributor:
+* Maximilian Odendahl
+*
+* Contributors:
+*
+* Description: provides a manager to keep track of all available engines
+*
+*/
+
+#ifndef CCALDAVENGINEMGR_H
+#define CCALDAVENGINEMGR_H
+
+// INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+
+#include <calprogresscallback.h>
+
+class CCalDavEngine;
+/**
+ * CCalDavEngineMgr
+ *
+ */
+class CCalDavEngineMgr : public CBase, MCalProgressCallBack
+ {
+public:
+
+ ~CCalDavEngineMgr();
+
+ static CCalDavEngineMgr* NewL();
+ static CCalDavEngineMgr* NewLC();
+
+ void Progress(TInt aPercentageCompleted);
+ void Completed(TInt aError);
+ TBool NotifyProgress();
+
+ TInt SyncL(const TDesC &aCalendar);
+ TInt SyncAllL();
+
+ TInt EnableL(const TDesC &aCalendar);
+ TInt DisableL(const TDesC &aCalendar);
+
+ TBool EnabledSyncL(const TDesC &aCalendar);
+
+ TPtrC8 UrlL(const TDesC &aCalendar);
+ void SetUrlL(const TDesC &aCalendar, const TDesC8 &aUrl);
+
+ TPtrC8 UsernameL(const TDesC &aCalendar);
+ void SetUsernameL(const TDesC &aCalendar, const TDesC8 &aUsername);
+
+ TPtrC8 PasswordL(const TDesC &aCalendar);
+ void SetPasswordL(const TDesC &aCalendar, const TDesC8 &aPassword);
+
+ // TODO do also if enable was not called yet? if yes, create CalDavEngine and store settings
+ TTimeIntervalMinutes SyncIntervalL(const TDesC &aCalendar);
+ void SetSyncIntervalL(const TDesC &aCalendar,
+ TTimeIntervalMinutes aSyncInterval);
+
+ TTimeIntervalDays PastDaysL(const TDesC &aCalendar);
+ void SetPastDaysL(const TDesC &aCalendar, TTimeIntervalDays aDays);
+
+ TBool ImmediateSyncL(const TDesC &aCalendar);
+ void SetImmediateSyncL(const TDesC &aCalendar, TBool aImmediateSyc);
+
+ TBool KeepServerEntryL(const TDesC &aCalendar);
+ void SetKeepServerEntryL(const TDesC &aCalendar, TBool aKeepServerEntry);
+
+private:
+
+ CCalDavEngineMgr();
+ void ConstructL();
+
+ TInt FindEngineL(const TDesC &aName, TBool aCreate = EFalse);
+ RPointerArray<CCalDavEngine> iEngines;
+
+ };
+
+#endif // CCALDAVENGINEMGR_H
--- a/calendarengines/caldav/inc/caldavserver.h Mon Mar 08 21:43:23 2010 +0000
+++ b/calendarengines/caldav/inc/caldavserver.h Sun Mar 14 13:09:26 2010 +0000
@@ -1,88 +1,88 @@
-/*
-* Copyright (c) 2010 Sun Microsystems, Inc. and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributor:
-* Maximilian Odendahl
-*
-* Contributors:
-*
-* Description: Caldav server, follows Symbian client/server
-* architecture
-*/
-
-#ifndef CCALDAVSERVER_H
-#define CCALDAVSERVER_H
-
-#include <e32base.h>
-
-#include "caldavutils.h"
-
-class CCalDavEngineMgr;
-
-// needed for creating server thread.
-const TUint KDefaultHeapSize = 0x10000;
-
-//**********************************
-//CCalDavServer
-//**********************************
-class CCalDavServer : public CPolicyServer
- {
-public:
- static CCalDavServer* NewLC();
- static TInt ThreadFunction(TAny* aStarted);
- static void PanicServer(TCalDavServPanic aPanic);
- CSession2
- * NewSessionL(const TVersion& aVersion, const RMessage2& aMessage) const;
-public:
-
- TInt EnableL(const TDesC &aCalendar);
- TInt DisableL(const TDesC &aCalendar);
-
- TBool EnabledSyncL(const TDesC &aCalendar) const;
-
- // TODO: make these asynchronous
- TInt SyncL(const TDesC &aCalendar);
- TInt SyncAllL();
-
- TPtrC8 UrlL(const TDesC &aCalendar);
- void SetUrlL(const TDesC &aCalendar, const TDesC8 &aUrl);
-
- TPtrC8 UsernameL(const TDesC &aCalendar);
- void SetUsernameL(const TDesC &aCalendar, const TDesC8 &aUsername);
-
- TPtrC8 PasswordL(const TDesC &aCalendar);
- void SetPasswordL(const TDesC &aCalendar, const TDesC8 &aPassword);
-
- TTimeIntervalMinutes SyncIntervalL(const TDesC &aCalendar) const;
- void SetSyncIntervalL(const TDesC &aCalendar,
- TTimeIntervalMinutes aSyncInterval);
-
- TTimeIntervalDays PastDaysL(const TDesC &aCalendar) const;
- void SetPastDaysL(const TDesC &aCalendar, TTimeIntervalDays aDays);
-
- TBool ImmediateSyncL(const TDesC &aCalendar) const;
- void SetImmediateSyncL(const TDesC &aCalendar, TBool aImmediateSyc);
-
- TBool KeepServerEntryL(const TDesC &aCalendar) const;
- void SetKeepServerEntryL(const TDesC &aCalendar, TBool aKeepServerEntry);
-
-private:
-
-private:
- static void ThreadFunctionL();
- ~CCalDavServer();
- CCalDavServer();
-
- CCalDavEngineMgr* iMgr;
-
-protected:
- void ConstructL();
- CCalDavServer(CActive::TPriority aActiveObjectPriority);
- };
-
-#endif
+/*
+* Copyright (c) 2010 Sun Microsystems, Inc. and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributor:
+* Maximilian Odendahl
+*
+* Contributors:
+*
+* Description: Caldav server, follows Symbian client/server
+* architecture
+*/
+
+#ifndef CCALDAVSERVER_H
+#define CCALDAVSERVER_H
+
+#include <e32base.h>
+
+#include "caldavutils.h"
+
+class CCalDavEngineMgr;
+
+// needed for creating server thread.
+const TUint KDefaultHeapSize = 0x10000;
+
+//**********************************
+//CCalDavServer
+//**********************************
+class CCalDavServer : public CPolicyServer
+ {
+public:
+ static CCalDavServer* NewLC();
+ static TInt ThreadFunction(TAny* aStarted);
+ static void PanicServer(TCalDavServPanic aPanic);
+ CSession2
+ * NewSessionL(const TVersion& aVersion, const RMessage2& aMessage) const;
+public:
+
+ TInt EnableL(const TDesC &aCalendar);
+ TInt DisableL(const TDesC &aCalendar);
+
+ TBool EnabledSyncL(const TDesC &aCalendar) const;
+
+ // TODO: make these asynchronous
+ TInt SyncL(const TDesC &aCalendar);
+ TInt SyncAllL();
+
+ TPtrC8 UrlL(const TDesC &aCalendar);
+ void SetUrlL(const TDesC &aCalendar, const TDesC8 &aUrl);
+
+ TPtrC8 UsernameL(const TDesC &aCalendar);
+ void SetUsernameL(const TDesC &aCalendar, const TDesC8 &aUsername);
+
+ TPtrC8 PasswordL(const TDesC &aCalendar);
+ void SetPasswordL(const TDesC &aCalendar, const TDesC8 &aPassword);
+
+ TTimeIntervalMinutes SyncIntervalL(const TDesC &aCalendar) const;
+ void SetSyncIntervalL(const TDesC &aCalendar,
+ TTimeIntervalMinutes aSyncInterval);
+
+ TTimeIntervalDays PastDaysL(const TDesC &aCalendar) const;
+ void SetPastDaysL(const TDesC &aCalendar, TTimeIntervalDays aDays);
+
+ TBool ImmediateSyncL(const TDesC &aCalendar) const;
+ void SetImmediateSyncL(const TDesC &aCalendar, TBool aImmediateSyc);
+
+ TBool KeepServerEntryL(const TDesC &aCalendar) const;
+ void SetKeepServerEntryL(const TDesC &aCalendar, TBool aKeepServerEntry);
+
+private:
+
+private:
+ static void ThreadFunctionL();
+ ~CCalDavServer();
+ CCalDavServer();
+
+ CCalDavEngineMgr* iMgr;
+
+protected:
+ void ConstructL();
+ CCalDavServer(CActive::TPriority aActiveObjectPriority);
+ };
+
+#endif
--- a/calendarengines/caldav/inc/caldavserversession.h Mon Mar 08 21:43:23 2010 +0000
+++ b/calendarengines/caldav/inc/caldavserversession.h Sun Mar 14 13:09:26 2010 +0000
@@ -1,91 +1,91 @@
-/*
-* Copyright (c) 2010 Sun Microsystems, Inc. and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributor:
-* Maximilian Odendahl
-*
-* Contributors:
-*
-* Description: Caldav server session, follows Symbian
-* client/server architecture
-*
-*/
-
-#ifndef CCALDAVSERVERSESSION_H
-#define CCALDAVSERVERSESSION_H
-
-#include <e32base.h>
-
-class CCalDavServer;
-
-//**********************************
-//CCalDavServerSession
-//**********************************
-/**
- This class represents a session with the server.
- Functions are provided to respond appropriately to client messages.
- */
-class CCalDavServerSession : public CSession2
- {
-public:
- CCalDavServerSession(CCalDavServer &aServer);
- void ServiceL(const RMessage2& aMessage);
-
- void EnableL(const RMessage2& aMessage);
- void DisableL(const RMessage2& aMessage);
-
- void SyncL(const RMessage2& aMessage);
- void SyncAllL(const RMessage2& aMessage);
-
- void UrlL(const RMessage2& aMessage);
- void SetUrlL(const RMessage2& aMessage);
-
- void UsernameL(const RMessage2& aMessage);
- void SetUsernameL(const RMessage2& aMessage);
-
- void PasswordL(const RMessage2& aMessage);
- void SetPasswordL(const RMessage2& aMessage);
-
- void SyncIntervalL(const RMessage2& aMessage);
- void SetSyncIntervalL(const RMessage2& aMessage);
-
- void PastDaysL(const RMessage2& aMessage);
- void SetPastDaysL(const RMessage2& aMessage);
-
- void ImmediateSyncL(const RMessage2& aMessage);
- void SetImmediateSyncL(const RMessage2& aMessage);
-
- void KeepServerEntryL(const RMessage2& aMessage);
- void SetKeepServerEntryL(const RMessage2& aMessage);
-
- void EnabledSyncL(const RMessage2& aMessage);
-
- // still there from symbian count example, not part of caldav
- void SetFromStringL(const RMessage2& aMessage);
- void Increase();
- void Decrease();
- void IncreaseBy(const RMessage2& aMessage);
- void DecreaseBy(const RMessage2& aMessage);
- void CounterValueL(const RMessage2& aMessage);
- void Reset();
- /********************************************************/
-
-protected:
- // panic the client
- void PanicClient(const RMessage2& aMessage, TInt aPanic) const;
-
-private:
- void DispatchMessageL(const RMessage2& aMessage);
-
- CCalDavServer& rServer;
- TInt iCount;
-
- };
-
-#endif
-
+/*
+* Copyright (c) 2010 Sun Microsystems, Inc. and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributor:
+* Maximilian Odendahl
+*
+* Contributors:
+*
+* Description: Caldav server session, follows Symbian
+* client/server architecture
+*
+*/
+
+#ifndef CCALDAVSERVERSESSION_H
+#define CCALDAVSERVERSESSION_H
+
+#include <e32base.h>
+
+class CCalDavServer;
+
+//**********************************
+//CCalDavServerSession
+//**********************************
+/**
+ This class represents a session with the server.
+ Functions are provided to respond appropriately to client messages.
+ */
+class CCalDavServerSession : public CSession2
+ {
+public:
+ CCalDavServerSession(CCalDavServer &aServer);
+ void ServiceL(const RMessage2& aMessage);
+
+ void EnableL(const RMessage2& aMessage);
+ void DisableL(const RMessage2& aMessage);
+
+ void SyncL(const RMessage2& aMessage);
+ void SyncAllL(const RMessage2& aMessage);
+
+ void UrlL(const RMessage2& aMessage);
+ void SetUrlL(const RMessage2& aMessage);
+
+ void UsernameL(const RMessage2& aMessage);
+ void SetUsernameL(const RMessage2& aMessage);
+
+ void PasswordL(const RMessage2& aMessage);
+ void SetPasswordL(const RMessage2& aMessage);
+
+ void SyncIntervalL(const RMessage2& aMessage);
+ void SetSyncIntervalL(const RMessage2& aMessage);
+
+ void PastDaysL(const RMessage2& aMessage);
+ void SetPastDaysL(const RMessage2& aMessage);
+
+ void ImmediateSyncL(const RMessage2& aMessage);
+ void SetImmediateSyncL(const RMessage2& aMessage);
+
+ void KeepServerEntryL(const RMessage2& aMessage);
+ void SetKeepServerEntryL(const RMessage2& aMessage);
+
+ void EnabledSyncL(const RMessage2& aMessage);
+
+ // still there from symbian count example, not part of caldav
+ void SetFromStringL(const RMessage2& aMessage);
+ void Increase();
+ void Decrease();
+ void IncreaseBy(const RMessage2& aMessage);
+ void DecreaseBy(const RMessage2& aMessage);
+ void CounterValueL(const RMessage2& aMessage);
+ void Reset();
+ /********************************************************/
+
+protected:
+ // panic the client
+ void PanicClient(const RMessage2& aMessage, TInt aPanic) const;
+
+private:
+ void DispatchMessageL(const RMessage2& aMessage);
+
+ CCalDavServer& rServer;
+ TInt iCount;
+
+ };
+
+#endif
+
--- a/calendarengines/caldav/inc/caldavsession.h Mon Mar 08 21:43:23 2010 +0000
+++ b/calendarengines/caldav/inc/caldavsession.h Sun Mar 14 13:09:26 2010 +0000
@@ -1,202 +1,202 @@
-/*
-* Copyright (c) 2010 Sun Microsystems, Inc. and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributor:
-* Maximilian Odendahl
-*
-* Contributors:
-*
-* Description: Client API to connect to Caldav server
-* Wrapper around RCalDavServer
-*/
-
-#ifndef CCALDAVSESSION_H
-#define CCALDAVSESSION_H
-
-// INCLUDES
-#include <e32std.h>
-#include <e32base.h>
-
-class CCalDavSessionImpl;
-
-/**
- * @class CCalenCustomisation
- * @brief Client API to connect to the CalDAV server.
- */
-NONSHARABLE_CLASS( CCalDavSession ) : public CBase
- {
-public:
- /** Allocates and constructs a session to the Calendar server.
- * @return Pointer to the newly created session.
- */
- IMPORT_C static CCalDavSession* NewL();
- /** Allocates and constructs a session to the Calendar server.
- @return Pointer to the newly created session.
- */
- IMPORT_C static CCalDavSession* NewLC();
-
- /**
- * standard destructor, close session with CalDavServer
- */
- IMPORT_C ~CCalDavSession();
-
- /**
- Enable access to a remote CalDAV server. At least url,
- username and password need to be set first.
-
- @param aCalendar calendar to enable, must be internal filename in the form c:calendar
- */
- IMPORT_C TInt Enable(const TDesC &aCalendar);
- /**
- Disable access to a remote CalDAV server.
-
- @param aCalendar calendar to disable, must be internal filename in the form c:calendar
- */
- IMPORT_C TInt Disable(const TDesC &aCalendar);
-
- /**
- On demand syncing of an enabled connection of one calendar file
-
- @param aCalendar calendar to enable, must be internal filename in the form c:calendar
- */
- IMPORT_C TInt SyncL(const TDesC &aCalendar);
- /**
- On demand syncing of all enabled connections
- */
- IMPORT_C TInt SyncAllL();
-
- /**
- Retrieve connection url
-
- @param aCalendar calendar for sync, must be internal filename in the form c:calendar
- @param aUrl url for the connection
- */
- IMPORT_C TInt Url(const TDesC &aCalendar, TDes8 &aUrl);
- /**
- Set connection url
-
- @param aCalendar calendar for sync, must be internal filename in the form c:calendar
- @param aUrl url for the url
- */
- IMPORT_C TInt SetUrl(const TDesC &aCalendar, const TDesC8 &aUrl);
-
- /**
- Retrieve connection username
-
- @param aCalendar calendar for sync, must be internal filename in the form c:calendar
- @param aUsername username for the connection
- */
-
- IMPORT_C TInt Username(const TDesC &aCalendar, TDes8 &aUsername);
- /**
- Set connection username
-
- @param aCalendar calendar for sync, must be internal filename in the form c:calendar
- @param aUsername username for the connection
- */
- IMPORT_C TInt SetUsername(const TDesC &aCalendar, const TDesC8 &aUsername);
-
- /**
- Retrieve connection password
-
- @param aCalendar calendar for sync, must be internal filename in the form c:calendar
- @param aPassword password for the connection
- */
-
- IMPORT_C TInt Password(const TDesC &aCalendar, TDes8 &aPassword);
- /**
- Set connection password
-
- @param aCalendar calendar for sync, must be internal filename in the form c:calendar
- @param aPassword password for the connection
- */
- IMPORT_C TInt SetPassword(const TDesC &aCalendar, const TDesC8 &aPassword);
- /**
- Retrieve synchonization interval
-
- @param aCalendar calendar for sync, must be internal filename in the form c:calendar
- @param aSyncInterval sync interval for the connection
- */
-
- IMPORT_C TInt SyncInterval(const TDesC &aCalendar,
- TTimeIntervalMinutes& aSyncInterval);
- /**
- Set synchonization interval
-
- @param aCalendar calendar for sync, must be internal filename in the form c:calendar
- @param aSyncInterval sync interval for the connection, value of zero minutes meaning
- continuous connection
- */
- IMPORT_C TInt SetSyncInterval(const TDesC &aCalendar,
- TTimeIntervalMinutes aSyncInterval);
-
- /**
- Retrieve time range into past for synchronization
-
- @param aCalendar calendar for sync, must be internal filename in the form c:calendar
- @param aDays number of days into the past for the connection
- */
- IMPORT_C TInt PastDays(const TDesC &aCalendar, TTimeIntervalDays &aDays);
- /**
- Set time range into past for synchronization
-
- @param aCalendar calendar for sync, must be internal filename in the form c:calendar
- @param aDays number of days into the past for the connection
- */
- IMPORT_C TInt SetPastDays(const TDesC &aCalendar, TTimeIntervalDays aDays);
-
- /**
- Retrieve immediate push of client changes
-
- @param aCalendar calendar for sync, must be internal filename in the form c:calendar
- @param aImmediateSync push client changes immediatly
- */
- IMPORT_C TInt ImmediateSync(const TDesC &aCalendar, TBool &aImmediateSyc);
- /**
- Set immediate push of client changes
-
- @param aCalendar calendar for sync, must be internal filename in the form c:calendar
- @param aImmediateSync push client changes immediatly
- */
- IMPORT_C TInt SetImmediateSync(const TDesC &aCalendar, TBool aImmediateSyc);
-
- /**
- During a synchronisation conflict, either the server or client needs to win, default is the server
-
- @param aCalendar calendar for sync, must be internal filename in the form c:calendar
- @param aKeepServerEntry server or client wins during synchronisation
- */
- IMPORT_C TInt KeepServerEntry(const TDesC &aCalendar,
- TBool &aKeepServerEntry);
- /**
- During a synchronisation conflict, either the server or client needs to win, which can be set here
-
- @param aCalendar calendar for sync, must be internal filename in the form c:calendar
- @param aKeepServerEntry server or client wins during synchronisation
- */
- IMPORT_C TInt SetKeepServerEntry(const TDesC &aCalendar,
- TBool aKeepServerEntry);
-
- /**
- Retrieve connection status
-
- @param aCalendar calendar for sync, must be internal filename in the form c:calendar
- @param aEnabledSync connection status
- */
- IMPORT_C TInt EnabledSync(const TDesC &aCalendar, TBool &aEnabledSync);
-
-private:
-
- CCalDavSession();
- void ConstructL();
-
- CCalDavSessionImpl* iImpl;
-
- };
-
-#endif // CCALDAVSESSION_H
+/*
+* Copyright (c) 2010 Sun Microsystems, Inc. and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributor:
+* Maximilian Odendahl
+*
+* Contributors:
+*
+* Description: Client API to connect to Caldav server
+* Wrapper around RCalDavServer
+*/
+
+#ifndef CCALDAVSESSION_H
+#define CCALDAVSESSION_H
+
+// INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+
+class CCalDavSessionImpl;
+
+/**
+ * @class CCalenCustomisation
+ * @brief Client API to connect to the CalDAV server.
+ */
+NONSHARABLE_CLASS( CCalDavSession ) : public CBase
+ {
+public:
+ /** Allocates and constructs a session to the Calendar server.
+ * @return Pointer to the newly created session.
+ */
+ IMPORT_C static CCalDavSession* NewL();
+ /** Allocates and constructs a session to the Calendar server.
+ @return Pointer to the newly created session.
+ */
+ IMPORT_C static CCalDavSession* NewLC();
+
+ /**
+ * standard destructor, close session with CalDavServer
+ */
+ IMPORT_C ~CCalDavSession();
+
+ /**
+ Enable access to a remote CalDAV server. At least url,
+ username and password need to be set first.
+
+ @param aCalendar calendar to enable, must be internal filename in the form c:calendar
+ */
+ IMPORT_C TInt Enable(const TDesC &aCalendar);
+ /**
+ Disable access to a remote CalDAV server.
+
+ @param aCalendar calendar to disable, must be internal filename in the form c:calendar
+ */
+ IMPORT_C TInt Disable(const TDesC &aCalendar);
+
+ /**
+ On demand syncing of an enabled connection of one calendar file
+
+ @param aCalendar calendar to enable, must be internal filename in the form c:calendar
+ */
+ IMPORT_C TInt SyncL(const TDesC &aCalendar);
+ /**
+ On demand syncing of all enabled connections
+ */
+ IMPORT_C TInt SyncAllL();
+
+ /**
+ Retrieve connection url
+
+ @param aCalendar calendar for sync, must be internal filename in the form c:calendar
+ @param aUrl url for the connection
+ */
+ IMPORT_C TInt Url(const TDesC &aCalendar, TDes8 &aUrl);
+ /**
+ Set connection url
+
+ @param aCalendar calendar for sync, must be internal filename in the form c:calendar
+ @param aUrl url for the url
+ */
+ IMPORT_C TInt SetUrl(const TDesC &aCalendar, const TDesC8 &aUrl);
+
+ /**
+ Retrieve connection username
+
+ @param aCalendar calendar for sync, must be internal filename in the form c:calendar
+ @param aUsername username for the connection
+ */
+
+ IMPORT_C TInt Username(const TDesC &aCalendar, TDes8 &aUsername);
+ /**
+ Set connection username
+
+ @param aCalendar calendar for sync, must be internal filename in the form c:calendar
+ @param aUsername username for the connection
+ */
+ IMPORT_C TInt SetUsername(const TDesC &aCalendar, const TDesC8 &aUsername);
+
+ /**
+ Retrieve connection password
+
+ @param aCalendar calendar for sync, must be internal filename in the form c:calendar
+ @param aPassword password for the connection
+ */
+
+ IMPORT_C TInt Password(const TDesC &aCalendar, TDes8 &aPassword);
+ /**
+ Set connection password
+
+ @param aCalendar calendar for sync, must be internal filename in the form c:calendar
+ @param aPassword password for the connection
+ */
+ IMPORT_C TInt SetPassword(const TDesC &aCalendar, const TDesC8 &aPassword);
+ /**
+ Retrieve synchonization interval
+
+ @param aCalendar calendar for sync, must be internal filename in the form c:calendar
+ @param aSyncInterval sync interval for the connection
+ */
+
+ IMPORT_C TInt SyncInterval(const TDesC &aCalendar,
+ TTimeIntervalMinutes& aSyncInterval);
+ /**
+ Set synchonization interval
+
+ @param aCalendar calendar for sync, must be internal filename in the form c:calendar
+ @param aSyncInterval sync interval for the connection, value of zero minutes meaning
+ continuous connection
+ */
+ IMPORT_C TInt SetSyncInterval(const TDesC &aCalendar,
+ TTimeIntervalMinutes aSyncInterval);
+
+ /**
+ Retrieve time range into past for synchronization
+
+ @param aCalendar calendar for sync, must be internal filename in the form c:calendar
+ @param aDays number of days into the past for the connection
+ */
+ IMPORT_C TInt PastDays(const TDesC &aCalendar, TTimeIntervalDays &aDays);
+ /**
+ Set time range into past for synchronization
+
+ @param aCalendar calendar for sync, must be internal filename in the form c:calendar
+ @param aDays number of days into the past for the connection
+ */
+ IMPORT_C TInt SetPastDays(const TDesC &aCalendar, TTimeIntervalDays aDays);
+
+ /**
+ Retrieve immediate push of client changes
+
+ @param aCalendar calendar for sync, must be internal filename in the form c:calendar
+ @param aImmediateSync push client changes immediatly
+ */
+ IMPORT_C TInt ImmediateSync(const TDesC &aCalendar, TBool &aImmediateSyc);
+ /**
+ Set immediate push of client changes
+
+ @param aCalendar calendar for sync, must be internal filename in the form c:calendar
+ @param aImmediateSync push client changes immediatly
+ */
+ IMPORT_C TInt SetImmediateSync(const TDesC &aCalendar, TBool aImmediateSyc);
+
+ /**
+ During a synchronisation conflict, either the server or client needs to win, default is the server
+
+ @param aCalendar calendar for sync, must be internal filename in the form c:calendar
+ @param aKeepServerEntry server or client wins during synchronisation
+ */
+ IMPORT_C TInt KeepServerEntry(const TDesC &aCalendar,
+ TBool &aKeepServerEntry);
+ /**
+ During a synchronisation conflict, either the server or client needs to win, which can be set here
+
+ @param aCalendar calendar for sync, must be internal filename in the form c:calendar
+ @param aKeepServerEntry server or client wins during synchronisation
+ */
+ IMPORT_C TInt SetKeepServerEntry(const TDesC &aCalendar,
+ TBool aKeepServerEntry);
+
+ /**
+ Retrieve connection status
+
+ @param aCalendar calendar for sync, must be internal filename in the form c:calendar
+ @param aEnabledSync connection status
+ */
+ IMPORT_C TInt EnabledSync(const TDesC &aCalendar, TBool &aEnabledSync);
+
+private:
+
+ CCalDavSession();
+ void ConstructL();
+
+ CCalDavSessionImpl* iImpl;
+
+ };
+
+#endif // CCALDAVSESSION_H
--- a/calendarengines/caldav/inc/caldavsessionimpl.h Mon Mar 08 21:43:23 2010 +0000
+++ b/calendarengines/caldav/inc/caldavsessionimpl.h Sun Mar 14 13:09:26 2010 +0000
@@ -1,82 +1,82 @@
-/*
-* Copyright (c) 2010 Sun Microsystems, Inc. and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributor:
-* Maximilian Odendahl
-*
-* Contributors:
-*
-* Description: Client API implementation
-* Wrapper around RCalDavServer
-*/
-
-#ifndef CCALDAVSESSIONIMPL_H
-#define CCALDAVSESSIONIMPL_H
-
-// INCLUDES
-#include <e32std.h>
-#include <e32base.h>
-
-class RCalDavServer;
-
-// CLASS DECLARATION
-
-/**
- * CCalDavSessionImpl
- *
- */
-class CCalDavSessionImpl : public CBase
- {
-public:
-
- ~CCalDavSessionImpl();
-
- static CCalDavSessionImpl* NewL();
- static CCalDavSessionImpl* NewLC();
-
- TInt Enable(const TDesC &aCalendar);
- TInt Disable(const TDesC &aCalendar);
-
- TInt SyncL(const TDesC &aCalendar);
- TInt SyncAllL();
-
- TInt Url(const TDesC &aCalendar, TDes8 &aUrl);
- TInt SetUrl(const TDesC &aCalendar, const TDesC8 &aUrl);
-
- TInt Username(const TDesC &aCalendar, TDes8 &aUsername);
- TInt SetUsername(const TDesC &aCalendar, const TDesC8 &aUsername);
-
- TInt Password(const TDesC &aCalendar, TDes8 &aPassword);
- TInt SetPassword(const TDesC &aCalendar, const TDesC8 &aPassword);
-
- TInt SyncInterval(const TDesC &aCalendar,
- TTimeIntervalMinutes& aSyncInterval);
- TInt SetSyncInterval(const TDesC &aCalendar,
- TTimeIntervalMinutes aSyncInterval);
-
- TInt PastDays(const TDesC &aCalendar, TTimeIntervalDays &aDays);
- TInt SetPastDays(const TDesC &aCalendar, TTimeIntervalDays aDays);
-
- TInt ImmediateSync(const TDesC &aCalendar, TBool &aImmediateSyc);
- TInt SetImmediateSync(const TDesC &aCalendar, TBool aImmediateSyc);
-
- TInt KeepServerEntry(const TDesC &aCalendar, TBool &aKeepServerEntry);
- TInt SetKeepServerEntry(const TDesC &aCalendar, TBool aKeepServerEntry);
-
- TInt EnabledSync(const TDesC &aCalendar, TBool &aEnabledSync);
-
-private:
-
- CCalDavSessionImpl();
- void ConstructL();
-
- RCalDavServer* iServer;
-
- };
-
-#endif // CCALDAVSESSIONIMPL_H
+/*
+* Copyright (c) 2010 Sun Microsystems, Inc. and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributor:
+* Maximilian Odendahl
+*
+* Contributors:
+*
+* Description: Client API implementation
+* Wrapper around RCalDavServer
+*/
+
+#ifndef CCALDAVSESSIONIMPL_H
+#define CCALDAVSESSIONIMPL_H
+
+// INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+
+class RCalDavServer;
+
+// CLASS DECLARATION
+
+/**
+ * CCalDavSessionImpl
+ *
+ */
+class CCalDavSessionImpl : public CBase
+ {
+public:
+
+ ~CCalDavSessionImpl();
+
+ static CCalDavSessionImpl* NewL();
+ static CCalDavSessionImpl* NewLC();
+
+ TInt Enable(const TDesC &aCalendar);
+ TInt Disable(const TDesC &aCalendar);
+
+ TInt SyncL(const TDesC &aCalendar);
+ TInt SyncAllL();
+
+ TInt Url(const TDesC &aCalendar, TDes8 &aUrl);
+ TInt SetUrl(const TDesC &aCalendar, const TDesC8 &aUrl);
+
+ TInt Username(const TDesC &aCalendar, TDes8 &aUsername);
+ TInt SetUsername(const TDesC &aCalendar, const TDesC8 &aUsername);
+
+ TInt Password(const TDesC &aCalendar, TDes8 &aPassword);
+ TInt SetPassword(const TDesC &aCalendar, const TDesC8 &aPassword);
+
+ TInt SyncInterval(const TDesC &aCalendar,
+ TTimeIntervalMinutes& aSyncInterval);
+ TInt SetSyncInterval(const TDesC &aCalendar,
+ TTimeIntervalMinutes aSyncInterval);
+
+ TInt PastDays(const TDesC &aCalendar, TTimeIntervalDays &aDays);
+ TInt SetPastDays(const TDesC &aCalendar, TTimeIntervalDays aDays);
+
+ TInt ImmediateSync(const TDesC &aCalendar, TBool &aImmediateSyc);
+ TInt SetImmediateSync(const TDesC &aCalendar, TBool aImmediateSyc);
+
+ TInt KeepServerEntry(const TDesC &aCalendar, TBool &aKeepServerEntry);
+ TInt SetKeepServerEntry(const TDesC &aCalendar, TBool aKeepServerEntry);
+
+ TInt EnabledSync(const TDesC &aCalendar, TBool &aEnabledSync);
+
+private:
+
+ CCalDavSessionImpl();
+ void ConstructL();
+
+ RCalDavServer* iServer;
+
+ };
+
+#endif // CCALDAVSESSIONIMPL_H
--- a/calendarengines/caldav/inc/caldavutils.h Mon Mar 08 21:43:23 2010 +0000
+++ b/calendarengines/caldav/inc/caldavutils.h Sun Mar 14 13:09:26 2010 +0000
@@ -1,251 +1,251 @@
-/*
-* Copyright (c) 2010 Sun Microsystems, Inc. and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributor:
-* Maximilian Odendahl
-*
-* Contributors:
-*
-* Description: various utility classes and functions
-* used in Caldav client and server code
-*/
-
-#ifndef CALDAVUTILS_H
-#define CALDAVUTILS_H
-
-// INCLUDES
-#include <e32std.h>
-#include <e32base.h>
-
-// CLASS DECLARATION
-class RHTTPTransaction;
-
-_LIT(KCalDavServerName,"!CalDavServer");
-_LIT(KCalDavServerFilename,"!CalDavServer.exe");
-_LIT8(KUserAgent, "Symbian 1.0");
-
-const TUint KCalDavServerMajorVersionNumber = 1;
-const TUint KCalDavServerMinorVersionNumber = 0;
-const TUint KCalDavServerBuildVersionNumber = 0;
-
-enum TCalDavServReq
- {
- ECalDavCreate = 1,
- ECalDavClose,
- ECalDavUnsupportedRequest,
- ECalDavEnable,
- ECalDavDisable,
- ECalDavMkCalendar,
- ECalDavDeleteCalendar,
- ECalDavSyncAll,
- ECalDavSync,
- ECalDavUrl,
- ECalDavSetUrl,
- ECalDavUsername,
- ECalDavSetUsername,
- ECalDavPassword,
- ECalDavSetPassword,
- ECalDavSyncInterval,
- ECalDavSetSyncInterval,
- ECalDavPastDays,
- ECalDavSetPastDays,
- ECalDavImmediateSync,
- ECalDavSetImmediateSync,
- ECalDavKeepServer,
- ECalDavSetKeepServer,
- ECalDavEnabled
- };
-
-enum TCalDavServLeave
- {
- ENonNumericString = 99
- };
-
-// reasons for server panic
-enum TCalDavServPanic
- {
- EBadRequest = 1,
- EBadDescriptor,
- EMainSchedulerError,
- ESvrCreateServer,
- ESvrStartServer,
- ECreateTrapCleanup,
- ENotImplementedYet,
- };
-
-struct TCalDAVOptions
- {
- // ALLOW header
- TBool DELETE;
- TBool GET;
- TBool HEAD;
- TBool MKCALENDAR;
- TBool MKCOL;
- TBool OPTIONS;
- TBool PROPFIND;
- TBool PROPPATCH;
- TBool PUT;
- TBool REPORT;
- TBool COPY;
- TBool POST;
- TBool MOVE;
- TBool ACL;
- TBool LOCK;
- TBool UNLOCK;
- TBool MULTIGET;
- TBool QUERY;
-
- TBool VEVENT;
- TBool VTODO;
- TBool VFREEBUSY;
- TBool VJOURNAL;
-
- //DAV header
- TBool ONE;
- TBool TWO;
- TBool THREE;
- TBool access_control;
- TBool calendar_access;
- TBool calendar_schedule;
- TBool calendar_auto_schedule;
- TBool extended_mkcol;
- TBool sync_collection;
- TBool sync_ctag;
- };
-_LIT8(colon,",");
-_LIT8(DAV,"DAV");
-_LIT8(ALLOW,"Allow");
-_LIT8(DELETE,"DELETE");
-_LIT8(GET,"GET");
-_LIT8(HEAD,"HEAD");
-_LIT8(MKCALENDAR,"MKCALENDAR");
-_LIT8(MKCOL,"MKCOL");
-_LIT8(OPTIONS,"OPTIONS");
-_LIT8(PROPFIND,"PROPFIND");
-_LIT8(PROPPATCH,"PROPPATCH");
-_LIT8(PUT,"PUT");
-_LIT8(REPORT,"REPORT");
-_LIT8(COPY,"COPY");
-_LIT8(POST,"POST");
-_LIT8(MOVE,"MOVE");
-_LIT8(ACL,"ACL");
-_LIT8(LOCK,"LOCK");
-_LIT8(UNLOCK,"UNLOCK");
-_LIT8(MULTIGET,"MULTIGET");
-//DAV header
-_LIT8(ZERO,"0");
-_LIT8(ONE,"1");
-_LIT8(TWO,"2");
-_LIT8(THREE,"3");
-_LIT8(access_control,"access-control");
-_LIT8(calendar_access,"calendar-access");
-_LIT8(calendar_schedule,"calendar-schedule");
-_LIT8(calendar_auto_schedule,"calendar-auto-schedule");
-_LIT8(sync_collection,"sync-collection");
-_LIT8(extended_mkcol,"extended-mkcol");
-_LIT8(KVEVENT,"VEVENT");
-_LIT8(KVTODO,"VTODO");
-_LIT8(KVJOURNAL,"VJOURNAL");
-_LIT8(KVFREBUSY,"VFREEBUSY");
-_LIT8(KDav,"DAV:");
-_LIT8(KMultistatus,"multistatus");
-_LIT8(LProp,"prop");
-_LIT8(KHref,"href");
-_LIT8(KResponse,"response");
-_LIT8(KStatus,"status");
-_LIT8(KOwner,"owner");
-_LIT8(KEtag,"getetag");
-_LIT8(KResourcetype,"resourcetype");
-_LIT8(KCalDav,"urn:ietf:params:xml:ns:caldav");
-_LIT8(KGetctag,"getctag");
-_LIT8(KSynctoken,"sync-token");
-_LIT8(KCalendarData,"calendar-data");
-_LIT8(KCalendar,"calendar");
-_LIT8(KCalendarHomeSet,"calendar-home-set");
-_LIT8(KOutbox,"schedule-outbox-URL");
-_LIT8(KInbox,"schedule-inbox-URL");
-_LIT8(KCalendarMultiget,"calendar-multiget");
-_LIT8(KCalendarQuery,"calendar-query");
-_LIT8(KDisplayname,"displayname");
-_LIT8(KSupportedCalendarComponentSet,"supported-calendar-component-set");
-_LIT8(KCalendar_Color,"calendar-color");
-
-// groupdav
-_LIT8(KVTodoCollection,"vtodo-collection");
-_LIT8(KVEventCollection,"vevent-collection");
-_LIT8(KIcs, ".ics");
-_LIT8(KUID,"UID:");
-_LIT8(KSlash,"/");
-_LIT8(KName,"name");
-_LIT8(KHrefstart,"<D:href xmlns:D=\"DAV:\">");
-_LIT8(KHrefend,"</D:href>");
-_LIT8(KMultistart,"<?xml version=\"1.0\" encoding=\"utf-8\" ?><C:calendar-multiget xmlns:C=\"urn:ietf:params:xml:ns:caldav\"><D:prop xmlns:D=\"DAV:\"><D:getetag/><C:calendar-data/></D:prop>");
-_LIT8(KMultiend,"</C:calendar-multiget>");
-_LIT8(KSync,"<?xml version=\"1.0\" encoding=\"utf-8\" ?><D:sync-collection xmlns:D=\"DAV:\"><D:sync-token>%S</D:sync-token><D:prop><D:getetag/></D:prop></D:sync-collection>");
-_LIT8(KCtag,"<?xml version=\"1.0\" encoding=\"utf-8\"?><D:propfind xmlns:C=\"urn:ietf:params:xml:ns:caldav\" xmlns:D=\"DAV:\"><D:prop><T:getctag xmlns:T=\"http://calendarserver.org/ns/\"/></D:prop></D:propfind>");
-_LIT8(KSupportedSet,"<?xml version=\"1.0\" encoding=\"utf-8\"?><D:propfind xmlns:C=\"urn:ietf:params:xml:ns:caldav\" xmlns:D=\"DAV:\"><D:prop><C:supported-calendar-component-set/><D:supported-report-set/><D:displayname/><A:calendar-color xmlns:A=\"http://apple.com/ns/ical/\"/></D:prop></D:propfind>");
-_LIT8(KCalendarurl,"<?xml version=\"1.0\" encoding=\"utf-8\"?><D:propfind xmlns:C=\"urn:ietf:params:xml:ns:caldav\" xmlns:D=\"DAV:\"><D:prop><D:owner/><D:resourcetype/></D:prop></D:propfind>");
-_LIT8(KPrincipalurl,"<?xml version=\"1.0\" encoding=\"utf-8\"?><D:propfind xmlns:C=\"urn:ietf:params:xml:ns:caldav\" xmlns:D=\"DAV:\"><D:prop><C:calendar-home-set/><C:schedule-inbox-URL/><C:schedule-outbox-URL/></D:prop></D:propfind>");
-_LIT8(KPropList,"<?xml version=\"1.0\" encoding=\"utf-8\"?><D:propfind xmlns:C=\"urn:ietf:params:xml:ns:caldav\" xmlns:D=\"DAV:\"><D:prop><D:getetag/></D:prop></D:propfind>");
-_LIT8(KTimeStartEVENT,"<?xml version=\"1.0\" encoding=\"UTF-8\"?><calendar-query xmlns:D=\"DAV:\" xmlns=\"urn:ietf:params:xml:ns:caldav\"><D:prop><D:getetag/></D:prop><filter><comp-filter name=\"VCALENDAR\"><comp-filter name=\"VEVENT\"><time-range start=");
-_LIT8(KTimeStartTODO,"<?xml version=\"1.0\" encoding=\"UTF-8\"?><calendar-query xmlns:D=\"DAV:\" xmlns=\"urn:ietf:params:xml:ns:caldav\"><D:prop><D:getetag/></D:prop><filter><comp-filter name=\"VCALENDAR\"><comp-filter name=\"VTODO\"><time-range start=");
-_LIT8(KTimeEnd," end=\"20200101T000000Z\"/></comp-filter></comp-filter></filter></calendar-query>");
-_LIT8(KTimeTest,"<?xml version=\"1.0\" encoding=\"UTF-8\"?><calendar-query xmlns:D=\"DAV:\" xmlns=\"urn:ietf:params:xml:ns:caldav\"><D:prop><D:getetag/></D:prop><filter><comp-filter name=\"VCALENDAR\"><comp-filter name=\"VEVENT\"><time-range start=\"20090509T220000Z\" end=\"20090509T220000Z\"/></comp-filter></comp-filter></filter></calendar-query>");
-
-_LIT8(KColorDisplayStart,"<?xml version=\"1.0\" encoding=\"utf-8\"?><D:propertyupdate xmlns:D=\"DAV:\"><D:set><D:prop><A:calendar-color xmlns:A=\"http://apple.com/ns/ical/\">");
-_LIT8(KColorDisplayMiddle,"</A:calendar-color><D:displayname>");
-_LIT8(KColorDisplayEnd,"</D:displayname></D:prop></D:set></D:propertyupdate>");
-
-// strings for CCalCalendarInfo Properties
-_LIT8(KCaldavEnabled,"caldavenabled");
-_LIT8(KCaldavFirstInit,"caldavfirstinit");
-_LIT8(KCaldavCtag,"caldavctag");
-_LIT8(KCaldavSynctoken,"caldavsynctoken");
-_LIT8(KCaldavManualSync,"caldavmanualsync");
-_LIT8(KCaldavTime,"caldavtime");
-_LIT8(KCaldavUser,"caldavuser");
-_LIT8(KCaldavPassword,"caldavpassword");
-_LIT8(KCaldavUrl,"caldavurl");
-_LIT8(KCaldavKeepServer,"caldavkeepserver");
-_LIT8(KCaldavImmediateSync,"caldavimmediatesync");
-_LIT8(KCaldavPastDays,"caldavpastdays");
-_LIT8(KCaldavSyncInterval,"caldavsyncinterval");
-
-class CalDavUtils : public CBase
- {
-public:
-
- ~CalDavUtils();
-
- static CalDavUtils* NewL();
- static CalDavUtils* NewLC();
-
- static void ScanDAVHeaderL(RHTTPTransaction &aTransaction,
- TCalDAVOptions &aOptions);
- static void ScanAllowHeaderL(RHTTPTransaction &aTransaction,
- TCalDAVOptions &aOptions);
- static void FixExportIssues(TDes8 &aDes);
- static void FixImportIssues(TDes8 &aDes);
- static void GetFileName(const TDesC8 &aIcs, TDes8 &aUrl);
-
- static HBufC8* EnsureSlashL(HBufC8* aIn);
- static HBufC8* CalDavUtils::EnsureSlashL(const TDesC8 &aIn);
-
-private:
-
- CalDavUtils();
- void ConstructL();
-
- static void FindAndRemoveMethod(TDes8 &aDes);
- static void FixBYMONTHDAY(TDes8 &aDes);
- static void FixSameTime(TDes8 &aDes);
- static void FixLineFeed(TDes8 &aDes);
-
- };
-
-#endif // CALDAVUTILS_H
+/*
+* Copyright (c) 2010 Sun Microsystems, Inc. and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributor:
+* Maximilian Odendahl
+*
+* Contributors:
+*
+* Description: various utility classes and functions
+* used in Caldav client and server code
+*/
+
+#ifndef CALDAVUTILS_H
+#define CALDAVUTILS_H
+
+// INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+
+// CLASS DECLARATION
+class RHTTPTransaction;
+
+_LIT(KCalDavServerName,"!CalDavServer");
+_LIT(KCalDavServerFilename,"!CalDavServer.exe");
+_LIT8(KUserAgent, "Symbian 1.0");
+
+const TUint KCalDavServerMajorVersionNumber = 1;
+const TUint KCalDavServerMinorVersionNumber = 0;
+const TUint KCalDavServerBuildVersionNumber = 0;
+
+enum TCalDavServReq
+ {
+ ECalDavCreate = 1,
+ ECalDavClose,
+ ECalDavUnsupportedRequest,
+ ECalDavEnable,
+ ECalDavDisable,
+ ECalDavMkCalendar,
+ ECalDavDeleteCalendar,
+ ECalDavSyncAll,
+ ECalDavSync,
+ ECalDavUrl,
+ ECalDavSetUrl,
+ ECalDavUsername,
+ ECalDavSetUsername,
+ ECalDavPassword,
+ ECalDavSetPassword,
+ ECalDavSyncInterval,
+ ECalDavSetSyncInterval,
+ ECalDavPastDays,
+ ECalDavSetPastDays,
+ ECalDavImmediateSync,
+ ECalDavSetImmediateSync,
+ ECalDavKeepServer,
+ ECalDavSetKeepServer,
+ ECalDavEnabled
+ };
+
+enum TCalDavServLeave
+ {
+ ENonNumericString = 99
+ };
+
+// reasons for server panic
+enum TCalDavServPanic
+ {
+ EBadRequest = 1,
+ EBadDescriptor,
+ EMainSchedulerError,
+ ESvrCreateServer,
+ ESvrStartServer,
+ ECreateTrapCleanup,
+ ENotImplementedYet,
+ };
+
+struct TCalDAVOptions
+ {
+ // ALLOW header
+ TBool DELETE;
+ TBool GET;
+ TBool HEAD;
+ TBool MKCALENDAR;
+ TBool MKCOL;
+ TBool OPTIONS;
+ TBool PROPFIND;
+ TBool PROPPATCH;
+ TBool PUT;
+ TBool REPORT;
+ TBool COPY;
+ TBool POST;
+ TBool MOVE;
+ TBool ACL;
+ TBool LOCK;
+ TBool UNLOCK;
+ TBool MULTIGET;
+ TBool QUERY;
+
+ TBool VEVENT;
+ TBool VTODO;
+ TBool VFREEBUSY;
+ TBool VJOURNAL;
+
+ //DAV header
+ TBool ONE;
+ TBool TWO;
+ TBool THREE;
+ TBool access_control;
+ TBool calendar_access;
+ TBool calendar_schedule;
+ TBool calendar_auto_schedule;
+ TBool extended_mkcol;
+ TBool sync_collection;
+ TBool sync_ctag;
+ };
+_LIT8(colon,",");
+_LIT8(DAV,"DAV");
+_LIT8(ALLOW,"Allow");
+_LIT8(DELETE,"DELETE");
+_LIT8(GET,"GET");
+_LIT8(HEAD,"HEAD");
+_LIT8(MKCALENDAR,"MKCALENDAR");
+_LIT8(MKCOL,"MKCOL");
+_LIT8(OPTIONS,"OPTIONS");
+_LIT8(PROPFIND,"PROPFIND");
+_LIT8(PROPPATCH,"PROPPATCH");
+_LIT8(PUT,"PUT");
+_LIT8(REPORT,"REPORT");
+_LIT8(COPY,"COPY");
+_LIT8(POST,"POST");
+_LIT8(MOVE,"MOVE");
+_LIT8(ACL,"ACL");
+_LIT8(LOCK,"LOCK");
+_LIT8(UNLOCK,"UNLOCK");
+_LIT8(MULTIGET,"MULTIGET");
+//DAV header
+_LIT8(ZERO,"0");
+_LIT8(ONE,"1");
+_LIT8(TWO,"2");
+_LIT8(THREE,"3");
+_LIT8(access_control,"access-control");
+_LIT8(calendar_access,"calendar-access");
+_LIT8(calendar_schedule,"calendar-schedule");
+_LIT8(calendar_auto_schedule,"calendar-auto-schedule");
+_LIT8(sync_collection,"sync-collection");
+_LIT8(extended_mkcol,"extended-mkcol");
+_LIT8(KVEVENT,"VEVENT");
+_LIT8(KVTODO,"VTODO");
+_LIT8(KVJOURNAL,"VJOURNAL");
+_LIT8(KVFREBUSY,"VFREEBUSY");
+_LIT8(KDav,"DAV:");
+_LIT8(KMultistatus,"multistatus");
+_LIT8(LProp,"prop");
+_LIT8(KHref,"href");
+_LIT8(KResponse,"response");
+_LIT8(KStatus,"status");
+_LIT8(KOwner,"owner");
+_LIT8(KEtag,"getetag");
+_LIT8(KResourcetype,"resourcetype");
+_LIT8(KCalDav,"urn:ietf:params:xml:ns:caldav");
+_LIT8(KGetctag,"getctag");
+_LIT8(KSynctoken,"sync-token");
+_LIT8(KCalendarData,"calendar-data");
+_LIT8(KCalendar,"calendar");
+_LIT8(KCalendarHomeSet,"calendar-home-set");
+_LIT8(KOutbox,"schedule-outbox-URL");
+_LIT8(KInbox,"schedule-inbox-URL");
+_LIT8(KCalendarMultiget,"calendar-multiget");
+_LIT8(KCalendarQuery,"calendar-query");
+_LIT8(KDisplayname,"displayname");
+_LIT8(KSupportedCalendarComponentSet,"supported-calendar-component-set");
+_LIT8(KCalendar_Color,"calendar-color");
+
+// groupdav
+_LIT8(KVTodoCollection,"vtodo-collection");
+_LIT8(KVEventCollection,"vevent-collection");
+_LIT8(KIcs, ".ics");
+_LIT8(KUID,"UID:");
+_LIT8(KSlash,"/");
+_LIT8(KName,"name");
+_LIT8(KHrefstart,"<D:href xmlns:D=\"DAV:\">");
+_LIT8(KHrefend,"</D:href>");
+_LIT8(KMultistart,"<?xml version=\"1.0\" encoding=\"utf-8\" ?><C:calendar-multiget xmlns:C=\"urn:ietf:params:xml:ns:caldav\"><D:prop xmlns:D=\"DAV:\"><D:getetag/><C:calendar-data/></D:prop>");
+_LIT8(KMultiend,"</C:calendar-multiget>");
+_LIT8(KSync,"<?xml version=\"1.0\" encoding=\"utf-8\" ?><D:sync-collection xmlns:D=\"DAV:\"><D:sync-token>%S</D:sync-token><D:prop><D:getetag/></D:prop></D:sync-collection>");
+_LIT8(KCtag,"<?xml version=\"1.0\" encoding=\"utf-8\"?><D:propfind xmlns:C=\"urn:ietf:params:xml:ns:caldav\" xmlns:D=\"DAV:\"><D:prop><T:getctag xmlns:T=\"http://calendarserver.org/ns/\"/></D:prop></D:propfind>");
+_LIT8(KSupportedSet,"<?xml version=\"1.0\" encoding=\"utf-8\"?><D:propfind xmlns:C=\"urn:ietf:params:xml:ns:caldav\" xmlns:D=\"DAV:\"><D:prop><C:supported-calendar-component-set/><D:supported-report-set/><D:displayname/><A:calendar-color xmlns:A=\"http://apple.com/ns/ical/\"/></D:prop></D:propfind>");
+_LIT8(KCalendarurl,"<?xml version=\"1.0\" encoding=\"utf-8\"?><D:propfind xmlns:C=\"urn:ietf:params:xml:ns:caldav\" xmlns:D=\"DAV:\"><D:prop><D:owner/><D:resourcetype/></D:prop></D:propfind>");
+_LIT8(KPrincipalurl,"<?xml version=\"1.0\" encoding=\"utf-8\"?><D:propfind xmlns:C=\"urn:ietf:params:xml:ns:caldav\" xmlns:D=\"DAV:\"><D:prop><C:calendar-home-set/><C:schedule-inbox-URL/><C:schedule-outbox-URL/></D:prop></D:propfind>");
+_LIT8(KPropList,"<?xml version=\"1.0\" encoding=\"utf-8\"?><D:propfind xmlns:C=\"urn:ietf:params:xml:ns:caldav\" xmlns:D=\"DAV:\"><D:prop><D:getetag/></D:prop></D:propfind>");
+_LIT8(KTimeStartEVENT,"<?xml version=\"1.0\" encoding=\"UTF-8\"?><calendar-query xmlns:D=\"DAV:\" xmlns=\"urn:ietf:params:xml:ns:caldav\"><D:prop><D:getetag/></D:prop><filter><comp-filter name=\"VCALENDAR\"><comp-filter name=\"VEVENT\"><time-range start=");
+_LIT8(KTimeStartTODO,"<?xml version=\"1.0\" encoding=\"UTF-8\"?><calendar-query xmlns:D=\"DAV:\" xmlns=\"urn:ietf:params:xml:ns:caldav\"><D:prop><D:getetag/></D:prop><filter><comp-filter name=\"VCALENDAR\"><comp-filter name=\"VTODO\"><time-range start=");
+_LIT8(KTimeEnd," end=\"20200101T000000Z\"/></comp-filter></comp-filter></filter></calendar-query>");
+_LIT8(KTimeTest,"<?xml version=\"1.0\" encoding=\"UTF-8\"?><calendar-query xmlns:D=\"DAV:\" xmlns=\"urn:ietf:params:xml:ns:caldav\"><D:prop><D:getetag/></D:prop><filter><comp-filter name=\"VCALENDAR\"><comp-filter name=\"VEVENT\"><time-range start=\"20090509T220000Z\" end=\"20090509T220000Z\"/></comp-filter></comp-filter></filter></calendar-query>");
+
+_LIT8(KColorDisplayStart,"<?xml version=\"1.0\" encoding=\"utf-8\"?><D:propertyupdate xmlns:D=\"DAV:\"><D:set><D:prop><A:calendar-color xmlns:A=\"http://apple.com/ns/ical/\">");
+_LIT8(KColorDisplayMiddle,"</A:calendar-color><D:displayname>");
+_LIT8(KColorDisplayEnd,"</D:displayname></D:prop></D:set></D:propertyupdate>");
+
+// strings for CCalCalendarInfo Properties
+_LIT8(KCaldavEnabled,"caldavenabled");
+_LIT8(KCaldavFirstInit,"caldavfirstinit");
+_LIT8(KCaldavCtag,"caldavctag");
+_LIT8(KCaldavSynctoken,"caldavsynctoken");
+_LIT8(KCaldavManualSync,"caldavmanualsync");
+_LIT8(KCaldavTime,"caldavtime");
+_LIT8(KCaldavUser,"caldavuser");
+_LIT8(KCaldavPassword,"caldavpassword");
+_LIT8(KCaldavUrl,"caldavurl");
+_LIT8(KCaldavKeepServer,"caldavkeepserver");
+_LIT8(KCaldavImmediateSync,"caldavimmediatesync");
+_LIT8(KCaldavPastDays,"caldavpastdays");
+_LIT8(KCaldavSyncInterval,"caldavsyncinterval");
+
+class CalDavUtils : public CBase
+ {
+public:
+
+ ~CalDavUtils();
+
+ static CalDavUtils* NewL();
+ static CalDavUtils* NewLC();
+
+ static void ScanDAVHeaderL(RHTTPTransaction &aTransaction,
+ TCalDAVOptions &aOptions);
+ static void ScanAllowHeaderL(RHTTPTransaction &aTransaction,
+ TCalDAVOptions &aOptions);
+ static void FixExportIssues(TDes8 &aDes);
+ static void FixImportIssues(TDes8 &aDes);
+ static void GetFileName(const TDesC8 &aIcs, TDes8 &aUrl);
+
+ static HBufC8* EnsureSlashL(HBufC8* aIn);
+ static HBufC8* CalDavUtils::EnsureSlashL(const TDesC8 &aIn);
+
+private:
+
+ CalDavUtils();
+ void ConstructL();
+
+ static void FindAndRemoveMethod(TDes8 &aDes);
+ static void FixBYMONTHDAY(TDes8 &aDes);
+ static void FixSameTime(TDes8 &aDes);
+ static void FixLineFeed(TDes8 &aDes);
+
+ };
+
+#endif // CALDAVUTILS_H
--- a/calendarengines/caldav/inc/httpclient.h Mon Mar 08 21:43:23 2010 +0000
+++ b/calendarengines/caldav/inc/httpclient.h Sun Mar 14 13:09:26 2010 +0000
@@ -1,146 +1,146 @@
-/*
-* Copyright (c) 2010 Sun Microsystems, Inc. and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributor:
-* Maximilian Odendahl
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#ifndef HTTPCLIENT_H
-#define HTTPCLIENT_H
-
-#include <http\MHTTPAuthenticationCallback.h>
-#include <http\mhttptransactioncallback.h>
-#include <http\mhttpdatasupplier.h>
-
-#include <es_sock.h>
-#include <extendedconnpref.h>
-
-struct TCalDAVOptions;
-
-_LIT8(KHTTP200,"http/1.1 200 ok");
-_LIT8(KHTTP201,"http/1.1 201 created");
-_LIT8(KHTTP404,"http/1.1 404 not found");
-
-#define ERROR 0
-#define OK 200
-#define CREATED 201
-#define NOCONTENT 204
-#define MULTISTATUS 207
-#define MUTIPLECHOICES 300
-#define BADREQUEST 400
-#define FORBIDDEN 403
-#define NOTFOUND 404
-#define NOTALLOWED 405
-#define CONFLICT 409
-#define PRECONDFAILED 412
-
-enum THttpAction
- {
- EActionUpload, EActionDelete, EActionOption, EActionNone
- };
-
-class CHttpClient : public CBase,
- public MHTTPDataSupplier,
- public MHTTPAuthenticationCallback,
- public MHTTPTransactionCallback
- {
-public:
- virtual ~CHttpClient();
- static CHttpClient* NewLC();
- static CHttpClient* NewL();
-
- TInt PutL(const TDesC8 &aUrl, const TDesC8 &aICS, CBufFlat *aResponse,
- const TDesC8 &aEtag = KNullDesC8);
- TInt MkCalendarL(const TDesC8 &aUrl, const TDesC8 &aBody,
- CBufFlat *aResponse);
- TInt DeleteL(const TDesC8 &aUrl, const TDesC8 &aETag = KNullDesC8);
- TInt HeadL(const TDesC8 &aUrl);
- TInt GetL(const TDesC8 &aUrl, CBufFlat *aResponse);
- TInt PropfindL(const TDesC8 &aUrl, const TDesC8 &aBodyRequest,
- CBufFlat *aResponse, TBool depth0 = ETrue);
- TInt ReportL(const TDesC8 &aUrl, const TDesC8 &aBodyRequest,
- CBufFlat *aResponse);
- TInt ProppatchL(const TDesC8 &aUrl, const TDesC8 &aBodyRequest,
- CBufFlat *aResponse);
-
- TInt GetServerOptionsL(const TDesC8 &aUrl, TCalDAVOptions &aOptions);
-
- // methods inherited from MHTTPDataSupplier
- virtual TBool GetNextDataPart(TPtrC8& aDataPart);
- virtual void ReleaseData();
- virtual TInt OverallDataSize();
- virtual TInt Reset();
-
- TInt ReturnCode();
- TPtrC8 ETag();
-
- //
- // methods from MHTTPTransactionCallback
- //
- virtual void MHFRunL(RHTTPTransaction aTransaction,
- const THTTPEvent& aEvent);
- virtual TInt MHFRunError(TInt aError, RHTTPTransaction aTransaction,
- const THTTPEvent& aEvent);
-
- // methods inherited from MHTTPAuthenticationCallback
- virtual TBool GetCredentialsL(const TUriC8& aURI, RString aRealm,
- RStringF aAuthenticationType, RString& aUsername,
- RString& aPassword);
-
- TPtrC8 User();
- void SetUserL(const TDesC8 &aUser);
-
- void SetPasswordL(const TDesC8 &aPassword);
- TPtrC8 Password();
-
-protected:
- CHttpClient();
- void ConstructL();
-private:
-
- void InvokeHttpMethodL(const TDesC8& aUri, RStringF aMethod);
- void SetHeaderL(RHTTPHeaders aHeaders, TInt aHdrField,
- const TDesC8& aHdrValue);
- void SetHeaderL(RHTTPHeaders aHeaders, const TDesC8 &aField,
- const TDesC8 &aValue);
- void GetEtagHeaderL(RHTTPTransaction& aTransaction);
-
- void GetPostBodyManuallyL();
-
- void OpenSessionL();
-
-private:
- RHTTPSession iSess;
- RHTTPTransaction iTrans;
- TParse iParsedFileName;
- CBufFlat* iBodyResponse;
- HBufC8* iBodyRequest;
-
- RSocketServ iSocketServ;
- RConnection iRConnection;
- TConnPrefList iPrefList;
- TExtendedConnPref iExtPrefs;
-
- HBufC8 *iUser;
- HBufC8 *iPassword;
-
- TCalDAVOptions *iOptions;
- THttpAction iAction;
-
- TInt iReturnCode;
- HBufC8* iEtag;
- TInt iCredentialCount;
-
- };
-
-#endif
+/*
+* Copyright (c) 2010 Sun Microsystems, Inc. and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributor:
+* Maximilian Odendahl
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef HTTPCLIENT_H
+#define HTTPCLIENT_H
+
+#include <http\MHTTPAuthenticationCallback.h>
+#include <http\mhttptransactioncallback.h>
+#include <http\mhttpdatasupplier.h>
+
+#include <es_sock.h>
+#include <extendedconnpref.h>
+
+struct TCalDAVOptions;
+
+_LIT8(KHTTP200,"http/1.1 200 ok");
+_LIT8(KHTTP201,"http/1.1 201 created");
+_LIT8(KHTTP404,"http/1.1 404 not found");
+
+#define ERROR 0
+#define OK 200
+#define CREATED 201
+#define NOCONTENT 204
+#define MULTISTATUS 207
+#define MUTIPLECHOICES 300
+#define BADREQUEST 400
+#define FORBIDDEN 403
+#define NOTFOUND 404
+#define NOTALLOWED 405
+#define CONFLICT 409
+#define PRECONDFAILED 412
+
+enum THttpAction
+ {
+ EActionUpload, EActionDelete, EActionOption, EActionNone
+ };
+
+class CHttpClient : public CBase,
+ public MHTTPDataSupplier,
+ public MHTTPAuthenticationCallback,
+ public MHTTPTransactionCallback
+ {
+public:
+ virtual ~CHttpClient();
+ static CHttpClient* NewLC();
+ static CHttpClient* NewL();
+
+ TInt PutL(const TDesC8 &aUrl, const TDesC8 &aICS, CBufFlat *aResponse,
+ const TDesC8 &aEtag = KNullDesC8);
+ TInt MkCalendarL(const TDesC8 &aUrl, const TDesC8 &aBody,
+ CBufFlat *aResponse);
+ TInt DeleteL(const TDesC8 &aUrl, const TDesC8 &aETag = KNullDesC8);
+ TInt HeadL(const TDesC8 &aUrl);
+ TInt GetL(const TDesC8 &aUrl, CBufFlat *aResponse);
+ TInt PropfindL(const TDesC8 &aUrl, const TDesC8 &aBodyRequest,
+ CBufFlat *aResponse, TBool depth0 = ETrue);
+ TInt ReportL(const TDesC8 &aUrl, const TDesC8 &aBodyRequest,
+ CBufFlat *aResponse);
+ TInt ProppatchL(const TDesC8 &aUrl, const TDesC8 &aBodyRequest,
+ CBufFlat *aResponse);
+
+ TInt GetServerOptionsL(const TDesC8 &aUrl, TCalDAVOptions &aOptions);
+
+ // methods inherited from MHTTPDataSupplier
+ virtual TBool GetNextDataPart(TPtrC8& aDataPart);
+ virtual void ReleaseData();
+ virtual TInt OverallDataSize();
+ virtual TInt Reset();
+
+ TInt ReturnCode();
+ TPtrC8 ETag();
+
+ //
+ // methods from MHTTPTransactionCallback
+ //
+ virtual void MHFRunL(RHTTPTransaction aTransaction,
+ const THTTPEvent& aEvent);
+ virtual TInt MHFRunError(TInt aError, RHTTPTransaction aTransaction,
+ const THTTPEvent& aEvent);
+
+ // methods inherited from MHTTPAuthenticationCallback
+ virtual TBool GetCredentialsL(const TUriC8& aURI, RString aRealm,
+ RStringF aAuthenticationType, RString& aUsername,
+ RString& aPassword);
+
+ TPtrC8 User();
+ void SetUserL(const TDesC8 &aUser);
+
+ void SetPasswordL(const TDesC8 &aPassword);
+ TPtrC8 Password();
+
+protected:
+ CHttpClient();
+ void ConstructL();
+private:
+
+ void InvokeHttpMethodL(const TDesC8& aUri, RStringF aMethod);
+ void SetHeaderL(RHTTPHeaders aHeaders, TInt aHdrField,
+ const TDesC8& aHdrValue);
+ void SetHeaderL(RHTTPHeaders aHeaders, const TDesC8 &aField,
+ const TDesC8 &aValue);
+ void GetEtagHeaderL(RHTTPTransaction& aTransaction);
+
+ void GetPostBodyManuallyL();
+
+ void OpenSessionL();
+
+private:
+ RHTTPSession iSess;
+ RHTTPTransaction iTrans;
+ TParse iParsedFileName;
+ CBufFlat* iBodyResponse;
+ HBufC8* iBodyRequest;
+
+ RSocketServ iSocketServ;
+ RConnection iRConnection;
+ TConnPrefList iPrefList;
+ TExtendedConnPref iExtPrefs;
+
+ HBufC8 *iUser;
+ HBufC8 *iPassword;
+
+ TCalDAVOptions *iOptions;
+ THttpAction iAction;
+
+ TInt iReturnCode;
+ HBufC8* iEtag;
+ TInt iCredentialCount;
+
+ };
+
+#endif
--- a/calendarengines/caldav/src/caldavclient.cpp Mon Mar 08 21:43:23 2010 +0000
+++ b/calendarengines/caldav/src/caldavclient.cpp Sun Mar 14 13:09:26 2010 +0000
@@ -1,329 +1,329 @@
-/*
-* Copyright (c) 2010 Sun Microsystems, Inc. and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributor:
-* Maximilian Odendahl
-*
-* Contributors:
-*
-* Description: provides a client API for Caldav server
-*
-*/
-
-#include "caldavclient.h"
-#include "caldavserver.h"
-#include "caldavutils.h"
-
-const TUint KDefaultMessageSlots = 4;
-
-// testing ************
-#include <e32base.h>
-#include <e32cons.h>
-#include <e32cmn.h>
-
-/**
- * RCalDavServer::RCalDavServer
- * default constructor
- */
-EXPORT_C RCalDavServer::RCalDavServer()
- {
- }
-
-/**
- * RCalDavServer::Connect
- * connect to server
- */
-EXPORT_C TInt RCalDavServer::Connect()
- {
- TInt retry = 2;
- for (;;)
- {
- TInt r = CreateSession(KCalDavServerName, Version(),
- KDefaultMessageSlots);
-
- if ((KErrNotFound != r) && (KErrServerTerminated != r))
- return (r);
-
- if (--retry == 0)
- return (r);
-
- r = StartServer();
- if ((KErrNone != r) && (KErrAlreadyExists != r))
- return (r);
- }
- }
-
-/**
- * RCalDavServer::Enable
- * enable Caldav sync
- */
-EXPORT_C TInt RCalDavServer::Enable(const TDesC &aCalendar)
- {
- TIpcArgs args(&aCalendar);
- return SendReceive(ECalDavEnable, args);
- }
-
-/**
- * RCalDavServer::Disable
- * disable Caldav sync
- */
-EXPORT_C TInt RCalDavServer::Disable(const TDesC &aCalendar)
- {
- TIpcArgs args(&aCalendar);
- return SendReceive(ECalDavDisable, args);
- }
-
-/**
- * RCalDavServer::EnabledSync
- * check for enabled sync
- */
-EXPORT_C TInt RCalDavServer::EnabledSync(const TDesC &aCalendar,
- TBool &aEnabled)
- {
- TPckg<TBool> enabled(aEnabled);
- TIpcArgs args(&aCalendar, &enabled);
- return (SendReceive(ECalDavEnabled, args));
- }
-
-/**
- * RCalDavServer::Sync
- * sync now a specific calendar
- */
-EXPORT_C TInt RCalDavServer::Sync(const TDesC &aCalendar)
- {
- TIpcArgs args(&aCalendar);
- return SendReceive(ECalDavSync, args);
- }
-
-/**
- * RCalDavServer::SyncAll
- * sync now all calendars
- */
-EXPORT_C TInt RCalDavServer::SyncAll()
- {
- return SendReceive(ECalDavSyncAll);
- }
-
-/**
- * RCalDavServer::Url
- * get caldav sync url
- */
-EXPORT_C TInt RCalDavServer::Url(const TDesC &aCalendar, TDes8 &aUrl)
- {
- TIpcArgs args(&aCalendar, &aUrl);
- return SendReceive(ECalDavUrl, args);
- }
-
-/**
- * RCalDavServer::SetUrl
- * set url
- */
-EXPORT_C TInt RCalDavServer::SetUrl(const TDesC &aCalendar, const TDesC8 &aUrl)
- {
- TIpcArgs args(&aCalendar, &aUrl);
- return SendReceive(ECalDavSetUrl, args);
- }
-
-/**
- * RCalDavServer::Username
- * get username
- */
-EXPORT_C TInt RCalDavServer::Username(const TDesC &aCalendar, TDes8 &aUsername)
- {
- TIpcArgs args(&aCalendar, &aUsername);
- return SendReceive(ECalDavUsername, args);
- }
-
-/**
- * RCalDavServer::SetUsername
- * set username
- */
-EXPORT_C TInt RCalDavServer::SetUsername(const TDesC &aCalendar,
- const TDesC8 &aUsername)
- {
- TIpcArgs args(&aCalendar, &aUsername);
- return SendReceive(ECalDavSetUsername, args);
- }
-
-/**
- * RCalDavServer::Password
- * get password
- */
-EXPORT_C TInt RCalDavServer::Password(const TDesC &aCalendar, TDes8 &aPassword)
- {
- TIpcArgs args(&aCalendar, &aPassword);
- return SendReceive(ECalDavPassword, args);
- }
-
-/**
- * RCalDavServer::SetPassword
- * set password
- */
-EXPORT_C TInt RCalDavServer::SetPassword(const TDesC &aCalendar,
- const TDesC8 &aPassword)
- {
- TIpcArgs args(&aCalendar, &aPassword);
- return SendReceive(ECalDavSetPassword, args);
- }
-
-/**
- * RCalDavServer::SyncInterval
- * get SyncInterval
- */
-EXPORT_C TInt RCalDavServer::SyncInterval(const TDesC &aCalendar,
- TTimeIntervalMinutes& aSyncInterval)
- {
- TPckg<TTimeIntervalMinutes> syncinterval(aSyncInterval);
- TIpcArgs args(&aCalendar, &syncinterval);
- return (SendReceive(ECalDavSyncInterval, args));
- }
-
-/**
- * RCalDavServer::SetSyncInterval
- * set SyncInterval
- */
-EXPORT_C TInt RCalDavServer::SetSyncInterval(const TDesC &aCalendar,
- TTimeIntervalMinutes aSyncInterval)
- {
- TPckg<TTimeIntervalMinutes> syncinterval(aSyncInterval);
- TIpcArgs args(&aCalendar, &syncinterval);
- return (SendReceive(ECalDavSetSyncInterval, args));
- }
-
-/**
- * RCalDavServer::PastDays
- * get past days
- */
-EXPORT_C TInt RCalDavServer::PastDays(const TDesC &aCalendar,
- TTimeIntervalDays &aDays)
- {
- TPckg<TTimeIntervalDays> pastdays(aDays);
- TIpcArgs args(&aCalendar, &pastdays);
- return (SendReceive(ECalDavPastDays, args));
- }
-
-/**
- * RCalDavServer::SetPastDays
- * set past days
- */
-EXPORT_C TInt RCalDavServer::SetPastDays(const TDesC &aCalendar,
- TTimeIntervalDays aDays)
- {
- TPckg<TTimeIntervalDays> pastdays(aDays);
- TIpcArgs args(&aCalendar, &pastdays);
- return (SendReceive(ECalDavSetPastDays, args));
- }
-
-/**
- * RCalDavServer::ImmediateSync
- * get Immediate Sync
- */
-EXPORT_C TInt RCalDavServer::ImmediateSync(const TDesC &aCalendar,
- TBool &aImmediateSyc)
- {
- TPckg<TBool> syncimmediate(aImmediateSyc);
- TIpcArgs args(&aCalendar, &syncimmediate);
- return (SendReceive(ECalDavImmediateSync, args));
- }
-
-/**
- * RCalDavServer::SetImmediateSync
- * set immediate Sync
- */
-EXPORT_C TInt RCalDavServer::SetImmediateSync(const TDesC &aCalendar,
- TBool aImmediateSyc)
- {
- TPckg<TBool> syncimmediate(aImmediateSyc);
- TIpcArgs args(&aCalendar, &syncimmediate);
- return SendReceive(ECalDavSetImmediateSync, args);
- }
-
-/**
- * RCalDavServer::KeepServerEntry
- * get KeepServerEntry
- */
-EXPORT_C TInt RCalDavServer::KeepServerEntry(const TDesC &aCalendar,
- TBool &aKeepServerEntry)
- {
- TPckg<TBool> keepserverentry(aKeepServerEntry);
- TIpcArgs args(&aCalendar, &keepserverentry);
- return SendReceive(ECalDavKeepServer, args);
- }
-
-/**
- * RCalDavServer::SetKeepServerEntry
- * set KeepServerEntry
- */
-EXPORT_C TInt RCalDavServer::SetKeepServerEntry(const TDesC &aCalendar,
- TBool aKeepServerEntry)
- {
- TPckg<TBool> keepserverentry(aKeepServerEntry);
- TIpcArgs args(&aCalendar, &keepserverentry);
- return SendReceive(ECalDavSetKeepServer, args);
- }
-
-/**
- * RCalDavServer::Version
- * get version
- */
-TVersion RCalDavServer::Version(void) const
- {
- return (TVersion(KCalDavServerMajorVersionNumber,
- KCalDavServerMinorVersionNumber, KCalDavServerBuildVersionNumber));
- }
-
-/**
- * RCalDavServer::UnsupportedRequest()
- * A server request to stop the server.
- * This is a request that is NOT implemented by the server; it is here to show
- * the handling of non-implemented requests.
- */
-TInt RCalDavServer::UnsupportedRequest()
- {
- return SendReceive(ECalDavUnsupportedRequest);
- }
-
-/**
- * RCalDavServer::BadRequest()
- * A request that the server knows nothing about.
- */
-void RCalDavServer::BadRequest()
- {
- SendReceive(9999);
- }
-
-static TInt StartServer()
- {
- RProcess server;
- TInt r = server.Create(KCalDavServerFilename, KNullDesC);
- if (r != KErrNone)
- return r;
-
- TRequestStatus stat;
- server.Rendezvous(stat);
-
- if (stat != KRequestPending)
- server.Kill(0); // abort startup
- else
- server.Resume(); // logon OK - start the server
-
- User::WaitForRequest(stat); // wait for start or death
-
- // Check the exit type.
- // We can't use the 'exit reason' because if the server panicked this
- // is set to the panic 'reason' (which may be '0' and cannot thus be distinguished
- // from KErrNone)
- r = server.ExitType();
- if (EExitPanic == r)
- r = KErrGeneral;
- else
- r = stat.Int();
-
- server.Close(); // This is no longer needed
- return r;
- }
+/*
+* Copyright (c) 2010 Sun Microsystems, Inc. and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributor:
+* Maximilian Odendahl
+*
+* Contributors:
+*
+* Description: provides a client API for Caldav server
+*
+*/
+
+#include "caldavclient.h"
+#include "caldavserver.h"
+#include "caldavutils.h"
+
+const TUint KDefaultMessageSlots = 4;
+
+// testing ************
+#include <e32base.h>
+#include <e32cons.h>
+#include <e32cmn.h>
+
+/**
+ * RCalDavServer::RCalDavServer
+ * default constructor
+ */
+EXPORT_C RCalDavServer::RCalDavServer()
+ {
+ }
+
+/**
+ * RCalDavServer::Connect
+ * connect to server
+ */
+EXPORT_C TInt RCalDavServer::Connect()
+ {
+ TInt retry = 2;
+ for (;;)
+ {
+ TInt r = CreateSession(KCalDavServerName, Version(),
+ KDefaultMessageSlots);
+
+ if ((KErrNotFound != r) && (KErrServerTerminated != r))
+ return (r);
+
+ if (--retry == 0)
+ return (r);
+
+ r = StartServer();
+ if ((KErrNone != r) && (KErrAlreadyExists != r))
+ return (r);
+ }
+ }
+
+/**
+ * RCalDavServer::Enable
+ * enable Caldav sync
+ */
+EXPORT_C TInt RCalDavServer::Enable(const TDesC &aCalendar)
+ {
+ TIpcArgs args(&aCalendar);
+ return SendReceive(ECalDavEnable, args);
+ }
+
+/**
+ * RCalDavServer::Disable
+ * disable Caldav sync
+ */
+EXPORT_C TInt RCalDavServer::Disable(const TDesC &aCalendar)
+ {
+ TIpcArgs args(&aCalendar);
+ return SendReceive(ECalDavDisable, args);
+ }
+
+/**
+ * RCalDavServer::EnabledSync
+ * check for enabled sync
+ */
+EXPORT_C TInt RCalDavServer::EnabledSync(const TDesC &aCalendar,
+ TBool &aEnabled)
+ {
+ TPckg<TBool> enabled(aEnabled);
+ TIpcArgs args(&aCalendar, &enabled);
+ return (SendReceive(ECalDavEnabled, args));
+ }
+
+/**
+ * RCalDavServer::Sync
+ * sync now a specific calendar
+ */
+EXPORT_C TInt RCalDavServer::Sync(const TDesC &aCalendar)
+ {
+ TIpcArgs args(&aCalendar);
+ return SendReceive(ECalDavSync, args);
+ }
+
+/**
+ * RCalDavServer::SyncAll
+ * sync now all calendars
+ */
+EXPORT_C TInt RCalDavServer::SyncAll()
+ {
+ return SendReceive(ECalDavSyncAll);
+ }
+
+/**
+ * RCalDavServer::Url
+ * get caldav sync url
+ */
+EXPORT_C TInt RCalDavServer::Url(const TDesC &aCalendar, TDes8 &aUrl)
+ {
+ TIpcArgs args(&aCalendar, &aUrl);
+ return SendReceive(ECalDavUrl, args);
+ }
+
+/**
+ * RCalDavServer::SetUrl
+ * set url
+ */
+EXPORT_C TInt RCalDavServer::SetUrl(const TDesC &aCalendar, const TDesC8 &aUrl)
+ {
+ TIpcArgs args(&aCalendar, &aUrl);
+ return SendReceive(ECalDavSetUrl, args);
+ }
+
+/**
+ * RCalDavServer::Username
+ * get username
+ */
+EXPORT_C TInt RCalDavServer::Username(const TDesC &aCalendar, TDes8 &aUsername)
+ {
+ TIpcArgs args(&aCalendar, &aUsername);
+ return SendReceive(ECalDavUsername, args);
+ }
+
+/**
+ * RCalDavServer::SetUsername
+ * set username
+ */
+EXPORT_C TInt RCalDavServer::SetUsername(const TDesC &aCalendar,
+ const TDesC8 &aUsername)
+ {
+ TIpcArgs args(&aCalendar, &aUsername);
+ return SendReceive(ECalDavSetUsername, args);
+ }
+
+/**
+ * RCalDavServer::Password
+ * get password
+ */
+EXPORT_C TInt RCalDavServer::Password(const TDesC &aCalendar, TDes8 &aPassword)
+ {
+ TIpcArgs args(&aCalendar, &aPassword);
+ return SendReceive(ECalDavPassword, args);
+ }
+
+/**
+ * RCalDavServer::SetPassword
+ * set password
+ */
+EXPORT_C TInt RCalDavServer::SetPassword(const TDesC &aCalendar,
+ const TDesC8 &aPassword)
+ {
+ TIpcArgs args(&aCalendar, &aPassword);
+ return SendReceive(ECalDavSetPassword, args);
+ }
+
+/**
+ * RCalDavServer::SyncInterval
+ * get SyncInterval
+ */
+EXPORT_C TInt RCalDavServer::SyncInterval(const TDesC &aCalendar,
+ TTimeIntervalMinutes& aSyncInterval)
+ {
+ TPckg<TTimeIntervalMinutes> syncinterval(aSyncInterval);
+ TIpcArgs args(&aCalendar, &syncinterval);
+ return (SendReceive(ECalDavSyncInterval, args));
+ }
+
+/**
+ * RCalDavServer::SetSyncInterval
+ * set SyncInterval
+ */
+EXPORT_C TInt RCalDavServer::SetSyncInterval(const TDesC &aCalendar,
+ TTimeIntervalMinutes aSyncInterval)
+ {
+ TPckg<TTimeIntervalMinutes> syncinterval(aSyncInterval);
+ TIpcArgs args(&aCalendar, &syncinterval);
+ return (SendReceive(ECalDavSetSyncInterval, args));
+ }
+
+/**
+ * RCalDavServer::PastDays
+ * get past days
+ */
+EXPORT_C TInt RCalDavServer::PastDays(const TDesC &aCalendar,
+ TTimeIntervalDays &aDays)
+ {
+ TPckg<TTimeIntervalDays> pastdays(aDays);
+ TIpcArgs args(&aCalendar, &pastdays);
+ return (SendReceive(ECalDavPastDays, args));
+ }
+
+/**
+ * RCalDavServer::SetPastDays
+ * set past days
+ */
+EXPORT_C TInt RCalDavServer::SetPastDays(const TDesC &aCalendar,
+ TTimeIntervalDays aDays)
+ {
+ TPckg<TTimeIntervalDays> pastdays(aDays);
+ TIpcArgs args(&aCalendar, &pastdays);
+ return (SendReceive(ECalDavSetPastDays, args));
+ }
+
+/**
+ * RCalDavServer::ImmediateSync
+ * get Immediate Sync
+ */
+EXPORT_C TInt RCalDavServer::ImmediateSync(const TDesC &aCalendar,
+ TBool &aImmediateSyc)
+ {
+ TPckg<TBool> syncimmediate(aImmediateSyc);
+ TIpcArgs args(&aCalendar, &syncimmediate);
+ return (SendReceive(ECalDavImmediateSync, args));
+ }
+
+/**
+ * RCalDavServer::SetImmediateSync
+ * set immediate Sync
+ */
+EXPORT_C TInt RCalDavServer::SetImmediateSync(const TDesC &aCalendar,
+ TBool aImmediateSyc)
+ {
+ TPckg<TBool> syncimmediate(aImmediateSyc);
+ TIpcArgs args(&aCalendar, &syncimmediate);
+ return SendReceive(ECalDavSetImmediateSync, args);
+ }
+
+/**
+ * RCalDavServer::KeepServerEntry
+ * get KeepServerEntry
+ */
+EXPORT_C TInt RCalDavServer::KeepServerEntry(const TDesC &aCalendar,
+ TBool &aKeepServerEntry)
+ {
+ TPckg<TBool> keepserverentry(aKeepServerEntry);
+ TIpcArgs args(&aCalendar, &keepserverentry);
+ return SendReceive(ECalDavKeepServer, args);
+ }
+
+/**
+ * RCalDavServer::SetKeepServerEntry
+ * set KeepServerEntry
+ */
+EXPORT_C TInt RCalDavServer::SetKeepServerEntry(const TDesC &aCalendar,
+ TBool aKeepServerEntry)
+ {
+ TPckg<TBool> keepserverentry(aKeepServerEntry);
+ TIpcArgs args(&aCalendar, &keepserverentry);
+ return SendReceive(ECalDavSetKeepServer, args);
+ }
+
+/**
+ * RCalDavServer::Version
+ * get version
+ */
+TVersion RCalDavServer::Version(void) const
+ {
+ return (TVersion(KCalDavServerMajorVersionNumber,
+ KCalDavServerMinorVersionNumber, KCalDavServerBuildVersionNumber));
+ }
+
+/**
+ * RCalDavServer::UnsupportedRequest()
+ * A server request to stop the server.
+ * This is a request that is NOT implemented by the server; it is here to show
+ * the handling of non-implemented requests.
+ */
+TInt RCalDavServer::UnsupportedRequest()
+ {
+ return SendReceive(ECalDavUnsupportedRequest);
+ }
+
+/**
+ * RCalDavServer::BadRequest()
+ * A request that the server knows nothing about.
+ */
+void RCalDavServer::BadRequest()
+ {
+ SendReceive(9999);
+ }
+
+static TInt StartServer()
+ {
+ RProcess server;
+ TInt r = server.Create(KCalDavServerFilename, KNullDesC);
+ if (r != KErrNone)
+ return r;
+
+ TRequestStatus stat;
+ server.Rendezvous(stat);
+
+ if (stat != KRequestPending)
+ server.Kill(0); // abort startup
+ else
+ server.Resume(); // logon OK - start the server
+
+ User::WaitForRequest(stat); // wait for start or death
+
+ // Check the exit type.
+ // We can't use the 'exit reason' because if the server panicked this
+ // is set to the panic 'reason' (which may be '0' and cannot thus be distinguished
+ // from KErrNone)
+ r = server.ExitType();
+ if (EExitPanic == r)
+ r = KErrGeneral;
+ else
+ r = stat.Int();
+
+ server.Close(); // This is no longer needed
+ return r;
+ }
--- a/calendarengines/caldav/src/caldavengine.cpp Mon Mar 08 21:43:23 2010 +0000
+++ b/calendarengines/caldav/src/caldavengine.cpp Sun Mar 14 13:09:26 2010 +0000
@@ -1,2612 +1,2617 @@
-/*
- * Copyright (c) 2010 Sun Microsystems, Inc. and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributor:
- * Maximilian Odendahl
- *
- * Contributors:
- *
- * Description: main Caldav class, all magic happens here
- * one engine for each configured Caldav calendar
- */
-#include "caldavengine.h"
-#include <f32file.h>
-#include <S32FILE.H>
-#include <S32MEM.H>
-#include <avkon.rsg>
-#include <UTF.H>
-#include <agnexportobserver.h>
-#include <calsession.h>
-#include <caliterator.h>
-#include <calentry.h>
-#include <calentryview.h>
-#include <caltime.h>
-#include <calalarm.h>
-#include <calcategory.h>
-#include <caluser.h>
-#include <calrrule.h>
-#include <calinstance.h>
-#include <calinstanceview.h>
-#include <caleninterimutils2.h>
-#include <calenexporter.h>
-#include <calenimporter.h>
-#include <calcalendarinfo.h>
-#include "calenglobaldata.h"
-#include <xmlengdocument.h>
-#include <xmlengnode.h>
-#include <xmlengelement.h>
-#include <xmlengnodelist.h>
-#include <xmlengtext.h>
-#include "httpclient.h"
-#include <e32math.h> // divmod
-#define MULTIGETSPLIT 100
-#define ARRAYEXPAND 4
-#define URLMAX 500
-#define EXPANDSIZE_SMALL 512
-#define EXPANDSIZE_BIG 1024
-_LIT(KFormatString,"\"%F%Y%M%DT000000Z\"");
-
-/**
- * SyncTickL
- * timer for basic sync interval
- */
-TInt SyncTickL(TAny *aObject)
- {
- CCalDavEngine* engine = ((CCalDavEngine*) aObject);
- CPeriodic* timer = engine->Timer();
- if (engine && timer)
- {
- timer->Cancel();
- TRAP_IGNORE(engine->SyncL());
- TInt ticktime = engine->SyncInterval().Int() == 0 ? 1
- : engine->SyncInterval().Int();
- const TUint64 tickInterval = 1000000 * 60 * ticktime;
- timer->Start(tickInterval, tickInterval, TCallBack(SyncTickL, engine));
- }
- return 0;
- }
-
-#ifdef _DEBUG
-void ExportToFileNameL(const TDesC8& aDes, const TDesC &aFilename)
- {
- RFs fsSession;
- User::LeaveIfError(fsSession.Connect());
- CleanupClosePushL(fsSession);
-
- TInt err = fsSession.MkDirAll(aFilename);
-
- RFile file;
- User::LeaveIfError(file.Replace(fsSession, aFilename, EFileWrite));
- CleanupClosePushL(file);
-
- RFileWriteStream writeStream2;
- writeStream2.Attach(file);
- CleanupClosePushL(writeStream2);
-
- writeStream2 << aDes;
- writeStream2.CommitL();
- CleanupStack::PopAndDestroy(&writeStream2);
- CleanupStack::PopAndDestroy(&file);
- CleanupStack::PopAndDestroy(&fsSession);
- }
-
-void ExportToFileL(CCalEntry* aEntry, CCalenExporter *iCalExporter)
- {
- if (aEntry)
- {
- _LIT(KFileName, "C:\\logs\\caldav\\testing_export.txt");
-
- RFs fsSession;
- User::LeaveIfError(fsSession.Connect());
- CleanupClosePushL(fsSession);
-
- TInt err = fsSession.MkDirAll(KFileName);
-
- RFile file;
- User::LeaveIfError(file.Replace(fsSession, KFileName, EFileWrite));
- CleanupClosePushL(file);
-
- RFileWriteStream writeStream2;
- writeStream2.Attach(file);
- CleanupClosePushL(writeStream2);
-
- iCalExporter->ExportICalL(*aEntry, writeStream2);
- writeStream2.CommitL();
- CleanupStack::PopAndDestroy(&writeStream2);
- CleanupStack::PopAndDestroy(&file);
- CleanupStack::PopAndDestroy(&fsSession);
- }
- }
-#endif
-
-/**
- * SearchL
- * search inside xml tree for a specific node
- */
-void SearchL(TXmlEngNode &aTopNode, const TDesC8 &aName,
- const TDesC8 &aNamespace, TXmlEngNode & aReturnNode)
- {
- RXmlEngNodeList<TXmlEngNode> List;
- aTopNode.GetChildNodes(List);
- while (List.HasNext() && aReturnNode.IsNull())
- {
- TXmlEngNode Node = List.Next();
- TXmlEngNode::TXmlEngDOMNodeType Type = Node.NodeType();
- if (Type == TXmlEngNode::EElement)
- {
- //todo: compare namespace ?
- if (Node.Name() == aName)
- {
- aReturnNode = Node.CopyL();
- return;
- }
- else
- {
- SearchL(Node, aName, aNamespace, aReturnNode);
- if (!aReturnNode.IsNull())
- return;
- }
- }
- }
- }
-
-/**
- * SearchL
- * search inside xml tree for a specific node
- */
-void SearchL(TXmlEngNode &aTopNode, const TDesC8 &aName,
- const TDesC8 &aNamespace, RBuf8 &aBuf)
- {
- RXmlEngNodeList<TXmlEngNode> List;
- aTopNode.GetChildNodes(List);
- while (List.HasNext())
- {
- TXmlEngNode Node = List.Next();
- TXmlEngNode::TXmlEngDOMNodeType Type = Node.NodeType();
- if (Type == TXmlEngNode::EElement)
- {
- //todo: compare namespace ?
- if (Node.Name() == aName)
- {
- if (Node.IsSimpleTextContents())
- aBuf.Create(Node.Value());
- else
- Node.WholeTextContentsCopyL(aBuf);
- return;
- }
- else
- {
- SearchL(Node, aName, aNamespace, aBuf);
- if (aBuf.Length())
- return;
- }
- }
- }
- }
-
-/**
- * SearchL
- * search inside xml tree for a specific node
- */
-TPtrC8 SearchL(TXmlEngNode &aTopNode, const TDesC8 &aName,
- const TDesC8 &aNamespace)
- {
- RXmlEngNodeList<TXmlEngNode> List;
- aTopNode.GetChildNodes(List);
- while (List.HasNext())
- {
- TXmlEngNode Node = List.Next();
- TXmlEngNode::TXmlEngDOMNodeType Type = Node.NodeType();
- if (Type == TXmlEngNode::EElement)
- {
- //todo: compare namespace ?
- if (Node.Name() == aName)
- return Node.Value();
- else
- {
- TPtrC8 Return = SearchL(Node, aName, aNamespace);
- if (Return != KNullDesC8)
- return Return;
- }
- }
- }
- return KNullDesC8();
- }
-
-/**
- * GetBoolFromPropertiesL
- * get a boolean value from CCalCalendarInfo
- */
-TBool GetBoolFromPropertiesL(CCalCalendarInfo* info, const TDesC8 &aKey)
- {
- TBool boolean;
- TPckgC<TBool> pckgboolean(boolean);
- pckgboolean.Set(info->PropertyValueL(aKey));
- return pckgboolean();
- }
-
-/**
- * GetTimeFromPropertiesL
- * get a time value from CCalCalendarInfo
- */
-TCalTime GetTimeFromPropertiesL(CCalCalendarInfo* info, const TDesC8 &aKey)
- {
- TCalTime time;
- TPckgC<TCalTime> pckgtime(time);
- pckgtime.Set(info->PropertyValueL(aKey));
- return pckgtime();
- }
-
-/**
- * PropertyExists
- * finds a property from an array
- */
-TBool PropertyExists(CDesC8Array* aArray, const TDesC8 &aKey)
- {
- TInt pos = 0;
- return aArray->Find(aKey, pos, ECmpNormal) == KErrNone;
- }
-
-/**
- * CCalDavEngine::SetCalendarInfoL
- * set key and value pair at calendar session info
- */
-void CCalDavEngine::SetCalendarInfoL(const TDesC8 &aKey, const TDesC8 &aValue)
- {
- TBool createdelete = !iCalSession;
- if (createdelete)
- {
- iCalSession = CCalSession::NewL();
- TRAP_IGNORE(iCalSession->OpenL(*iCalendar));
- }
- CCalCalendarInfo* calendarInfo = iCalSession->CalendarInfoL();
- CleanupStack::PushL(calendarInfo);
- TPckgC<TBool> enabled(iEnabled);
- calendarInfo->SetPropertyL(KCaldavEnabled, enabled);
- if (aValue != KNullDesC8)
- calendarInfo->SetPropertyL(aKey, aValue);
- iCalSession->SetCalendarInfoL(*calendarInfo);
- CleanupStack::PopAndDestroy(calendarInfo);
-
- if (createdelete)
- {
- delete iCalSession;
- iCalSession = NULL;
- }
- }
-
-/**
- * CCalDavEngine::CCalDavEngine
- * default constructor
- */
-CCalDavEngine::CCalDavEngine() :
- iCalSession(0), iCalIter(0), iCalEntryView(0), iCalExporter(0),
- iCalImporter(0), iCalIntermimUtils2(0), iCalendar(0), iUrl(0),
- iBaseUrl(0), iHome(0), iHttp(0), iSynctoken(0), iCTag(0),
- iSyncInterval(DEFAULT_SYNC_MINUTES), iPastDays(DEFAULT_PAST_DAYS),
- iImmediateSync(DEFAULT_IMMEDIATE_SYNC), iKeepServerEntry(
- DEFAULT_KEEP_SERVER_ENTRY), iEnabled(EFalse), iTimer(0)
- {
- }
-
-/**
- * CCalDavEngine::~CCalDavEngine
- * default destructor
- */
-CCalDavEngine::~CCalDavEngine()
- {
- iLocalUidArray.Close();
- iGlobalUidArray.Close();
- iDeletedEntries.Close();
-
- iDomParser.Close();
- iDomImpl.Close();
-
- if (iCalendar)
- delete iCalendar;
-
- if (iUrl)
- delete iUrl;
-
- if (iBaseUrl)
- delete iBaseUrl;
-
- if (iHttp)
- delete iHttp;
-
- DeleteCalObjects();
-
- if (iCalIntermimUtils2)
- delete iCalIntermimUtils2;
-
- if (iSynctoken)
- delete iSynctoken;
-
- if (iCTag)
- delete iCTag;
-
- if (iHome)
- delete iHome;
-
- if (iTimer)
- delete iTimer;
- }
-
-/**
- * CCalDavEngine::NewLC
- * first phase construction
- */
-CCalDavEngine* CCalDavEngine::NewLC(const TDesC& aCalendar)
- {
- CCalDavEngine* self = new (ELeave) CCalDavEngine();
- CleanupStack::PushL(self);
- self->ConstructL(aCalendar);
- return self;
- }
-
-/**
- * CCalDavEngine::NewL
- * first phase construction
- */
-CCalDavEngine* CCalDavEngine::NewL(const TDesC& aCalendar)
- {
- CCalDavEngine* self = CCalDavEngine::NewLC(aCalendar);
- CleanupStack::Pop(self); // self;
- return self;
- }
-
-/**
- * CCalDavEngine::
- * second phase construction
- */
-void CCalDavEngine::ConstructL(const TDesC& aCalendar)
- {
- iManualSync = EFalse;
- iFirstInit = ETrue;
- iCalendar = aCalendar.AllocL();
-
- iHttp = CHttpClient::NewL();
-
- iDomImpl.OpenL();
- TInt err = iDomParser.Open(iDomImpl);
- if (KErrNone != err)
- User::Leave(err);
-
- iTimer = CPeriodic::NewL(EPriorityNormal);
- iCalIntermimUtils2 = CCalenInterimUtils2::NewL();
- iCalSession = CCalSession::NewL();
- TRAP_IGNORE(iCalSession->OpenL(aCalendar));
- CalendarInfoL();
- // we can't close the file, so delete it completly
- delete iCalSession;
- iCalSession = NULL;
- }
-
-/**
- * CCalDavEngine::Progress
- * Progress callback
- */
-void CCalDavEngine::Progress(TInt /*aPercentageCompleted*/)
- {
- }
-
-/**
- * CCalDavEngine::RegisterL
- * register all neccessary notification callback
- */
-void CCalDavEngine::RegisterL()
- {
- TDateTime Start;
- TDateTime End;
- End.SetYear(2200);
-
- TCalTime StartCal;
- TCalTime EndCal;
- StartCal.SetTimeLocalL(Start);
- EndCal.SetTimeLocalL(End);
- CalCommon::TCalTimeRange Range(StartCal, EndCal);
- CCalChangeNotificationFilter *Filter = CCalChangeNotificationFilter::NewL(
- MCalChangeCallBack2::EChangeEntryAll, true, Range);
- iCalSession->StartChangeNotification(*this, *Filter);
- iCalSession->StartFileChangeNotificationL(*this);
- delete Filter;
- }
-
-/**
- * CCalDavEngine::CalendarInfoL
- * load all properties from CalendarInfo
- */
-void CCalDavEngine::CalendarInfoL()
- {
- CCalCalendarInfo* calendarInfo = iCalSession->CalendarInfoL();
- if (calendarInfo->IsValid())
- {
- CleanupStack::PushL(calendarInfo);
- CDesC8Array* propertyKeys = calendarInfo->PropertyKeysL();
- CleanupStack::PushL(propertyKeys);
- TInt pos = 0;
- if (propertyKeys->Find(KCaldavEnabled, pos, ECmpNormal) == KErrNone)
- {
- iEnabled = GetBoolFromPropertiesL(calendarInfo, KCaldavEnabled);
- if (PropertyExists(propertyKeys, KCaldavFirstInit))
- iFirstInit = GetBoolFromPropertiesL(calendarInfo,
- KCaldavFirstInit);
- if (PropertyExists(propertyKeys, KCaldavSynctoken))
- iSynctoken
- = calendarInfo->PropertyValueL(KCaldavSynctoken).AllocL();
- if (PropertyExists(propertyKeys, KCaldavCtag))
- iCTag = calendarInfo->PropertyValueL(KCaldavCtag).AllocL();
- if (PropertyExists(propertyKeys, KCaldavManualSync))
- iManualSync = GetBoolFromPropertiesL(calendarInfo,
- KCaldavManualSync);
- if (PropertyExists(propertyKeys, KCaldavTime))
- iLastSyncTime = GetTimeFromPropertiesL(calendarInfo,
- KCaldavTime);
- if (PropertyExists(propertyKeys, KCaldavUrl))
- iUrl = calendarInfo->PropertyValueL(KCaldavUrl).AllocL();
- if (PropertyExists(propertyKeys, KCaldavUser))
- iHttp->SetUserL(calendarInfo->PropertyValueL(KCaldavUser));
- if (PropertyExists(propertyKeys, KCaldavPassword))
- iHttp->SetPasswordL(calendarInfo->PropertyValueL(
- KCaldavPassword));
- if (PropertyExists(propertyKeys, KCaldavKeepServer))
- iKeepServerEntry = GetBoolFromPropertiesL(calendarInfo,
- KCaldavKeepServer);
- if (PropertyExists(propertyKeys, KCaldavImmediateSync))
- iImmediateSync = GetBoolFromPropertiesL(calendarInfo,
- KCaldavImmediateSync);
- if (PropertyExists(propertyKeys, KCaldavPastDays))
- {
- TPckgC<TTimeIntervalDays> pastdays(iPastDays);
- pastdays.Set(calendarInfo->PropertyValueL(KCaldavPastDays));
- iPastDays = pastdays();
- }
- if (PropertyExists(propertyKeys, KCaldavSyncInterval))
- {
- TPckgC<TTimeIntervalMinutes> syncinterval(iSyncInterval);
- syncinterval.Set(calendarInfo->PropertyValueL(
- KCaldavSyncInterval));
- iSyncInterval = syncinterval();
- }
- // access point
- }
-
- CleanupStack::PopAndDestroy(propertyKeys);
- CleanupStack::Pop(calendarInfo);
- }
- delete calendarInfo;
- }
-
-/**
- * CCalDavEngine::InitL
- * check for correct url
- * load most Caldav url properties
- * do inital sync
- */
-TInt CCalDavEngine::InitL()
- {
- // this is only needed to find a GlobalUID from a LocalUID, used after an event was deleted
- // also used now for uploading of local events when only GlobalUID is know
- LocalLoopL(ELoopActionFillArray);
-
- if (iFirstInit)
- {
- TInt err = GetCalendarUrlsL(NULL);
- if (err == KErrArgument)
- return KErrArgument;
- GetOptionsL();
- SetLastSyncTimeL();
-
- TBool success;
- // get all server items
- if (iOptions.sync_collection)
- success = WebDavSyncL();
- else
- success = ListL() == KErrNone;
-
- if (!success)
- return KErrGeneral;
-
- // upload all local entries of this calendar to server
- LocalLoopL(ELoopActionUpload);
-
- if (iOptions.sync_collection)
- SetSyncTokenL(GetSyncTokenL());
- else
- SetCTagL(GetCTagL());
-
- iFirstInit = EFalse;
- iEnabled = ETrue;
- TPckgC<TBool> firstInit(iFirstInit);
- SetCalendarInfoL(KCaldavFirstInit, firstInit); // this will set iEnabled as well
- }
- else
- {
- TInt err = GetCalendarUrlsL(NULL);
- if (err == KErrArgument)
- return KErrArgument;
- GetOptionsL();
- SetLastSyncTimeL();
- iEnabled = ETrue;
- SetCalendarInfoL(KCaldavEnabled, KNullDesC8);
- SyncL();
- }
-
- return KErrNone;
- }
-
-/**
- * CCalDavEngine::Completed
- * Completed callback
- */
-void CCalDavEngine::Completed(TInt aError)
- {
- if (aError == KErrNone)
- {
- CActiveScheduler::Stop();
- }
- else
- iManualSync = true;
- }
-
-/**
- * CCalDavEngine::NotifyProgress
- * NotifyProgress callback
- */
-TBool CCalDavEngine::NotifyProgress()
- {
- return EFalse;
- }
-
-/**
- * CCalDavEngine::CalChangeNotification
- * change item callback, sync to server
- */
-void CCalDavEngine::CalChangeNotification(RArray<TCalChangeEntry> &aChangeItems)
- {
- for (TInt i = 0; i < aChangeItems.Count(); i++)
- {
- TRAP_IGNORE(HandleChangeL(aChangeItems[i].iChangeType, aChangeItems[i].iEntryType, aChangeItems[i].iEntryId));
- }
- }
-
-/**
- * CCalDavEngine::CalendarInfoChangeNotificationL
- * change callback, sync changed color or name to server
- */
-void CCalDavEngine::CalendarInfoChangeNotificationL(RPointerArray<
- CCalFileChangeInfo>& aCalendarInfoChangeEntries)
- {
- for (TInt i = 0; i < aCalendarInfoChangeEntries.Count(); i++)
- {
- if ((aCalendarInfoChangeEntries[i]->FileNameL() == *iCalendar)
- && (aCalendarInfoChangeEntries[i]->ChangeType()
- == MCalFileChangeObserver::ECalendarInfoUpdated))
- {
- TRAP_IGNORE(HandleCalendarInfoChangeL());
- }
- }
- }
-
-/**
- * CCalDavEngine::HandleCalendarInfoChangeL
- * sync changed color or name to server
- */
-void CCalDavEngine::HandleCalendarInfoChangeL()
- {
- if (iHttp)
- {
- CBufFlat* response = CBufFlat::NewL(EXPANDSIZE_SMALL);
- CleanupStack::PushL(response);
- CCalCalendarInfo* info = iCalSession->CalendarInfoL();
- CleanupStack::PushL(info);
-
- HBufC8* name =
- CnvUtfConverter::ConvertFromUnicodeToUtf8L(info->NameL());
- CleanupStack::PushL(name);
-
- TRgb color = info->Color();
- _LIT8(KColorformat,"#%02x%02x%02xFF");
- TBuf8<9> colorbuf;
- colorbuf.Format(KColorformat, color.Red(), color.Green(), color.Blue());
-
- HBufC8* patch = HBufC8::NewLC(KColorDisplayStart().Length()
- + colorbuf.Length() + KColorDisplayMiddle().Length()
- + name->Length() + KColorDisplayEnd().Length());
- patch->Des().Append(KColorDisplayStart);
- patch->Des().Append(colorbuf);
- patch->Des().Append(KColorDisplayMiddle);
- patch->Des().Append(*name);
- patch->Des().Append(KColorDisplayEnd);
- iHttp->ProppatchL(*iUrl, *patch, response);
- CleanupStack::PopAndDestroy(4); // response, info, name, patch
- }
- }
-
-/**
- * CCalDavEngine::HandleChangeL
- * change item callback, sync to server
- */
-void CCalDavEngine::HandleChangeL(
- MCalChangeCallBack2::TChangeType &aChangeType,
- MCalChangeCallBack2::TChangeEntryType &aEntryType, TCalLocalUid &aUid)
- {
- switch (aChangeType)
- {
- case MCalChangeCallBack2::EChangeAdd:
- case MCalChangeCallBack2::EChangeModify:
- {
- if (iImmediateSync)
- UploadEntryL(aUid, aChangeType, aEntryType);
- else
- // enable manual sync for the next sync interval
- SyncFailedL();
- break;
- }
- case MCalChangeCallBack2::EChangeDelete:
- {
- if (iImmediateSync)
- DeleteEntryL(aUid);
- else
- {
- iDeletedEntries.Append(aUid);
- SyncFailedL();
- }
- break;
- }
- case MCalChangeCallBack2::EChangeUndefined:
- {
- // upload new and modified entries to server
- UploadModifiedSinceDateL();
-
- // Find locally deleted ones and delete on server
- DeleteRemovedEntriesOnServerL();
-
- break;
- }
- }
- }
-
-/**
- * CCalDavEngine::EnableL
- * enable Caldav sync
- */
-TInt CCalDavEngine::EnableL()
- {
- if (!iCalEntryView) //do not use iEnabled here,might be set already in ConstructL()
- {
- TInt aErr = CreateCalObjectsL();
- if ((aErr == KErrNone) && (InitL() == KErrNone))
- {
- iTimer->Cancel();
- TInt ticktime = iSyncInterval.Int() == 0 ? 1 : iSyncInterval.Int();
- const TUint64 tickInterval = 1000000 * 60 * ticktime;
- iTimer->Start(tickInterval, tickInterval,
- TCallBack(SyncTickL, this));
- // register change notification
- RegisterL();
- return KErrNone;
- }
- else
- {
- iEnabled = EFalse;
- SetCalendarInfoL(KCaldavEnabled, KNullDesC8);
- DeleteCalObjects();
- return KErrArgument;
- }
- }
- return KErrNone;
- }
-
-/**
- * CCalDavEngine::DeleteCalObjects
- * delete all calendar objects
- */
-void CCalDavEngine::DeleteCalObjects()
- {
- delete iCalIter;
- iCalIter = NULL;
- delete iCalEntryView;
- iCalEntryView = NULL;
- delete iCalImporter;
- iCalImporter = NULL;
- delete iCalExporter;
- iCalExporter = NULL;
- if (iCalSession)
- {
- iCalSession->StopChangeNotification();
- iCalSession->StopFileChangeNotification();
- delete iCalSession;
- }
- iCalSession = NULL;
- }
-
-/**
- * CCalDavEngine::CreateCalObjectsL
- * create all calendar objects
- */
-TInt CCalDavEngine::CreateCalObjectsL()
- {
- iCalSession = CCalSession::NewL();
- TRAPD(aErr,iCalSession->OpenL(*iCalendar));
- iCalExporter = CCalenExporter::NewL(*iCalSession);
- iCalImporter = CCalenImporter::NewL(*iCalSession);
- iCalEntryView = CCalEntryView::NewL(*iCalSession);
- iCalIter = CCalIter::NewL(*iCalSession);
- return aErr;
- }
-
-/**
- * CCalDavEngine::DisableL
- * disable sync
- */
-void CCalDavEngine::DisableL()
- {
- if (iEnabled)
- {
- iTimer->Cancel();
- iEnabled = EFalse;
- SetCalendarInfoL(KCaldavEnabled, KNullDesC8);
- DeleteCalObjects();
- }
- }
-
-/**
- * CCalDavEngine::EnabledSync
- * check for enabled sync
- */
-TBool CCalDavEngine::EnabledSync()
- {
- return iEnabled;
- }
-
-/**
- * CCalDavEngine::TimeReportL
- * do a CalDav time report
- */
-TInt CCalDavEngine::TimeReportL(TBool VEVENT, const TDesC8 &aStart,
- TBool aDelete)
- {
- CBufFlat* body = CBufFlat::NewL(EXPANDSIZE_BIG);
- CleanupStack::PushL(body);
-
- body->InsertL(body->Size(), VEVENT ? KTimeStartEVENT() : KTimeStartTODO());
- body->InsertL(body->Size(), aStart); // "20090509T220000Z"/>
- body->InsertL(body->Size(), KTimeEnd);
-
- CBufFlat* response = CBufFlat::NewL(EXPANDSIZE_BIG);
- CleanupStack::PushL(response);
- TInt ret = iHttp->ReportL(*iUrl, body->Ptr(0), response);
-
- if (ret == MULTISTATUS)
- ret = aDelete ? ParseResponsesDeleteL(response->Ptr(0))
- : ParseResponsesL(response->Ptr(0));
- else
- ret = KErrGeneral;
-
- CleanupStack::PopAndDestroy(response);
- CleanupStack::PopAndDestroy(body);
- return ret;
- }
-
-/**
- * CCalDavEngine::ListL
- * get events either using time report or basic propfind
- */
-TInt CCalDavEngine::ListL()
- {
- if (iOptions.calendar_access)
- {
- TTime syncstart;
- syncstart.HomeTime();
- syncstart = syncstart - iPastDays;
- TBuf<100> nowStr;
- syncstart.FormatL(nowStr, KFormatString);
- TBuf8<100> nowStrAdd;
- nowStrAdd.Append(nowStr);
-
- TInt eventreturn = KErrNone;
- if (iOptions.VEVENT)
- eventreturn = TimeReportL(ETrue, nowStrAdd);
-
- TInt todoreturn = KErrNone;
- if (iOptions.VTODO)
- todoreturn = TimeReportL(EFalse, nowStrAdd);
-
- return (eventreturn == KErrNone) && (todoreturn == KErrNone) ? KErrNone
- : KErrGeneral;
- }
- else
- {
- // use PROPFIND report
- CBufFlat* response = CBufFlat::NewL(EXPANDSIZE_SMALL);
- CleanupStack::PushL(response);
- TInt ret = iHttp->PropfindL(*iUrl, KPropList, response, EFalse);
- if (ret == MULTISTATUS)
- ret = ParseResponsesL(response->Ptr(0));
- else
- ret = KErrGeneral;
- CleanupStack::PopAndDestroy(response);
- return ret;
- }
- }
-
-/**
- * CCalDavEngine::SyncL
- * sync a calendar
- */
-TInt CCalDavEngine::SyncL()
- {
- if (iUrl)
- {
- if (iOptions.sync_collection)
- return WebDavSyncL();
- else
- return ManualSyncL();
- }
- return KErrGeneral;
- }
-
-/**
- * CCalDavEngine::ManualSyncL
- * if sync failed previously, try again manually
- */
-TBool CCalDavEngine::ManualSyncL()
- {
- TBool client = ClientChangesL();
- if (iOptions.sync_ctag)
- {
- HBufC8 *newCTag = GetCTagL();
- TBool server = ETrue;
- if ((CTag() != *newCTag) && (*newCTag != KNullDesC8))
- {
- server = ServerChangesL();
- if (server)
- SetCTagL(newCTag);
- else
- delete newCTag;
- }
- else
- delete newCTag;
-
- return client || server;
- }
- else
- {
- TBool server = ServerChangesL();
- return client || server;
- }
- }
-
-/**
- * CCalDavEngine::ServerChangesL
- * sync server changes
- */
-TBool CCalDavEngine::ServerChangesL()
- {
- // loop over all server items to find new and modified entries
- // uses either propfind or calendar-query
- TInt ret = ListL();
-
- // loop over all local items to find deleted ones on the server
- LocalLoopL(ELoopActionDeleteLocal);
-
- return ret == KErrNone;
- }
-
-/**
- * CCalDavEngine::LocalLoopL
- * loop over local calendar store
- */
-TInt CCalDavEngine::LocalLoopL(TLocalLoopAction aAction)
- {
- TBuf8<URLMAX> iter = iCalIter->FirstL();
- TBuf8<URLMAX> url;
- while (iter != KNullDesC8)
- {
- url.Append(*iUrl);
- url.Append(iter);
- url.Append(KIcs);
- switch (aAction)
- {
- case ELoopActionDeleteLocal:
- {
- if (HeadL(iter) == NOTFOUND)
- DeleteLocalEntryL(url);
- break;
- }
- case ELoopActionFillArray:
- {
- RPointerArray<CCalEntry> entryArray;
- CleanupClosePushL(entryArray);
- iCalEntryView->FetchL(iter, entryArray);
- if (entryArray.Count())
- {
- iLocalUidArray.Append(entryArray[0]->LocalUidL());
- iGlobalUidArray.Append(entryArray[0]->UidL());
- }
- entryArray.ResetAndDestroy();
- CleanupStack::PopAndDestroy(&entryArray);
-
- break;
- }
- case ELoopActionUpload:
- {
- TInt pos = iGlobalUidArray.Find(iter);
- if ((pos != KErrNotFound) && (iLocalUidArray.Count() > pos))
- UploadEntryL(iLocalUidArray[pos],
- MCalChangeCallBack2::EChangeAdd,
- MCalChangeCallBack2::EChangeEntryAll);
- break;
- }
- }
- url.Delete(0, url.Length());
- iter = iCalIter->NextL();
- }
- return KErrNone;
- }
-
-/**
- * CCalDavEngine::ParseResponsesDeleteL
- * process a recieved multistatus response
- */
-TInt CCalDavEngine::ParseResponsesDeleteL(const TDesC8 &aDocument)
- {
- TInt ret = KErrNone;
- RXmlEngDocument document = iDomParser.ParseL(aDocument);
- CleanupClosePushL(document);
- if (document.NotNull())
- {
- // this method works for response as well as sync-response
- // do not use GetElementsByTagNameL for one specific responses directly
- TXmlEngElement ResponseListTop;
- SearchL(document, KMultistatus, KNullDesC8, ResponseListTop);
-
- RXmlEngNodeList<TXmlEngNode> ResponseList;
- CleanupClosePushL(ResponseList);
- ResponseListTop.GetChildNodes(ResponseList);
-
- while (ResponseList.HasNext())
- {
- TXmlEngNode node = ResponseList.Next();
- if (node.NodeType() == TXmlEngNode::EElement)
- {
- TPtrC8 href = SearchL(node, KHref, KNullDesC8);
- // don't do anything with home itself
- if ((href.Right(KIcs().Length()) == KIcs))
- {
- if (!DoesEntryExistL(href))
- DeleteEntryL(href);
- }
- }
- }
- CleanupStack::PopAndDestroy(&ResponseList);
-
- }
- else
- ret = KErrArgument;
- CleanupStack::PopAndDestroy(&document);
- return ret;
- }
-
-/**
- * CCalDavEngine::ParseResponsesL
- * process a recieved multistatus response
- */
-TInt CCalDavEngine::ParseResponsesL(RXmlEngDocument &aDocument, TBool aMultiget)
- {
- TInt ret = KErrNone;
- if (aDocument.NotNull())
- {
- CDesC8ArrayFlat *multiget = NULL;
- if (iOptions.MULTIGET)
- {
- multiget = new (ELeave) CDesC8ArrayFlat(ARRAYEXPAND);
- CleanupStack::PushL(multiget);
- }
-
- // this method works for response as well as sync-response
- // do not use GetElementsByTagNameL for one specific responses directly
- TXmlEngElement ResponseListTop;
- SearchL(aDocument, KMultistatus, KNullDesC8, ResponseListTop);
-
- RXmlEngNodeList<TXmlEngNode> ResponseList;
- CleanupClosePushL(ResponseList);
- ResponseListTop.GetChildNodes(ResponseList);
-
- while (ResponseList.HasNext())
- {
- TXmlEngNode node = ResponseList.Next();
- if (node.NodeType() == TXmlEngNode::EElement)
- {
- TPtrC8 href = SearchL(node, KHref, KNullDesC8);
- //do not use Search, only looking for first childs,
- //as D:propstat has D:status as well
- RXmlEngNodeList<TXmlEngElement> statuslist;
- CleanupClosePushL(statuslist);
- node.AsElement().GetElementsByTagNameL(statuslist, KStatus,
- KDav);
- //only one or zero item
- HBufC8* status =
- statuslist.Count() ? statuslist.Next().Value().AllocL()
- : KNullDesC8().AllocL();
- CleanupStack::PopAndDestroy(&statuslist);
- CleanupStack::PushL(status);
- status->Des().LowerCase();
- TPtrC8 etag = SearchL(node, KEtag, KNullDesC8);
- RBuf8 calendardata;
- SearchL(node, KCalendarData, KNullDesC8, calendardata);
- calendardata.CleanupClosePushL();
-
- // don't do anything with home itself
- if (href.Right(KIcs().Length()) == KIcs)
- {
- if ((*status == KHTTP200) || (*status == KHTTP201) || (*status == KNullDesC8))
- {
- if ((calendardata == KNullDesC8))
- {
- if (aMultiget)
- {
- // ATTENTION: an empty response to a multiget should never happen
- // data wrapped inside CDATA, e.g. bedework ??
- }
- else
- //TOOD: if this is a webdav sync response, we should skip the etag check
- AddModifyLocalEntryL(href, etag, multiget);
- }
- else
- {
- // response to a multiget or time-range report, we now already have everything we need
- StoreEntryL(calendardata, etag);
- }
- }
- else if (*status == KHTTP404)
- {
- if (iOptions.sync_collection)
- {
- // if this is an initial sync without token,
- // this should be ignored, Sun Server bug!!!
- if (SyncToken() != KNullDesC8)
- DeleteLocalEntryL(href);
- }
- else
- {
- //multiget answer, but deleted in the meantime, should delete locally as well
- DeleteLocalEntryL(href);
- }
- }
- }
- CleanupStack::PopAndDestroy(&calendardata);
- CleanupStack::PopAndDestroy(status);
- }
- }
- CleanupStack::PopAndDestroy(&ResponseList);
-
- if (iOptions.MULTIGET)
- {
- if (multiget->Count())
- {
- DownloadEntryL(multiget);
- multiget->Reset();
- }
- CleanupStack::PopAndDestroy(multiget);
- }
- }
- else
- ret = KErrArgument;
-
- return ret;
- }
-
-/**
- * CCalDavEngine::ParseResponsesL
- * process a recieved multistatus response
- */
-TInt CCalDavEngine::ParseResponsesL(const TDesC8 &aDocument, TBool aMultiget)
- {
-#ifdef _DEBUG
- _LIT(KFilename,"c:\\logs\\caldav\\parseresonseslatest.txt");
- ExportToFileNameL(aDocument, KFilename);
-#endif
-
- RXmlEngDocument document = iDomParser.ParseL(aDocument);
- CleanupClosePushL(document);
- TInt ret = ParseResponsesL(document, aMultiget);
- CleanupStack::PopAndDestroy(&document);
- return ret;
- }
-
-/**
- * CCalDavEngine::StoreEntryL
- * store event in local store
- */
-#ifdef ETAG
-TInt CCalDavEngine::StoreEntryL(const TDesC8 &aBuf, const TDesC8 &aEtag)
-#else
-TInt CCalDavEngine::StoreEntryL(const TDesC8 &aBuf, const TDesC8 &/*aEtag*/)
-#endif
- {
-#ifdef _DEBUG
- _LIT(KFileName2, "C:\\logs\\caldav\\testing_import.txt");
- ExportToFileNameL(aBuf, KFileName2);
-#endif
-
- HBufC8* buffer = HBufC8::NewL(aBuf.Length() + 500);
- buffer->Des().Append(aBuf);
- TPtr8 ptr = buffer->Des();
- CalDavUtils::FixImportIssues(ptr);
-
- RPointerArray<CCalEntry> Array;
- CleanupClosePushL(Array);
- RDesReadStream ReadStream;
- ReadStream.Open(ptr);
- CleanupClosePushL(ReadStream);
-#ifdef _DEBUG
- _LIT(KFileName, "C:\\logs\\caldav\\testing_import_fixed.txt");
- ExportToFileNameL(ptr, KFileName);
-#endif
- TRAPD(error, iCalImporter->ImportICalendarL(ReadStream,Array));
- CleanupStack::PopAndDestroy(&ReadStream); // calls close on rSteam
- if ((error == KErrNone) && (Array.Count()))
- {
- iCalIntermimUtils2->StoreL(*iCalEntryView, *Array[0], ETrue); // or should last one be EFalse??
- TInt pos = iLocalUidArray.Find(Array[0]->LocalUidL());
- if (pos == KErrNotFound)
- {
- iLocalUidArray.Append(Array[0]->LocalUidL());
- iGlobalUidArray.Append(Array[0]->UidL());
- }
-#ifdef ETAG
- Array[0]->SetETag(aEtag);
-#endif
- }
- Array.ResetAndDestroy();
- CleanupStack::PopAndDestroy(&Array);
-
- delete buffer;
- return error;
- }
-
-/**
- * CCalDavEngine::WebDavSyncReportL
- * webdav sync report
- * http://tools.ietf.org/html/draft-daboo-webdav-sync-02
- */
-TInt CCalDavEngine::WebDavSyncReportL(TBool aSynctoken)
- {
- HBufC8 *Buf = HBufC8::NewL(KSync().Length() + SyncToken().Length());
- TPtrC8 token = SyncToken();
- if (aSynctoken)
- Buf->Des().Format(KSync, &token);
- else
- Buf->Des().Format(KSync, &KNullDesC8());
- CleanupStack::PushL(Buf);
-
- CBufFlat* response = CBufFlat::NewL(EXPANDSIZE_BIG);
- CleanupStack::PushL(response);
- TInt ret = iHttp->ReportL(*iUrl, *Buf, response);
-
- if (ret == MULTISTATUS)
- {
- RXmlEngDocument document = iDomParser.ParseL(response->Ptr(0));
- CleanupClosePushL(document);
- if (document.NotNull())
- {
- TPtrC8 Token = SearchL(document, KSynctoken, KNullDesC8);
- if ((Token != KNullDesC8) && (Token != SyncToken()))
- {
- ret = ParseResponsesL(document);
- //store newest token
- if (ret == KErrNone)
- SetSyncTokenL(Token.AllocL());
- }
- else
- ret = KErrNone;
- }
- else
- ret = KErrGeneral;
- CleanupStack::PopAndDestroy(&document);
- }
- CleanupStack::PopAndDestroy(response);
- CleanupStack::PopAndDestroy(Buf);
- return ret;
- }
-
-/**
- * CCalDavEngine::WebDavSyncL
- * sync using webdav sync
- * http://tools.ietf.org/html/draft-daboo-webdav-sync-02
- */
-TBool CCalDavEngine::WebDavSyncL()
- {
- if (iHttp)
- {
- // commit any left over client changes
- TBool RetClient = ClientChangesL();
- // get all changes from server
- TInt ret = WebDavSyncReportL(ETrue);
- if (ret == CONFLICT)
- ret = WebDavSyncReportL(EFalse);
- return (ret == KErrNone) && RetClient;
- }
- return EFalse;
- }
-
-/**
- * CCalDavEngine::GetUIDByUrl
- * parse url to find UID
- */
-TPtrC8 CCalDavEngine::GetUIDByUrl(const TDesC8 &aUrl)
- {
- TPtrC8 UID;
- TInt Pos = aUrl.LocateReverse('/');
- TInt Pos2 = aUrl.Find(KIcs);
-
- if ((Pos != KErrNotFound) && (Pos2 != KErrNotFound))
- UID.Set(aUrl.Mid(Pos + 1, Pos2 - Pos - 1));
- else
- {
- if (Pos != KErrNotFound)
- UID.Set(aUrl.Mid(Pos + 1, aUrl.Length() - Pos - 1));
- else if (Pos2 != KErrNotFound)
- UID.Set(aUrl.Left(aUrl.Length() - KIcs().Length()));
- else
- UID.Set(aUrl);
- }
-
- return UID;
- }
-
-/**
- * CCalDavEngine::DoesEntryExistL
- * check if entry exists in local store
- */
-unsigned long CCalDavEngine::DoesEntryExistL(const TDesC8 &aUrl)
- {
- // check if we already have it locally by uid
- RPointerArray<CCalEntry> entryArray;
- CleanupClosePushL(entryArray);
- iCalEntryView->FetchL(GetUIDByUrl(aUrl), entryArray);
- // get parent
- CCalEntry *entry = entryArray.Count() ? entryArray[0] : NULL;
- TInt ret = entry ? entry->LocalUidL() : 0;
- entryArray.ResetAndDestroy();
- CleanupStack::PopAndDestroy(&entryArray);
- return ret;
- }
-
-/**
- * CCalDavEngine::ETagMatchL
- * checks for equal ETag
- */
-TBool CCalDavEngine::ETagMatchL(const TDesC8& /*aUrl*/, const TDesC8& /*aETag*/)
- {
-#ifdef ETAG
- // check if we already have it locally by uid
- RPointerArray<CCalEntry> entryArray;
- CleanupClosePushL(entryArray);
- iCalEntryView->FetchL(GetUIDByUrl(aUrl), entryArray);
- // get parent
- CCalEntry *entry = entryArray.Count() ? entryArray[0] : NULL;
- TBool ret = entry ? entry->ETag() == aETag : EFalse;
- entryArray.ResetAndDestroy();
- CleanupStack::PopAndDestroy(&entryArray);
- return ret;
-#else
- return EFalse;
-#endif
- }
-
-/**
- * CCalDavEngine::AddModifyLocalEntryL
- * add or modify existing event
- */
-TInt CCalDavEngine::AddModifyLocalEntryL(const TDesC8 &aUrl,
- const TDesC8 &aETag, CDesC8ArrayFlat* aArray)
- {
- // check if we have the entry locally
- // check for etag if we have the latest version, if not, download and import or add to multiget request
- if (!ETagMatchL(aUrl, aETag))
- {
- if (aArray)
- aArray->AppendL(aUrl);
- else
- DownloadEntryL(aUrl);
- }
- return KErrNone;
- }
-
-/**
- * CCalDavEngine::DownloadEntryL
- * download entries using multiget from server
- */
-TInt CCalDavEngine::DownloadEntryL(CDesC8Array* aArray)
- {
- TInt ret = KErrNone;
- TInt64 remainder;
- TInt64 result = Math::DivMod64(aArray->Count(), MULTIGETSPLIT, remainder);
-
- // split large multigets request into several smaller ones
- for (TInt64 l = 0; l <= result; l++)
- {
- // do the multiget request and pass it to parserepsonses again to read in the data
- CBufFlat* body = CBufFlat::NewL(EXPANDSIZE_BIG);
- CleanupStack::PushL(body);
-
- body->InsertL(body->Size(), KMultistart);
- for (TInt64 i = 0; i <= ((l == result) ? remainder - 1 : MULTIGETSPLIT
- - 1); i++)
- {
- body->InsertL(body->Size(), KHrefstart);
- body->InsertL(body->Size(), (*aArray)[MULTIGETSPLIT * l + i]);
- body->InsertL(body->Size(), KHrefend);
- }
- body->InsertL(body->Size(), KMultiend);
-
- CBufFlat* response = CBufFlat::NewL(EXPANDSIZE_BIG);
- CleanupStack::PushL(response);
- TInt Return = iHttp->ReportL(*iUrl, body->Ptr(0), response);
-
- if (Return == MULTISTATUS)
- {
- TInt parsereturn = ParseResponsesL(response->Ptr(0), ETrue);
- // if it failed before, we do not want to override this error
- ret = (ret == KErrNone) ? parsereturn : ret;
- }
- else
- ret = KErrGeneral;
- CleanupStack::PopAndDestroy(response);
- CleanupStack::PopAndDestroy(body);
-
- }
- return ret;
- }
-
-/**
- * CCalDavEngine::DownloadEntryL
- * download entry from server
- */
-TInt CCalDavEngine::DownloadEntryL(const TDesC8 &aUrl)
- {
- TBuf8<URLMAX> url;
- url.Append(*iUrl);
- url.Append(GetUIDByUrl(aUrl));
- url.Append(KIcs);
-
- CBufFlat* response = CBufFlat::NewL(EXPANDSIZE_SMALL);
- CleanupStack::PushL(response);
- TInt ret = iHttp->GetL(url, response);
- if (ret == OK)
- ret = StoreEntryL(response->Ptr(0), iHttp->ETag());
- else
- ret = KErrGeneral;
- CleanupStack::PopAndDestroy(response);
- return ret;
- }
-
-/**
- * CCalDavEngine::DeleteLocalEntryL
- * delete an event from local store
- */
-TInt CCalDavEngine::DeleteLocalEntryL(const TDesC8 &aUID)
- {
- CDesC8ArrayFlat * Array = new (ELeave) CDesC8ArrayFlat(ARRAYEXPAND);
- CleanupStack::PushL(Array);
- Array->AppendL(GetUIDByUrl(aUID));
- // we could have delete it ourselves, so it is already gone
- TRAPD(error, iCalEntryView->DeleteL(*Array));
- Array->Reset();
- CleanupStack::PopAndDestroy(Array);
- return error;
- }
-
-/**
- * CCalDavEngine::DeleteRemovedEntriesOnServerL
- * check for removed entries on server
- */
-TInt CCalDavEngine::DeleteRemovedEntriesOnServerL()
- {
- if (iOptions.calendar_access)
- {
- TTime syncstart;
- syncstart.HomeTime();
- syncstart = syncstart - iPastDays;
- TBuf<100> nowStr;
- syncstart.FormatL(nowStr, KFormatString);
- TBuf8<100> nowStrAdd;
- nowStrAdd.Append(nowStr);
-
- TInt eventreturn = KErrNone;
- if (iOptions.VEVENT)
- eventreturn = TimeReportL(ETrue, nowStrAdd, ETrue);
-
- TInt todoreturn = KErrNone;
- if (iOptions.VTODO)
- todoreturn = TimeReportL(EFalse, nowStrAdd, ETrue);
-
- return (eventreturn == KErrNone) && (todoreturn == KErrNone) ? KErrNone
- : KErrGeneral;
- }
- else
- {
- // use PROPFIND report
- CBufFlat* response = CBufFlat::NewL(EXPANDSIZE_SMALL);
- CleanupStack::PushL(response);
- TInt ret = iHttp->PropfindL(*iUrl, KPropList, response, EFalse);
- if (ret == MULTISTATUS)
- ret = ParseResponsesDeleteL(response->Ptr(0));
- else
- ret = KErrGeneral;
- CleanupStack::PopAndDestroy(response);
- return ret;
- }
-
- }
-
-/**
- * CCalDavEngine::UploadModifiedSinceDateL
- * check for any modified data after last sync time
- */
-TBool CCalDavEngine::UploadModifiedSinceDateL()
- {
- TBool manualsync = EFalse;
- // upload modified and newly create ones
- RArray<TCalLocalUid> *Ids = new (ELeave) RArray<TCalLocalUid> (ARRAYEXPAND);
- iCalEntryView->GetIdsModifiedSinceDateL(iLastSyncTime, *Ids);
- for (TInt i = 0; i < Ids->Count(); i++)
- {
- TCalLocalUid id = (*Ids)[i];
- TInt ret = UploadEntryL(id, MCalChangeCallBack2::EChangeUndefined,
- MCalChangeCallBack2::EChangeEntryAll);
- // TOOD: if it fails during upload, ignore
- // if it fails due to internet connection, try again
- if (ret != KErrNone)
- manualsync = ETrue;
- }
- Ids->Reset();
- delete Ids;
- return manualsync;
- }
-
-/**
- * CCalDavEngine::ClientChangesL
- * check for left over local client changes
- */
-TBool CCalDavEngine::ClientChangesL()
- {
- if (iCalEntryView && iManualSync)
- {
- iManualSync = EFalse;
-
- // upload modified and newly create ones
- iManualSync = UploadModifiedSinceDateL();
-
- // delete locally deleted entries on server
- for (TInt i = iDeletedEntries.Count() - 1; i >= 0; --i)
- {
- TInt ret = DeleteEntryL(iDeletedEntries[i]);
- if (ret == KErrNone)
- iDeletedEntries.Remove(i);
-
- }
-
- iManualSync = iDeletedEntries.Count() ? ETrue : EFalse;
-
- TPckgC<TBool> manualSync(iManualSync);
- SetCalendarInfoL(KCaldavManualSync, manualSync);
- }
-
- return ETrue;
- }
-
-/**
- * CCalDavEngine::MkcalendarL
- * create a new calendar on the server
- */
-TInt CCalDavEngine::MkcalendarL(const TDesC8 &aName)
- {
- if (iOptions.MKCALENDAR)
- {
- TBuf8<URLMAX> url;
- url.Append(*iHome);
- url.Append(aName);
- url.Append(KSlash);
-
- CBufFlat* response = CBufFlat::NewL(EXPANDSIZE_SMALL);
- CleanupStack::PushL(response);
-
- // TOOD: initialize with name, body etc.
- TInt ret = iHttp->MkCalendarL(url, KNullDesC8, response);
-
- if ((ret == CREATED) || (ret == OK))
- ret = KErrNone;
- else if ((ret == NOTALLOWED) || (ret == FORBIDDEN))
- ret = KErrArgument;
- else
- ret = KErrGeneral;
- CleanupStack::PopAndDestroy(response);
- return ret;
- }
- else
- return KErrNotSupported;
- }
-
-/**
- * CCalDavEngine::DeleteCalendarL
- * delete a calendar on the server
- */
-TInt CCalDavEngine::DeleteCalendarL(const TDesC8 &aName)
- {
- if (iOptions.MKCALENDAR)
- {
- TBuf8<URLMAX> url;
- url.Append(*iHome);
- url.Append(aName);
- url.Append(KSlash);
-
- CBufFlat* response = CBufFlat::NewL(EXPANDSIZE_SMALL);
- CleanupStack::PushL(response);
- TInt ret = iHttp->DeleteL(url);
- if ((ret == NOCONTENT) || (ret == OK))
- ret = KErrNone;
- else
- ret = KErrGeneral;
- CleanupStack::PopAndDestroy(response);
- return ret;
- }
- else
- return KErrNotSupported;
- }
-
-/**
- * CCalDavEngine::HeadL
- * check for existence of an entry on server
- */
-TInt CCalDavEngine::HeadL(const TDesC8 &aUID)
- {
- // special handing for yahoo neccessary
- // after deleting an event, it is still there and findable with HEAD
- _LIT8(KYahoo,"yahoo");
- _LIT8(KTrash,"trash");
-
- TBuf8<URLMAX> url;
- url.Append(*iUrl);
- url.Append(aUID);
- url.Append(KIcs);
- if (iUrl->Find(KYahoo) == KErrNotFound)
- {
- TInt head = iHttp->HeadL(url);
- return (head == NOCONTENT) || (head == OK) ? OK : head;
- }
- else
- {
- CBufFlat* response = CBufFlat::NewL(EXPANDSIZE_SMALL);
- CleanupStack::PushL(response);
- TInt ret = iHttp->PropfindL(url, KNullDesC8, response);
-
- if (ret == MULTISTATUS)
- {
- RXmlEngDocument document = iDomParser.ParseL(response->Ptr(0));
- CleanupClosePushL(document);
- if (document.NotNull())
- {
- HBufC8* href = SearchL(document, KHref, KNullDesC8).AllocL();
- href->Des().LowerCase();
- ret = href->Find(KTrash) == KErrNotFound ? OK : NOTFOUND;
- delete href;
- }
- CleanupStack::PopAndDestroy(&document);
- CleanupStack::PopAndDestroy(response);
- return ret;
- }
- else
- {
- CleanupStack::PopAndDestroy(response);
- return NOTFOUND;
- }
- }
- }
-
-/**
- * CCalDavEngine::DeleteEntryL
- * delete entry on server
- */
-TInt CCalDavEngine::DeleteEntryL(const TDesC8 &aUid)
- {
- TBuf8<URLMAX> url;
- url.Append(*iBaseUrl);
- url.Append(aUid);
- return iHttp->DeleteL(url);
- }
-
-/**
- * CCalDavEngine::DeleteEntryL
- * delete entry on server
- */
-TInt CCalDavEngine::DeleteEntryL(const TCalLocalUid &aUid)
- {
- TInt Ret = KErrNone;
- // find the filename for a given local UID
- TInt aPos = iLocalUidArray.Find(aUid);
- if (aPos != KErrNotFound)
- {
- TBuf8<URLMAX> url;
- url.Append(*iUrl);
- url.Append(iGlobalUidArray[aPos]);
- url.Append(KIcs);
-
-#ifdef ETAG
- CCalEntry* entry = iCalEntryView->FetchL(aUid);
- CleanupStack::PushL(entry);
- TInt Return = entry ? iHttp->DeleteL(url, entry->ETag())
- : iHttp->DeleteL(url);
- CleanupStack::PopAndDestroy(entry);
-#else
- TInt Return = iHttp->DeleteL(url);
-#endif
-
- if ((Return == NOCONTENT) || (Return == OK))
- {
- SetLastSyncTimeL();
- }
- else if (Return == PRECONDFAILED)
- {
- // someone modified this in the meantime
- // ask user if he wants the new event or still delete it
- TBool modify = EFalse;
- if (modify)
- DownloadEntryL(url);
- else
- iHttp->DeleteL(url);
- }
- else if (Return == NOTFOUND)
- {
- // someone deleted this already
- Ret = KErrGeneral;
- }
- else
- {
- Ret = KErrGeneral;
- SyncFailedL();
- TInt pos = iDeletedEntries.Find(aUid);
- if (pos == KErrNotFound)
- iDeletedEntries.Append(aUid);
- }
- }
- else
- Ret = KErrGeneral;
- return Ret;
- }
-
-/**
- * CCalDavEngine::UploadEntryL
- * upload entry to server
- */
-TInt CCalDavEngine::UploadEntryL(CCalEntry* aEntry,
- MCalChangeCallBack2::TChangeType aChangeType,
- MCalChangeCallBack2::TChangeEntryType aEntryType)
- {
- if (aEntry)
- {
- TInt ret = KErrNone;
- TBool upload = EFalse;
- switch (aEntryType)
- {
- case MCalChangeCallBack2::EChangeEntryEvent:
- case MCalChangeCallBack2::EChangeEntryTodo:
- {
- upload = aEntry && ((MCalChangeCallBack2::EChangeEntryEvent
- && iOptions.VEVENT)
- || (MCalChangeCallBack2::EChangeEntryTodo
- && iOptions.VTODO));
- break;
- }
- case MCalChangeCallBack2::EChangeEntryAll:
- {
- if (aEntry)
- {
- switch (aEntry->EntryTypeL())
- {
- case CCalEntry::EAppt:
- case CCalEntry::EAnniv:
- case CCalEntry::EEvent:
- case CCalEntry::EReminder:
- {
- upload = iOptions.VEVENT;
- break;
- }
- case CCalEntry::ETodo:
- {
- upload = iOptions.VTODO;
- break;
- }
- }
- }
-
- }
- }
- if (upload)
- {
- CBufFlat* BufFlat = CBufFlat::NewL(EXPANDSIZE_SMALL);
- CleanupStack::PushL(BufFlat);
- RBufWriteStream writeStream(*BufFlat);
- CleanupClosePushL(writeStream);
- iCalExporter->ExportICalL(*aEntry, writeStream);
- writeStream.CommitL();
- CleanupStack::PopAndDestroy(&writeStream);
-
- HBufC8* buffer = BufFlat->Ptr(0).AllocL();
- CleanupStack::PopAndDestroy(BufFlat);
- CleanupStack::PushL(buffer);
- TPtr8 ptr = buffer->Des();
- CalDavUtils::FixExportIssues(ptr);
-
-#ifdef _DEBUG
- ExportToFileL(aEntry, iCalExporter);
- _LIT(KFileName, "C:\\logs\\caldav\\testing_export_fixed.txt");
- ExportToFileNameL(ptr, KFileName);
-#endif
-
- TBuf8<URLMAX> url;
- url.Append(*iUrl);
- url.Append(aEntry->UidL());
- url.Append(KIcs);
-
- CBufFlat* response = CBufFlat::NewL(EXPANDSIZE_SMALL);
- CleanupStack::PushL(response);
-
-#ifdef ETAG
- TPtrC8 etag = aEntry->GetETag();
- TBool newentry = (aChangeType == MCalChangeCallBack2::EChangeAdd)
- || ((aChangeType == MCalChangeCallBack2::EChangeUndefined)
- && (etag == KNullDesC8));
- TInt Ret = newentry ? iHttp->PutL(url, *buffer, response)
- : iHttp->PutL(url, *buffer, response, etag);
-#else
- TBool newentry = (aChangeType == MCalChangeCallBack2::EChangeAdd)
- || (aChangeType == MCalChangeCallBack2::EChangeUndefined);
- TInt Ret = newentry ? iHttp->PutL(url, *buffer, response)
- : iHttp->PutL(url, *buffer, response, _L8("ETAG"));
-#endif
- if ((Ret == CREATED) || (Ret == NOCONTENT) || (Ret == OK))
- {
- if (newentry)
- {
- iLocalUidArray.Append(aEntry->LocalUidL());
- iGlobalUidArray.Append(aEntry->UidL());
- }
-#ifdef ETAG
- aEntry->SetETag(iHttp->ETag());
-#endif
- SetLastSyncTimeL();
- }
- else if (Ret == PRECONDFAILED)
- {
- if (newentry)// same filename already exists, use a different one and upload again
- {
- TBuf8<URLMAX> nextUrl;
- nextUrl.Append(*iUrl);
- nextUrl.Append(aEntry->UidL());
- TTime time;
- time.HomeTime();
- _LIT(KTimeFormat,"%H%T%S");
- TBuf<20> StringTime;
- time.FormatL(StringTime, KTimeFormat);
- nextUrl.Append(StringTime);
- nextUrl.Append(_L8(".ics"));
- response->Reset();
- TInt Ret = iHttp->PutL(nextUrl, *buffer, response);
- if ((Ret == CREATED) || (Ret == OK))
- {
- iLocalUidArray.Append(aEntry->LocalUidL());
- iGlobalUidArray.Append(aEntry->UidL());
-#ifdef ETAG
- aEntry->SetETag(iHttp->ETag());
-#endif
- SetLastSyncTimeL();
- }
- else
- {
- SyncFailedL();
- ret = KErrAbort;
- }
- }
- else
- {
- if (!iKeepServerEntry)
- {
- response->Reset();
- // upload again without ETAG to overwrite server entry
- TInt Ret = iHttp->PutL(url, *buffer, response);
- if ((Ret == CREATED) || (Ret == OK))
- {
-#ifdef ETAG
- aEntry->SetETag(iHttp->ETag());
-#endif
- SetLastSyncTimeL();
- }
- else
- {
- SyncFailedL();
- ret = KErrAbort;
- }
- }
- else
- {
- // download the server event and update local store
- ret = DownloadEntryL(url);
- if (ret == KErrNone)
- SetLastSyncTimeL();
- else
- {
- SyncFailedL();
- ret = KErrAbort;
- }
- }
- }
- }
- else
- {
- SyncFailedL();
- ret = KErrAbort;
- }
- CleanupStack::PopAndDestroy(response);
- CleanupStack::PopAndDestroy(buffer);
- }
- return ret;
- }
- return KErrArgument;
- }
-
-/**
- * CCalDavEngine::UploadEntryL
- * upload entry to server
- */
-TInt CCalDavEngine::UploadEntryL(const TCalLocalUid &aUid,
- MCalChangeCallBack2::TChangeType aChangeType,
- MCalChangeCallBack2::TChangeEntryType aEntryType)
- {
- CCalEntry * aEntry = iCalEntryView->FetchL(aUid);
- CleanupStack::PushL(aEntry);
- TInt ret = UploadEntryL(aEntry, aChangeType, aEntryType);
- CleanupStack::PopAndDestroy(aEntry);
- return ret;
- }
-
-/**
- * CCalDavEngine::GetSyncTokenL
- * get latest Webdav Sync token
- */
-HBufC8* CCalDavEngine::GetSyncTokenL()
- {
- HBufC8 *aBuf = HBufC8::NewL(KSync().Length());
- aBuf->Des().Format(KSync, &KNullDesC8());
- CleanupStack::PushL(aBuf);
-
- CBufFlat* response = CBufFlat::NewL(EXPANDSIZE_SMALL);
- CleanupStack::PushL(response);
- TInt RetServer = iHttp->ReportL(*iUrl, *aBuf, response);
-
- if (RetServer)
- {
- RXmlEngDocument document = iDomParser.ParseL(response->Ptr(0));
- CleanupClosePushL(document);
- if (document.NotNull())
- {
- HBufC8* ret = SearchL(document, KSynctoken, KNullDesC8).AllocL();
- CleanupStack::PopAndDestroy(&document);
- CleanupStack::PopAndDestroy(response);
- CleanupStack::PopAndDestroy(aBuf);
- return ret;
- }
- CleanupStack::PopAndDestroy(&document);
- }
- CleanupStack::PopAndDestroy(response);
- CleanupStack::PopAndDestroy(aBuf);
- return KNullDesC8().AllocL();
- }
-
-/**
- * CCalDavEngine::CheckCalendarInfoL
- * check for new calendar displayname and color
- */
-void CCalDavEngine::CheckCalendarInfoL(RXmlEngDocument &aDocument)
- {
- TBool change = EFalse;
- CCalCalendarInfo* info = iCalSession->CalendarInfoL();
- CleanupStack::PushL(info);
-
- HBufC8* color = SearchL(aDocument, KCalendar_Color, KNullDesC8).AllocLC();
- if ((*color != KNullDesC8) && (color->Length() > 6))
- {
- TLex8 lexred(color->Des().Mid(1, 2));
- TInt red;
- lexred.Val(red);
- TLex8 lexgreen(color->Des().Mid(3, 2));
- TInt green;
- lexgreen.Val(green);
- TLex8 lexblue(color->Des().Mid(5, 2));
- TInt blue;
- lexblue.Val(blue);
- TRgb newcolor(red, green, blue);
- if (info->Color() != newcolor)
- {
- info->SetColor(newcolor);
- change = ETrue;
- }
- }
- CleanupStack::PopAndDestroy(color);
-
- HBufC8* displayname =
- SearchL(aDocument, KDisplayname, KNullDesC8).AllocLC();
- if (*displayname != KNullDesC8)
- {
- HBufC16* name =
- CnvUtfConverter::ConvertToUnicodeFromUtf8L(*displayname);
- CleanupStack::PushL(name);
- if (info->NameL() != *name)
- {
- info->SetNameL(*name);
- change = ETrue;
- }
- CleanupStack::PopAndDestroy(name);
- change = ETrue;
- }
- CleanupStack::PopAndDestroy(displayname);
-
- if (change)
- iCalSession->SetCalendarInfoL(*info);
- CleanupStack::PopAndDestroy(info);
-
- }
-
-/**
- * CCalDavEngine::GetCTagL
- * get latest CTag
- * https://trac.calendarserver.org/browser/CalendarServer/trunk/doc/Extensions/caldav-ctag.txt
- */
-HBufC8* CCalDavEngine::GetCTagL()
- {
- if (iHttp)
- {
- CBufFlat* response = CBufFlat::NewL(EXPANDSIZE_SMALL);
- CleanupStack::PushL(response);
- TInt ret = iHttp->PropfindL(*iUrl, KCtag, response);
-
- if (ret == MULTISTATUS)
- {
- RXmlEngDocument document = iDomParser.ParseL(response->Ptr(0));
- CleanupClosePushL(document);
- if (document.NotNull())
- {
- HBufC8* status =
- SearchL(document, KStatus, KNullDesC8).AllocLC();
- HBufC8* ctag =
- SearchL(document, KGetctag, KNullDesC8).AllocLC();
- status->Des().LowerCase();
- if ((*ctag != KNullDesC8) && (*status == KHTTP200))
- {
- CleanupStack::Pop(ctag);
- CleanupStack::PopAndDestroy(status);
- CleanupStack::PopAndDestroy(&document);
- CleanupStack::PopAndDestroy(response);
- return ctag;
- }
- else
- CleanupStack::PopAndDestroy(ctag);
- CleanupStack::PopAndDestroy(status);
- }
- CleanupStack::PopAndDestroy(&document);
-
- }
- CleanupStack::PopAndDestroy(response);
- }
- return KNullDesC8().AllocL();
- }
-
-/**
- * CCalDavEngine::GetOptionsL
- * get OPTIONS from server
- */
-TBool CCalDavEngine::GetOptionsL()
- {
- if (iHttp)
- {
- // check DAV and allow headers
- iHttp->GetServerOptionsL(*iUrl, iOptions);
-
- // check ctag extension
- HBufC8* ctag = GetCTagL();
- if (*ctag != KNullDesC8)
- iOptions.sync_ctag = true;
- delete ctag;
-
- // check supported elements
- CBufFlat* response = CBufFlat::NewL(EXPANDSIZE_SMALL);
- CleanupStack::PushL(response);
- TInt Ret = iHttp->PropfindL(*iUrl, KSupportedSet, response);
-
- if (Ret == MULTISTATUS)
- {
- RXmlEngDocument document = iDomParser.ParseL(response->Ptr(0));
- CleanupClosePushL(document);
- if (document.NotNull())
- {
- CheckCalendarInfoL(document);
-
- //<C:supported-calendar-component-set/>
- TXmlEngElement supportedelement;
- SearchL(document, KSupportedCalendarComponentSet, KNullDesC8,
- supportedelement);
- if (supportedelement.NotNull())
- {
- RXmlEngNodeList<TXmlEngElement> supportedelements;
- CleanupClosePushL(supportedelements);
- supportedelement.GetChildElements(supportedelements);
- while (supportedelements.HasNext())
- {
- TXmlEngElement element = supportedelements.Next();
- TPtrC8 value = element.AttributeValueL(KName);
- if (value == KNullDesC8)
- value.Set(element.AttributeValueL(KName, KCalDav));
- if (value == KVEVENT)
- iOptions.VEVENT = ETrue;
- else if (value == KVTODO)
- iOptions.VTODO = ETrue;
- else if (value == KVFREBUSY)
- iOptions.VFREEBUSY = ETrue;
- else if (value == KVJOURNAL)
- iOptions.VJOURNAL = ETrue;
- }
- CleanupStack::PopAndDestroy(&supportedelements);
- }
- }
- CleanupStack::PopAndDestroy(&document);
- }
- CleanupStack::PopAndDestroy(response);
- }
- return ETrue;
- }
-
-/**
- * CCalDavEngine::SetSyncTokenL
- * set sync token
- */
-void CCalDavEngine::SetSyncTokenL(HBufC8* aToken)
- {
- if (iSynctoken)
- {
- delete iSynctoken;
- iSynctoken = NULL;
- }
- iSynctoken = aToken;
- SetCalendarInfoL(KCaldavSynctoken, *iSynctoken);
- }
-
-/**
- * CCalDavEngine::SyncToken
- * get synctoken
- */
-TPtrC8 CCalDavEngine::SyncToken()
- {
- return iSynctoken ? *iSynctoken : KNullDesC8();
- }
-
-/**
- * CCalDavEngine::SetCTagL
- * set ctag
- */
-void CCalDavEngine::SetCTagL(HBufC8* aToken)
- {
- if (iCTag)
- {
- delete iCTag;
- iCTag = NULL;
- }
- iCTag = aToken;
- SetCalendarInfoL(KCaldavCtag, *iCTag);
- }
-
-/**
- * CCalDavEngine::CTag
- * get ctag
- */
-TPtrC8 CCalDavEngine::CTag()
- {
- return iCTag ? *iCTag : KNullDesC8();
- }
-
-/**
- * CCalDavEngine::SetLastSyncTimeL
- * set last sync time
- */
-void CCalDavEngine::SetLastSyncTimeL()
- {
- // only set a new last sync time, if we did not have a failed one before
- // otherwise, the old one would be lost
- if (!iManualSync)
- {
- TTime time;
- time.UniversalTime();
- iLastSyncTime.SetTimeUtcL(time);
- TPckgC<TCalTime> lasttime(iLastSyncTime);
- SetCalendarInfoL(KCaldavTime, lasttime);
- }
- }
-
-/**
- * CCalDavEngine::SyncFailedL
- * sync failed, enable manual sync
- */
-void CCalDavEngine::SyncFailedL()
- {
- if (!iManualSync)
- {
- iManualSync = ETrue;
- TPckgC<TBool> manualSync(iManualSync);
- SetCalendarInfoL(KCaldavManualSync, manualSync);
- }
- }
-
-/**
- * CCalDavEngine::GetBaseUrl
- * get base domain url
- */
-void CCalDavEngine::GetBaseUrl(const TDesC8 &aUrl)
- {
- _LIT8(http,"http://");
- _LIT8(https,"https://");
-
- if (iBaseUrl)
- {
- delete iBaseUrl;
- iBaseUrl = NULL;
- }
-
- if (aUrl.Length() > http().Length())
- {
- TInt length = aUrl.Find(https) != KErrNotFound ? https().Length()
- : http().Length();
- TInt pos = aUrl.Mid(length).Locate('/');
- iBaseUrl = aUrl.Left(pos + length).Alloc();
- }
- }
-
-/**
- * CCalDavEngine::FindUrlsL
- * find home, inbox and outbox property
- */
-void CCalDavEngine::FindUrlsL(const TDesC8 &aDes, HBufC8 *&home,
- HBufC8 *&inbox, HBufC8 *&outbox)
- {
- RXmlEngDocument document = iDomParser.ParseL(aDes);
- CleanupClosePushL(document);
- if (document.NotNull())
- {
- HBufC8* status = SearchL(document, KStatus, KNullDesC8).AllocLC();
- status->Des().LowerCase();
- if (*status == KHTTP200)
- {
- TXmlEngElement calendarhome, inboxhome, outboxhome;
-
- SearchL(document, KCalendarHomeSet, KNullDesC8, calendarhome);
- if (calendarhome.NotNull())
- {
- TPtrC8 homeend = SearchL(calendarhome, KHref, KNullDesC8);
- home = HBufC8::NewL(iBaseUrl->Length() + homeend.Length());
- home->Des().Append(*iBaseUrl);
- home->Des().Append(homeend);
- }
-
- SearchL(document, KInbox, KNullDesC8, inboxhome);
- if (inboxhome.NotNull())
- {
- TPtrC8 inboxend = SearchL(inboxhome, KHref, KNullDesC8);
- inbox = HBufC8::NewL(iBaseUrl->Length() + inboxend.Length());
- inbox->Des().Append(*iBaseUrl);
- inbox->Des().Append(inboxend);
- }
-
- SearchL(document, KOutbox, KNullDesC8, outboxhome);
- if (outboxhome.NotNull())
- {
- TPtrC8 outboxend = SearchL(outboxhome, KHref, KNullDesC8);
- outbox = HBufC8::NewL(iBaseUrl->Length() + outboxend.Length());
- outbox->Des().Append(*iBaseUrl);
- outbox->Des().Append(outboxend);
- }
- }
- CleanupStack::PopAndDestroy(status);
- }
- CleanupStack::PopAndDestroy(&document);
- }
-
-/**
- * CCalDavEngine::FindCalendarCollectionL
- * find all calendar collections under home url
- */
-HBufC8* CCalDavEngine::FindCalendarCollectionL(const TDesC8 &aUrl,
- CDesC8ArrayFlat *aArray)
- {
- HBufC8* homecalendar = 0;
-
- // do propfind depth:1 and find all calendar collections
- // right now, take the first one as default
- CBufFlat* response = CBufFlat::NewL(EXPANDSIZE_SMALL);
- CleanupStack::PushL(response);
- TInt retcode = iHttp->PropfindL(aUrl, KCalendarurl, response, EFalse);
- if (retcode == MULTISTATUS)
- {
- RXmlEngDocument document = iDomParser.ParseL(response->Ptr(0));
- CleanupClosePushL(document);
- if (document.NotNull() && document.DocumentElement().NotNull())
- {
- RXmlEngNodeList<TXmlEngElement> ResponseList;
- CleanupClosePushL(ResponseList);
- document.DocumentElement().GetElementsByTagNameL(ResponseList,
- KResponse, KDav);
- TBool FirstOneDone = EFalse;
- while (ResponseList.HasNext())
- {
- TXmlEngElement node = ResponseList.Next();
- TPtrC8 href = SearchL(node, KHref, KNullDesC8);
- TPtrC8 status = SearchL(node, KStatus, KNullDesC8);
-
- TXmlEngElement calendar;
- TXmlEngElement vevent_collection;
- TXmlEngElement vtodo_collection;
- SearchL(node, KCalendar, KNullDesC8, calendar);
- SearchL(node, KVEventCollection, KNullDesC8, vevent_collection);
- SearchL(node, KVTodoCollection, KNullDesC8, vtodo_collection);
-
- if (calendar.NotNull() || vevent_collection.NotNull()
- || vtodo_collection.NotNull())
- {
- if (!FirstOneDone)
- {
- homecalendar = HBufC8::NewL(iBaseUrl->Length()
- + href.Length());
- homecalendar->Des().Append(*iBaseUrl);
- homecalendar->Des().Append(href);
-
- iOptions.VEVENT = vevent_collection.NotNull();
- iOptions.VTODO = vtodo_collection.NotNull();
-
- FirstOneDone = ETrue;
- }
-
- if (aArray)
- {
- TBuf8<URLMAX> url;
- url.Append(*iBaseUrl);
- url.Append(href);
- aArray->AppendL(url);
- }
- }
- }
- CleanupStack::PopAndDestroy(&ResponseList);
- }
- CleanupStack::PopAndDestroy(&document);
- }
- CleanupStack::PopAndDestroy(response);
- return homecalendar;
- }
-
-/**
- * CCalDavEngine::GetCalendarUrlsL
- * find calendar url based on any url
- * could be principal url, home or direct calendar url
- */
-TInt CCalDavEngine::GetCalendarUrlsL(CDesC8ArrayFlat *aArray)
- {
- if (iHttp && iUrl)
- {
- HBufC8 *principal = 0;
- HBufC8 *home = 0;
- HBufC8 *homecalendar = 0;
- HBufC8 *inbox = 0;
- HBufC8 *outbox = 0;
-
- GetBaseUrl(*iUrl);
-
- // TODO: does this really find groupdav collection?
-
- // find out if this is a caldav or groupdav calendar collection
- CBufFlat* response = CBufFlat::NewL(EXPANDSIZE_SMALL);
- CleanupStack::PushL(response);
- TInt retcode = iHttp->PropfindL(*iUrl, KCalendarurl, response);
- if (retcode == MULTISTATUS)
- {
- RXmlEngDocument document = iDomParser.ParseL(response->Ptr(0));
- CleanupClosePushL(document);
- if (document.NotNull())
- {
- HBufC8* status =
- SearchL(document, KStatus, KNullDesC8).AllocLC();
- status->Des().LowerCase();
- TXmlEngElement calendar;
- SearchL(document, KCalendar, KNullDesC8, calendar);
- // it should be <owner><href>value</href></owner>
- // but oracle beehive server does <owner>value</owner>
- TXmlEngElement owner;
- SearchL(document, KOwner, KNullDesC8, owner);
- TPtrC8 ownerref1 = SearchL(owner, KHref, KNullDesC8);
- TPtrC8 ownerref2 = owner.Value();
- TPtrC8 ownerref;
- ownerref.Set(ownerref1 != KNullDesC8 ? ownerref1 : ownerref2);
-
- if (calendar.NotNull() && (ownerref != KNullDesC8) && (*status
- == KHTTP200))
- {
- // this is a calendar collection and we know the principal as well now
- homecalendar = iUrl->AllocL();
- _LIT8(KHTTP,"http");
- HBufC8* http = ownerref.Left(KHTTP().Length()).AllocLC();
- if (*http == KHTTP)
- {
- // sogo server does not return relative, but principal url
- principal = ownerref.AllocL();
- }
- else
- {
- principal = HBufC8::NewL(iBaseUrl->Length()
- + ownerref.Length());
- principal->Des().Append(*iBaseUrl);
- principal->Des().Append(ownerref);
- }
- CleanupStack::PopAndDestroy(http);
- }
- CleanupStack::PopAndDestroy(status);
- }
- CleanupStack::PopAndDestroy(&document);
- }
-
- // if we have principal, ask for home, otherwise see if principal was given in the first place
- if (principal)
- {
- response->Reset();
- TInt retcode =
- iHttp->PropfindL(*principal, KPrincipalurl, response);
- if (retcode == MULTISTATUS)
- {
- FindUrlsL(response->Ptr(0), home, inbox, outbox);
- }
- }
- else
- {
- response->Reset();
- TInt retcode = iHttp->PropfindL(*iUrl, KPrincipalurl, response);
- if (retcode == MULTISTATUS)
- {
- FindUrlsL(response->Ptr(0), home, inbox, outbox);
- }
- }
-
- home = CalDavUtils::EnsureSlashL(home);
- inbox = CalDavUtils::EnsureSlashL(inbox);
- outbox = CalDavUtils::EnsureSlashL(outbox);
-
- // find out all calendar collections under home
- if (home)
- {
- // TODO: temporary? we already have homecalendar...
- if (!homecalendar)
- {
- homecalendar = FindCalendarCollectionL(*home, aArray);
- }
- }
- else
- {
- // have not found out home nor a groupdav collection, maybe we are home ourselves
- homecalendar = FindCalendarCollectionL(*iUrl, aArray);
- if (homecalendar)
- home = iUrl->AllocL();
- }
-
- CleanupStack::PopAndDestroy(response);
- delete principal;
- delete inbox;
- delete outbox;
-
- if (home)
- iHome = CalDavUtils::EnsureSlashL(home);
- if (homecalendar)
- {
- delete iUrl;
- iUrl = NULL;
- iUrl = CalDavUtils::EnsureSlashL(homecalendar);
- return KErrNone;
- }
- else
- return KErrArgument;
- }
- return KErrArgument;
- }
-
-/**
- * CCalDavEngine::CalendarName
- * get calendar name
- */
-TPtrC CCalDavEngine::CalendarName() const
- {
- return iCalendar ? *iCalendar : KNullDesC();
- }
-
-/**
- * CCalDavEngine::Home
- * get home
- */
-TPtrC8 CCalDavEngine::Home() const
- {
- return iHome ? *iHome : KNullDesC8();
- }
-
-/**
- * CCalDavEngine::Url
- * get url
- */
-TPtrC8 CCalDavEngine::Url() const
- {
- return iUrl ? *iUrl : KNullDesC8();
- }
-
-/**
- * CCalDavEngine::SetUrlL
- * set url
- */
-void CCalDavEngine::SetUrlL(const TDesC8 &aUrl)
- {
- if (iUrl ? *iUrl != aUrl : ETrue)
- {
- DisableL();
-
- if (iUrl)
- {
- delete iUrl;
- iUrl = NULL;
- }
-
- iUrl = CalDavUtils::EnsureSlashL(aUrl);
- SetCalendarInfoL(KCaldavUrl, *iUrl);
- }
- }
-
-/**
- * CCalDavEngine::User
- * get user
- */
-TPtrC8 CCalDavEngine::User() const
- {
- return iHttp->User();
- }
-
-/**
- * CCalDavEngine::SetUserL
- * set user
- */
-void CCalDavEngine::SetUserL(const TDesC8 &aUser)
- {
- if (iHttp->User() != aUser)
- {
- DisableL();
- SetCalendarInfoL(KCaldavUser, aUser);
- iHttp->SetUserL(aUser);
- }
- }
-
-/**
- * CCalDavEngine::Password
- * get password
- */
-TPtrC8 CCalDavEngine::Password() const
- {
- return iHttp->Password();
- }
-
-/**
- * CCalDavEngine::SetPasswordL
- * set password
- */
-void CCalDavEngine::SetPasswordL(const TDesC8 &aPassword)
- {
- if (iHttp->Password() != aPassword)
- {
- DisableL();
- iHttp->SetPasswordL(aPassword);
- SetCalendarInfoL(KCaldavPassword, aPassword);
- }
- }
-
-/**
- * CCalDavEngine::SyncInterval
- * get SyncInterval
- */
-TTimeIntervalMinutes CCalDavEngine::SyncInterval() const
- {
- return iSyncInterval;
- }
-
-/**
- * CCalDavEngine::SetSyncIntervalL
- * set SetSyncIntervalL
- */
-void CCalDavEngine::SetSyncIntervalL(TTimeIntervalMinutes aSyncInterval)
- {
- iSyncInterval = aSyncInterval;
- TPckgC<TTimeIntervalMinutes> minutes(iSyncInterval);
- SetCalendarInfoL(KCaldavSyncInterval, minutes);
- }
-
-/**
- * CCalDavEngine::PastDays
- * get past days
- */
-TTimeIntervalDays CCalDavEngine::PastDays() const
- {
- return iPastDays;
- }
-
-/**
- * CCalDavEngine::SetPastDaysL
- * Set PastDaysL
- */
-void CCalDavEngine::SetPastDaysL(TTimeIntervalDays aDays)
- {
- iPastDays = aDays;
- TPckgC<TTimeIntervalDays> days(iPastDays);
- SetCalendarInfoL(KCaldavPastDays, days);
- }
-
-/**
- * CCalDavEngine::ImmediateSync
- * get ImmediateSyncL
- */
-TBool CCalDavEngine::ImmediateSync() const
- {
- return iImmediateSync;
- }
-
-/**
- * CCalDavEngine::SetImmediateSyncL
- * Set ImmediateSyncL
- */
-void CCalDavEngine::SetImmediateSyncL(TBool aImmediateSyc)
- {
- iImmediateSync = aImmediateSyc;
- TPckgC<TBool> immediatesync(iImmediateSync);
- SetCalendarInfoL(KCaldavImmediateSync, immediatesync);
- }
-
-/**
- * CCalDavEngine::KeepServerEntry
- * get KeepServerEntryL
- */
-TBool CCalDavEngine::KeepServerEntry() const
- {
- return iKeepServerEntry;
- }
-
-/**
- * CCalDavEngine::SetKeepServerEntryL
- * Set KeepServerEntryL
- */
-void CCalDavEngine::SetKeepServerEntryL(TBool aKeepServerEntry)
- {
- iKeepServerEntry = aKeepServerEntry;
- TPckgC<TBool> keepserver(iKeepServerEntry);
- SetCalendarInfoL(KCaldavKeepServer, keepserver);
- }
-
-/**
- * CCalDavEngine::Timer
- * get timer
- */
-CPeriodic* CCalDavEngine::Timer()
- {
- return iTimer;
- }
+/*
+ * Copyright (c) 2010 Sun Microsystems, Inc. and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributor:
+ * Maximilian Odendahl
+ *
+ * Contributors:
+ *
+ * Description: main Caldav class, all magic happens here
+ * one engine for each configured Caldav calendar
+ */
+#include "caldavengine.h"
+#include <f32file.h>
+#include <S32FILE.H>
+#include <S32MEM.H>
+#include <avkon.rsg>
+#include <UTF.H>
+#include <agnexportobserver.h>
+#include <calsession.h>
+#include <caliterator.h>
+#include <calentry.h>
+#include <calentryview.h>
+#include <caltime.h>
+#include <calalarm.h>
+#include <calcategory.h>
+#include <caluser.h>
+#include <calrrule.h>
+#include <calinstance.h>
+#include <calinstanceview.h>
+#include <caleninterimutils2.h>
+#include <calenexporter.h>
+#include <calenimporter.h>
+#include <calcalendarinfo.h>
+#include "calenglobaldata.h"
+#include <xmlengdocument.h>
+#include <xmlengnode.h>
+#include <xmlengelement.h>
+#include <xmlengnodelist.h>
+#include <xmlengtext.h>
+#include "httpclient.h"
+#include <e32math.h> // divmod
+#define MULTIGETSPLIT 100
+#define ARRAYEXPAND 4
+#define URLMAX 500
+#define EXPANDSIZE_SMALL 512
+#define EXPANDSIZE_BIG 1024
+_LIT(KFormatString,"\"%F%Y%M%DT000000Z\"");
+
+/**
+ * SyncTickL
+ * timer for basic sync interval
+ */
+TInt SyncTickL(TAny *aObject)
+ {
+ CCalDavEngine* engine = ((CCalDavEngine*) aObject);
+ CPeriodic* timer = engine->Timer();
+ if (engine && timer)
+ {
+ timer->Cancel();
+ TRAP_IGNORE(engine->SyncL());
+ TInt ticktime = engine->SyncInterval().Int() == 0 ? 1
+ : engine->SyncInterval().Int();
+ const TUint64 tickInterval = 1000000 * 60 * ticktime;
+ timer->Start(tickInterval, tickInterval, TCallBack(SyncTickL, engine));
+ }
+ return 0;
+ }
+
+#ifdef _DEBUG
+void ExportToFileNameL(const TDesC8& aDes, const TDesC &aFilename)
+ {
+ RFs fsSession;
+ User::LeaveIfError(fsSession.Connect());
+ CleanupClosePushL(fsSession);
+
+ TInt err = fsSession.MkDirAll(aFilename);
+
+ RFile file;
+ User::LeaveIfError(file.Replace(fsSession, aFilename, EFileWrite));
+ CleanupClosePushL(file);
+
+ RFileWriteStream writeStream2;
+ writeStream2.Attach(file);
+ CleanupClosePushL(writeStream2);
+
+ writeStream2 << aDes;
+ writeStream2.CommitL();
+ CleanupStack::PopAndDestroy(&writeStream2);
+ CleanupStack::PopAndDestroy(&file);
+ CleanupStack::PopAndDestroy(&fsSession);
+ }
+
+void ExportToFileL(CCalEntry* aEntry, CCalenExporter *iCalExporter)
+ {
+ if (aEntry)
+ {
+ _LIT(KFileName, "C:\\logs\\caldav\\testing_export.txt");
+
+ RFs fsSession;
+ User::LeaveIfError(fsSession.Connect());
+ CleanupClosePushL(fsSession);
+
+ TInt err = fsSession.MkDirAll(KFileName);
+
+ RFile file;
+ User::LeaveIfError(file.Replace(fsSession, KFileName, EFileWrite));
+ CleanupClosePushL(file);
+
+ RFileWriteStream writeStream2;
+ writeStream2.Attach(file);
+ CleanupClosePushL(writeStream2);
+
+ iCalExporter->ExportICalL(*aEntry, writeStream2);
+ writeStream2.CommitL();
+ CleanupStack::PopAndDestroy(&writeStream2);
+ CleanupStack::PopAndDestroy(&file);
+ CleanupStack::PopAndDestroy(&fsSession);
+ }
+ }
+#endif
+
+/**
+ * SearchL
+ * search inside xml tree for a specific node
+ */
+void SearchL(TXmlEngNode &aTopNode, const TDesC8 &aName,
+ const TDesC8 &aNamespace, TXmlEngNode & aReturnNode)
+ {
+ RXmlEngNodeList<TXmlEngNode> List;
+ aTopNode.GetChildNodes(List);
+ while (List.HasNext() && aReturnNode.IsNull())
+ {
+ TXmlEngNode Node = List.Next();
+ TXmlEngNode::TXmlEngDOMNodeType Type = Node.NodeType();
+ if (Type == TXmlEngNode::EElement)
+ {
+ //todo: compare namespace ?
+ if (Node.Name() == aName)
+ {
+ aReturnNode = Node.CopyL();
+ return;
+ }
+ else
+ {
+ SearchL(Node, aName, aNamespace, aReturnNode);
+ if (!aReturnNode.IsNull())
+ return;
+ }
+ }
+ }
+ }
+
+/**
+ * SearchL
+ * search inside xml tree for a specific node
+ */
+void SearchL(TXmlEngNode &aTopNode, const TDesC8 &aName,
+ const TDesC8 &aNamespace, RBuf8 &aBuf)
+ {
+ RXmlEngNodeList<TXmlEngNode> List;
+ aTopNode.GetChildNodes(List);
+ while (List.HasNext())
+ {
+ TXmlEngNode Node = List.Next();
+ TXmlEngNode::TXmlEngDOMNodeType Type = Node.NodeType();
+ if (Type == TXmlEngNode::EElement)
+ {
+ //todo: compare namespace ?
+ if (Node.Name() == aName)
+ {
+ if (Node.IsSimpleTextContents())
+ aBuf.Create(Node.Value());
+ else
+ Node.WholeTextContentsCopyL(aBuf);
+ return;
+ }
+ else
+ {
+ SearchL(Node, aName, aNamespace, aBuf);
+ if (aBuf.Length())
+ return;
+ }
+ }
+ }
+ }
+
+/**
+ * SearchL
+ * search inside xml tree for a specific node
+ */
+TPtrC8 SearchL(TXmlEngNode &aTopNode, const TDesC8 &aName,
+ const TDesC8 &aNamespace)
+ {
+ RXmlEngNodeList<TXmlEngNode> List;
+ aTopNode.GetChildNodes(List);
+ while (List.HasNext())
+ {
+ TXmlEngNode Node = List.Next();
+ TXmlEngNode::TXmlEngDOMNodeType Type = Node.NodeType();
+ if (Type == TXmlEngNode::EElement)
+ {
+ //todo: compare namespace ?
+ if (Node.Name() == aName)
+ return Node.Value();
+ else
+ {
+ TPtrC8 Return = SearchL(Node, aName, aNamespace);
+ if (Return != KNullDesC8)
+ return Return;
+ }
+ }
+ }
+ return KNullDesC8();
+ }
+
+/**
+ * GetBoolFromPropertiesL
+ * get a boolean value from CCalCalendarInfo
+ */
+TBool GetBoolFromPropertiesL(CCalCalendarInfo* info, const TDesC8 &aKey)
+ {
+ TBool boolean;
+ TPckgC<TBool> pckgboolean(boolean);
+ pckgboolean.Set(info->PropertyValueL(aKey));
+ return pckgboolean();
+ }
+
+/**
+ * GetTimeFromPropertiesL
+ * get a time value from CCalCalendarInfo
+ */
+TCalTime GetTimeFromPropertiesL(CCalCalendarInfo* info, const TDesC8 &aKey)
+ {
+ TCalTime time;
+ TPckgC<TCalTime> pckgtime(time);
+ pckgtime.Set(info->PropertyValueL(aKey));
+ return pckgtime();
+ }
+
+/**
+ * PropertyExists
+ * finds a property from an array
+ */
+TBool PropertyExists(CDesC8Array* aArray, const TDesC8 &aKey)
+ {
+ TInt pos = 0;
+ return aArray->Find(aKey, pos, ECmpNormal) == KErrNone;
+ }
+
+/**
+ * CCalDavEngine::SetCalendarInfoL
+ * set key and value pair at calendar session info
+ */
+void CCalDavEngine::SetCalendarInfoL(const TDesC8 &aKey, const TDesC8 &aValue)
+ {
+ TBool createdelete = !iCalSession;
+ if (createdelete)
+ {
+ iCalSession = CCalSession::NewL();
+ TRAP_IGNORE(iCalSession->OpenL(*iCalendar));
+ }
+ CCalCalendarInfo* calendarInfo = iCalSession->CalendarInfoL();
+ CleanupStack::PushL(calendarInfo);
+ TPckgC<TBool> enabled(iEnabled);
+ calendarInfo->SetPropertyL(KCaldavEnabled, enabled);
+ if (aValue != KNullDesC8)
+ calendarInfo->SetPropertyL(aKey, aValue);
+ iCalSession->SetCalendarInfoL(*calendarInfo);
+ CleanupStack::PopAndDestroy(calendarInfo);
+
+ if (createdelete)
+ {
+ delete iCalSession;
+ iCalSession = NULL;
+ }
+ }
+
+/**
+ * CCalDavEngine::CCalDavEngine
+ * default constructor
+ */
+CCalDavEngine::CCalDavEngine() :
+ iCalSession(0), iCalIter(0), iCalEntryView(0), iCalExporter(0),
+ iCalImporter(0), iCalIntermimUtils2(0), iCalendar(0), iUrl(0),
+ iBaseUrl(0), iHome(0), iHttp(0), iSynctoken(0), iCTag(0),
+ iSyncInterval(DEFAULT_SYNC_MINUTES), iPastDays(DEFAULT_PAST_DAYS),
+ iImmediateSync(DEFAULT_IMMEDIATE_SYNC), iKeepServerEntry(
+ DEFAULT_KEEP_SERVER_ENTRY), iEnabled(EFalse), iTimer(0)
+ {
+ }
+
+/**
+ * CCalDavEngine::~CCalDavEngine
+ * default destructor
+ */
+CCalDavEngine::~CCalDavEngine()
+ {
+ iLocalUidArray.Close();
+ iGlobalUidArray.Close();
+ iDeletedEntries.Close();
+
+ iDomParser.Close();
+ iDomImpl.Close();
+
+ if (iCalendar)
+ delete iCalendar;
+
+ if (iUrl)
+ delete iUrl;
+
+ if (iBaseUrl)
+ delete iBaseUrl;
+
+ if (iHttp)
+ delete iHttp;
+
+ DeleteCalObjects();
+
+ if (iCalIntermimUtils2)
+ delete iCalIntermimUtils2;
+
+ if (iSynctoken)
+ delete iSynctoken;
+
+ if (iCTag)
+ delete iCTag;
+
+ if (iHome)
+ delete iHome;
+
+ if (iTimer)
+ delete iTimer;
+ }
+
+/**
+ * CCalDavEngine::NewLC
+ * first phase construction
+ */
+CCalDavEngine* CCalDavEngine::NewLC(const TDesC& aCalendar)
+ {
+ CCalDavEngine* self = new (ELeave) CCalDavEngine();
+ CleanupStack::PushL(self);
+ self->ConstructL(aCalendar);
+ return self;
+ }
+
+/**
+ * CCalDavEngine::NewL
+ * first phase construction
+ */
+CCalDavEngine* CCalDavEngine::NewL(const TDesC& aCalendar)
+ {
+ CCalDavEngine* self = CCalDavEngine::NewLC(aCalendar);
+ CleanupStack::Pop(self); // self;
+ return self;
+ }
+
+/**
+ * CCalDavEngine::
+ * second phase construction
+ */
+void CCalDavEngine::ConstructL(const TDesC& aCalendar)
+ {
+ iManualSync = EFalse;
+ iFirstInit = ETrue;
+ iCalendar = aCalendar.AllocL();
+
+ iHttp = CHttpClient::NewL();
+
+ iDomImpl.OpenL();
+ TInt err = iDomParser.Open(iDomImpl);
+ if (KErrNone != err)
+ User::Leave(err);
+
+ iTimer = CPeriodic::NewL(EPriorityNormal);
+ iCalIntermimUtils2 = CCalenInterimUtils2::NewL();
+ iCalSession = CCalSession::NewL();
+ TRAP_IGNORE(iCalSession->OpenL(aCalendar));
+ CalendarInfoL();
+ // we can't close the file, so delete it completly
+ delete iCalSession;
+ iCalSession = NULL;
+ }
+
+/**
+ * CCalDavEngine::Progress
+ * Progress callback
+ */
+void CCalDavEngine::Progress(TInt /*aPercentageCompleted*/)
+ {
+ }
+
+/**
+ * CCalDavEngine::RegisterL
+ * register all neccessary notification callback
+ */
+void CCalDavEngine::RegisterL()
+ {
+ TDateTime Start;
+ TDateTime End;
+ End.SetYear(2200);
+
+ TCalTime StartCal;
+ TCalTime EndCal;
+ StartCal.SetTimeLocalL(Start);
+ EndCal.SetTimeLocalL(End);
+ CalCommon::TCalTimeRange Range(StartCal, EndCal);
+ CCalChangeNotificationFilter *Filter = CCalChangeNotificationFilter::NewL(
+ MCalChangeCallBack2::EChangeEntryAll, true, Range);
+ iCalSession->StartChangeNotification(*this, *Filter);
+ iCalSession->StartFileChangeNotificationL(*this);
+ delete Filter;
+ }
+
+/**
+ * CCalDavEngine::CalendarInfoL
+ * load all properties from CalendarInfo
+ */
+void CCalDavEngine::CalendarInfoL()
+ {
+ CCalCalendarInfo* calendarInfo = iCalSession->CalendarInfoL();
+ if (calendarInfo->IsValid())
+ {
+ CleanupStack::PushL(calendarInfo);
+ CDesC8Array* propertyKeys = calendarInfo->PropertyKeysL();
+ CleanupStack::PushL(propertyKeys);
+ TInt pos = 0;
+ if (propertyKeys->Find(KCaldavEnabled, pos, ECmpNormal) == KErrNone)
+ {
+ iEnabled = GetBoolFromPropertiesL(calendarInfo, KCaldavEnabled);
+ if (PropertyExists(propertyKeys, KCaldavFirstInit))
+ iFirstInit = GetBoolFromPropertiesL(calendarInfo,
+ KCaldavFirstInit);
+ if (PropertyExists(propertyKeys, KCaldavSynctoken))
+ iSynctoken
+ = calendarInfo->PropertyValueL(KCaldavSynctoken).AllocL();
+ if (PropertyExists(propertyKeys, KCaldavCtag))
+ iCTag = calendarInfo->PropertyValueL(KCaldavCtag).AllocL();
+ if (PropertyExists(propertyKeys, KCaldavManualSync))
+ iManualSync = GetBoolFromPropertiesL(calendarInfo,
+ KCaldavManualSync);
+ if (PropertyExists(propertyKeys, KCaldavTime))
+ iLastSyncTime = GetTimeFromPropertiesL(calendarInfo,
+ KCaldavTime);
+ if (PropertyExists(propertyKeys, KCaldavUrl))
+ iUrl = calendarInfo->PropertyValueL(KCaldavUrl).AllocL();
+ if (PropertyExists(propertyKeys, KCaldavUser))
+ iHttp->SetUserL(calendarInfo->PropertyValueL(KCaldavUser));
+ if (PropertyExists(propertyKeys, KCaldavPassword))
+ iHttp->SetPasswordL(calendarInfo->PropertyValueL(
+ KCaldavPassword));
+ if (PropertyExists(propertyKeys, KCaldavKeepServer))
+ iKeepServerEntry = GetBoolFromPropertiesL(calendarInfo,
+ KCaldavKeepServer);
+ if (PropertyExists(propertyKeys, KCaldavImmediateSync))
+ iImmediateSync = GetBoolFromPropertiesL(calendarInfo,
+ KCaldavImmediateSync);
+ if (PropertyExists(propertyKeys, KCaldavPastDays))
+ {
+ TPckgC<TTimeIntervalDays> pastdays(iPastDays);
+ pastdays.Set(calendarInfo->PropertyValueL(KCaldavPastDays));
+ iPastDays = pastdays();
+ }
+ if (PropertyExists(propertyKeys, KCaldavSyncInterval))
+ {
+ TPckgC<TTimeIntervalMinutes> syncinterval(iSyncInterval);
+ syncinterval.Set(calendarInfo->PropertyValueL(
+ KCaldavSyncInterval));
+ iSyncInterval = syncinterval();
+ }
+ // access point
+ }
+
+ CleanupStack::PopAndDestroy(propertyKeys);
+ CleanupStack::Pop(calendarInfo);
+ }
+ delete calendarInfo;
+ }
+
+/**
+ * CCalDavEngine::InitL
+ * check for correct url
+ * load most Caldav url properties
+ * do inital sync
+ */
+TInt CCalDavEngine::InitL()
+ {
+ // this is only needed to find a GlobalUID from a LocalUID, used after an event was deleted
+ // also used now for uploading of local events when only GlobalUID is know
+ LocalLoopL(ELoopActionFillArray);
+
+ if (iFirstInit)
+ {
+ TInt err = GetCalendarUrlsL(NULL);
+ if (err == KErrArgument)
+ return KErrArgument;
+ GetOptionsL();
+ SetLastSyncTimeL();
+
+ TBool success;
+ // get all server items
+ if (iOptions.sync_collection)
+ success = WebDavSyncL();
+ else
+ success = ListL() == KErrNone;
+
+ if (!success)
+ return KErrGeneral;
+
+ // upload all local entries of this calendar to server
+ LocalLoopL(ELoopActionUpload);
+
+ if (iOptions.sync_collection)
+ SetSyncTokenL(GetSyncTokenL());
+ else
+ SetCTagL(GetCTagL());
+
+ iFirstInit = EFalse;
+ iEnabled = ETrue;
+ TPckgC<TBool> firstInit(iFirstInit);
+ SetCalendarInfoL(KCaldavFirstInit, firstInit); // this will set iEnabled as well
+ }
+ else
+ {
+ TInt err = GetCalendarUrlsL(NULL);
+ if (err == KErrArgument)
+ return KErrArgument;
+ GetOptionsL();
+ SetLastSyncTimeL();
+ iEnabled = ETrue;
+ SetCalendarInfoL(KCaldavEnabled, KNullDesC8);
+ SyncL();
+ }
+
+ return KErrNone;
+ }
+
+/**
+ * CCalDavEngine::Completed
+ * Completed callback
+ */
+void CCalDavEngine::Completed(TInt aError)
+ {
+ if (aError == KErrNone)
+ {
+ CActiveScheduler::Stop();
+ }
+ else
+ iManualSync = true;
+ }
+
+/**
+ * CCalDavEngine::NotifyProgress
+ * NotifyProgress callback
+ */
+TBool CCalDavEngine::NotifyProgress()
+ {
+ return EFalse;
+ }
+
+/**
+ * CCalDavEngine::CalChangeNotification
+ * change item callback, sync to server
+ */
+void CCalDavEngine::CalChangeNotification(RArray<TCalChangeEntry> &aChangeItems)
+ {
+ for (TInt i = 0; i < aChangeItems.Count(); i++)
+ {
+ TRAP_IGNORE(HandleChangeL(aChangeItems[i].iChangeType, aChangeItems[i].iEntryType, aChangeItems[i].iEntryId));
+ }
+ }
+
+/**
+ * CCalDavEngine::CalendarInfoChangeNotificationL
+ * change callback, sync changed color or name to server
+ */
+void CCalDavEngine::CalendarInfoChangeNotificationL(RPointerArray<
+ CCalFileChangeInfo>& aCalendarInfoChangeEntries)
+ {
+ for (TInt i = 0; i < aCalendarInfoChangeEntries.Count(); i++)
+ {
+ if ((aCalendarInfoChangeEntries[i]->FileNameL() == *iCalendar)
+ && (aCalendarInfoChangeEntries[i]->ChangeType()
+ == MCalFileChangeObserver::ECalendarInfoUpdated))
+ {
+ TRAP_IGNORE(HandleCalendarInfoChangeL());
+ }
+ }
+ }
+
+/**
+ * CCalDavEngine::HandleCalendarInfoChangeL
+ * sync changed color or name to server
+ */
+void CCalDavEngine::HandleCalendarInfoChangeL()
+ {
+ if (iHttp)
+ {
+ CBufFlat* response = CBufFlat::NewL(EXPANDSIZE_SMALL);
+ CleanupStack::PushL(response);
+ CCalCalendarInfo* info = iCalSession->CalendarInfoL();
+ CleanupStack::PushL(info);
+
+ HBufC8* name =
+ CnvUtfConverter::ConvertFromUnicodeToUtf8L(info->NameL());
+ CleanupStack::PushL(name);
+
+ TRgb color = info->Color();
+ _LIT8(KColorformat,"#%02x%02x%02xFF");
+ TBuf8<9> colorbuf;
+ colorbuf.Format(KColorformat, color.Red(), color.Green(), color.Blue());
+
+ HBufC8* patch = HBufC8::NewLC(KColorDisplayStart().Length()
+ + colorbuf.Length() + KColorDisplayMiddle().Length()
+ + name->Length() + KColorDisplayEnd().Length());
+ patch->Des().Append(KColorDisplayStart);
+ patch->Des().Append(colorbuf);
+ patch->Des().Append(KColorDisplayMiddle);
+ patch->Des().Append(*name);
+ patch->Des().Append(KColorDisplayEnd);
+ iHttp->ProppatchL(*iUrl, *patch, response);
+ CleanupStack::PopAndDestroy(4); // response, info, name, patch
+ }
+ }
+
+/**
+ * CCalDavEngine::HandleChangeL
+ * change item callback, sync to server
+ */
+void CCalDavEngine::HandleChangeL(
+ MCalChangeCallBack2::TChangeType &aChangeType,
+ MCalChangeCallBack2::TChangeEntryType &aEntryType, TCalLocalUid &aUid)
+ {
+ switch (aChangeType)
+ {
+ case MCalChangeCallBack2::EChangeAdd:
+ case MCalChangeCallBack2::EChangeModify:
+ {
+ if (iImmediateSync)
+ UploadEntryL(aUid, aChangeType, aEntryType);
+ else
+ // enable manual sync for the next sync interval
+ SyncFailedL();
+ break;
+ }
+ case MCalChangeCallBack2::EChangeDelete:
+ {
+ if (iImmediateSync)
+ DeleteEntryL(aUid);
+ else
+ {
+ iDeletedEntries.Append(aUid);
+ SyncFailedL();
+ }
+ break;
+ }
+ case MCalChangeCallBack2::EChangeUndefined:
+ {
+ // upload new and modified entries to server
+ UploadModifiedSinceDateL();
+
+ // Find locally deleted ones and delete on server
+ DeleteRemovedEntriesOnServerL();
+
+ break;
+ }
+ }
+ }
+
+/**
+ * CCalDavEngine::EnableL
+ * enable Caldav sync
+ */
+TInt CCalDavEngine::EnableL()
+ {
+ if (!iCalEntryView) //do not use iEnabled here,might be set already in ConstructL()
+ {
+ TInt aErr = CreateCalObjectsL();
+ if ((aErr == KErrNone) && (InitL() == KErrNone))
+ {
+ iTimer->Cancel();
+ TInt ticktime = iSyncInterval.Int() == 0 ? 1 : iSyncInterval.Int();
+ const TUint64 tickInterval = 1000000 * 60 * ticktime;
+ iTimer->Start(tickInterval, tickInterval,
+ TCallBack(SyncTickL, this));
+ // register change notification
+ RegisterL();
+ return KErrNone;
+ }
+ else
+ {
+ iEnabled = EFalse;
+ SetCalendarInfoL(KCaldavEnabled, KNullDesC8);
+ DeleteCalObjects();
+ return KErrArgument;
+ }
+ }
+ return KErrNone;
+ }
+
+/**
+ * CCalDavEngine::DeleteCalObjects
+ * delete all calendar objects
+ */
+void CCalDavEngine::DeleteCalObjects()
+ {
+ delete iCalIter;
+ iCalIter = NULL;
+ delete iCalEntryView;
+ iCalEntryView = NULL;
+ delete iCalImporter;
+ iCalImporter = NULL;
+ delete iCalExporter;
+ iCalExporter = NULL;
+ if (iCalSession)
+ {
+ iCalSession->StopChangeNotification();
+ iCalSession->StopFileChangeNotification();
+ delete iCalSession;
+ }
+ iCalSession = NULL;
+ }
+
+/**
+ * CCalDavEngine::CreateCalObjectsL
+ * create all calendar objects
+ */
+TInt CCalDavEngine::CreateCalObjectsL()
+ {
+ iCalSession = CCalSession::NewL();
+ TRAPD(aErr,iCalSession->OpenL(*iCalendar));
+ iCalExporter = CCalenExporter::NewL(*iCalSession);
+ iCalImporter = CCalenImporter::NewL(*iCalSession);
+ iCalEntryView = CCalEntryView::NewL(*iCalSession);
+ iCalIter = CCalIter::NewL(*iCalSession);
+ return aErr;
+ }
+
+/**
+ * CCalDavEngine::DisableL
+ * disable sync
+ */
+void CCalDavEngine::DisableL()
+ {
+ if (iEnabled)
+ {
+ iTimer->Cancel();
+ iEnabled = EFalse;
+ SetCalendarInfoL(KCaldavEnabled, KNullDesC8);
+ DeleteCalObjects();
+ }
+ }
+
+/**
+ * CCalDavEngine::EnabledSync
+ * check for enabled sync
+ */
+TBool CCalDavEngine::EnabledSync()
+ {
+ return iEnabled;
+ }
+
+/**
+ * CCalDavEngine::TimeReportL
+ * do a CalDav time report
+ */
+TInt CCalDavEngine::TimeReportL(TBool VEVENT, const TDesC8 &aStart,
+ TBool aDelete)
+ {
+ CBufFlat* body = CBufFlat::NewL(EXPANDSIZE_BIG);
+ CleanupStack::PushL(body);
+
+ body->InsertL(body->Size(), VEVENT ? KTimeStartEVENT() : KTimeStartTODO());
+ body->InsertL(body->Size(), aStart); // "20090509T220000Z"/>
+ body->InsertL(body->Size(), KTimeEnd);
+
+ CBufFlat* response = CBufFlat::NewL(EXPANDSIZE_BIG);
+ CleanupStack::PushL(response);
+ TInt ret = iHttp->ReportL(*iUrl, body->Ptr(0), response);
+
+ if (ret == MULTISTATUS)
+ ret = aDelete ? ParseResponsesDeleteL(response->Ptr(0))
+ : ParseResponsesL(response->Ptr(0));
+ else
+ ret = KErrGeneral;
+
+ CleanupStack::PopAndDestroy(response);
+ CleanupStack::PopAndDestroy(body);
+ return ret;
+ }
+
+/**
+ * CCalDavEngine::ListL
+ * get events either using time report or basic propfind
+ */
+TInt CCalDavEngine::ListL()
+ {
+ if (iOptions.calendar_access)
+ {
+ TTime syncstart;
+ syncstart.HomeTime();
+ syncstart = syncstart - iPastDays;
+ TBuf<100> nowStr;
+ syncstart.FormatL(nowStr, KFormatString);
+ TBuf8<100> nowStrAdd;
+ nowStrAdd.Append(nowStr);
+
+ TInt eventreturn = KErrNone;
+ if (iOptions.VEVENT)
+ eventreturn = TimeReportL(ETrue, nowStrAdd);
+
+ TInt todoreturn = KErrNone;
+ if (iOptions.VTODO)
+ todoreturn = TimeReportL(EFalse, nowStrAdd);
+
+ return (eventreturn == KErrNone) && (todoreturn == KErrNone) ? KErrNone
+ : KErrGeneral;
+ }
+ else
+ {
+ // use PROPFIND report
+ CBufFlat* response = CBufFlat::NewL(EXPANDSIZE_SMALL);
+ CleanupStack::PushL(response);
+ TInt ret = iHttp->PropfindL(*iUrl, KPropList, response, EFalse);
+ if (ret == MULTISTATUS)
+ ret = ParseResponsesL(response->Ptr(0));
+ else
+ ret = KErrGeneral;
+ CleanupStack::PopAndDestroy(response);
+ return ret;
+ }
+ }
+
+/**
+ * CCalDavEngine::SyncL
+ * sync a calendar
+ */
+TInt CCalDavEngine::SyncL()
+ {
+ if (iUrl)
+ {
+ if (iOptions.sync_collection)
+ return WebDavSyncL();
+ else
+ return ManualSyncL();
+ }
+ return KErrGeneral;
+ }
+
+/**
+ * CCalDavEngine::ManualSyncL
+ * if sync failed previously, try again manually
+ */
+TBool CCalDavEngine::ManualSyncL()
+ {
+ TBool client = ClientChangesL();
+ if (iOptions.sync_ctag)
+ {
+ HBufC8 *newCTag = GetCTagL();
+ TBool server = ETrue;
+ if ((CTag() != *newCTag) && (*newCTag != KNullDesC8))
+ {
+ server = ServerChangesL();
+ if (server)
+ SetCTagL(newCTag);
+ else
+ delete newCTag;
+ }
+ else
+ delete newCTag;
+
+ return client || server;
+ }
+ else
+ {
+ TBool server = ServerChangesL();
+ return client || server;
+ }
+ }
+
+/**
+ * CCalDavEngine::ServerChangesL
+ * sync server changes
+ */
+TBool CCalDavEngine::ServerChangesL()
+ {
+ // loop over all server items to find new and modified entries
+ // uses either propfind or calendar-query
+ TInt ret = ListL();
+
+ // loop over all local items to find deleted ones on the server
+ LocalLoopL(ELoopActionDeleteLocal);
+
+ return ret == KErrNone;
+ }
+
+/**
+ * CCalDavEngine::LocalLoopL
+ * loop over local calendar store
+ */
+TInt CCalDavEngine::LocalLoopL(TLocalLoopAction aAction)
+ {
+ TBuf8<URLMAX> iter = iCalIter->FirstL();
+ TBuf8<URLMAX> url;
+ while (iter != KNullDesC8)
+ {
+ url.Append(*iUrl);
+ url.Append(iter);
+ url.Append(KIcs);
+ switch (aAction)
+ {
+ case ELoopActionDeleteLocal:
+ {
+ if (HeadL(iter) == NOTFOUND)
+ DeleteLocalEntryL(url);
+ break;
+ }
+ case ELoopActionFillArray:
+ {
+ RPointerArray<CCalEntry> entryArray;
+ CleanupClosePushL(entryArray);
+ iCalEntryView->FetchL(iter, entryArray);
+ if (entryArray.Count())
+ {
+ iLocalUidArray.Append(entryArray[0]->LocalUidL());
+ iGlobalUidArray.Append(entryArray[0]->UidL());
+ }
+ entryArray.ResetAndDestroy();
+ CleanupStack::PopAndDestroy(&entryArray);
+
+ break;
+ }
+ case ELoopActionUpload:
+ {
+ TInt pos = iGlobalUidArray.Find(iter);
+ if ((pos != KErrNotFound) && (iLocalUidArray.Count() > pos))
+ UploadEntryL(iLocalUidArray[pos],
+ MCalChangeCallBack2::EChangeAdd,
+ MCalChangeCallBack2::EChangeEntryAll);
+ break;
+ }
+ }
+ url.Delete(0, url.Length());
+ iter = iCalIter->NextL();
+ }
+ return KErrNone;
+ }
+
+/**
+ * CCalDavEngine::ParseResponsesDeleteL
+ * process a recieved multistatus response
+ */
+TInt CCalDavEngine::ParseResponsesDeleteL(const TDesC8 &aDocument)
+ {
+ TInt ret = KErrNone;
+ RXmlEngDocument document = iDomParser.ParseL(aDocument);
+ CleanupClosePushL(document);
+ if (document.NotNull())
+ {
+ // this method works for response as well as sync-response
+ // do not use GetElementsByTagNameL for one specific responses directly
+ TXmlEngElement ResponseListTop;
+ SearchL(document, KMultistatus, KNullDesC8, ResponseListTop);
+
+ RXmlEngNodeList<TXmlEngNode> ResponseList;
+ CleanupClosePushL(ResponseList);
+ ResponseListTop.GetChildNodes(ResponseList);
+
+ while (ResponseList.HasNext())
+ {
+ TXmlEngNode node = ResponseList.Next();
+ if (node.NodeType() == TXmlEngNode::EElement)
+ {
+ TPtrC8 href = SearchL(node, KHref, KNullDesC8);
+ // don't do anything with home itself
+ if ((href.Right(KIcs().Length()) == KIcs))
+ {
+ if (!DoesEntryExistL(href))
+ DeleteEntryL(href);
+ }
+ }
+ }
+ CleanupStack::PopAndDestroy(&ResponseList);
+
+ }
+ else
+ ret = KErrArgument;
+ CleanupStack::PopAndDestroy(&document);
+ return ret;
+ }
+
+/**
+ * CCalDavEngine::ParseResponsesL
+ * process a recieved multistatus response
+ */
+TInt CCalDavEngine::ParseResponsesL(RXmlEngDocument &aDocument, TBool aMultiget)
+ {
+ TInt ret = KErrNone;
+ if (aDocument.NotNull())
+ {
+ CDesC8ArrayFlat *multiget = NULL;
+ if (iOptions.MULTIGET)
+ {
+ multiget = new (ELeave) CDesC8ArrayFlat(ARRAYEXPAND);
+ CleanupStack::PushL(multiget);
+ }
+
+ // this method works for response as well as sync-response
+ // do not use GetElementsByTagNameL for one specific responses directly
+ TXmlEngElement ResponseListTop;
+ SearchL(aDocument, KMultistatus, KNullDesC8, ResponseListTop);
+
+ RXmlEngNodeList<TXmlEngNode> ResponseList;
+ CleanupClosePushL(ResponseList);
+ ResponseListTop.GetChildNodes(ResponseList);
+
+ while (ResponseList.HasNext())
+ {
+ TXmlEngNode node = ResponseList.Next();
+ if (node.NodeType() == TXmlEngNode::EElement)
+ {
+ TPtrC8 href = SearchL(node, KHref, KNullDesC8);
+ //do not use Search, only looking for first childs,
+ //as D:propstat has D:status as well
+ RXmlEngNodeList<TXmlEngElement> statuslist;
+ CleanupClosePushL(statuslist);
+ node.AsElement().GetElementsByTagNameL(statuslist, KStatus,
+ KDav);
+ //only one or zero item
+ HBufC8* status =
+ statuslist.Count() ? statuslist.Next().Value().AllocL()
+ : KNullDesC8().AllocL();
+ CleanupStack::PopAndDestroy(&statuslist);
+ CleanupStack::PushL(status);
+ status->Des().LowerCase();
+ TPtrC8 etag = SearchL(node, KEtag, KNullDesC8);
+ RBuf8 calendardata;
+ SearchL(node, KCalendarData, KNullDesC8, calendardata);
+ calendardata.CleanupClosePushL();
+
+ // don't do anything with home itself
+ if (href.Right(KIcs().Length()) == KIcs)
+ {
+ if ((*status == KHTTP200) || (*status == KHTTP201) || (*status == KNullDesC8))
+ {
+ if ((calendardata == KNullDesC8))
+ {
+ if (aMultiget)
+ {
+ // ATTENTION: an empty response to a multiget should never happen
+ // data wrapped inside CDATA, e.g. bedework ??
+ }
+ else
+ //TOOD: if this is a webdav sync response, we should skip the etag check
+ AddModifyLocalEntryL(href, etag, multiget);
+ }
+ else
+ {
+ // response to a multiget or time-range report, we now already have everything we need
+ StoreEntryL(calendardata, etag);
+ }
+ }
+ else if (*status == KHTTP404)
+ {
+ if (iOptions.sync_collection)
+ {
+ // if this is an initial sync without token,
+ // this should be ignored, Sun Server bug!!!
+ if (SyncToken() != KNullDesC8)
+ DeleteLocalEntryL(href);
+ }
+ else
+ {
+ //multiget answer, but deleted in the meantime, should delete locally as well
+ DeleteLocalEntryL(href);
+ }
+ }
+ }
+ CleanupStack::PopAndDestroy(&calendardata);
+ CleanupStack::PopAndDestroy(status);
+ }
+ }
+ CleanupStack::PopAndDestroy(&ResponseList);
+
+ if (iOptions.MULTIGET)
+ {
+ if (multiget->Count())
+ {
+ DownloadEntryL(multiget);
+ multiget->Reset();
+ }
+ CleanupStack::PopAndDestroy(multiget);
+ }
+ }
+ else
+ ret = KErrArgument;
+
+ return ret;
+ }
+
+/**
+ * CCalDavEngine::ParseResponsesL
+ * process a recieved multistatus response
+ */
+TInt CCalDavEngine::ParseResponsesL(const TDesC8 &aDocument, TBool aMultiget)
+ {
+#ifdef _DEBUG
+ _LIT(KFilename,"c:\\logs\\caldav\\parseresonseslatest.txt");
+ ExportToFileNameL(aDocument, KFilename);
+#endif
+
+ RXmlEngDocument document = iDomParser.ParseL(aDocument);
+ CleanupClosePushL(document);
+ TInt ret = ParseResponsesL(document, aMultiget);
+ CleanupStack::PopAndDestroy(&document);
+ return ret;
+ }
+
+/**
+ * CCalDavEngine::StoreEntryL
+ * store event in local store
+ */
+#ifdef ETAG
+TInt CCalDavEngine::StoreEntryL(const TDesC8 &aBuf, const TDesC8 &aEtag)
+#else
+TInt CCalDavEngine::StoreEntryL(const TDesC8 &aBuf, const TDesC8 &/*aEtag*/)
+#endif
+ {
+#ifdef _DEBUG
+ _LIT(KFileName2, "C:\\logs\\caldav\\testing_import.txt");
+ ExportToFileNameL(aBuf, KFileName2);
+#endif
+
+ HBufC8* buffer = HBufC8::NewL(aBuf.Length() + 500);
+ buffer->Des().Append(aBuf);
+ TPtr8 ptr = buffer->Des();
+ CalDavUtils::FixImportIssues(ptr);
+
+ RPointerArray<CCalEntry> Array;
+ CleanupClosePushL(Array);
+ RDesReadStream ReadStream;
+ ReadStream.Open(ptr);
+ CleanupClosePushL(ReadStream);
+#ifdef _DEBUG
+ _LIT(KFileName, "C:\\logs\\caldav\\testing_import_fixed.txt");
+ ExportToFileNameL(ptr, KFileName);
+#endif
+ TRAPD(error, iCalImporter->ImportICalendarL(ReadStream,Array));
+ CleanupStack::PopAndDestroy(&ReadStream); // calls close on rSteam
+ if ((error == KErrNone) && (Array.Count()))
+ {
+ iCalIntermimUtils2->StoreL(*iCalEntryView, *Array[0], ETrue); // or should last one be EFalse??
+ TInt pos = iLocalUidArray.Find(Array[0]->LocalUidL());
+ if (pos == KErrNotFound)
+ {
+ iLocalUidArray.Append(Array[0]->LocalUidL());
+ iGlobalUidArray.Append(Array[0]->UidL());
+ }
+#ifdef ETAG
+ Array[0]->SetETag(aEtag);
+#endif
+ }
+ Array.ResetAndDestroy();
+ CleanupStack::PopAndDestroy(&Array);
+
+ delete buffer;
+ return error;
+ }
+
+/**
+ * CCalDavEngine::WebDavSyncReportL
+ * webdav sync report
+ * http://tools.ietf.org/html/draft-daboo-webdav-sync-02
+ */
+TInt CCalDavEngine::WebDavSyncReportL(TBool aSynctoken)
+ {
+ HBufC8 *Buf = HBufC8::NewL(KSync().Length() + SyncToken().Length());
+ TPtrC8 token = SyncToken();
+ if (aSynctoken)
+ Buf->Des().Format(KSync, &token);
+ else
+ Buf->Des().Format(KSync, &KNullDesC8());
+ CleanupStack::PushL(Buf);
+
+ CBufFlat* response = CBufFlat::NewL(EXPANDSIZE_BIG);
+ CleanupStack::PushL(response);
+ TInt ret = iHttp->ReportL(*iUrl, *Buf, response);
+
+ if (ret == MULTISTATUS)
+ {
+ RXmlEngDocument document = iDomParser.ParseL(response->Ptr(0));
+ CleanupClosePushL(document);
+ if (document.NotNull())
+ {
+ TPtrC8 Token = SearchL(document, KSynctoken, KNullDesC8);
+ if ((Token != KNullDesC8) && (Token != SyncToken()))
+ {
+ ret = ParseResponsesL(document);
+ //store newest token
+ if (ret == KErrNone)
+ SetSyncTokenL(Token.AllocL());
+ }
+ else
+ ret = KErrNone;
+ }
+ else
+ ret = KErrGeneral;
+ CleanupStack::PopAndDestroy(&document);
+ }
+ CleanupStack::PopAndDestroy(response);
+ CleanupStack::PopAndDestroy(Buf);
+ return ret;
+ }
+
+/**
+ * CCalDavEngine::WebDavSyncL
+ * sync using webdav sync
+ * http://tools.ietf.org/html/draft-daboo-webdav-sync-02
+ */
+TBool CCalDavEngine::WebDavSyncL()
+ {
+ if (iHttp)
+ {
+ // commit any left over client changes
+ TBool RetClient = ClientChangesL();
+ // get all changes from server
+ TInt ret = WebDavSyncReportL(ETrue);
+ if (ret == CONFLICT)
+ ret = WebDavSyncReportL(EFalse);
+ return (ret == KErrNone) && RetClient;
+ }
+ return EFalse;
+ }
+
+/**
+ * CCalDavEngine::GetUIDByUrl
+ * parse url to find UID
+ */
+TPtrC8 CCalDavEngine::GetUIDByUrl(const TDesC8 &aUrl)
+ {
+ TPtrC8 UID;
+ TInt Pos = aUrl.LocateReverse('/');
+ TInt Pos2 = aUrl.Find(KIcs);
+
+ if ((Pos != KErrNotFound) && (Pos2 != KErrNotFound))
+ UID.Set(aUrl.Mid(Pos + 1, Pos2 - Pos - 1));
+ else
+ {
+ if (Pos != KErrNotFound)
+ UID.Set(aUrl.Mid(Pos + 1, aUrl.Length() - Pos - 1));
+ else if (Pos2 != KErrNotFound)
+ UID.Set(aUrl.Left(aUrl.Length() - KIcs().Length()));
+ else
+ UID.Set(aUrl);
+ }
+
+ return UID;
+ }
+
+/**
+ * CCalDavEngine::DoesEntryExistL
+ * check if entry exists in local store
+ */
+unsigned long CCalDavEngine::DoesEntryExistL(const TDesC8 &aUrl)
+ {
+ // check if we already have it locally by uid
+ RPointerArray<CCalEntry> entryArray;
+ CleanupClosePushL(entryArray);
+ iCalEntryView->FetchL(GetUIDByUrl(aUrl), entryArray);
+ // get parent
+ CCalEntry *entry = entryArray.Count() ? entryArray[0] : NULL;
+ TInt ret = entry ? entry->LocalUidL() : 0;
+ entryArray.ResetAndDestroy();
+ CleanupStack::PopAndDestroy(&entryArray);
+ return ret;
+ }
+
+/**
+ * CCalDavEngine::ETagMatchL
+ * checks for equal ETag
+ */
+TBool CCalDavEngine::ETagMatchL(const TDesC8& /*aUrl*/, const TDesC8& /*aETag*/)
+ {
+#ifdef ETAG
+ // check if we already have it locally by uid
+ RPointerArray<CCalEntry> entryArray;
+ CleanupClosePushL(entryArray);
+ iCalEntryView->FetchL(GetUIDByUrl(aUrl), entryArray);
+ // get parent
+ CCalEntry *entry = entryArray.Count() ? entryArray[0] : NULL;
+ TBool ret = entry ? entry->ETag() == aETag : EFalse;
+ entryArray.ResetAndDestroy();
+ CleanupStack::PopAndDestroy(&entryArray);
+ return ret;
+#else
+ return EFalse;
+#endif
+ }
+
+/**
+ * CCalDavEngine::AddModifyLocalEntryL
+ * add or modify existing event
+ */
+TInt CCalDavEngine::AddModifyLocalEntryL(const TDesC8 &aUrl,
+ const TDesC8 &aETag, CDesC8ArrayFlat* aArray)
+ {
+ // check if we have the entry locally
+ // check for etag if we have the latest version, if not, download and import or add to multiget request
+ if (!ETagMatchL(aUrl, aETag))
+ {
+ if (aArray)
+ aArray->AppendL(aUrl);
+ else
+ DownloadEntryL(aUrl);
+ }
+ return KErrNone;
+ }
+
+/**
+ * CCalDavEngine::DownloadEntryL
+ * download entries using multiget from server
+ */
+TInt CCalDavEngine::DownloadEntryL(CDesC8Array* aArray)
+ {
+ TInt ret = KErrNone;
+ TInt64 remainder;
+ TInt64 result = Math::DivMod64(aArray->Count(), MULTIGETSPLIT, remainder);
+
+ // split large multigets request into several smaller ones
+ for (TInt64 l = 0; l <= result; l++)
+ {
+ // do the multiget request and pass it to parserepsonses again to read in the data
+ CBufFlat* body = CBufFlat::NewL(EXPANDSIZE_BIG);
+ CleanupStack::PushL(body);
+
+ body->InsertL(body->Size(), KMultistart);
+ for (TInt64 i = 0; i <= ((l == result) ? remainder - 1 : MULTIGETSPLIT
+ - 1); i++)
+ {
+ body->InsertL(body->Size(), KHrefstart);
+ body->InsertL(body->Size(), (*aArray)[MULTIGETSPLIT * l + i]);
+ body->InsertL(body->Size(), KHrefend);
+ }
+ body->InsertL(body->Size(), KMultiend);
+
+ CBufFlat* response = CBufFlat::NewL(EXPANDSIZE_BIG);
+ CleanupStack::PushL(response);
+ TInt Return = iHttp->ReportL(*iUrl, body->Ptr(0), response);
+
+ if (Return == MULTISTATUS)
+ {
+ TInt parsereturn = ParseResponsesL(response->Ptr(0), ETrue);
+ // if it failed before, we do not want to override this error
+ ret = (ret == KErrNone) ? parsereturn : ret;
+ }
+ else
+ ret = KErrGeneral;
+ CleanupStack::PopAndDestroy(response);
+ CleanupStack::PopAndDestroy(body);
+
+ }
+ return ret;
+ }
+
+/**
+ * CCalDavEngine::DownloadEntryL
+ * download entry from server
+ */
+TInt CCalDavEngine::DownloadEntryL(const TDesC8 &aUrl)
+ {
+ TBuf8<URLMAX> url;
+ url.Append(*iUrl);
+ url.Append(GetUIDByUrl(aUrl));
+ url.Append(KIcs);
+
+ CBufFlat* response = CBufFlat::NewL(EXPANDSIZE_SMALL);
+ CleanupStack::PushL(response);
+ TInt ret = iHttp->GetL(url, response);
+ if (ret == OK)
+ ret = StoreEntryL(response->Ptr(0), iHttp->ETag());
+ else
+ ret = KErrGeneral;
+ CleanupStack::PopAndDestroy(response);
+ return ret;
+ }
+
+/**
+ * CCalDavEngine::DeleteLocalEntryL
+ * delete an event from local store
+ */
+TInt CCalDavEngine::DeleteLocalEntryL(const TDesC8 &aUID)
+ {
+ CDesC8ArrayFlat * Array = new (ELeave) CDesC8ArrayFlat(ARRAYEXPAND);
+ CleanupStack::PushL(Array);
+ Array->AppendL(GetUIDByUrl(aUID));
+ // we could have delete it ourselves, so it is already gone
+ TRAPD(error, iCalEntryView->DeleteL(*Array));
+ Array->Reset();
+ CleanupStack::PopAndDestroy(Array);
+ return error;
+ }
+
+/**
+ * CCalDavEngine::DeleteRemovedEntriesOnServerL
+ * check for removed entries on server
+ */
+TInt CCalDavEngine::DeleteRemovedEntriesOnServerL()
+ {
+ if (iOptions.calendar_access)
+ {
+ TTime syncstart;
+ syncstart.HomeTime();
+ syncstart = syncstart - iPastDays;
+ TBuf<100> nowStr;
+ syncstart.FormatL(nowStr, KFormatString);
+ TBuf8<100> nowStrAdd;
+ nowStrAdd.Append(nowStr);
+
+ TInt eventreturn = KErrNone;
+ if (iOptions.VEVENT)
+ eventreturn = TimeReportL(ETrue, nowStrAdd, ETrue);
+
+ TInt todoreturn = KErrNone;
+ if (iOptions.VTODO)
+ todoreturn = TimeReportL(EFalse, nowStrAdd, ETrue);
+
+ return (eventreturn == KErrNone) && (todoreturn == KErrNone) ? KErrNone
+ : KErrGeneral;
+ }
+ else
+ {
+ // use PROPFIND report
+ CBufFlat* response = CBufFlat::NewL(EXPANDSIZE_SMALL);
+ CleanupStack::PushL(response);
+ TInt ret = iHttp->PropfindL(*iUrl, KPropList, response, EFalse);
+ if (ret == MULTISTATUS)
+ ret = ParseResponsesDeleteL(response->Ptr(0));
+ else
+ ret = KErrGeneral;
+ CleanupStack::PopAndDestroy(response);
+ return ret;
+ }
+
+ }
+
+/**
+ * CCalDavEngine::UploadModifiedSinceDateL
+ * check for any modified data after last sync time
+ */
+TBool CCalDavEngine::UploadModifiedSinceDateL()
+ {
+ TBool manualsync = EFalse;
+ // upload modified and newly create ones
+ RArray<TCalLocalUid> *Ids = new (ELeave) RArray<TCalLocalUid> (ARRAYEXPAND);
+ iCalEntryView->GetIdsModifiedSinceDateL(iLastSyncTime, *Ids);
+ for (TInt i = 0; i < Ids->Count(); i++)
+ {
+ TCalLocalUid id = (*Ids)[i];
+ TInt ret = UploadEntryL(id, MCalChangeCallBack2::EChangeUndefined,
+ MCalChangeCallBack2::EChangeEntryAll);
+ // TOOD: if it fails during upload, ignore
+ // if it fails due to internet connection, try again
+ if (ret != KErrNone)
+ manualsync = ETrue;
+ }
+ Ids->Reset();
+ delete Ids;
+ return manualsync;
+ }
+
+/**
+ * CCalDavEngine::ClientChangesL
+ * check for left over local client changes
+ */
+TBool CCalDavEngine::ClientChangesL()
+ {
+ if (iCalEntryView && iManualSync)
+ {
+ iManualSync = EFalse;
+
+ // upload modified and newly create ones
+ iManualSync = UploadModifiedSinceDateL();
+
+ // delete locally deleted entries on server
+ for (TInt i = iDeletedEntries.Count() - 1; i >= 0; --i)
+ {
+ TInt ret = DeleteEntryL(iDeletedEntries[i]);
+ if (ret == KErrNone)
+ iDeletedEntries.Remove(i);
+
+ }
+
+ iManualSync = iDeletedEntries.Count() ? ETrue : EFalse;
+
+ TPckgC<TBool> manualSync(iManualSync);
+ SetCalendarInfoL(KCaldavManualSync, manualSync);
+ }
+
+ return ETrue;
+ }
+
+/**
+ * CCalDavEngine::MkcalendarL
+ * create a new calendar on the server
+ */
+TInt CCalDavEngine::MkcalendarL(const TDesC8 &aName)
+ {
+ if (iOptions.MKCALENDAR)
+ {
+ TBuf8<URLMAX> url;
+ url.Append(*iHome);
+ url.Append(aName);
+ url.Append(KSlash);
+
+ CBufFlat* response = CBufFlat::NewL(EXPANDSIZE_SMALL);
+ CleanupStack::PushL(response);
+
+ // TOOD: initialize with name, body etc.
+ TInt ret = iHttp->MkCalendarL(url, KNullDesC8, response);
+
+ if ((ret == CREATED) || (ret == OK))
+ ret = KErrNone;
+ else if ((ret == NOTALLOWED) || (ret == FORBIDDEN))
+ ret = KErrArgument;
+ else
+ ret = KErrGeneral;
+ CleanupStack::PopAndDestroy(response);
+ return ret;
+ }
+ else
+ return KErrNotSupported;
+ }
+
+/**
+ * CCalDavEngine::DeleteCalendarL
+ * delete a calendar on the server
+ */
+TInt CCalDavEngine::DeleteCalendarL(const TDesC8 &aName)
+ {
+ if (iOptions.MKCALENDAR)
+ {
+ TBuf8<URLMAX> url;
+ url.Append(*iHome);
+ url.Append(aName);
+ url.Append(KSlash);
+
+ CBufFlat* response = CBufFlat::NewL(EXPANDSIZE_SMALL);
+ CleanupStack::PushL(response);
+ TInt ret = iHttp->DeleteL(url);
+ if ((ret == NOCONTENT) || (ret == OK))
+ ret = KErrNone;
+ else
+ ret = KErrGeneral;
+ CleanupStack::PopAndDestroy(response);
+ return ret;
+ }
+ else
+ return KErrNotSupported;
+ }
+
+/**
+ * CCalDavEngine::HeadL
+ * check for existence of an entry on server
+ */
+TInt CCalDavEngine::HeadL(const TDesC8 &aUID)
+ {
+ // special handing for yahoo neccessary
+ // after deleting an event, it is still there and findable with HEAD
+ _LIT8(KYahoo,"yahoo");
+ _LIT8(KTrash,"trash");
+
+ TBuf8<URLMAX> url;
+ url.Append(*iUrl);
+ url.Append(aUID);
+ url.Append(KIcs);
+ if (iUrl->Find(KYahoo) == KErrNotFound)
+ {
+ TInt head = iHttp->HeadL(url);
+ return (head == NOCONTENT) || (head == OK) ? OK : head;
+ }
+ else
+ {
+ CBufFlat* response = CBufFlat::NewL(EXPANDSIZE_SMALL);
+ CleanupStack::PushL(response);
+ TInt ret = iHttp->PropfindL(url, KNullDesC8, response);
+
+ if (ret == MULTISTATUS)
+ {
+ RXmlEngDocument document = iDomParser.ParseL(response->Ptr(0));
+ CleanupClosePushL(document);
+ if (document.NotNull())
+ {
+ HBufC8* href = SearchL(document, KHref, KNullDesC8).AllocL();
+ href->Des().LowerCase();
+ ret = href->Find(KTrash) == KErrNotFound ? OK : NOTFOUND;
+ delete href;
+ }
+ CleanupStack::PopAndDestroy(&document);
+ CleanupStack::PopAndDestroy(response);
+ return ret;
+ }
+ else
+ {
+ CleanupStack::PopAndDestroy(response);
+ return NOTFOUND;
+ }
+ }
+ }
+
+/**
+ * CCalDavEngine::DeleteEntryL
+ * delete entry on server
+ */
+TInt CCalDavEngine::DeleteEntryL(const TDesC8 &aUid)
+ {
+ TBuf8<URLMAX> url;
+ url.Append(*iBaseUrl);
+ url.Append(aUid);
+ return iHttp->DeleteL(url);
+ }
+
+/**
+ * CCalDavEngine::DeleteEntryL
+ * delete entry on server
+ */
+TInt CCalDavEngine::DeleteEntryL(const TCalLocalUid &aUid)
+ {
+ TInt Ret = KErrNone;
+ // find the filename for a given local UID
+ TInt aPos = iLocalUidArray.Find(aUid);
+ if (aPos != KErrNotFound)
+ {
+ TBuf8<URLMAX> url;
+ url.Append(*iUrl);
+ url.Append(iGlobalUidArray[aPos]);
+ url.Append(KIcs);
+
+#ifdef ETAG
+ CCalEntry* entry = iCalEntryView->FetchL(aUid);
+ CleanupStack::PushL(entry);
+ TInt Return = entry ? iHttp->DeleteL(url, entry->ETag())
+ : iHttp->DeleteL(url);
+ CleanupStack::PopAndDestroy(entry);
+#else
+ TInt Return = iHttp->DeleteL(url);
+#endif
+
+ if ((Return == NOCONTENT) || (Return == OK))
+ {
+ SetLastSyncTimeL();
+ }
+ else if (Return == PRECONDFAILED)
+ {
+ // someone modified this in the meantime
+ // ask user if he wants the new event or still delete it
+ TBool modify = EFalse;
+ if (modify)
+ DownloadEntryL(url);
+ else
+ iHttp->DeleteL(url);
+ }
+ else if (Return == NOTFOUND)
+ {
+ // someone deleted this already
+ Ret = KErrGeneral;
+ }
+ else if (Return == FORBIDDEN)
+ {
+ // event read-only
+ Ret = KErrGeneral;
+ }
+ else
+ {
+ Ret = KErrGeneral;
+ SyncFailedL();
+ TInt pos = iDeletedEntries.Find(aUid);
+ if (pos == KErrNotFound)
+ iDeletedEntries.Append(aUid);
+ }
+ }
+ else
+ Ret = KErrGeneral;
+ return Ret;
+ }
+
+/**
+ * CCalDavEngine::UploadEntryL
+ * upload entry to server
+ */
+TInt CCalDavEngine::UploadEntryL(CCalEntry* aEntry,
+ MCalChangeCallBack2::TChangeType aChangeType,
+ MCalChangeCallBack2::TChangeEntryType aEntryType)
+ {
+ if (aEntry)
+ {
+ TInt ret = KErrNone;
+ TBool upload = EFalse;
+ switch (aEntryType)
+ {
+ case MCalChangeCallBack2::EChangeEntryEvent:
+ case MCalChangeCallBack2::EChangeEntryTodo:
+ {
+ upload = aEntry && ((MCalChangeCallBack2::EChangeEntryEvent
+ && iOptions.VEVENT)
+ || (MCalChangeCallBack2::EChangeEntryTodo
+ && iOptions.VTODO));
+ break;
+ }
+ case MCalChangeCallBack2::EChangeEntryAll:
+ {
+ if (aEntry)
+ {
+ switch (aEntry->EntryTypeL())
+ {
+ case CCalEntry::EAppt:
+ case CCalEntry::EAnniv:
+ case CCalEntry::EEvent:
+ case CCalEntry::EReminder:
+ {
+ upload = iOptions.VEVENT;
+ break;
+ }
+ case CCalEntry::ETodo:
+ {
+ upload = iOptions.VTODO;
+ break;
+ }
+ }
+ }
+
+ }
+ }
+ if (upload)
+ {
+ CBufFlat* BufFlat = CBufFlat::NewL(EXPANDSIZE_SMALL);
+ CleanupStack::PushL(BufFlat);
+ RBufWriteStream writeStream(*BufFlat);
+ CleanupClosePushL(writeStream);
+ iCalExporter->ExportICalL(*aEntry, writeStream);
+ writeStream.CommitL();
+ CleanupStack::PopAndDestroy(&writeStream);
+
+ HBufC8* buffer = BufFlat->Ptr(0).AllocL();
+ CleanupStack::PopAndDestroy(BufFlat);
+ CleanupStack::PushL(buffer);
+ TPtr8 ptr = buffer->Des();
+ CalDavUtils::FixExportIssues(ptr);
+
+#ifdef _DEBUG
+ ExportToFileL(aEntry, iCalExporter);
+ _LIT(KFileName, "C:\\logs\\caldav\\testing_export_fixed.txt");
+ ExportToFileNameL(ptr, KFileName);
+#endif
+
+ TBuf8<URLMAX> url;
+ url.Append(*iUrl);
+ url.Append(aEntry->UidL());
+ url.Append(KIcs);
+
+ CBufFlat* response = CBufFlat::NewL(EXPANDSIZE_SMALL);
+ CleanupStack::PushL(response);
+
+#ifdef ETAG
+ TPtrC8 etag = aEntry->GetETag();
+ TBool newentry = (aChangeType == MCalChangeCallBack2::EChangeAdd)
+ || ((aChangeType == MCalChangeCallBack2::EChangeUndefined)
+ && (etag == KNullDesC8));
+ TInt Ret = newentry ? iHttp->PutL(url, *buffer, response)
+ : iHttp->PutL(url, *buffer, response, etag);
+#else
+ TBool newentry = (aChangeType == MCalChangeCallBack2::EChangeAdd)
+ || (aChangeType == MCalChangeCallBack2::EChangeUndefined);
+ TInt Ret = newentry ? iHttp->PutL(url, *buffer, response)
+ : iHttp->PutL(url, *buffer, response, _L8("ETAG"));
+#endif
+ if ((Ret == CREATED) || (Ret == NOCONTENT) || (Ret == OK))
+ {
+ if (newentry)
+ {
+ iLocalUidArray.Append(aEntry->LocalUidL());
+ iGlobalUidArray.Append(aEntry->UidL());
+ }
+#ifdef ETAG
+ aEntry->SetETag(iHttp->ETag());
+#endif
+ SetLastSyncTimeL();
+ }
+ else if (Ret == PRECONDFAILED)
+ {
+ if (newentry)// same filename already exists, use a different one and upload again
+ {
+ TBuf8<URLMAX> nextUrl;
+ nextUrl.Append(*iUrl);
+ nextUrl.Append(aEntry->UidL());
+ TTime time;
+ time.HomeTime();
+ _LIT(KTimeFormat,"%H%T%S");
+ TBuf<20> StringTime;
+ time.FormatL(StringTime, KTimeFormat);
+ nextUrl.Append(StringTime);
+ nextUrl.Append(_L8(".ics"));
+ response->Reset();
+ TInt Ret = iHttp->PutL(nextUrl, *buffer, response);
+ if ((Ret == CREATED) || (Ret == OK))
+ {
+ iLocalUidArray.Append(aEntry->LocalUidL());
+ iGlobalUidArray.Append(aEntry->UidL());
+#ifdef ETAG
+ aEntry->SetETag(iHttp->ETag());
+#endif
+ SetLastSyncTimeL();
+ }
+ else
+ {
+ SyncFailedL();
+ ret = KErrAbort;
+ }
+ }
+ else
+ {
+ if (!iKeepServerEntry)
+ {
+ response->Reset();
+ // upload again without ETAG to overwrite server entry
+ TInt Ret = iHttp->PutL(url, *buffer, response);
+ if ((Ret == CREATED) || (Ret == OK))
+ {
+#ifdef ETAG
+ aEntry->SetETag(iHttp->ETag());
+#endif
+ SetLastSyncTimeL();
+ }
+ else
+ {
+ SyncFailedL();
+ ret = KErrAbort;
+ }
+ }
+ else
+ {
+ // download the server event and update local store
+ ret = DownloadEntryL(url);
+ if (ret == KErrNone)
+ SetLastSyncTimeL();
+ else
+ {
+ SyncFailedL();
+ ret = KErrAbort;
+ }
+ }
+ }
+ }
+ else
+ {
+ SyncFailedL();
+ ret = KErrAbort;
+ }
+ CleanupStack::PopAndDestroy(response);
+ CleanupStack::PopAndDestroy(buffer);
+ }
+ return ret;
+ }
+ return KErrArgument;
+ }
+
+/**
+ * CCalDavEngine::UploadEntryL
+ * upload entry to server
+ */
+TInt CCalDavEngine::UploadEntryL(const TCalLocalUid &aUid,
+ MCalChangeCallBack2::TChangeType aChangeType,
+ MCalChangeCallBack2::TChangeEntryType aEntryType)
+ {
+ CCalEntry * aEntry = iCalEntryView->FetchL(aUid);
+ CleanupStack::PushL(aEntry);
+ TInt ret = UploadEntryL(aEntry, aChangeType, aEntryType);
+ CleanupStack::PopAndDestroy(aEntry);
+ return ret;
+ }
+
+/**
+ * CCalDavEngine::GetSyncTokenL
+ * get latest Webdav Sync token
+ */
+HBufC8* CCalDavEngine::GetSyncTokenL()
+ {
+ HBufC8 *aBuf = HBufC8::NewL(KSync().Length());
+ aBuf->Des().Format(KSync, &KNullDesC8());
+ CleanupStack::PushL(aBuf);
+
+ CBufFlat* response = CBufFlat::NewL(EXPANDSIZE_SMALL);
+ CleanupStack::PushL(response);
+ TInt RetServer = iHttp->ReportL(*iUrl, *aBuf, response);
+
+ if (RetServer)
+ {
+ RXmlEngDocument document = iDomParser.ParseL(response->Ptr(0));
+ CleanupClosePushL(document);
+ if (document.NotNull())
+ {
+ HBufC8* ret = SearchL(document, KSynctoken, KNullDesC8).AllocL();
+ CleanupStack::PopAndDestroy(&document);
+ CleanupStack::PopAndDestroy(response);
+ CleanupStack::PopAndDestroy(aBuf);
+ return ret;
+ }
+ CleanupStack::PopAndDestroy(&document);
+ }
+ CleanupStack::PopAndDestroy(response);
+ CleanupStack::PopAndDestroy(aBuf);
+ return KNullDesC8().AllocL();
+ }
+
+/**
+ * CCalDavEngine::CheckCalendarInfoL
+ * check for new calendar displayname and color
+ */
+void CCalDavEngine::CheckCalendarInfoL(RXmlEngDocument &aDocument)
+ {
+ TBool change = EFalse;
+ CCalCalendarInfo* info = iCalSession->CalendarInfoL();
+ CleanupStack::PushL(info);
+
+ HBufC8* color = SearchL(aDocument, KCalendar_Color, KNullDesC8).AllocLC();
+ if ((*color != KNullDesC8) && (color->Length() > 6))
+ {
+ TLex8 lexred(color->Des().Mid(1, 2));
+ TInt red;
+ lexred.Val(red);
+ TLex8 lexgreen(color->Des().Mid(3, 2));
+ TInt green;
+ lexgreen.Val(green);
+ TLex8 lexblue(color->Des().Mid(5, 2));
+ TInt blue;
+ lexblue.Val(blue);
+ TRgb newcolor(red, green, blue);
+ if (info->Color() != newcolor)
+ {
+ info->SetColor(newcolor);
+ change = ETrue;
+ }
+ }
+ CleanupStack::PopAndDestroy(color);
+
+ HBufC8* displayname =
+ SearchL(aDocument, KDisplayname, KNullDesC8).AllocLC();
+ if (*displayname != KNullDesC8)
+ {
+ HBufC16* name =
+ CnvUtfConverter::ConvertToUnicodeFromUtf8L(*displayname);
+ CleanupStack::PushL(name);
+ if (info->NameL() != *name)
+ {
+ info->SetNameL(*name);
+ change = ETrue;
+ }
+ CleanupStack::PopAndDestroy(name);
+ change = ETrue;
+ }
+ CleanupStack::PopAndDestroy(displayname);
+
+ if (change)
+ iCalSession->SetCalendarInfoL(*info);
+ CleanupStack::PopAndDestroy(info);
+
+ }
+
+/**
+ * CCalDavEngine::GetCTagL
+ * get latest CTag
+ * https://trac.calendarserver.org/browser/CalendarServer/trunk/doc/Extensions/caldav-ctag.txt
+ */
+HBufC8* CCalDavEngine::GetCTagL()
+ {
+ if (iHttp)
+ {
+ CBufFlat* response = CBufFlat::NewL(EXPANDSIZE_SMALL);
+ CleanupStack::PushL(response);
+ TInt ret = iHttp->PropfindL(*iUrl, KCtag, response);
+
+ if (ret == MULTISTATUS)
+ {
+ RXmlEngDocument document = iDomParser.ParseL(response->Ptr(0));
+ CleanupClosePushL(document);
+ if (document.NotNull())
+ {
+ HBufC8* status =
+ SearchL(document, KStatus, KNullDesC8).AllocLC();
+ HBufC8* ctag =
+ SearchL(document, KGetctag, KNullDesC8).AllocLC();
+ status->Des().LowerCase();
+ if ((*ctag != KNullDesC8) && (*status == KHTTP200))
+ {
+ CleanupStack::Pop(ctag);
+ CleanupStack::PopAndDestroy(status);
+ CleanupStack::PopAndDestroy(&document);
+ CleanupStack::PopAndDestroy(response);
+ return ctag;
+ }
+ else
+ CleanupStack::PopAndDestroy(ctag);
+ CleanupStack::PopAndDestroy(status);
+ }
+ CleanupStack::PopAndDestroy(&document);
+
+ }
+ CleanupStack::PopAndDestroy(response);
+ }
+ return KNullDesC8().AllocL();
+ }
+
+/**
+ * CCalDavEngine::GetOptionsL
+ * get OPTIONS from server
+ */
+TBool CCalDavEngine::GetOptionsL()
+ {
+ if (iHttp)
+ {
+ // check DAV and allow headers
+ iHttp->GetServerOptionsL(*iUrl, iOptions);
+
+ // check ctag extension
+ HBufC8* ctag = GetCTagL();
+ if (*ctag != KNullDesC8)
+ iOptions.sync_ctag = true;
+ delete ctag;
+
+ // check supported elements
+ CBufFlat* response = CBufFlat::NewL(EXPANDSIZE_SMALL);
+ CleanupStack::PushL(response);
+ TInt Ret = iHttp->PropfindL(*iUrl, KSupportedSet, response);
+
+ if (Ret == MULTISTATUS)
+ {
+ RXmlEngDocument document = iDomParser.ParseL(response->Ptr(0));
+ CleanupClosePushL(document);
+ if (document.NotNull())
+ {
+ CheckCalendarInfoL(document);
+
+ //<C:supported-calendar-component-set/>
+ TXmlEngElement supportedelement;
+ SearchL(document, KSupportedCalendarComponentSet, KNullDesC8,
+ supportedelement);
+ if (supportedelement.NotNull())
+ {
+ RXmlEngNodeList<TXmlEngElement> supportedelements;
+ CleanupClosePushL(supportedelements);
+ supportedelement.GetChildElements(supportedelements);
+ while (supportedelements.HasNext())
+ {
+ TXmlEngElement element = supportedelements.Next();
+ TPtrC8 value = element.AttributeValueL(KName);
+ if (value == KNullDesC8)
+ value.Set(element.AttributeValueL(KName, KCalDav));
+ if (value == KVEVENT)
+ iOptions.VEVENT = ETrue;
+ else if (value == KVTODO)
+ iOptions.VTODO = ETrue;
+ else if (value == KVFREBUSY)
+ iOptions.VFREEBUSY = ETrue;
+ else if (value == KVJOURNAL)
+ iOptions.VJOURNAL = ETrue;
+ }
+ CleanupStack::PopAndDestroy(&supportedelements);
+ }
+ }
+ CleanupStack::PopAndDestroy(&document);
+ }
+ CleanupStack::PopAndDestroy(response);
+ }
+ return ETrue;
+ }
+
+/**
+ * CCalDavEngine::SetSyncTokenL
+ * set sync token
+ */
+void CCalDavEngine::SetSyncTokenL(HBufC8* aToken)
+ {
+ if (iSynctoken)
+ {
+ delete iSynctoken;
+ iSynctoken = NULL;
+ }
+ iSynctoken = aToken;
+ SetCalendarInfoL(KCaldavSynctoken, *iSynctoken);
+ }
+
+/**
+ * CCalDavEngine::SyncToken
+ * get synctoken
+ */
+TPtrC8 CCalDavEngine::SyncToken()
+ {
+ return iSynctoken ? *iSynctoken : KNullDesC8();
+ }
+
+/**
+ * CCalDavEngine::SetCTagL
+ * set ctag
+ */
+void CCalDavEngine::SetCTagL(HBufC8* aToken)
+ {
+ if (iCTag)
+ {
+ delete iCTag;
+ iCTag = NULL;
+ }
+ iCTag = aToken;
+ SetCalendarInfoL(KCaldavCtag, *iCTag);
+ }
+
+/**
+ * CCalDavEngine::CTag
+ * get ctag
+ */
+TPtrC8 CCalDavEngine::CTag()
+ {
+ return iCTag ? *iCTag : KNullDesC8();
+ }
+
+/**
+ * CCalDavEngine::SetLastSyncTimeL
+ * set last sync time
+ */
+void CCalDavEngine::SetLastSyncTimeL()
+ {
+ // only set a new last sync time, if we did not have a failed one before
+ // otherwise, the old one would be lost
+ if (!iManualSync)
+ {
+ TTime time;
+ time.UniversalTime();
+ iLastSyncTime.SetTimeUtcL(time);
+ TPckgC<TCalTime> lasttime(iLastSyncTime);
+ SetCalendarInfoL(KCaldavTime, lasttime);
+ }
+ }
+
+/**
+ * CCalDavEngine::SyncFailedL
+ * sync failed, enable manual sync
+ */
+void CCalDavEngine::SyncFailedL()
+ {
+ if (!iManualSync)
+ {
+ iManualSync = ETrue;
+ TPckgC<TBool> manualSync(iManualSync);
+ SetCalendarInfoL(KCaldavManualSync, manualSync);
+ }
+ }
+
+/**
+ * CCalDavEngine::GetBaseUrl
+ * get base domain url
+ */
+void CCalDavEngine::GetBaseUrl(const TDesC8 &aUrl)
+ {
+ _LIT8(http,"http://");
+ _LIT8(https,"https://");
+
+ if (iBaseUrl)
+ {
+ delete iBaseUrl;
+ iBaseUrl = NULL;
+ }
+
+ if (aUrl.Length() > http().Length())
+ {
+ TInt length = aUrl.Find(https) != KErrNotFound ? https().Length()
+ : http().Length();
+ TInt pos = aUrl.Mid(length).Locate('/');
+ iBaseUrl = aUrl.Left(pos + length).Alloc();
+ }
+ }
+
+/**
+ * CCalDavEngine::FindUrlsL
+ * find home, inbox and outbox property
+ */
+void CCalDavEngine::FindUrlsL(const TDesC8 &aDes, HBufC8 *&home,
+ HBufC8 *&inbox, HBufC8 *&outbox)
+ {
+ RXmlEngDocument document = iDomParser.ParseL(aDes);
+ CleanupClosePushL(document);
+ if (document.NotNull())
+ {
+ HBufC8* status = SearchL(document, KStatus, KNullDesC8).AllocLC();
+ status->Des().LowerCase();
+ if (*status == KHTTP200)
+ {
+ TXmlEngElement calendarhome, inboxhome, outboxhome;
+
+ SearchL(document, KCalendarHomeSet, KNullDesC8, calendarhome);
+ if (calendarhome.NotNull())
+ {
+ TPtrC8 homeend = SearchL(calendarhome, KHref, KNullDesC8);
+ home = HBufC8::NewL(iBaseUrl->Length() + homeend.Length());
+ home->Des().Append(*iBaseUrl);
+ home->Des().Append(homeend);
+ }
+
+ SearchL(document, KInbox, KNullDesC8, inboxhome);
+ if (inboxhome.NotNull())
+ {
+ TPtrC8 inboxend = SearchL(inboxhome, KHref, KNullDesC8);
+ inbox = HBufC8::NewL(iBaseUrl->Length() + inboxend.Length());
+ inbox->Des().Append(*iBaseUrl);
+ inbox->Des().Append(inboxend);
+ }
+
+ SearchL(document, KOutbox, KNullDesC8, outboxhome);
+ if (outboxhome.NotNull())
+ {
+ TPtrC8 outboxend = SearchL(outboxhome, KHref, KNullDesC8);
+ outbox = HBufC8::NewL(iBaseUrl->Length() + outboxend.Length());
+ outbox->Des().Append(*iBaseUrl);
+ outbox->Des().Append(outboxend);
+ }
+ }
+ CleanupStack::PopAndDestroy(status);
+ }
+ CleanupStack::PopAndDestroy(&document);
+ }
+
+/**
+ * CCalDavEngine::FindCalendarCollectionL
+ * find all calendar collections under home url
+ */
+HBufC8* CCalDavEngine::FindCalendarCollectionL(const TDesC8 &aUrl,
+ CDesC8ArrayFlat *aArray)
+ {
+ HBufC8* homecalendar = 0;
+
+ // do propfind depth:1 and find all calendar collections
+ // right now, take the first one as default
+ CBufFlat* response = CBufFlat::NewL(EXPANDSIZE_SMALL);
+ CleanupStack::PushL(response);
+ TInt retcode = iHttp->PropfindL(aUrl, KCalendarurl, response, EFalse);
+ if (retcode == MULTISTATUS)
+ {
+ RXmlEngDocument document = iDomParser.ParseL(response->Ptr(0));
+ CleanupClosePushL(document);
+ if (document.NotNull() && document.DocumentElement().NotNull())
+ {
+ RXmlEngNodeList<TXmlEngElement> ResponseList;
+ CleanupClosePushL(ResponseList);
+ document.DocumentElement().GetElementsByTagNameL(ResponseList,
+ KResponse, KDav);
+ TBool FirstOneDone = EFalse;
+ while (ResponseList.HasNext())
+ {
+ TXmlEngElement node = ResponseList.Next();
+ TPtrC8 href = SearchL(node, KHref, KNullDesC8);
+ TPtrC8 status = SearchL(node, KStatus, KNullDesC8);
+
+ TXmlEngElement calendar;
+ TXmlEngElement vevent_collection;
+ TXmlEngElement vtodo_collection;
+ SearchL(node, KCalendar, KNullDesC8, calendar);
+ SearchL(node, KVEventCollection, KNullDesC8, vevent_collection);
+ SearchL(node, KVTodoCollection, KNullDesC8, vtodo_collection);
+
+ if (calendar.NotNull() || vevent_collection.NotNull()
+ || vtodo_collection.NotNull())
+ {
+ if (!FirstOneDone)
+ {
+ homecalendar = HBufC8::NewL(iBaseUrl->Length()
+ + href.Length());
+ homecalendar->Des().Append(*iBaseUrl);
+ homecalendar->Des().Append(href);
+
+ iOptions.VEVENT = vevent_collection.NotNull();
+ iOptions.VTODO = vtodo_collection.NotNull();
+
+ FirstOneDone = ETrue;
+ }
+
+ if (aArray)
+ {
+ TBuf8<URLMAX> url;
+ url.Append(*iBaseUrl);
+ url.Append(href);
+ aArray->AppendL(url);
+ }
+ }
+ }
+ CleanupStack::PopAndDestroy(&ResponseList);
+ }
+ CleanupStack::PopAndDestroy(&document);
+ }
+ CleanupStack::PopAndDestroy(response);
+ return homecalendar;
+ }
+
+/**
+ * CCalDavEngine::GetCalendarUrlsL
+ * find calendar url based on any url
+ * could be principal url, home or direct calendar url
+ */
+TInt CCalDavEngine::GetCalendarUrlsL(CDesC8ArrayFlat *aArray)
+ {
+ if (iHttp && iUrl)
+ {
+ HBufC8 *principal = 0;
+ HBufC8 *home = 0;
+ HBufC8 *homecalendar = 0;
+ HBufC8 *inbox = 0;
+ HBufC8 *outbox = 0;
+
+ GetBaseUrl(*iUrl);
+
+ // TODO: does this really find groupdav collection?
+
+ // find out if this is a caldav or groupdav calendar collection
+ CBufFlat* response = CBufFlat::NewL(EXPANDSIZE_SMALL);
+ CleanupStack::PushL(response);
+ TInt retcode = iHttp->PropfindL(*iUrl, KCalendarurl, response);
+ if (retcode == MULTISTATUS)
+ {
+ RXmlEngDocument document = iDomParser.ParseL(response->Ptr(0));
+ CleanupClosePushL(document);
+ if (document.NotNull())
+ {
+ HBufC8* status =
+ SearchL(document, KStatus, KNullDesC8).AllocLC();
+ status->Des().LowerCase();
+ TXmlEngElement calendar;
+ SearchL(document, KCalendar, KNullDesC8, calendar);
+ // it should be <owner><href>value</href></owner>
+ // but oracle beehive server does <owner>value</owner>
+ TXmlEngElement owner;
+ SearchL(document, KOwner, KNullDesC8, owner);
+ TPtrC8 ownerref1 = SearchL(owner, KHref, KNullDesC8);
+ TPtrC8 ownerref2 = owner.Value();
+ TPtrC8 ownerref;
+ ownerref.Set(ownerref1 != KNullDesC8 ? ownerref1 : ownerref2);
+
+ if (calendar.NotNull() && (ownerref != KNullDesC8) && (*status
+ == KHTTP200))
+ {
+ // this is a calendar collection and we know the principal as well now
+ homecalendar = iUrl->AllocL();
+ _LIT8(KHTTP,"http");
+ HBufC8* http = ownerref.Left(KHTTP().Length()).AllocLC();
+ if (*http == KHTTP)
+ {
+ // sogo server does not return relative, but principal url
+ principal = ownerref.AllocL();
+ }
+ else
+ {
+ principal = HBufC8::NewL(iBaseUrl->Length()
+ + ownerref.Length());
+ principal->Des().Append(*iBaseUrl);
+ principal->Des().Append(ownerref);
+ }
+ CleanupStack::PopAndDestroy(http);
+ }
+ CleanupStack::PopAndDestroy(status);
+ }
+ CleanupStack::PopAndDestroy(&document);
+ }
+
+ // if we have principal, ask for home, otherwise see if principal was given in the first place
+ if (principal)
+ {
+ response->Reset();
+ TInt retcode =
+ iHttp->PropfindL(*principal, KPrincipalurl, response);
+ if (retcode == MULTISTATUS)
+ {
+ FindUrlsL(response->Ptr(0), home, inbox, outbox);
+ }
+ }
+ else
+ {
+ response->Reset();
+ TInt retcode = iHttp->PropfindL(*iUrl, KPrincipalurl, response);
+ if (retcode == MULTISTATUS)
+ {
+ FindUrlsL(response->Ptr(0), home, inbox, outbox);
+ }
+ }
+
+ home = CalDavUtils::EnsureSlashL(home);
+ inbox = CalDavUtils::EnsureSlashL(inbox);
+ outbox = CalDavUtils::EnsureSlashL(outbox);
+
+ // find out all calendar collections under home
+ if (home)
+ {
+ // TODO: temporary? we already have homecalendar...
+ if (!homecalendar)
+ {
+ homecalendar = FindCalendarCollectionL(*home, aArray);
+ }
+ }
+ else
+ {
+ // have not found out home nor a groupdav collection, maybe we are home ourselves
+ homecalendar = FindCalendarCollectionL(*iUrl, aArray);
+ if (homecalendar)
+ home = iUrl->AllocL();
+ }
+
+ CleanupStack::PopAndDestroy(response);
+ delete principal;
+ delete inbox;
+ delete outbox;
+
+ if (home)
+ iHome = CalDavUtils::EnsureSlashL(home);
+ if (homecalendar)
+ {
+ delete iUrl;
+ iUrl = NULL;
+ iUrl = CalDavUtils::EnsureSlashL(homecalendar);
+ return KErrNone;
+ }
+ else
+ return KErrArgument;
+ }
+ return KErrArgument;
+ }
+
+/**
+ * CCalDavEngine::CalendarName
+ * get calendar name
+ */
+TPtrC CCalDavEngine::CalendarName() const
+ {
+ return iCalendar ? *iCalendar : KNullDesC();
+ }
+
+/**
+ * CCalDavEngine::Home
+ * get home
+ */
+TPtrC8 CCalDavEngine::Home() const
+ {
+ return iHome ? *iHome : KNullDesC8();
+ }
+
+/**
+ * CCalDavEngine::Url
+ * get url
+ */
+TPtrC8 CCalDavEngine::Url() const
+ {
+ return iUrl ? *iUrl : KNullDesC8();
+ }
+
+/**
+ * CCalDavEngine::SetUrlL
+ * set url
+ */
+void CCalDavEngine::SetUrlL(const TDesC8 &aUrl)
+ {
+ if (iUrl ? *iUrl != aUrl : ETrue)
+ {
+ DisableL();
+
+ if (iUrl)
+ {
+ delete iUrl;
+ iUrl = NULL;
+ }
+
+ iUrl = CalDavUtils::EnsureSlashL(aUrl);
+ SetCalendarInfoL(KCaldavUrl, *iUrl);
+ }
+ }
+
+/**
+ * CCalDavEngine::User
+ * get user
+ */
+TPtrC8 CCalDavEngine::User() const
+ {
+ return iHttp->User();
+ }
+
+/**
+ * CCalDavEngine::SetUserL
+ * set user
+ */
+void CCalDavEngine::SetUserL(const TDesC8 &aUser)
+ {
+ if (iHttp->User() != aUser)
+ {
+ DisableL();
+ SetCalendarInfoL(KCaldavUser, aUser);
+ iHttp->SetUserL(aUser);
+ }
+ }
+
+/**
+ * CCalDavEngine::Password
+ * get password
+ */
+TPtrC8 CCalDavEngine::Password() const
+ {
+ return iHttp->Password();
+ }
+
+/**
+ * CCalDavEngine::SetPasswordL
+ * set password
+ */
+void CCalDavEngine::SetPasswordL(const TDesC8 &aPassword)
+ {
+ if (iHttp->Password() != aPassword)
+ {
+ DisableL();
+ iHttp->SetPasswordL(aPassword);
+ SetCalendarInfoL(KCaldavPassword, aPassword);
+ }
+ }
+
+/**
+ * CCalDavEngine::SyncInterval
+ * get SyncInterval
+ */
+TTimeIntervalMinutes CCalDavEngine::SyncInterval() const
+ {
+ return iSyncInterval;
+ }
+
+/**
+ * CCalDavEngine::SetSyncIntervalL
+ * set SetSyncIntervalL
+ */
+void CCalDavEngine::SetSyncIntervalL(TTimeIntervalMinutes aSyncInterval)
+ {
+ iSyncInterval = aSyncInterval;
+ TPckgC<TTimeIntervalMinutes> minutes(iSyncInterval);
+ SetCalendarInfoL(KCaldavSyncInterval, minutes);
+ }
+
+/**
+ * CCalDavEngine::PastDays
+ * get past days
+ */
+TTimeIntervalDays CCalDavEngine::PastDays() const
+ {
+ return iPastDays;
+ }
+
+/**
+ * CCalDavEngine::SetPastDaysL
+ * Set PastDaysL
+ */
+void CCalDavEngine::SetPastDaysL(TTimeIntervalDays aDays)
+ {
+ iPastDays = aDays;
+ TPckgC<TTimeIntervalDays> days(iPastDays);
+ SetCalendarInfoL(KCaldavPastDays, days);
+ }
+
+/**
+ * CCalDavEngine::ImmediateSync
+ * get ImmediateSyncL
+ */
+TBool CCalDavEngine::ImmediateSync() const
+ {
+ return iImmediateSync;
+ }
+
+/**
+ * CCalDavEngine::SetImmediateSyncL
+ * Set ImmediateSyncL
+ */
+void CCalDavEngine::SetImmediateSyncL(TBool aImmediateSyc)
+ {
+ iImmediateSync = aImmediateSyc;
+ TPckgC<TBool> immediatesync(iImmediateSync);
+ SetCalendarInfoL(KCaldavImmediateSync, immediatesync);
+ }
+
+/**
+ * CCalDavEngine::KeepServerEntry
+ * get KeepServerEntryL
+ */
+TBool CCalDavEngine::KeepServerEntry() const
+ {
+ return iKeepServerEntry;
+ }
+
+/**
+ * CCalDavEngine::SetKeepServerEntryL
+ * Set KeepServerEntryL
+ */
+void CCalDavEngine::SetKeepServerEntryL(TBool aKeepServerEntry)
+ {
+ iKeepServerEntry = aKeepServerEntry;
+ TPckgC<TBool> keepserver(iKeepServerEntry);
+ SetCalendarInfoL(KCaldavKeepServer, keepserver);
+ }
+
+/**
+ * CCalDavEngine::Timer
+ * get timer
+ */
+CPeriodic* CCalDavEngine::Timer()
+ {
+ return iTimer;
+ }
--- a/calendarengines/caldav/src/caldavenginemgr.cpp Mon Mar 08 21:43:23 2010 +0000
+++ b/calendarengines/caldav/src/caldavenginemgr.cpp Sun Mar 14 13:09:26 2010 +0000
@@ -1,372 +1,372 @@
-/*
-* Copyright (c) 2010 Sun Microsystems, Inc. and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributor:
-* Maximilian Odendahl
-*
-* Contributors:
-*
-* Description: provides a manager to keep track of all available engines
-*
-*/
-
-#include "caldavenginemgr.h"
-#include "caldavengine.h"
-
-#include <calsession.h>
-#include <calcalendarinfo.h>
-#include "calenglobaldata.h"
-
-/**
- * CCalDavEngineMgr::CCalDavEngineMgr()
- * default constructor
- */
-CCalDavEngineMgr::CCalDavEngineMgr()
- {
- }
-
-/**
- * CCalDavEngineMgr::~CCalDavEngineMgr()
- * default destructor
- */
-CCalDavEngineMgr::~CCalDavEngineMgr()
- {
- for (TInt i = iEngines.Count() - 1; i >= 0; --i)
- delete iEngines[i];
- iEngines.Close();
- }
-
-/**
- * CCalDavEngineMgr::NewLC()
- * first phase construction
- */
-CCalDavEngineMgr* CCalDavEngineMgr::NewLC()
- {
- CCalDavEngineMgr* self = new (ELeave) CCalDavEngineMgr();
- CleanupStack::PushL(self);
- self->ConstructL();
- return self;
- }
-
-/**
- * CCalDavEngineMgr::NewL()
- * first phase construction
- */
-CCalDavEngineMgr* CCalDavEngineMgr::NewL()
- {
- CCalDavEngineMgr* self = CCalDavEngineMgr::NewLC();
- CleanupStack::Pop(); // self;
- return self;
- }
-
-/**
- * CCalDavEngineMgr::Progress()
- * progress callback
- */
-void CCalDavEngineMgr::Progress(TInt /*aPercentageCompleted*/)
- {
- }
-
-/**
- * CCalDavEngineMgr::Completed()
- * completed callback
- */
-void CCalDavEngineMgr::Completed(TInt /*aError*/)
- {
- }
-
-/**
- * CCalDavEngineMgr::NotifyProgress()
- * NotifyProgress callback
- */
-TBool CCalDavEngineMgr::NotifyProgress()
- {
- return EFalse;
- }
-
-/**
- * CCalDavEngineMgr::ConstructL()
- * second phase construction
- * check all calendar files, for each one which has caldav sync enabled,
- * create a CCalDavengine and enable sync
- */
-void CCalDavEngineMgr::ConstructL()
- {
- RPointerArray<CCalCalendarInfo> calendarInfoList;
- CCalenGlobalData* data = CCalenGlobalData::NewL(*this);
- data->InitializeGlobalDataL();
- CleanupStack::PushL(data);
- data->GetAllCalendarInfoL(calendarInfoList);
- CleanupClosePushL(calendarInfoList);
-
- for (TInt i = 0; i < calendarInfoList.Count(); i++)
- {
- CDesC8Array* propertyKeys = calendarInfoList[i]->PropertyKeysL();
- CleanupStack::PushL(propertyKeys);
- TInt pos = 0;
- if (propertyKeys->Find(KCaldavEnabled, pos, ECmpNormal) == KErrNone)
- {
- CCalDavEngine* engine = CCalDavEngine::NewL(
- calendarInfoList[i]->FileNameL());
- iEngines.Append(engine);
- if (engine->EnabledSync())
- engine->EnableL();
- }
- CleanupStack::PopAndDestroy(propertyKeys);
- }
- CleanupStack::PopAndDestroy(&calendarInfoList);
- CleanupStack::PopAndDestroy(data);
- }
-
-/**
- * CCalDavEngineMgr::FindEngineL()
- * find engines inside engine array, create if neccessary
- */
-TInt CCalDavEngineMgr::FindEngineL(const TDesC &aName, TBool aCreate)
- {
- CCalSession* session = CCalSession::NewL();
- TRAPD(error,session->OpenL(aName));
- delete session;
- if (error != KErrNone)
- return KErrNotFound;
-
- for (TInt i = 0; i <= iEngines.Count() - 1; i++)
- {
- if (iEngines[i]->CalendarName() == aName)
- return i;
- }
-
- if (aCreate)
- {
- iEngines.Append(CCalDavEngine::NewL(aName));
- return iEngines.Count() - 1;
- }
- else
- return KErrNotFound;
- }
-
-/**
- * CCalDavEngineMgr::SyncL()
- * sync specific calendar
- */
-TInt CCalDavEngineMgr::SyncL(const TDesC &aCalendar)
- {
- TInt pos = FindEngineL(aCalendar);
- if (pos != KErrNotFound)
- return iEngines[pos]->SyncL();
- else
- return KErrNotFound;
- }
-
-/**
- * CCalDavEngineMgr::SyncAllL()
- * sync all calendars
- */
-TInt CCalDavEngineMgr::SyncAllL()
- {
- // sync all caldav enabled calendars
- for (TInt i = 0; i <= iEngines.Count() - 1; i++)
- iEngines[i]->SyncL();
- return KErrNone;
- }
-
-/**
- * CCalDavEngineMgr::DisableL()
- *
- */
-TInt CCalDavEngineMgr::DisableL(const TDesC &aCalendar)
- {
- TInt pos = FindEngineL(aCalendar);
-
- if (pos != KErrNotFound)
- iEngines[pos]->DisableL();
-
- return pos == KErrNotFound ? KErrNotFound : KErrNone;
- }
-
-/**
- * CCalDavEngineMgr::EnableL()
- *
- */
-TInt CCalDavEngineMgr::EnableL(const TDesC &aCalendar)
- {
- TInt pos = FindEngineL(aCalendar);
- if (pos != KErrNotFound)
- {
- return iEngines[pos]->EnableL();
- }
-
- return KErrArgument;
- }
-
-/**
- * CCalDavEngineMgr::UrlL()
- *
- */
-TPtrC8 CCalDavEngineMgr::UrlL(const TDesC &aCalendar)
- {
- TInt pos = FindEngineL(aCalendar);
- return (pos != KErrNotFound) ? iEngines[pos]->Url() : KNullDesC8();
- }
-
-/**
- * CCalDavEngineMgr::SetUrlL()
- *
- */
-void CCalDavEngineMgr::SetUrlL(const TDesC &aCalendar, const TDesC8 &aUrl)
- {
- TInt pos = FindEngineL(aCalendar, ETrue);
- if (pos != KErrNotFound)
- iEngines[pos]->SetUrlL(aUrl);
- }
-
-/**
- * CCalDavEngineMgr::UsernameL()
- *
- */
-TPtrC8 CCalDavEngineMgr::UsernameL(const TDesC &aCalendar)
- {
- TInt pos = FindEngineL(aCalendar);
- return (pos != KErrNotFound) ? iEngines[pos]->User() : KNullDesC8();
- }
-
-/**
- * CCalDavEngineMgr::SetUsernameL()
- *
- */
-void CCalDavEngineMgr::SetUsernameL(const TDesC &aCalendar,
- const TDesC8 &aUsername)
- {
- TInt pos = FindEngineL(aCalendar, ETrue);
- if (pos != KErrNotFound)
- iEngines[pos]->SetUserL(aUsername);
- }
-
-/**
- * CCalDavEngineMgr::PasswordL()
- *
- */
-TPtrC8 CCalDavEngineMgr::PasswordL(const TDesC &aCalendar)
- {
- TInt pos = FindEngineL(aCalendar);
- return (pos != KErrNotFound) ? iEngines[pos]->Password() : KNullDesC8();
- }
-
-/**
- * CCalDavEngineMgr::SetPasswordL()
- *
- */
-void CCalDavEngineMgr::SetPasswordL(const TDesC &aCalendar,
- const TDesC8 &aPassword)
- {
- TInt pos = FindEngineL(aCalendar, ETrue);
- if (pos != KErrNotFound)
- iEngines[pos]->SetPasswordL(aPassword);
- }
-
-/**
- * CCalDavEngineMgr::SyncIntervalL()
- *
- */
-TTimeIntervalMinutes CCalDavEngineMgr::SyncIntervalL(const TDesC &aCalendar)
- {
- TInt pos = FindEngineL(aCalendar);
- return (pos != KErrNotFound) ? iEngines[pos]->SyncInterval()
- : TTimeIntervalMinutes(DEFAULT_SYNC_MINUTES);
- }
-
-/**
- * CCalDavEngineMgr::SetSyncIntervalL()
- *
- */
-void CCalDavEngineMgr::SetSyncIntervalL(const TDesC &aCalendar,
- TTimeIntervalMinutes aSyncInterval)
- {
- TInt pos = FindEngineL(aCalendar, ETrue);
- if (pos != KErrNotFound)
- iEngines[pos]->SetSyncIntervalL(aSyncInterval);
- }
-
-/**
- * CCalDavEngineMgr::PastDaysL()
- *
- */
-TTimeIntervalDays CCalDavEngineMgr::PastDaysL(const TDesC &aCalendar)
- {
- TInt pos = FindEngineL(aCalendar);
- return (pos != KErrNotFound) ? iEngines[pos]->PastDays()
- : TTimeIntervalDays(DEFAULT_PAST_DAYS);
- }
-
-/**
- * CCalDavEngineMgr::SetPastDaysL()
- *
- */
-void CCalDavEngineMgr::SetPastDaysL(const TDesC &aCalendar,
- TTimeIntervalDays aDays)
- {
- TInt pos = FindEngineL(aCalendar, ETrue);
- if (pos != KErrNotFound)
- iEngines[pos]->SetPastDaysL(aDays);
- }
-
-/**
- * CCalDavEngineMgr::ImmediateSyncL()
- *
- */
-TBool CCalDavEngineMgr::ImmediateSyncL(const TDesC &aCalendar)
- {
- TInt pos = FindEngineL(aCalendar);
- return pos != KErrNotFound ? iEngines[pos]->ImmediateSync()
- : DEFAULT_IMMEDIATE_SYNC;
- }
-
-/**
- * CCalDavEngineMgr::SetImmediateSyncL()
- *
- */
-void CCalDavEngineMgr::SetImmediateSyncL(const TDesC &aCalendar,
- TBool aImmediateSyc)
- {
- TInt pos = FindEngineL(aCalendar, ETrue);
- if (pos != KErrNotFound)
- iEngines[pos]->SetImmediateSyncL(aImmediateSyc);
- }
-
-/**
- * CCalDavEngineMgr::KeepServerEntryL()
- *
- */
-TBool CCalDavEngineMgr::KeepServerEntryL(const TDesC &aCalendar)
- {
- TInt pos = FindEngineL(aCalendar);
- return pos != KErrNotFound ? iEngines[pos]->KeepServerEntry()
- : DEFAULT_KEEP_SERVER_ENTRY;
- }
-
-/**
- * CCalDavEngineMgr::SetKeepServerEntryL()
- *
- */
-void CCalDavEngineMgr::SetKeepServerEntryL(const TDesC &aCalendar,
- TBool aKeepServerEntry)
- {
- TInt pos = FindEngineL(aCalendar, ETrue);
- if (pos != KErrNotFound)
- iEngines[pos]->SetKeepServerEntryL(aKeepServerEntry);
- }
-
-/**
- * CCalDavEngineMgr::EnabledSyncL()
- *
- */
-TBool CCalDavEngineMgr::EnabledSyncL(const TDesC &aCalendar)
- {
- TInt pos = FindEngineL(aCalendar);
- return (pos != KErrNotFound) ? iEngines[pos]->EnabledSync() : EFalse;
- }
+/*
+* Copyright (c) 2010 Sun Microsystems, Inc. and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributor:
+* Maximilian Odendahl
+*
+* Contributors:
+*
+* Description: provides a manager to keep track of all available engines
+*
+*/
+
+#include "caldavenginemgr.h"
+#include "caldavengine.h"
+
+#include <calsession.h>
+#include <calcalendarinfo.h>
+#include "calenglobaldata.h"
+
+/**
+ * CCalDavEngineMgr::CCalDavEngineMgr()
+ * default constructor
+ */
+CCalDavEngineMgr::CCalDavEngineMgr()
+ {
+ }
+
+/**
+ * CCalDavEngineMgr::~CCalDavEngineMgr()
+ * default destructor
+ */
+CCalDavEngineMgr::~CCalDavEngineMgr()
+ {
+ for (TInt i = iEngines.Count() - 1; i >= 0; --i)
+ delete iEngines[i];
+ iEngines.Close();
+ }
+
+/**
+ * CCalDavEngineMgr::NewLC()
+ * first phase construction
+ */
+CCalDavEngineMgr* CCalDavEngineMgr::NewLC()
+ {
+ CCalDavEngineMgr* self = new (ELeave) CCalDavEngineMgr();
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ return self;
+ }
+
+/**
+ * CCalDavEngineMgr::NewL()
+ * first phase construction
+ */
+CCalDavEngineMgr* CCalDavEngineMgr::NewL()
+ {
+ CCalDavEngineMgr* self = CCalDavEngineMgr::NewLC();
+ CleanupStack::Pop(); // self;
+ return self;
+ }
+
+/**
+ * CCalDavEngineMgr::Progress()
+ * progress callback
+ */
+void CCalDavEngineMgr::Progress(TInt /*aPercentageCompleted*/)
+ {
+ }
+
+/**
+ * CCalDavEngineMgr::Completed()
+ * completed callback
+ */
+void CCalDavEngineMgr::Completed(TInt /*aError*/)
+ {
+ }
+
+/**
+ * CCalDavEngineMgr::NotifyProgress()
+ * NotifyProgress callback
+ */
+TBool CCalDavEngineMgr::NotifyProgress()
+ {
+ return EFalse;
+ }
+
+/**
+ * CCalDavEngineMgr::ConstructL()
+ * second phase construction
+ * check all calendar files, for each one which has caldav sync enabled,
+ * create a CCalDavengine and enable sync
+ */
+void CCalDavEngineMgr::ConstructL()
+ {
+ RPointerArray<CCalCalendarInfo> calendarInfoList;
+ CCalenGlobalData* data = CCalenGlobalData::NewL(*this);
+ data->InitializeGlobalDataL();
+ CleanupStack::PushL(data);
+ data->GetAllCalendarInfoL(calendarInfoList);
+ CleanupClosePushL(calendarInfoList);
+
+ for (TInt i = 0; i < calendarInfoList.Count(); i++)
+ {
+ CDesC8Array* propertyKeys = calendarInfoList[i]->PropertyKeysL();
+ CleanupStack::PushL(propertyKeys);
+ TInt pos = 0;
+ if (propertyKeys->Find(KCaldavEnabled, pos, ECmpNormal) == KErrNone)
+ {
+ CCalDavEngine* engine = CCalDavEngine::NewL(
+ calendarInfoList[i]->FileNameL());
+ iEngines.Append(engine);
+ if (engine->EnabledSync())
+ engine->EnableL();
+ }
+ CleanupStack::PopAndDestroy(propertyKeys);
+ }
+ CleanupStack::PopAndDestroy(&calendarInfoList);
+ CleanupStack::PopAndDestroy(data);
+ }
+
+/**
+ * CCalDavEngineMgr::FindEngineL()
+ * find engines inside engine array, create if neccessary
+ */
+TInt CCalDavEngineMgr::FindEngineL(const TDesC &aName, TBool aCreate)
+ {
+ CCalSession* session = CCalSession::NewL();
+ TRAPD(error,session->OpenL(aName));
+ delete session;
+ if (error != KErrNone)
+ return KErrNotFound;
+
+ for (TInt i = 0; i <= iEngines.Count() - 1; i++)
+ {
+ if (iEngines[i]->CalendarName() == aName)
+ return i;
+ }
+
+ if (aCreate)
+ {
+ iEngines.Append(CCalDavEngine::NewL(aName));
+ return iEngines.Count() - 1;
+ }
+ else
+ return KErrNotFound;
+ }
+
+/**
+ * CCalDavEngineMgr::SyncL()
+ * sync specific calendar
+ */
+TInt CCalDavEngineMgr::SyncL(const TDesC &aCalendar)
+ {
+ TInt pos = FindEngineL(aCalendar);
+ if (pos != KErrNotFound)
+ return iEngines[pos]->SyncL();
+ else
+ return KErrNotFound;
+ }
+
+/**
+ * CCalDavEngineMgr::SyncAllL()
+ * sync all calendars
+ */
+TInt CCalDavEngineMgr::SyncAllL()
+ {
+ // sync all caldav enabled calendars
+ for (TInt i = 0; i <= iEngines.Count() - 1; i++)
+ iEngines[i]->SyncL();
+ return KErrNone;
+ }
+
+/**
+ * CCalDavEngineMgr::DisableL()
+ *
+ */
+TInt CCalDavEngineMgr::DisableL(const TDesC &aCalendar)
+ {
+ TInt pos = FindEngineL(aCalendar);
+
+ if (pos != KErrNotFound)
+ iEngines[pos]->DisableL();
+
+ return pos == KErrNotFound ? KErrNotFound : KErrNone;
+ }
+
+/**
+ * CCalDavEngineMgr::EnableL()
+ *
+ */
+TInt CCalDavEngineMgr::EnableL(const TDesC &aCalendar)
+ {
+ TInt pos = FindEngineL(aCalendar);
+ if (pos != KErrNotFound)
+ {
+ return iEngines[pos]->EnableL();
+ }
+
+ return KErrArgument;
+ }
+
+/**
+ * CCalDavEngineMgr::UrlL()
+ *
+ */
+TPtrC8 CCalDavEngineMgr::UrlL(const TDesC &aCalendar)
+ {
+ TInt pos = FindEngineL(aCalendar);
+ return (pos != KErrNotFound) ? iEngines[pos]->Url() : KNullDesC8();
+ }
+
+/**
+ * CCalDavEngineMgr::SetUrlL()
+ *
+ */
+void CCalDavEngineMgr::SetUrlL(const TDesC &aCalendar, const TDesC8 &aUrl)
+ {
+ TInt pos = FindEngineL(aCalendar, ETrue);
+ if (pos != KErrNotFound)
+ iEngines[pos]->SetUrlL(aUrl);
+ }
+
+/**
+ * CCalDavEngineMgr::UsernameL()
+ *
+ */
+TPtrC8 CCalDavEngineMgr::UsernameL(const TDesC &aCalendar)
+ {
+ TInt pos = FindEngineL(aCalendar);
+ return (pos != KErrNotFound) ? iEngines[pos]->User() : KNullDesC8();
+ }
+
+/**
+ * CCalDavEngineMgr::SetUsernameL()
+ *
+ */
+void CCalDavEngineMgr::SetUsernameL(const TDesC &aCalendar,
+ const TDesC8 &aUsername)
+ {
+ TInt pos = FindEngineL(aCalendar, ETrue);
+ if (pos != KErrNotFound)
+ iEngines[pos]->SetUserL(aUsername);
+ }
+
+/**
+ * CCalDavEngineMgr::PasswordL()
+ *
+ */
+TPtrC8 CCalDavEngineMgr::PasswordL(const TDesC &aCalendar)
+ {
+ TInt pos = FindEngineL(aCalendar);
+ return (pos != KErrNotFound) ? iEngines[pos]->Password() : KNullDesC8();
+ }
+
+/**
+ * CCalDavEngineMgr::SetPasswordL()
+ *
+ */
+void CCalDavEngineMgr::SetPasswordL(const TDesC &aCalendar,
+ const TDesC8 &aPassword)
+ {
+ TInt pos = FindEngineL(aCalendar, ETrue);
+ if (pos != KErrNotFound)
+ iEngines[pos]->SetPasswordL(aPassword);
+ }
+
+/**
+ * CCalDavEngineMgr::SyncIntervalL()
+ *
+ */
+TTimeIntervalMinutes CCalDavEngineMgr::SyncIntervalL(const TDesC &aCalendar)
+ {
+ TInt pos = FindEngineL(aCalendar);
+ return (pos != KErrNotFound) ? iEngines[pos]->SyncInterval()
+ : TTimeIntervalMinutes(DEFAULT_SYNC_MINUTES);
+ }
+
+/**
+ * CCalDavEngineMgr::SetSyncIntervalL()
+ *
+ */
+void CCalDavEngineMgr::SetSyncIntervalL(const TDesC &aCalendar,
+ TTimeIntervalMinutes aSyncInterval)
+ {
+ TInt pos = FindEngineL(aCalendar, ETrue);
+ if (pos != KErrNotFound)
+ iEngines[pos]->SetSyncIntervalL(aSyncInterval);
+ }
+
+/**
+ * CCalDavEngineMgr::PastDaysL()
+ *
+ */
+TTimeIntervalDays CCalDavEngineMgr::PastDaysL(const TDesC &aCalendar)
+ {
+ TInt pos = FindEngineL(aCalendar);
+ return (pos != KErrNotFound) ? iEngines[pos]->PastDays()
+ : TTimeIntervalDays(DEFAULT_PAST_DAYS);
+ }
+
+/**
+ * CCalDavEngineMgr::SetPastDaysL()
+ *
+ */
+void CCalDavEngineMgr::SetPastDaysL(const TDesC &aCalendar,
+ TTimeIntervalDays aDays)
+ {
+ TInt pos = FindEngineL(aCalendar, ETrue);
+ if (pos != KErrNotFound)
+ iEngines[pos]->SetPastDaysL(aDays);
+ }
+
+/**
+ * CCalDavEngineMgr::ImmediateSyncL()
+ *
+ */
+TBool CCalDavEngineMgr::ImmediateSyncL(const TDesC &aCalendar)
+ {
+ TInt pos = FindEngineL(aCalendar);
+ return pos != KErrNotFound ? iEngines[pos]->ImmediateSync()
+ : DEFAULT_IMMEDIATE_SYNC;
+ }
+
+/**
+ * CCalDavEngineMgr::SetImmediateSyncL()
+ *
+ */
+void CCalDavEngineMgr::SetImmediateSyncL(const TDesC &aCalendar,
+ TBool aImmediateSyc)
+ {
+ TInt pos = FindEngineL(aCalendar, ETrue);
+ if (pos != KErrNotFound)
+ iEngines[pos]->SetImmediateSyncL(aImmediateSyc);
+ }
+
+/**
+ * CCalDavEngineMgr::KeepServerEntryL()
+ *
+ */
+TBool CCalDavEngineMgr::KeepServerEntryL(const TDesC &aCalendar)
+ {
+ TInt pos = FindEngineL(aCalendar);
+ return pos != KErrNotFound ? iEngines[pos]->KeepServerEntry()
+ : DEFAULT_KEEP_SERVER_ENTRY;
+ }
+
+/**
+ * CCalDavEngineMgr::SetKeepServerEntryL()
+ *
+ */
+void CCalDavEngineMgr::SetKeepServerEntryL(const TDesC &aCalendar,
+ TBool aKeepServerEntry)
+ {
+ TInt pos = FindEngineL(aCalendar, ETrue);
+ if (pos != KErrNotFound)
+ iEngines[pos]->SetKeepServerEntryL(aKeepServerEntry);
+ }
+
+/**
+ * CCalDavEngineMgr::EnabledSyncL()
+ *
+ */
+TBool CCalDavEngineMgr::EnabledSyncL(const TDesC &aCalendar)
+ {
+ TInt pos = FindEngineL(aCalendar);
+ return (pos != KErrNotFound) ? iEngines[pos]->EnabledSync() : EFalse;
+ }
--- a/calendarengines/caldav/src/caldavserver.cpp Mon Mar 08 21:43:23 2010 +0000
+++ b/calendarengines/caldav/src/caldavserver.cpp Sun Mar 14 13:09:26 2010 +0000
@@ -1,373 +1,373 @@
-/*
-* Copyright (c) 2010 Sun Microsystems, Inc. and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributor:
-* Maximilian Odendahl
-*
-* Contributors:
-*
-* Description: Caldav server, follows Symbian client/server
-* architecture
-*/
-
-#include <e32svr.h>
-#include <e32uid.h>
-#include <S32MEM.H>
-
-#include <xmlengdocument.h>
-#include <xmlengtext.h>
-
-#include "caldavserver.h"
-#include "caldavenginemgr.h"
-#include "caldavserverSession.h"
-#include "httpclient.h"
-
-const TUint KServerPolicyRangeCount = 2;
-
-const TInt KServerPolicyRanges[KServerPolicyRangeCount] =
- {
- 0, // range is 0 inclusive
- 200
- // range is 1-KMaxTInt inclusive
- };
-
-const TUint8 KServerPolicyElementsIndex[KServerPolicyRangeCount] =
- {
- 0, // applies to 0th range
- CPolicyServer::ENotSupported
- // applies to 1st range
- };
-
-/**
- * CPolicyServer::TPolicyElement()
- *
- */
-const CPolicyServer::TPolicyElement
- KServerPolicyElements[] =
- {
- {
- _INIT_SECURITY_POLICY_C5(ECapabilityWriteDeviceData,ECapabilityWriteUserData, ECapabilityReadDeviceData,ECapabilityReadUserData,ECapabilityNetworkServices), CPolicyServer::EFailClient
- }
- };
-
-const CPolicyServer::TPolicy KServerPolicy =
- {
- CPolicyServer::EAlwaysPass, // specifies all connect attempts should pass
- KServerPolicyRangeCount,
- KServerPolicyRanges,
- KServerPolicyElementsIndex,
- KServerPolicyElements
- };
-
-/**
- * CCalDavServer::CCalDavServer
- * default constructor
- */
-CCalDavServer::CCalDavServer(CActive::TPriority aActiveObjectPriority) :
- CPolicyServer(aActiveObjectPriority, KServerPolicy)
- {
- }
-
-/**
- * CCalDavServer::NewSessionL
- * Creates a new session with the server.
- */
-CSession2* CCalDavServer::NewSessionL(const TVersion& aVersion,
- const RMessage2& /*aMessage*/) const
- {
- // Check that the version is OK
- TVersion v(KCalDavServerMajorVersionNumber,
- KCalDavServerMinorVersionNumber, KCalDavServerBuildVersionNumber);
- if (!User::QueryVersionSupported(v, aVersion))
- User::Leave(KErrNotSupported);
-
- // CAN USE THE aMessage argument to check client's security and identity
- // can make use of this later but for now ignore. AH 4/5/05
- // the connect message is delivered via the RMessage2 object passed.
-
- // do something with this later (and move it to the start of the function?)
-
- // Create the session.
- return new (ELeave) CCalDavServerSession(*const_cast<CCalDavServer*> (this));
- }
-
-/**
-* CCalDavServer::PanicServer
- A utility function to panic the server.
- */
-void CCalDavServer::PanicServer(TCalDavServPanic aPanic)
- {
- _LIT(KTxtServerPanic,"CalDav server panic");
- User::Panic(KTxtServerPanic, aPanic);
- }
-
-/**
- * CCalDavServer::ThreadFunction
- * The count server thread function that initialises the server.
- */
-TInt CCalDavServer::ThreadFunction(TAny* /**aStarted*/)
- {
- CTrapCleanup* cleanupStack = CTrapCleanup::New();
- if (!(cleanupStack))
- {
- PanicServer(ECreateTrapCleanup);
- }
- TRAPD( err, ThreadFunctionL() );
- if (err != KErrNone)
- {
- PanicServer(ESvrCreateServer);
- }
-
- delete cleanupStack;
- cleanupStack = NULL;
-
- return KErrNone;
-
- }
-
-/**
- * CCalDavServer::NewLC
- * first phase construction
- */
-CCalDavServer* CCalDavServer::NewLC()
- {
- CCalDavServer* self =
- new (ELeave) CCalDavServer(CActive::EPriorityStandard);
- CleanupStack::PushL(self);
- self->ConstructL();
- return self;
- }
-
-/**
- * CCalDavServer::ConstructL
- * second phase construction
- */
-void CCalDavServer::ConstructL()
- {
- StartL(KCalDavServerName);
-
- iMgr = CCalDavEngineMgr::NewL();
- }
-
-/**
- * CCalDavServer::ThreadFunctionL
- * start scheduler and construct function
- */
-void CCalDavServer::ThreadFunctionL()
- {
- // Construct active scheduler
- CActiveScheduler* activeScheduler = new (ELeave) CActiveScheduler;
- CleanupStack::PushL(activeScheduler);
-
- // Install active scheduler
- // We don't need to check whether an active scheduler is already installed
- // as this is a new thread, so there won't be one
- CActiveScheduler::Install(activeScheduler);
-
- // Construct our server, leave it on clean-up stack
- CCalDavServer::NewLC();
-
- // Naming the server thread after the server helps to debug panics
- User::LeaveIfError(User::RenameThread(KCalDavServerName));
-
- RProcess::Rendezvous(KErrNone);
-
- // Start handling requests
- CActiveScheduler::Start();
-
- CleanupStack::PopAndDestroy(2, activeScheduler); //Anonymous CCalDavServer
- }
-
-/**
- * CCalDavServer::~CCalDavServer
- * default destructor
- */
-CCalDavServer::~CCalDavServer()
- {
- if (iMgr)
- delete iMgr;
- }
-
-/**
- * CCalDavServer::SyncL
- *
- */
-TInt CCalDavServer::SyncL(const TDesC &aCalendar)
- {
- return iMgr->SyncL(aCalendar);
- }
-
-/**
- * CCalDavServer::SyncAllL
- *
- */
-TInt CCalDavServer::SyncAllL()
- {
- return iMgr->SyncAllL();
- }
-
-/**
- * CCalDavServer::EnableL
- *
- */
-TInt CCalDavServer::EnableL(const TDesC &aCalendar)
- {
- return iMgr->EnableL(aCalendar);
- }
-
-/**
- * CCalDavServer::DisableL
- *
- */
-TInt CCalDavServer::DisableL(const TDesC &aCalendar)
- {
- return iMgr->DisableL(aCalendar);
- }
-
-/**
- * CCalDavServer::UrlL
- *
- */
-TPtrC8 CCalDavServer::UrlL(const TDesC &aCalendar)
- {
- return iMgr->UrlL(aCalendar);
- }
-
-/**
- * CCalDavServer::SetUrlL
- *
- */
-void CCalDavServer::SetUrlL(const TDesC &aCalendar, const TDesC8 &aUrl)
- {
- return iMgr->SetUrlL(aCalendar, aUrl);
- }
-
-/**
- * CCalDavServer::UsernameL
- *
- */
-TPtrC8 CCalDavServer::UsernameL(const TDesC &aCalendar)
- {
- return iMgr->UsernameL(aCalendar);
- }
-
-/**
- * CCalDavServer::SetUsernameL
- *
- */
-void CCalDavServer::SetUsernameL(const TDesC &aCalendar, const TDesC8 &aUsername)
- {
- return iMgr->SetUsernameL(aCalendar, aUsername);
- }
-
-/**
- * CCalDavServer::PasswordL
- *
- */
-TPtrC8 CCalDavServer::PasswordL(const TDesC &aCalendar)
- {
- return iMgr->PasswordL(aCalendar);
- }
-
-/**
- * CCalDavServer::SetPasswordL
- *
- */
-void CCalDavServer::SetPasswordL(const TDesC &aCalendar, const TDesC8 &aPassword)
- {
- return iMgr->SetPasswordL(aCalendar, aPassword);
- }
-
-/**
- * CCalDavServer::SyncIntervalL
- *
- */
-TTimeIntervalMinutes CCalDavServer::SyncIntervalL(const TDesC &aCalendar) const
- {
- return iMgr->SyncIntervalL(aCalendar);
- }
-
-/**
- * CCalDavServer::SetSyncIntervalL
- *
- */
-void CCalDavServer::SetSyncIntervalL(const TDesC &aCalendar,
- TTimeIntervalMinutes aSyncInterval)
- {
- iMgr->SetSyncIntervalL(aCalendar, aSyncInterval);
- }
-
-/**
- * CCalDavServer::EnabledSyncL
- *
- */
-TBool CCalDavServer::EnabledSyncL(const TDesC &aCalendar) const
- {
- return iMgr->EnabledSyncL(aCalendar);
- }
-
-/**
- * CCalDavServer::PastDaysL
- *
- */
-TTimeIntervalDays CCalDavServer::PastDaysL(const TDesC &aCalendar) const
- {
- return iMgr->PastDaysL(aCalendar);
- }
-
-/**
- * CCalDavServer::SetPastDaysL
- *
- */
-void CCalDavServer::SetPastDaysL(const TDesC &aCalendar, TTimeIntervalDays aDays)
- {
- iMgr->SetPastDaysL(aCalendar, aDays);
- }
-
-/**
- * CCalDavServer::ImmediateSyncL
- *
- */
-TBool CCalDavServer::ImmediateSyncL(const TDesC &aCalendar) const
- {
- return iMgr->ImmediateSyncL(aCalendar);
- }
-
-/**
- * CCalDavServer::SetImmediateSyncL
- *
- */
-void CCalDavServer::SetImmediateSyncL(const TDesC &aCalendar,
- TBool aImmediateSyc)
- {
- iMgr->SetImmediateSyncL(aCalendar, aImmediateSyc);
- }
-
-/**
- * CCalDavServer::KeepServerEntryL
- *
- */
-TBool CCalDavServer::KeepServerEntryL(const TDesC &aCalendar) const
- {
- return iMgr->KeepServerEntryL(aCalendar);
- }
-
-/**
- * CCalDavServer::SetKeepServerEntryL
- *
- */
-void CCalDavServer::SetKeepServerEntryL(const TDesC &aCalendar,
- TBool aKeepServerEntry)
- {
- iMgr->SetKeepServerEntryL(aCalendar, aKeepServerEntry);
- }
-
-TInt E32Main()
- {
- return CCalDavServer::ThreadFunction(NULL);
- }
+/*
+* Copyright (c) 2010 Sun Microsystems, Inc. and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributor:
+* Maximilian Odendahl
+*
+* Contributors:
+*
+* Description: Caldav server, follows Symbian client/server
+* architecture
+*/
+
+#include <e32svr.h>
+#include <e32uid.h>
+#include <S32MEM.H>
+
+#include <xmlengdocument.h>
+#include <xmlengtext.h>
+
+#include "caldavserver.h"
+#include "caldavenginemgr.h"
+#include "caldavserverSession.h"
+#include "httpclient.h"
+
+const TUint KServerPolicyRangeCount = 2;
+
+const TInt KServerPolicyRanges[KServerPolicyRangeCount] =
+ {
+ 0, // range is 0 inclusive
+ 200
+ // range is 1-KMaxTInt inclusive
+ };
+
+const TUint8 KServerPolicyElementsIndex[KServerPolicyRangeCount] =
+ {
+ 0, // applies to 0th range
+ CPolicyServer::ENotSupported
+ // applies to 1st range
+ };
+
+/**
+ * CPolicyServer::TPolicyElement()
+ *
+ */
+const CPolicyServer::TPolicyElement
+ KServerPolicyElements[] =
+ {
+ {
+ _INIT_SECURITY_POLICY_C5(ECapabilityWriteDeviceData,ECapabilityWriteUserData, ECapabilityReadDeviceData,ECapabilityReadUserData,ECapabilityNetworkServices), CPolicyServer::EFailClient
+ }
+ };
+
+const CPolicyServer::TPolicy KServerPolicy =
+ {
+ CPolicyServer::EAlwaysPass, // specifies all connect attempts should pass
+ KServerPolicyRangeCount,
+ KServerPolicyRanges,
+ KServerPolicyElementsIndex,
+ KServerPolicyElements
+ };
+
+/**
+ * CCalDavServer::CCalDavServer
+ * default constructor
+ */
+CCalDavServer::CCalDavServer(CActive::TPriority aActiveObjectPriority) :
+ CPolicyServer(aActiveObjectPriority, KServerPolicy)
+ {
+ }
+
+/**
+ * CCalDavServer::NewSessionL
+ * Creates a new session with the server.
+ */
+CSession2* CCalDavServer::NewSessionL(const TVersion& aVersion,
+ const RMessage2& /*aMessage*/) const
+ {
+ // Check that the version is OK
+ TVersion v(KCalDavServerMajorVersionNumber,
+ KCalDavServerMinorVersionNumber, KCalDavServerBuildVersionNumber);
+ if (!User::QueryVersionSupported(v, aVersion))
+ User::Leave(KErrNotSupported);
+
+ // CAN USE THE aMessage argument to check client's security and identity
+ // can make use of this later but for now ignore. AH 4/5/05
+ // the connect message is delivered via the RMessage2 object passed.
+
+ // do something with this later (and move it to the start of the function?)
+
+ // Create the session.
+ return new (ELeave) CCalDavServerSession(*const_cast<CCalDavServer*> (this));
+ }
+
+/**
+* CCalDavServer::PanicServer
+ A utility function to panic the server.
+ */
+void CCalDavServer::PanicServer(TCalDavServPanic aPanic)
+ {
+ _LIT(KTxtServerPanic,"CalDav server panic");
+ User::Panic(KTxtServerPanic, aPanic);
+ }
+
+/**
+ * CCalDavServer::ThreadFunction
+ * The count server thread function that initialises the server.
+ */
+TInt CCalDavServer::ThreadFunction(TAny* /**aStarted*/)
+ {
+ CTrapCleanup* cleanupStack = CTrapCleanup::New();
+ if (!(cleanupStack))
+ {
+ PanicServer(ECreateTrapCleanup);
+ }
+ TRAPD( err, ThreadFunctionL() );
+ if (err != KErrNone)
+ {
+ PanicServer(ESvrCreateServer);
+ }
+
+ delete cleanupStack;
+ cleanupStack = NULL;
+
+ return KErrNone;
+
+ }
+
+/**
+ * CCalDavServer::NewLC
+ * first phase construction
+ */
+CCalDavServer* CCalDavServer::NewLC()
+ {
+ CCalDavServer* self =
+ new (ELeave) CCalDavServer(CActive::EPriorityStandard);
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ return self;
+ }
+
+/**
+ * CCalDavServer::ConstructL
+ * second phase construction
+ */
+void CCalDavServer::ConstructL()
+ {
+ StartL(KCalDavServerName);
+
+ iMgr = CCalDavEngineMgr::NewL();
+ }
+
+/**
+ * CCalDavServer::ThreadFunctionL
+ * start scheduler and construct function
+ */
+void CCalDavServer::ThreadFunctionL()
+ {
+ // Construct active scheduler
+ CActiveScheduler* activeScheduler = new (ELeave) CActiveScheduler;
+ CleanupStack::PushL(activeScheduler);
+
+ // Install active scheduler
+ // We don't need to check whether an active scheduler is already installed
+ // as this is a new thread, so there won't be one
+ CActiveScheduler::Install(activeScheduler);
+
+ // Construct our server, leave it on clean-up stack
+ CCalDavServer::NewLC();
+
+ // Naming the server thread after the server helps to debug panics
+ User::LeaveIfError(User::RenameThread(KCalDavServerName));
+
+ RProcess::Rendezvous(KErrNone);
+
+ // Start handling requests
+ CActiveScheduler::Start();
+
+ CleanupStack::PopAndDestroy(2, activeScheduler); //Anonymous CCalDavServer
+ }
+
+/**
+ * CCalDavServer::~CCalDavServer
+ * default destructor
+ */
+CCalDavServer::~CCalDavServer()
+ {
+ if (iMgr)
+ delete iMgr;
+ }
+
+/**
+ * CCalDavServer::SyncL
+ *
+ */
+TInt CCalDavServer::SyncL(const TDesC &aCalendar)
+ {
+ return iMgr->SyncL(aCalendar);
+ }
+
+/**
+ * CCalDavServer::SyncAllL
+ *
+ */
+TInt CCalDavServer::SyncAllL()
+ {
+ return iMgr->SyncAllL();
+ }
+
+/**
+ * CCalDavServer::EnableL
+ *
+ */
+TInt CCalDavServer::EnableL(const TDesC &aCalendar)
+ {
+ return iMgr->EnableL(aCalendar);
+ }
+
+/**
+ * CCalDavServer::DisableL
+ *
+ */
+TInt CCalDavServer::DisableL(const TDesC &aCalendar)
+ {
+ return iMgr->DisableL(aCalendar);
+ }
+
+/**
+ * CCalDavServer::UrlL
+ *
+ */
+TPtrC8 CCalDavServer::UrlL(const TDesC &aCalendar)
+ {
+ return iMgr->UrlL(aCalendar);
+ }
+
+/**
+ * CCalDavServer::SetUrlL
+ *
+ */
+void CCalDavServer::SetUrlL(const TDesC &aCalendar, const TDesC8 &aUrl)
+ {
+ return iMgr->SetUrlL(aCalendar, aUrl);
+ }
+
+/**
+ * CCalDavServer::UsernameL
+ *
+ */
+TPtrC8 CCalDavServer::UsernameL(const TDesC &aCalendar)
+ {
+ return iMgr->UsernameL(aCalendar);
+ }
+
+/**
+ * CCalDavServer::SetUsernameL
+ *
+ */
+void CCalDavServer::SetUsernameL(const TDesC &aCalendar, const TDesC8 &aUsername)
+ {
+ return iMgr->SetUsernameL(aCalendar, aUsername);
+ }
+
+/**
+ * CCalDavServer::PasswordL
+ *
+ */
+TPtrC8 CCalDavServer::PasswordL(const TDesC &aCalendar)
+ {
+ return iMgr->PasswordL(aCalendar);
+ }
+
+/**
+ * CCalDavServer::SetPasswordL
+ *
+ */
+void CCalDavServer::SetPasswordL(const TDesC &aCalendar, const TDesC8 &aPassword)
+ {
+ return iMgr->SetPasswordL(aCalendar, aPassword);
+ }
+
+/**
+ * CCalDavServer::SyncIntervalL
+ *
+ */
+TTimeIntervalMinutes CCalDavServer::SyncIntervalL(const TDesC &aCalendar) const
+ {
+ return iMgr->SyncIntervalL(aCalendar);
+ }
+
+/**
+ * CCalDavServer::SetSyncIntervalL
+ *
+ */
+void CCalDavServer::SetSyncIntervalL(const TDesC &aCalendar,
+ TTimeIntervalMinutes aSyncInterval)
+ {
+ iMgr->SetSyncIntervalL(aCalendar, aSyncInterval);
+ }
+
+/**
+ * CCalDavServer::EnabledSyncL
+ *
+ */
+TBool CCalDavServer::EnabledSyncL(const TDesC &aCalendar) const
+ {
+ return iMgr->EnabledSyncL(aCalendar);
+ }
+
+/**
+ * CCalDavServer::PastDaysL
+ *
+ */
+TTimeIntervalDays CCalDavServer::PastDaysL(const TDesC &aCalendar) const
+ {
+ return iMgr->PastDaysL(aCalendar);
+ }
+
+/**
+ * CCalDavServer::SetPastDaysL
+ *
+ */
+void CCalDavServer::SetPastDaysL(const TDesC &aCalendar, TTimeIntervalDays aDays)
+ {
+ iMgr->SetPastDaysL(aCalendar, aDays);
+ }
+
+/**
+ * CCalDavServer::ImmediateSyncL
+ *
+ */
+TBool CCalDavServer::ImmediateSyncL(const TDesC &aCalendar) const
+ {
+ return iMgr->ImmediateSyncL(aCalendar);
+ }
+
+/**
+ * CCalDavServer::SetImmediateSyncL
+ *
+ */
+void CCalDavServer::SetImmediateSyncL(const TDesC &aCalendar,
+ TBool aImmediateSyc)
+ {
+ iMgr->SetImmediateSyncL(aCalendar, aImmediateSyc);
+ }
+
+/**
+ * CCalDavServer::KeepServerEntryL
+ *
+ */
+TBool CCalDavServer::KeepServerEntryL(const TDesC &aCalendar) const
+ {
+ return iMgr->KeepServerEntryL(aCalendar);
+ }
+
+/**
+ * CCalDavServer::SetKeepServerEntryL
+ *
+ */
+void CCalDavServer::SetKeepServerEntryL(const TDesC &aCalendar,
+ TBool aKeepServerEntry)
+ {
+ iMgr->SetKeepServerEntryL(aCalendar, aKeepServerEntry);
+ }
+
+TInt E32Main()
+ {
+ return CCalDavServer::ThreadFunction(NULL);
+ }
--- a/calendarengines/caldav/src/caldavserversession.cpp Mon Mar 08 21:43:23 2010 +0000
+++ b/calendarengines/caldav/src/caldavserversession.cpp Sun Mar 14 13:09:26 2010 +0000
@@ -1,400 +1,400 @@
-/*
-* Copyright (c) 2010 Sun Microsystems, Inc. and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributor:
-* Maximilian Odendahl
-*
-* Contributors:
-*
-* Description: Caldav server session, follows Symbian
-* client/server architecture
-*/
-
-#include <e32cmn.h>
-
-#include "caldavserversession.h"
-#include "caldavserver.h"
-#include "caldavutils.h"
-
-#define MAXLENGTH 500
-
-CCalDavServerSession::CCalDavServerSession(CCalDavServer &aServer) :
- rServer(aServer)
- {
- }
-
-/**
- Services a client request.
- */
-void CCalDavServerSession::ServiceL(const RMessage2& aMessage)
- {
- TRAP_IGNORE(DispatchMessageL(aMessage));
- }
-
-/**
- Called by ServiceL()
-
- It tests the function code and then delegates to
- the appropriate function.
- */
-void CCalDavServerSession::DispatchMessageL(const RMessage2& aMessage)
- {
- switch (aMessage.Function())
- {
- case ECalDavEnable:
- EnableL(aMessage);
- return;
- case ECalDavDisable:
- DisableL(aMessage);
- return;
- case ECalDavSyncAll:
- SyncAllL(aMessage);
- return;
- case ECalDavSync:
- SyncL(aMessage);
- return;
- case ECalDavUrl:
- UrlL(aMessage);
- return;
- case ECalDavSetUrl:
- SetUrlL(aMessage);
- return;
- case ECalDavUsername:
- UsernameL(aMessage);
- return;
- case ECalDavSetUsername:
- SetUsernameL(aMessage);
- return;
- case ECalDavPassword:
- PasswordL(aMessage);
- return;
- case ECalDavSetPassword:
- SetPasswordL(aMessage);
- return;
- case ECalDavSyncInterval:
- SyncIntervalL(aMessage);
- return;
- case ECalDavSetSyncInterval:
- SetSyncIntervalL(aMessage);
- return;
- case ECalDavPastDays:
- PastDaysL(aMessage);
- return;
- case ECalDavSetPastDays:
- SetPastDaysL(aMessage);
- return;
- case ECalDavImmediateSync:
- ImmediateSyncL(aMessage);
- return;
- case ECalDavSetImmediateSync:
- SetImmediateSyncL(aMessage);
- return;
- case ECalDavKeepServer:
- KeepServerEntryL(aMessage);
- return;
- case ECalDavSetKeepServer:
- SetKeepServerEntryL(aMessage);
- return;
- case ECalDavEnabled:
- EnabledSyncL(aMessage);
- return;
- case ECalDavUnsupportedRequest:
- User::Leave(KErrNotSupported);
- // Requests that we don't understand at all are a different matter.
- // This is considered a client programming error, so we panic the
- // client - this also completes the message.
- default:
- PanicClient(aMessage, EBadRequest);
- return;
- }
- }
-
-/**
- Panics the client
- */
-void CCalDavServerSession::PanicClient(const RMessage2& aMessage, TInt aPanic) const
- {
- _LIT(KTxtServer,"CalDav server");
- aMessage.Panic(KTxtServer, aPanic);
- }
-
-void CCalDavServerSession::EnableL(const RMessage2& aMessage)
- {
- TUint length = aMessage.GetDesLength(0);
- HBufC* calendar = HBufC::NewLC(length);
- TPtr calendarPtr(calendar->Des());
- aMessage.ReadL(0, calendarPtr);
-
- TInt result = rServer.EnableL(*calendar);
-
- CleanupStack::PopAndDestroy(calendar);
- aMessage.Complete(result);
- }
-
-void CCalDavServerSession::DisableL(const RMessage2& aMessage)
- {
- TUint length = aMessage.GetDesLength(0);
- HBufC* calendar = HBufC::NewLC(length);
- TPtr calendarPtr(calendar->Des());
- aMessage.ReadL(0, calendarPtr);
-
- TInt result = rServer.DisableL(*calendar);
- CleanupStack::PopAndDestroy(calendar);
- aMessage.Complete(result);
- }
-
-void CCalDavServerSession::SyncL(const RMessage2& aMessage)
- {
- TUint length = aMessage.GetDesLength(0);
- HBufC* calendar = HBufC::NewLC(length);
- TPtr calendarPtr(calendar->Des());
- aMessage.ReadL(0, calendarPtr);
-
- TInt result = rServer.SyncL(*calendar);
- CleanupStack::PopAndDestroy(calendar);
- aMessage.Complete(result);
- }
-
-void CCalDavServerSession::SyncAllL(const RMessage2& aMessage)
- {
- TInt result = rServer.SyncAllL();
- aMessage.Complete(result);
- }
-
-void CCalDavServerSession::UrlL(const RMessage2& aMessage)
- {
- TUint length = aMessage.GetDesLength(0);
- HBufC* calendar = HBufC::NewLC(length);
- TPtr calendarPtr(calendar->Des());
- aMessage.ReadL(0, calendarPtr);
-
- aMessage.WriteL(1, rServer.UrlL(*calendar));
- CleanupStack::PopAndDestroy(calendar);
- aMessage.Complete(KErrNone);
- }
-
-void CCalDavServerSession::SetUrlL(const RMessage2& aMessage)
- {
- TUint length = aMessage.GetDesLength(0);
- HBufC* calendar = HBufC::NewLC(length);
- TPtr calendarPtr(calendar->Des());
- aMessage.ReadL(0, calendarPtr);
-
- length = aMessage.GetDesLength(1);
- HBufC8* url = HBufC8::NewLC(length);
- TPtr8 urlPtr(url->Des());
- aMessage.ReadL(1, urlPtr);
-
- rServer.SetUrlL(*calendar, *url);
- CleanupStack::PopAndDestroy(url);
- CleanupStack::PopAndDestroy(calendar);
-
- aMessage.Complete(KErrNone);
- }
-
-void CCalDavServerSession::UsernameL(const RMessage2& aMessage)
- {
- TUint length = aMessage.GetDesLength(0);
- HBufC* calendar = HBufC::NewLC(length);
- TPtr calendarPtr(calendar->Des());
- aMessage.ReadL(0, calendarPtr);
-
- aMessage.WriteL(1, rServer.UsernameL(*calendar));
- CleanupStack::PopAndDestroy(calendar);
- aMessage.Complete(KErrNone);
- }
-
-void CCalDavServerSession::SetUsernameL(const RMessage2& aMessage)
- {
- TUint length = aMessage.GetDesLength(0);
- HBufC* calendar = HBufC::NewLC(length);
- TPtr calendarPtr(calendar->Des());
- aMessage.ReadL(0, calendarPtr);
-
- length = aMessage.GetDesLength(1);
- HBufC8* username = HBufC8::NewLC(length);
- TPtr8 usernamePtr(username->Des());
- aMessage.ReadL(1, usernamePtr);
-
- rServer.SetUsernameL(*calendar, *username);
- CleanupStack::PopAndDestroy(username);
- CleanupStack::PopAndDestroy(calendar);
-
- aMessage.Complete(KErrNone);
- }
-
-void CCalDavServerSession::PasswordL(const RMessage2& aMessage)
- {
- TUint length = aMessage.GetDesLength(0);
- HBufC* calendar = HBufC::NewLC(length);
- TPtr calendarPtr(calendar->Des());
- aMessage.ReadL(0, calendarPtr);
-
- aMessage.WriteL(1, rServer.PasswordL(*calendar));
- CleanupStack::PopAndDestroy(calendar);
- aMessage.Complete(KErrNone);
- }
-
-void CCalDavServerSession::SetPasswordL(const RMessage2& aMessage)
- {
- TUint length = aMessage.GetDesLength(0);
- HBufC* calendar = HBufC::NewLC(length);
- TPtr calendarPtr(calendar->Des());
- aMessage.ReadL(0, calendarPtr);
-
- length = aMessage.GetDesLength(1);
- HBufC8* password = HBufC8::NewLC(length);
- TPtr8 passwordPtr(password->Des());
- aMessage.ReadL(1, passwordPtr);
-
- rServer.SetPasswordL(*calendar, *password);
- CleanupStack::PopAndDestroy(password);
- CleanupStack::PopAndDestroy(calendar);
-
- aMessage.Complete(KErrNone);
- }
-
-void CCalDavServerSession::SyncIntervalL(const RMessage2& aMessage)
- {
- TUint length = aMessage.GetDesLength(0);
- HBufC* calendar = HBufC::NewLC(length);
- TPtr calendarPtr(calendar->Des());
- aMessage.ReadL(0, calendarPtr);
-
- TTimeIntervalMinutes interval = rServer.SyncIntervalL(*calendar);
- TPckg<TTimeIntervalMinutes> intervalDes(interval);
- aMessage.WriteL(1, intervalDes);
-
- CleanupStack::PopAndDestroy(calendar);
- aMessage.Complete(KErrNone);
- }
-
-void CCalDavServerSession::SetSyncIntervalL(const RMessage2& aMessage)
- {
- TUint length = aMessage.GetDesLength(0);
- HBufC* calendar = HBufC::NewLC(length);
- TPtr calendarPtr(calendar->Des());
- aMessage.ReadL(0, calendarPtr);
-
- TTimeIntervalMinutes interval;
- ;
- TPckg<TTimeIntervalMinutes> intervalDes(interval);
- aMessage.ReadL(1, intervalDes);
-
- rServer.SetSyncIntervalL(*calendar, interval);
- CleanupStack::PopAndDestroy(calendar);
- aMessage.Complete(KErrNone);
- }
-
-void CCalDavServerSession::PastDaysL(const RMessage2& aMessage)
- {
- TUint length = aMessage.GetDesLength(0);
- HBufC* calendar = HBufC::NewLC(length);
- TPtr calendarPtr(calendar->Des());
- aMessage.ReadL(0, calendarPtr);
-
- TTimeIntervalDays days = rServer.PastDaysL(*calendar);
- TPckg<TTimeIntervalDays> daysDes(days);
- aMessage.WriteL(1, daysDes);
-
- CleanupStack::PopAndDestroy(calendar);
- aMessage.Complete(KErrNone);
- }
-
-void CCalDavServerSession::SetPastDaysL(const RMessage2& aMessage)
- {
- TUint length = aMessage.GetDesLength(0);
- HBufC* calendar = HBufC::NewLC(length);
- TPtr calendarPtr(calendar->Des());
- aMessage.ReadL(0, calendarPtr);
-
- TTimeIntervalDays days;
- TPckg<TTimeIntervalDays> daysDes(days);
- aMessage.ReadL(1, daysDes);
-
- rServer.SetPastDaysL(*calendar, days);
- CleanupStack::PopAndDestroy(calendar);
- aMessage.Complete(KErrNone);
- }
-
-void CCalDavServerSession::ImmediateSyncL(const RMessage2& aMessage)
- {
- TUint length = aMessage.GetDesLength(0);
- HBufC* calendar = HBufC::NewLC(length);
- TPtr calendarPtr(calendar->Des());
- aMessage.ReadL(0, calendarPtr);
-
- TBool immediate = rServer.ImmediateSyncL(*calendar);
- TPckg<TBool> immediateDes(immediate);
- aMessage.WriteL(1, immediateDes);
-
- CleanupStack::PopAndDestroy(calendar);
- aMessage.Complete(KErrNone);
- }
-
-void CCalDavServerSession::SetImmediateSyncL(const RMessage2& aMessage)
- {
- TUint length = aMessage.GetDesLength(0);
- HBufC* calendar = HBufC::NewLC(length);
- TPtr calendarPtr(calendar->Des());
- aMessage.ReadL(0, calendarPtr);
-
- TBool immediate;
- TPckg<TBool> immediateDes(immediate);
- aMessage.ReadL(1, immediateDes);
- rServer.SetImmediateSyncL(*calendar, immediate);
-
- CleanupStack::PopAndDestroy(calendar);
- aMessage.Complete(KErrNone);
- }
-
-void CCalDavServerSession::KeepServerEntryL(const RMessage2& aMessage)
- {
- TUint length = aMessage.GetDesLength(0);
- HBufC* calendar = HBufC::NewLC(length);
- TPtr calendarPtr(calendar->Des());
- aMessage.ReadL(0, calendarPtr);
-
- TBool keepserver = rServer.ImmediateSyncL(*calendar);
- TPckg<TBool> keepserverDes(keepserver);
- aMessage.WriteL(1, keepserverDes);
-
- CleanupStack::PopAndDestroy(calendar);
- aMessage.Complete(KErrNone);
- }
-
-void CCalDavServerSession::EnabledSyncL(const RMessage2& aMessage)
- {
- TUint length = aMessage.GetDesLength(0);
- HBufC* calendar = HBufC::NewLC(length);
- TPtr calendarPtr(calendar->Des());
- aMessage.ReadL(0, calendarPtr);
-
- TBool enabledsync = rServer.EnabledSyncL(*calendar);
- TPckg<TBool> enabledsyncDes(enabledsync);
- aMessage.WriteL(1, enabledsyncDes);
-
- CleanupStack::PopAndDestroy(calendar);
- aMessage.Complete(KErrNone);
- }
-
-void CCalDavServerSession::SetKeepServerEntryL(const RMessage2& aMessage)
- {
- TUint length = aMessage.GetDesLength(0);
- HBufC* calendar = HBufC::NewLC(length);
- TPtr calendarPtr(calendar->Des());
- aMessage.ReadL(0, calendarPtr);
-
- TBool keepserver;
- TPckg<TBool> keepserverDes(keepserver);
- aMessage.ReadL(1, keepserverDes);
- rServer.SetImmediateSyncL(*calendar, keepserver);
-
- CleanupStack::PopAndDestroy(calendar);
- aMessage.Complete(KErrNone);
- }
+/*
+* Copyright (c) 2010 Sun Microsystems, Inc. and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributor:
+* Maximilian Odendahl
+*
+* Contributors:
+*
+* Description: Caldav server session, follows Symbian
+* client/server architecture
+*/
+
+#include <e32cmn.h>
+
+#include "caldavserversession.h"
+#include "caldavserver.h"
+#include "caldavutils.h"
+
+#define MAXLENGTH 500
+
+CCalDavServerSession::CCalDavServerSession(CCalDavServer &aServer) :
+ rServer(aServer)
+ {
+ }
+
+/**
+ Services a client request.
+ */
+void CCalDavServerSession::ServiceL(const RMessage2& aMessage)
+ {
+ TRAP_IGNORE(DispatchMessageL(aMessage));
+ }
+
+/**
+ Called by ServiceL()
+
+ It tests the function code and then delegates to
+ the appropriate function.
+ */
+void CCalDavServerSession::DispatchMessageL(const RMessage2& aMessage)
+ {
+ switch (aMessage.Function())
+ {
+ case ECalDavEnable:
+ EnableL(aMessage);
+ return;
+ case ECalDavDisable:
+ DisableL(aMessage);
+ return;
+ case ECalDavSyncAll:
+ SyncAllL(aMessage);
+ return;
+ case ECalDavSync:
+ SyncL(aMessage);
+ return;
+ case ECalDavUrl:
+ UrlL(aMessage);
+ return;
+ case ECalDavSetUrl:
+ SetUrlL(aMessage);
+ return;
+ case ECalDavUsername:
+ UsernameL(aMessage);
+ return;
+ case ECalDavSetUsername:
+ SetUsernameL(aMessage);
+ return;
+ case ECalDavPassword:
+ PasswordL(aMessage);
+ return;
+ case ECalDavSetPassword:
+ SetPasswordL(aMessage);
+ return;
+ case ECalDavSyncInterval:
+ SyncIntervalL(aMessage);
+ return;
+ case ECalDavSetSyncInterval:
+ SetSyncIntervalL(aMessage);
+ return;
+ case ECalDavPastDays:
+ PastDaysL(aMessage);
+ return;
+ case ECalDavSetPastDays:
+ SetPastDaysL(aMessage);
+ return;
+ case ECalDavImmediateSync:
+ ImmediateSyncL(aMessage);
+ return;
+ case ECalDavSetImmediateSync:
+ SetImmediateSyncL(aMessage);
+ return;
+ case ECalDavKeepServer:
+ KeepServerEntryL(aMessage);
+ return;
+ case ECalDavSetKeepServer:
+ SetKeepServerEntryL(aMessage);
+ return;
+ case ECalDavEnabled:
+ EnabledSyncL(aMessage);
+ return;
+ case ECalDavUnsupportedRequest:
+ User::Leave(KErrNotSupported);
+ // Requests that we don't understand at all are a different matter.
+ // This is considered a client programming error, so we panic the
+ // client - this also completes the message.
+ default:
+ PanicClient(aMessage, EBadRequest);
+ return;
+ }
+ }
+
+/**
+ Panics the client
+ */
+void CCalDavServerSession::PanicClient(const RMessage2& aMessage, TInt aPanic) const
+ {
+ _LIT(KTxtServer,"CalDav server");
+ aMessage.Panic(KTxtServer, aPanic);
+ }
+
+void CCalDavServerSession::EnableL(const RMessage2& aMessage)
+ {
+ TUint length = aMessage.GetDesLength(0);
+ HBufC* calendar = HBufC::NewLC(length);
+ TPtr calendarPtr(calendar->Des());
+ aMessage.ReadL(0, calendarPtr);
+
+ TInt result = rServer.EnableL(*calendar);
+
+ CleanupStack::PopAndDestroy(calendar);
+ aMessage.Complete(result);
+ }
+
+void CCalDavServerSession::DisableL(const RMessage2& aMessage)
+ {
+ TUint length = aMessage.GetDesLength(0);
+ HBufC* calendar = HBufC::NewLC(length);
+ TPtr calendarPtr(calendar->Des());
+ aMessage.ReadL(0, calendarPtr);
+
+ TInt result = rServer.DisableL(*calendar);
+ CleanupStack::PopAndDestroy(calendar);
+ aMessage.Complete(result);
+ }
+
+void CCalDavServerSession::SyncL(const RMessage2& aMessage)
+ {
+ TUint length = aMessage.GetDesLength(0);
+ HBufC* calendar = HBufC::NewLC(length);
+ TPtr calendarPtr(calendar->Des());
+ aMessage.ReadL(0, calendarPtr);
+
+ TInt result = rServer.SyncL(*calendar);
+ CleanupStack::PopAndDestroy(calendar);
+ aMessage.Complete(result);
+ }
+
+void CCalDavServerSession::SyncAllL(const RMessage2& aMessage)
+ {
+ TInt result = rServer.SyncAllL();
+ aMessage.Complete(result);
+ }
+
+void CCalDavServerSession::UrlL(const RMessage2& aMessage)
+ {
+ TUint length = aMessage.GetDesLength(0);
+ HBufC* calendar = HBufC::NewLC(length);
+ TPtr calendarPtr(calendar->Des());
+ aMessage.ReadL(0, calendarPtr);
+
+ aMessage.WriteL(1, rServer.UrlL(*calendar));
+ CleanupStack::PopAndDestroy(calendar);
+ aMessage.Complete(KErrNone);
+ }
+
+void CCalDavServerSession::SetUrlL(const RMessage2& aMessage)
+ {
+ TUint length = aMessage.GetDesLength(0);
+ HBufC* calendar = HBufC::NewLC(length);
+ TPtr calendarPtr(calendar->Des());
+ aMessage.ReadL(0, calendarPtr);
+
+ length = aMessage.GetDesLength(1);
+ HBufC8* url = HBufC8::NewLC(length);
+ TPtr8 urlPtr(url->Des());
+ aMessage.ReadL(1, urlPtr);
+
+ rServer.SetUrlL(*calendar, *url);
+ CleanupStack::PopAndDestroy(url);
+ CleanupStack::PopAndDestroy(calendar);
+
+ aMessage.Complete(KErrNone);
+ }
+
+void CCalDavServerSession::UsernameL(const RMessage2& aMessage)
+ {
+ TUint length = aMessage.GetDesLength(0);
+ HBufC* calendar = HBufC::NewLC(length);
+ TPtr calendarPtr(calendar->Des());
+ aMessage.ReadL(0, calendarPtr);
+
+ aMessage.WriteL(1, rServer.UsernameL(*calendar));
+ CleanupStack::PopAndDestroy(calendar);
+ aMessage.Complete(KErrNone);
+ }
+
+void CCalDavServerSession::SetUsernameL(const RMessage2& aMessage)
+ {
+ TUint length = aMessage.GetDesLength(0);
+ HBufC* calendar = HBufC::NewLC(length);
+ TPtr calendarPtr(calendar->Des());
+ aMessage.ReadL(0, calendarPtr);
+
+ length = aMessage.GetDesLength(1);
+ HBufC8* username = HBufC8::NewLC(length);
+ TPtr8 usernamePtr(username->Des());
+ aMessage.ReadL(1, usernamePtr);
+
+ rServer.SetUsernameL(*calendar, *username);
+ CleanupStack::PopAndDestroy(username);
+ CleanupStack::PopAndDestroy(calendar);
+
+ aMessage.Complete(KErrNone);
+ }
+
+void CCalDavServerSession::PasswordL(const RMessage2& aMessage)
+ {
+ TUint length = aMessage.GetDesLength(0);
+ HBufC* calendar = HBufC::NewLC(length);
+ TPtr calendarPtr(calendar->Des());
+ aMessage.ReadL(0, calendarPtr);
+
+ aMessage.WriteL(1, rServer.PasswordL(*calendar));
+ CleanupStack::PopAndDestroy(calendar);
+ aMessage.Complete(KErrNone);
+ }
+
+void CCalDavServerSession::SetPasswordL(const RMessage2& aMessage)
+ {
+ TUint length = aMessage.GetDesLength(0);
+ HBufC* calendar = HBufC::NewLC(length);
+ TPtr calendarPtr(calendar->Des());
+ aMessage.ReadL(0, calendarPtr);
+
+ length = aMessage.GetDesLength(1);
+ HBufC8* password = HBufC8::NewLC(length);
+ TPtr8 passwordPtr(password->Des());
+ aMessage.ReadL(1, passwordPtr);
+
+ rServer.SetPasswordL(*calendar, *password);
+ CleanupStack::PopAndDestroy(password);
+ CleanupStack::PopAndDestroy(calendar);
+
+ aMessage.Complete(KErrNone);
+ }
+
+void CCalDavServerSession::SyncIntervalL(const RMessage2& aMessage)
+ {
+ TUint length = aMessage.GetDesLength(0);
+ HBufC* calendar = HBufC::NewLC(length);
+ TPtr calendarPtr(calendar->Des());
+ aMessage.ReadL(0, calendarPtr);
+
+ TTimeIntervalMinutes interval = rServer.SyncIntervalL(*calendar);
+ TPckg<TTimeIntervalMinutes> intervalDes(interval);
+ aMessage.WriteL(1, intervalDes);
+
+ CleanupStack::PopAndDestroy(calendar);
+ aMessage.Complete(KErrNone);
+ }
+
+void CCalDavServerSession::SetSyncIntervalL(const RMessage2& aMessage)
+ {
+ TUint length = aMessage.GetDesLength(0);
+ HBufC* calendar = HBufC::NewLC(length);
+ TPtr calendarPtr(calendar->Des());
+ aMessage.ReadL(0, calendarPtr);
+
+ TTimeIntervalMinutes interval;
+ ;
+ TPckg<TTimeIntervalMinutes> intervalDes(interval);
+ aMessage.ReadL(1, intervalDes);
+
+ rServer.SetSyncIntervalL(*calendar, interval);
+ CleanupStack::PopAndDestroy(calendar);
+ aMessage.Complete(KErrNone);
+ }
+
+void CCalDavServerSession::PastDaysL(const RMessage2& aMessage)
+ {
+ TUint length = aMessage.GetDesLength(0);
+ HBufC* calendar = HBufC::NewLC(length);
+ TPtr calendarPtr(calendar->Des());
+ aMessage.ReadL(0, calendarPtr);
+
+ TTimeIntervalDays days = rServer.PastDaysL(*calendar);
+ TPckg<TTimeIntervalDays> daysDes(days);
+ aMessage.WriteL(1, daysDes);
+
+ CleanupStack::PopAndDestroy(calendar);
+ aMessage.Complete(KErrNone);
+ }
+
+void CCalDavServerSession::SetPastDaysL(const RMessage2& aMessage)
+ {
+ TUint length = aMessage.GetDesLength(0);
+ HBufC* calendar = HBufC::NewLC(length);
+ TPtr calendarPtr(calendar->Des());
+ aMessage.ReadL(0, calendarPtr);
+
+ TTimeIntervalDays days;
+ TPckg<TTimeIntervalDays> daysDes(days);
+ aMessage.ReadL(1, daysDes);
+
+ rServer.SetPastDaysL(*calendar, days);
+ CleanupStack::PopAndDestroy(calendar);
+ aMessage.Complete(KErrNone);
+ }
+
+void CCalDavServerSession::ImmediateSyncL(const RMessage2& aMessage)
+ {
+ TUint length = aMessage.GetDesLength(0);
+ HBufC* calendar = HBufC::NewLC(length);
+ TPtr calendarPtr(calendar->Des());
+ aMessage.ReadL(0, calendarPtr);
+
+ TBool immediate = rServer.ImmediateSyncL(*calendar);
+ TPckg<TBool> immediateDes(immediate);
+ aMessage.WriteL(1, immediateDes);
+
+ CleanupStack::PopAndDestroy(calendar);
+ aMessage.Complete(KErrNone);
+ }
+
+void CCalDavServerSession::SetImmediateSyncL(const RMessage2& aMessage)
+ {
+ TUint length = aMessage.GetDesLength(0);
+ HBufC* calendar = HBufC::NewLC(length);
+ TPtr calendarPtr(calendar->Des());
+ aMessage.ReadL(0, calendarPtr);
+
+ TBool immediate;
+ TPckg<TBool> immediateDes(immediate);
+ aMessage.ReadL(1, immediateDes);
+ rServer.SetImmediateSyncL(*calendar, immediate);
+
+ CleanupStack::PopAndDestroy(calendar);
+ aMessage.Complete(KErrNone);
+ }
+
+void CCalDavServerSession::KeepServerEntryL(const RMessage2& aMessage)
+ {
+ TUint length = aMessage.GetDesLength(0);
+ HBufC* calendar = HBufC::NewLC(length);
+ TPtr calendarPtr(calendar->Des());
+ aMessage.ReadL(0, calendarPtr);
+
+ TBool keepserver = rServer.ImmediateSyncL(*calendar);
+ TPckg<TBool> keepserverDes(keepserver);
+ aMessage.WriteL(1, keepserverDes);
+
+ CleanupStack::PopAndDestroy(calendar);
+ aMessage.Complete(KErrNone);
+ }
+
+void CCalDavServerSession::EnabledSyncL(const RMessage2& aMessage)
+ {
+ TUint length = aMessage.GetDesLength(0);
+ HBufC* calendar = HBufC::NewLC(length);
+ TPtr calendarPtr(calendar->Des());
+ aMessage.ReadL(0, calendarPtr);
+
+ TBool enabledsync = rServer.EnabledSyncL(*calendar);
+ TPckg<TBool> enabledsyncDes(enabledsync);
+ aMessage.WriteL(1, enabledsyncDes);
+
+ CleanupStack::PopAndDestroy(calendar);
+ aMessage.Complete(KErrNone);
+ }
+
+void CCalDavServerSession::SetKeepServerEntryL(const RMessage2& aMessage)
+ {
+ TUint length = aMessage.GetDesLength(0);
+ HBufC* calendar = HBufC::NewLC(length);
+ TPtr calendarPtr(calendar->Des());
+ aMessage.ReadL(0, calendarPtr);
+
+ TBool keepserver;
+ TPckg<TBool> keepserverDes(keepserver);
+ aMessage.ReadL(1, keepserverDes);
+ rServer.SetImmediateSyncL(*calendar, keepserver);
+
+ CleanupStack::PopAndDestroy(calendar);
+ aMessage.Complete(KErrNone);
+ }
--- a/calendarengines/caldav/src/caldavsession.cpp Mon Mar 08 21:43:23 2010 +0000
+++ b/calendarengines/caldav/src/caldavsession.cpp Sun Mar 14 13:09:26 2010 +0000
@@ -1,154 +1,154 @@
-/*
-* Copyright (c) 2010 Sun Microsystems, Inc. and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributor:
-* Maximilian Odendahl
-*
-* Contributors:
-*
-* Description: Client API to connect to Caldav server
-* Wrapper around RCalDavServer
-*/
-
-#include "caldavsession.h"
-#include "caldavsessionimpl.h"
-
-CCalDavSession::CCalDavSession()
- {
- }
-
-EXPORT_C CCalDavSession::~CCalDavSession()
- {
- delete iImpl;
- }
-
-EXPORT_C CCalDavSession* CCalDavSession::NewLC()
- {
- CCalDavSession* self = new (ELeave) CCalDavSession();
- CleanupStack::PushL(self);
- self->ConstructL();
- return self;
- }
-
-EXPORT_C CCalDavSession* CCalDavSession::NewL()
- {
- CCalDavSession* self = CCalDavSession::NewLC();
- CleanupStack::Pop(self);
- return self;
- }
-
-void CCalDavSession::ConstructL()
- {
- iImpl = CCalDavSessionImpl::NewL();
- }
-
-EXPORT_C TInt CCalDavSession::Enable(const TDesC &aCalendar)
- {
- return iImpl->Enable(aCalendar);
- }
-
-EXPORT_C TInt CCalDavSession::Disable(const TDesC &aCalendar)
- {
- return iImpl->Disable(aCalendar);
- }
-
-EXPORT_C TInt CCalDavSession::SyncL(const TDesC &aCalendar)
- {
- return iImpl->SyncL(aCalendar);
- }
-
-EXPORT_C TInt CCalDavSession::SyncAllL()
- {
- return iImpl->SyncAllL();
- }
-
-EXPORT_C TInt CCalDavSession::Url(const TDesC &aCalendar, TDes8 &aUrl)
- {
- return iImpl->Url(aCalendar, aUrl);
- }
-
-EXPORT_C TInt CCalDavSession::SetUrl(const TDesC &aCalendar, const TDesC8 &aUrl)
- {
- return iImpl->SetUrl(aCalendar, aUrl);
- }
-
-EXPORT_C TInt CCalDavSession::Username(const TDesC &aCalendar, TDes8 &aUsername)
- {
- return iImpl->Username(aCalendar, aUsername);
- }
-
-EXPORT_C TInt CCalDavSession::SetUsername(const TDesC &aCalendar,
- const TDesC8 &aUsername)
- {
- return iImpl->SetUsername(aCalendar, aUsername);
- }
-
-EXPORT_C TInt CCalDavSession::Password(const TDesC &aCalendar, TDes8 &aPassword)
- {
- return iImpl->Password(aCalendar, aPassword);
- }
-
-EXPORT_C TInt CCalDavSession::SetPassword(const TDesC &aCalendar,
- const TDesC8 &aPassword)
- {
- return iImpl->SetPassword(aCalendar, aPassword);
- }
-
-EXPORT_C TInt CCalDavSession::SyncInterval(const TDesC &aCalendar,
- TTimeIntervalMinutes& aSyncInterval)
- {
- return iImpl->SyncInterval(aCalendar, aSyncInterval);
- }
-
-EXPORT_C TInt CCalDavSession::SetSyncInterval(const TDesC &aCalendar,
- TTimeIntervalMinutes aSyncInterval)
- {
- return iImpl->SetSyncInterval(aCalendar, aSyncInterval);
- }
-
-EXPORT_C TInt CCalDavSession::PastDays(const TDesC &aCalendar,
- TTimeIntervalDays &aDays)
- {
- return iImpl->PastDays(aCalendar, aDays);
- }
-
-EXPORT_C TInt CCalDavSession::SetPastDays(const TDesC &aCalendar,
- TTimeIntervalDays aDays)
- {
- return iImpl->SetPastDays(aCalendar, aDays);
- }
-
-EXPORT_C TInt CCalDavSession::ImmediateSync(const TDesC &aCalendar,
- TBool &aImmediateSyc)
- {
- return iImpl->ImmediateSync(aCalendar, aImmediateSyc);
- }
-
-EXPORT_C TInt CCalDavSession::SetImmediateSync(const TDesC &aCalendar,
- TBool aImmediateSyc)
- {
- return iImpl->SetImmediateSync(aCalendar, aImmediateSyc);
- }
-
-EXPORT_C TInt CCalDavSession::KeepServerEntry(const TDesC &aCalendar,
- TBool &aKeepServerEntry)
- {
- return iImpl->KeepServerEntry(aCalendar, aKeepServerEntry);
- }
-
-EXPORT_C TInt CCalDavSession::SetKeepServerEntry(const TDesC &aCalendar,
- TBool aKeepServerEntry)
- {
- return iImpl->SetKeepServerEntry(aCalendar, aKeepServerEntry);
- }
-
-EXPORT_C TInt CCalDavSession::EnabledSync(const TDesC &aCalendar,
- TBool &aEnabledSync)
- {
- return iImpl->EnabledSync(aCalendar, aEnabledSync);
- }
+/*
+* Copyright (c) 2010 Sun Microsystems, Inc. and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributor:
+* Maximilian Odendahl
+*
+* Contributors:
+*
+* Description: Client API to connect to Caldav server
+* Wrapper around RCalDavServer
+*/
+
+#include "caldavsession.h"
+#include "caldavsessionimpl.h"
+
+CCalDavSession::CCalDavSession()
+ {
+ }
+
+EXPORT_C CCalDavSession::~CCalDavSession()
+ {
+ delete iImpl;
+ }
+
+EXPORT_C CCalDavSession* CCalDavSession::NewLC()
+ {
+ CCalDavSession* self = new (ELeave) CCalDavSession();
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ return self;
+ }
+
+EXPORT_C CCalDavSession* CCalDavSession::NewL()
+ {
+ CCalDavSession* self = CCalDavSession::NewLC();
+ CleanupStack::Pop(self);
+ return self;
+ }
+
+void CCalDavSession::ConstructL()
+ {
+ iImpl = CCalDavSessionImpl::NewL();
+ }
+
+EXPORT_C TInt CCalDavSession::Enable(const TDesC &aCalendar)
+ {
+ return iImpl->Enable(aCalendar);
+ }
+
+EXPORT_C TInt CCalDavSession::Disable(const TDesC &aCalendar)
+ {
+ return iImpl->Disable(aCalendar);
+ }
+
+EXPORT_C TInt CCalDavSession::SyncL(const TDesC &aCalendar)
+ {
+ return iImpl->SyncL(aCalendar);
+ }
+
+EXPORT_C TInt CCalDavSession::SyncAllL()
+ {
+ return iImpl->SyncAllL();
+ }
+
+EXPORT_C TInt CCalDavSession::Url(const TDesC &aCalendar, TDes8 &aUrl)
+ {
+ return iImpl->Url(aCalendar, aUrl);
+ }
+
+EXPORT_C TInt CCalDavSession::SetUrl(const TDesC &aCalendar, const TDesC8 &aUrl)
+ {
+ return iImpl->SetUrl(aCalendar, aUrl);
+ }
+
+EXPORT_C TInt CCalDavSession::Username(const TDesC &aCalendar, TDes8 &aUsername)
+ {
+ return iImpl->Username(aCalendar, aUsername);
+ }
+
+EXPORT_C TInt CCalDavSession::SetUsername(const TDesC &aCalendar,
+ const TDesC8 &aUsername)
+ {
+ return iImpl->SetUsername(aCalendar, aUsername);
+ }
+
+EXPORT_C TInt CCalDavSession::Password(const TDesC &aCalendar, TDes8 &aPassword)
+ {
+ return iImpl->Password(aCalendar, aPassword);
+ }
+
+EXPORT_C TInt CCalDavSession::SetPassword(const TDesC &aCalendar,
+ const TDesC8 &aPassword)
+ {
+ return iImpl->SetPassword(aCalendar, aPassword);
+ }
+
+EXPORT_C TInt CCalDavSession::SyncInterval(const TDesC &aCalendar,
+ TTimeIntervalMinutes& aSyncInterval)
+ {
+ return iImpl->SyncInterval(aCalendar, aSyncInterval);
+ }
+
+EXPORT_C TInt CCalDavSession::SetSyncInterval(const TDesC &aCalendar,
+ TTimeIntervalMinutes aSyncInterval)
+ {
+ return iImpl->SetSyncInterval(aCalendar, aSyncInterval);
+ }
+
+EXPORT_C TInt CCalDavSession::PastDays(const TDesC &aCalendar,
+ TTimeIntervalDays &aDays)
+ {
+ return iImpl->PastDays(aCalendar, aDays);
+ }
+
+EXPORT_C TInt CCalDavSession::SetPastDays(const TDesC &aCalendar,
+ TTimeIntervalDays aDays)
+ {
+ return iImpl->SetPastDays(aCalendar, aDays);
+ }
+
+EXPORT_C TInt CCalDavSession::ImmediateSync(const TDesC &aCalendar,
+ TBool &aImmediateSyc)
+ {
+ return iImpl->ImmediateSync(aCalendar, aImmediateSyc);
+ }
+
+EXPORT_C TInt CCalDavSession::SetImmediateSync(const TDesC &aCalendar,
+ TBool aImmediateSyc)
+ {
+ return iImpl->SetImmediateSync(aCalendar, aImmediateSyc);
+ }
+
+EXPORT_C TInt CCalDavSession::KeepServerEntry(const TDesC &aCalendar,
+ TBool &aKeepServerEntry)
+ {
+ return iImpl->KeepServerEntry(aCalendar, aKeepServerEntry);
+ }
+
+EXPORT_C TInt CCalDavSession::SetKeepServerEntry(const TDesC &aCalendar,
+ TBool aKeepServerEntry)
+ {
+ return iImpl->SetKeepServerEntry(aCalendar, aKeepServerEntry);
+ }
+
+EXPORT_C TInt CCalDavSession::EnabledSync(const TDesC &aCalendar,
+ TBool &aEnabledSync)
+ {
+ return iImpl->EnabledSync(aCalendar, aEnabledSync);
+ }
--- a/calendarengines/caldav/src/caldavsessionimpl.cpp Mon Mar 08 21:43:23 2010 +0000
+++ b/calendarengines/caldav/src/caldavsessionimpl.cpp Sun Mar 14 13:09:26 2010 +0000
@@ -1,160 +1,160 @@
-/*
-* Copyright (c) 2010 Sun Microsystems, Inc. and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributor:
-* Maximilian Odendahl
-*
-* Contributors:
-*
-* Description: Client API implementation
-* Wrapper around RCalDavServer
-*/
-
-#include "caldavsessionimpl.h"
-#include "caldavclient.h"
-
-CCalDavSessionImpl::CCalDavSessionImpl()
- {
- // No implementation required
- }
-
-CCalDavSessionImpl::~CCalDavSessionImpl()
- {
- if (iServer)
- {
- iServer->Close();
- delete iServer;
- }
- }
-
-CCalDavSessionImpl* CCalDavSessionImpl::NewLC()
- {
- CCalDavSessionImpl* self = new (ELeave) CCalDavSessionImpl();
- CleanupStack::PushL(self);
- self->ConstructL();
- return self;
- }
-
-CCalDavSessionImpl* CCalDavSessionImpl::NewL()
- {
- CCalDavSessionImpl* self = CCalDavSessionImpl::NewLC();
- CleanupStack::Pop(self);
- return self;
- }
-
-void CCalDavSessionImpl::ConstructL()
- {
- iServer = new (ELeave) RCalDavServer();
- User::LeaveIfError(iServer->Connect());
- }
-
-TInt CCalDavSessionImpl::Enable(const TDesC &aCalendar)
- {
- return iServer->Enable(aCalendar);
- }
-
-TInt CCalDavSessionImpl::Disable(const TDesC &aCalendar)
- {
- return iServer->Disable(aCalendar);
- }
-
-TInt CCalDavSessionImpl::SyncL(const TDesC &aCalendar)
- {
- return iServer->Sync(aCalendar);
- }
-
-TInt CCalDavSessionImpl::SyncAllL()
- {
- return iServer->SyncAll();
- }
-
-TInt CCalDavSessionImpl::Url(const TDesC &aCalendar, TDes8 &aUrl)
- {
- return iServer->Url(aCalendar, aUrl);
- }
-
-TInt CCalDavSessionImpl::SetUrl(const TDesC &aCalendar, const TDesC8 &aUrl)
- {
- return iServer->SetUrl(aCalendar, aUrl);
- }
-
-TInt CCalDavSessionImpl::Username(const TDesC &aCalendar, TDes8 &aUsername)
- {
- return iServer->Username(aCalendar, aUsername);
- }
-
-TInt CCalDavSessionImpl::SetUsername(const TDesC &aCalendar,
- const TDesC8 &aUsername)
- {
- return iServer->SetUsername(aCalendar, aUsername);
- }
-
-TInt CCalDavSessionImpl::Password(const TDesC &aCalendar, TDes8 &aPassword)
- {
- return iServer->Password(aCalendar, aPassword);
- }
-
-TInt CCalDavSessionImpl::SetPassword(const TDesC &aCalendar,
- const TDesC8 &aPassword)
- {
- return iServer->SetPassword(aCalendar, aPassword);
- }
-
-TInt CCalDavSessionImpl::SyncInterval(const TDesC &aCalendar,
- TTimeIntervalMinutes& aSyncInterval)
- {
- return iServer->SyncInterval(aCalendar, aSyncInterval);
- }
-
-TInt CCalDavSessionImpl::SetSyncInterval(const TDesC &aCalendar,
- TTimeIntervalMinutes aSyncInterval)
- {
- return iServer->SetSyncInterval(aCalendar, aSyncInterval);
- }
-
-TInt CCalDavSessionImpl::PastDays(const TDesC &aCalendar,
- TTimeIntervalDays &aDays)
- {
- return iServer->PastDays(aCalendar, aDays);
- }
-
-TInt CCalDavSessionImpl::SetPastDays(const TDesC &aCalendar,
- TTimeIntervalDays aDays)
- {
- return iServer->SetPastDays(aCalendar, aDays);
- }
-
-TInt CCalDavSessionImpl::ImmediateSync(const TDesC &aCalendar,
- TBool &aImmediateSyc)
- {
- return iServer->ImmediateSync(aCalendar, aImmediateSyc);
- }
-
-TInt CCalDavSessionImpl::SetImmediateSync(const TDesC &aCalendar,
- TBool aImmediateSyc)
- {
- return iServer->SetImmediateSync(aCalendar, aImmediateSyc);
- }
-
-TInt CCalDavSessionImpl::KeepServerEntry(const TDesC &aCalendar,
- TBool &aKeepServerEntry)
- {
- return iServer->KeepServerEntry(aCalendar, aKeepServerEntry);
- }
-
-TInt CCalDavSessionImpl::SetKeepServerEntry(const TDesC &aCalendar,
- TBool aKeepServerEntry)
- {
- return iServer->SetKeepServerEntry(aCalendar, aKeepServerEntry);
- }
-
-TInt CCalDavSessionImpl::EnabledSync(const TDesC &aCalendar,
- TBool &aEnabledSync)
- {
- return iServer->EnabledSync(aCalendar, aEnabledSync);
- }
+/*
+* Copyright (c) 2010 Sun Microsystems, Inc. and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributor:
+* Maximilian Odendahl
+*
+* Contributors:
+*
+* Description: Client API implementation
+* Wrapper around RCalDavServer
+*/
+
+#include "caldavsessionimpl.h"
+#include "caldavclient.h"
+
+CCalDavSessionImpl::CCalDavSessionImpl()
+ {
+ // No implementation required
+ }
+
+CCalDavSessionImpl::~CCalDavSessionImpl()
+ {
+ if (iServer)
+ {
+ iServer->Close();
+ delete iServer;
+ }
+ }
+
+CCalDavSessionImpl* CCalDavSessionImpl::NewLC()
+ {
+ CCalDavSessionImpl* self = new (ELeave) CCalDavSessionImpl();
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ return self;
+ }
+
+CCalDavSessionImpl* CCalDavSessionImpl::NewL()
+ {
+ CCalDavSessionImpl* self = CCalDavSessionImpl::NewLC();
+ CleanupStack::Pop(self);
+ return self;
+ }
+
+void CCalDavSessionImpl::ConstructL()
+ {
+ iServer = new (ELeave) RCalDavServer();
+ User::LeaveIfError(iServer->Connect());
+ }
+
+TInt CCalDavSessionImpl::Enable(const TDesC &aCalendar)
+ {
+ return iServer->Enable(aCalendar);
+ }
+
+TInt CCalDavSessionImpl::Disable(const TDesC &aCalendar)
+ {
+ return iServer->Disable(aCalendar);
+ }
+
+TInt CCalDavSessionImpl::SyncL(const TDesC &aCalendar)
+ {
+ return iServer->Sync(aCalendar);
+ }
+
+TInt CCalDavSessionImpl::SyncAllL()
+ {
+ return iServer->SyncAll();
+ }
+
+TInt CCalDavSessionImpl::Url(const TDesC &aCalendar, TDes8 &aUrl)
+ {
+ return iServer->Url(aCalendar, aUrl);
+ }
+
+TInt CCalDavSessionImpl::SetUrl(const TDesC &aCalendar, const TDesC8 &aUrl)
+ {
+ return iServer->SetUrl(aCalendar, aUrl);
+ }
+
+TInt CCalDavSessionImpl::Username(const TDesC &aCalendar, TDes8 &aUsername)
+ {
+ return iServer->Username(aCalendar, aUsername);
+ }
+
+TInt CCalDavSessionImpl::SetUsername(const TDesC &aCalendar,
+ const TDesC8 &aUsername)
+ {
+ return iServer->SetUsername(aCalendar, aUsername);
+ }
+
+TInt CCalDavSessionImpl::Password(const TDesC &aCalendar, TDes8 &aPassword)
+ {
+ return iServer->Password(aCalendar, aPassword);
+ }
+
+TInt CCalDavSessionImpl::SetPassword(const TDesC &aCalendar,
+ const TDesC8 &aPassword)
+ {
+ return iServer->SetPassword(aCalendar, aPassword);
+ }
+
+TInt CCalDavSessionImpl::SyncInterval(const TDesC &aCalendar,
+ TTimeIntervalMinutes& aSyncInterval)
+ {
+ return iServer->SyncInterval(aCalendar, aSyncInterval);
+ }
+
+TInt CCalDavSessionImpl::SetSyncInterval(const TDesC &aCalendar,
+ TTimeIntervalMinutes aSyncInterval)
+ {
+ return iServer->SetSyncInterval(aCalendar, aSyncInterval);
+ }
+
+TInt CCalDavSessionImpl::PastDays(const TDesC &aCalendar,
+ TTimeIntervalDays &aDays)
+ {
+ return iServer->PastDays(aCalendar, aDays);
+ }
+
+TInt CCalDavSessionImpl::SetPastDays(const TDesC &aCalendar,
+ TTimeIntervalDays aDays)
+ {
+ return iServer->SetPastDays(aCalendar, aDays);
+ }
+
+TInt CCalDavSessionImpl::ImmediateSync(const TDesC &aCalendar,
+ TBool &aImmediateSyc)
+ {
+ return iServer->ImmediateSync(aCalendar, aImmediateSyc);
+ }
+
+TInt CCalDavSessionImpl::SetImmediateSync(const TDesC &aCalendar,
+ TBool aImmediateSyc)
+ {
+ return iServer->SetImmediateSync(aCalendar, aImmediateSyc);
+ }
+
+TInt CCalDavSessionImpl::KeepServerEntry(const TDesC &aCalendar,
+ TBool &aKeepServerEntry)
+ {
+ return iServer->KeepServerEntry(aCalendar, aKeepServerEntry);
+ }
+
+TInt CCalDavSessionImpl::SetKeepServerEntry(const TDesC &aCalendar,
+ TBool aKeepServerEntry)
+ {
+ return iServer->SetKeepServerEntry(aCalendar, aKeepServerEntry);
+ }
+
+TInt CCalDavSessionImpl::EnabledSync(const TDesC &aCalendar,
+ TBool &aEnabledSync)
+ {
+ return iServer->EnabledSync(aCalendar, aEnabledSync);
+ }
--- a/calendarengines/caldav/src/caldavutils.cpp Mon Mar 08 21:43:23 2010 +0000
+++ b/calendarengines/caldav/src/caldavutils.cpp Sun Mar 14 13:09:26 2010 +0000
@@ -1,375 +1,375 @@
-/*
-* Copyright (c) 2010 Sun Microsystems, Inc. and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributor:
-* Maximilian Odendahl
-*
-* Contributors:
-*
-* Description: various utility classes and functions
-* used in Caldav client and server code
-*/
-
-#include "caldavutils.h"
-
-#include <http\MHTTPAuthenticationCallback.h>
-#include <http\mhttptransactioncallback.h>
-#include <http\mhttpdatasupplier.h>
-#include <http\rhttpheaders.h>
-
-/**
- * CalDavUtils::CalDavUtils
- * default constructor
- */
-CalDavUtils::CalDavUtils()
- {
- // No implementation required
- }
-
-/**
- * CalDavUtils::~CalDavUtils
- * default destructor
- */
-CalDavUtils::~CalDavUtils()
- {
- }
-
-/**
- * CalDavUtils::NewLC
- * first phase construction
- */
-CalDavUtils* CalDavUtils::NewLC()
- {
- CalDavUtils* self = new (ELeave) CalDavUtils();
- CleanupStack::PushL(self);
- self->ConstructL();
- return self;
- }
-
-/**
- * CalDavUtils::NewL
- * first phase construction
- */
-CalDavUtils* CalDavUtils::NewL()
- {
- CalDavUtils* self = CalDavUtils::NewLC();
- CleanupStack::Pop(self); // self;
- return self;
- }
-
-/**
- * CalDavUtils::ConstructL
- * second phase construction
- */
-void CalDavUtils::ConstructL()
- {
- }
-
-/**
- * CalDavUtils::FixImportIssues
- * fix import issues
- */
-void CalDavUtils::FixImportIssues(TDes8 &aDes)
- {
- const TUint KICalCarriageReturnChar('\r');
- _LIT8(KICalNewlineChar,"\n");
- _LIT8(KICalCarriageReturnLineFeed,"\r\n");
-
- TInt ret = aDes.Find(KICalNewlineChar);
-
- while ((ret != KErrNotFound) && (ret == 0 ? ETrue : (aDes[ret - 1]
- != KICalCarriageReturnChar)))
- {
- aDes.Replace(ret, 1, KICalCarriageReturnLineFeed);
- TInt mid = aDes.Mid(ret + 2).Find(KICalNewlineChar);
- ret = mid != KErrNone ? mid + ret + 2 : KErrNotFound;
- }
- }
-
-/**
- * CalDavUtils::FixExportIssues
- * fix export issues, hopefully can be removed in the future
- */
-void CalDavUtils::FixExportIssues(TDes8 &aDes)
- {
- FixSameTime(aDes);
- FindAndRemoveMethod(aDes);
- FixBYMONTHDAY(aDes);
- FixLineFeed(aDes);
- //TODO: using public, nothing is exported
- }
-
-/**
- * CalDavUtils::FixLineFeed
- * fix lidne feed
- */
-void CalDavUtils::FixLineFeed(TDes8 &aDes)
- {
- _LIT8(lf1,"
");
- _LIT8(KBackSlashN,"\\n");
- TInt ret = aDes.Find(lf1);
- while (ret != KErrNotFound)
- {
- aDes.Replace(ret, lf1().Length(), KBackSlashN);
- ret = aDes.Find(lf1);
- }
- }
-
-/**
- * CalDavUtils::FixSameTime
- * fix same time
- */
-void CalDavUtils::FixSameTime(TDes8 &aDes)
- {
-#define DATELENGTH 15
- _LIT8(DTSTART,"DTSTART:");
- _LIT8(DTEND,"DTEND:");
- _LIT8(DUE,"DUE:");
- _LIT8(nine,"9");
- _LIT8(five,"5");
- _LIT8(VEVENT,"VEVENT");
- _LIT8(VTODO,"VTODO");
-
- // add one second if DTSTART and DTEND is the same
- // ATTENTION: works only for very simple cases right now
- // DTSTART:20090630T000000
- // DTEND:20090630T000000
- if (aDes.Find(VEVENT) != KErrNone)
- {
- TInt PosStart = aDes.Find(DTSTART);
- TInt PosDue = aDes.Find(DTEND);
-
- if ((PosStart != KErrNone) && (PosDue != KErrNone))
- {
- TPtrC8 PtrStart = aDes.Mid(PosStart + DTSTART().Length(),
- DATELENGTH);
- TPtrC8 PtrStop = aDes.Mid(PosDue + DTEND().Length(), DATELENGTH);
-
- if (PtrStart == PtrStop)
- {
- aDes.Replace(PosDue + DTEND().Length() + DATELENGTH - 1, 1,
- nine);
- aDes.Replace(PosDue + DTEND().Length() + DATELENGTH - 2, 1,
- five);
- aDes.Replace(PosDue + DTEND().Length() + DATELENGTH - 3, 1,
- nine);
- }
- }
- }
-
- // add one second if DTSTART and DUE is the same
- // ATTENTION: works only for very simple cases right now
- // DTSTART:20090630T000000
- // DUE:20090630T000000
-
- if (aDes.Find(VTODO) != KErrNone)
- {
- TInt PosStart = aDes.Find(DTSTART);
- TInt PosDue = aDes.Find(DUE);
-
- if ((PosStart != KErrNone) && (PosDue != KErrNone))
- {
- TPtrC8 PtrStart = aDes.Mid(PosStart + DTSTART().Length(),
- DATELENGTH);
- TPtrC8 PtrStop = aDes.Mid(PosDue + DUE().Length(), DATELENGTH);
-
- if (PtrStart == PtrStop)
- {
- aDes.Replace(PosDue + DUE().Length() + DATELENGTH - 1, 1, nine);
- aDes.Replace(PosDue + DUE().Length() + DATELENGTH - 2, 1, five);
- aDes.Replace(PosDue + DUE().Length() + DATELENGTH - 3, 1, nine);
- }
- }
- }
- }
-
-/**
- * CalDavUtils::FindAndRemoveMethod
- * fix wrong method export
- */
-void CalDavUtils::FindAndRemoveMethod(TDes8 &aDes)
- {
- _LIT8(method,"METHOD:PUBLISH\r\n");
- TInt Ret = aDes.Find(method);
- while (Ret != KErrNotFound)
- {
- aDes.Delete(Ret, method().Length());
- Ret = aDes.Find(method);
- }
- }
-
-/**
- * CalDavUtils::FixBYMONTHDAY
- * fix wrong BYMONTHDAY export
- */
-void CalDavUtils::FixBYMONTHDAY(TDes8 &aDes)
- {
- _LIT8(method0,"BYMONTHDAY=0");
- _LIT8(method1,"BYMONTHDAY=1");
- TInt ret = aDes.Find(method0);
- while (ret != KErrNotFound)
- {
- aDes.Replace(ret, method1().Length(), method1);
- ret = aDes.Find(method0);
- }
- }
-
-/**
- * CalDavUtils::ScanAllowHeaderL
- * fix scan allow header
- */
-void CalDavUtils::ScanAllowHeaderL(RHTTPTransaction &aTransaction,
- TCalDAVOptions &aOptions)
- {
- RStringF Header = aTransaction.Session().StringPool().OpenFStringL(ALLOW);
- THTTPHdrVal HeaderVal;
- if (aTransaction.Response().GetHeaderCollection().GetField(Header, 0,
- HeaderVal) == KErrNone)
- {
- RStringF FieldValStr = aTransaction.Session().StringPool().StringF(
- HeaderVal.StrF());
- const TDesC8 &FieldValDesC = FieldValStr.DesC();
- HBufC8 *FieldVal = FieldValDesC.AllocLC();
- // delete all colons
- TInt Pos = FieldVal->Find(colon);
- while (Pos != KErrNotFound)
- {
- FieldVal->Des().Delete(Pos, 1);
- Pos = FieldVal->Find(colon);
- }
- TLex8 Lex(FieldVal->Des());
- TBool stop = EFalse;
- while (!stop)
- {
- TPtrC8 Ptr = Lex.NextToken();
- stop = Ptr.Length() == 0;
- if (Ptr == DELETE)
- aOptions.DELETE = ETrue;
- else if (Ptr == GET)
- aOptions.GET = ETrue;
- else if (Ptr == HEAD)
- aOptions.HEAD = ETrue;
- else if (Ptr == MKCALENDAR)
- aOptions.MKCALENDAR = ETrue;
- else if (Ptr == MKCOL)
- aOptions.MKCOL = ETrue;
- else if (Ptr == OPTIONS)
- aOptions.OPTIONS = ETrue;
- else if (Ptr == PROPFIND)
- aOptions.PROPFIND = ETrue;
- else if (Ptr == PROPPATCH)
- aOptions.PROPPATCH = ETrue;
- else if (Ptr == PUT)
- aOptions.PUT = ETrue;
- else if (Ptr == REPORT)
- aOptions.REPORT = ETrue;
- else if (Ptr == COPY)
- aOptions.COPY = ETrue;
- else if (Ptr == POST)
- aOptions.POST = ETrue;
- else if (Ptr == MOVE)
- aOptions.MOVE = ETrue;
- else if (Ptr == ACL)
- aOptions.ACL = ETrue;
- else if (Ptr == LOCK)
- aOptions.LOCK = ETrue;
- else if (Ptr == UNLOCK)
- aOptions.UNLOCK = ETrue;
- }
- CleanupStack::PopAndDestroy(FieldVal);
- }
- Header.Close();
- }
-
-/**
- * CalDavUtils::ScanDAVHeaderL
- * scan DAV header
- */
-void CalDavUtils::ScanDAVHeaderL(RHTTPTransaction &aTransaction,
- TCalDAVOptions &aOptions)
- {
- RStringF Header = aTransaction.Session().StringPool().OpenFStringL(DAV);
- THTTPHdrVal aHeaderVal;
- if (aTransaction.Response().GetHeaderCollection().GetField(Header, 0,
- aHeaderVal) == KErrNone)
- {
- RStringF FieldValStr = aTransaction.Session().StringPool().StringF(
- aHeaderVal.StrF());
- const TDesC8 &FieldValDesC = FieldValStr.DesC();
- HBufC8 *FieldVal = FieldValDesC.AllocLC();
- // delete all colons
- TInt Pos = FieldVal->Find(colon);
- while (Pos != KErrNotFound)
- {
- FieldVal->Des().Delete(Pos, 1);
- Pos = FieldVal->Find(colon);
- }
- TLex8 Lex(FieldVal->Des());
- TBool stop = EFalse;
- while (!stop)
- {
- TPtrC8 Ptr = Lex.NextToken();
- stop = Ptr.Length() == 0;
- if (Ptr == ONE)
- aOptions.ONE = ETrue;
- else if (Ptr == TWO)
- aOptions.TWO = ETrue;
- else if (Ptr == THREE)
- aOptions.THREE = ETrue;
- else if (Ptr == access_control)
- aOptions.access_control = ETrue;
- else if (Ptr == calendar_access)
- {
- aOptions.calendar_access = ETrue;
- // this is a CalDAV server for sure, MULTIGET and calendar-query is required
- // we do not check for this anymore in CCaldavEngine::GetOptions()
- aOptions.MULTIGET = ETrue;
- aOptions.QUERY = ETrue;
- }
- else if (Ptr == calendar_schedule)
- aOptions.calendar_schedule = ETrue;
- else if (Ptr == calendar_auto_schedule)
- aOptions.calendar_auto_schedule = ETrue;
- else if (Ptr == sync_collection)
- aOptions.sync_collection = ETrue;
- else if (Ptr == extended_mkcol)
- aOptions.extended_mkcol = ETrue;
- }
- CleanupStack::PopAndDestroy(FieldVal);
- }
- Header.Close();
- }
-
-/**
- * CalDavUtils::EnsureSlashL
- * ensure trailing slash
- */
-HBufC8* CalDavUtils::EnsureSlashL(HBufC8* aIn)
- {
- if ((aIn == NULL) || (aIn->Right(KSlash().Length()) == KSlash))
- return aIn;
- else
- {
- HBufC8 *out = HBufC8::NewL(aIn->Length() + KSlash().Length());
- out->Des().Append(*aIn);
- out->Des().Append(KSlash);
- delete aIn;
- aIn = NULL;
- return out;
- }
- }
-
-/**
- * CalDavUtils::EnsureSlashL
- * ensure trailing slash
- */
-HBufC8* CalDavUtils::EnsureSlashL(const TDesC8 &aIn)
- {
- HBufC8 *out = aIn.AllocL();
- return CalDavUtils::EnsureSlashL(out);
- }
+/*
+* Copyright (c) 2010 Sun Microsystems, Inc. and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributor:
+* Maximilian Odendahl
+*
+* Contributors:
+*
+* Description: various utility classes and functions
+* used in Caldav client and server code
+*/
+
+#include "caldavutils.h"
+
+#include <http\MHTTPAuthenticationCallback.h>
+#include <http\mhttptransactioncallback.h>
+#include <http\mhttpdatasupplier.h>
+#include <http\rhttpheaders.h>
+
+/**
+ * CalDavUtils::CalDavUtils
+ * default constructor
+ */
+CalDavUtils::CalDavUtils()
+ {
+ // No implementation required
+ }
+
+/**
+ * CalDavUtils::~CalDavUtils
+ * default destructor
+ */
+CalDavUtils::~CalDavUtils()
+ {
+ }
+
+/**
+ * CalDavUtils::NewLC
+ * first phase construction
+ */
+CalDavUtils* CalDavUtils::NewLC()
+ {
+ CalDavUtils* self = new (ELeave) CalDavUtils();
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ return self;
+ }
+
+/**
+ * CalDavUtils::NewL
+ * first phase construction
+ */
+CalDavUtils* CalDavUtils::NewL()
+ {
+ CalDavUtils* self = CalDavUtils::NewLC();
+ CleanupStack::Pop(self); // self;
+ return self;
+ }
+
+/**
+ * CalDavUtils::ConstructL
+ * second phase construction
+ */
+void CalDavUtils::ConstructL()
+ {
+ }
+
+/**
+ * CalDavUtils::FixImportIssues
+ * fix import issues
+ */
+void CalDavUtils::FixImportIssues(TDes8 &aDes)
+ {
+ const TUint KICalCarriageReturnChar('\r');
+ _LIT8(KICalNewlineChar,"\n");
+ _LIT8(KICalCarriageReturnLineFeed,"\r\n");
+
+ TInt ret = aDes.Find(KICalNewlineChar);
+
+ while ((ret != KErrNotFound) && (ret == 0 ? ETrue : (aDes[ret - 1]
+ != KICalCarriageReturnChar)))
+ {
+ aDes.Replace(ret, 1, KICalCarriageReturnLineFeed);
+ TInt mid = aDes.Mid(ret + 2).Find(KICalNewlineChar);
+ ret = mid != KErrNone ? mid + ret + 2 : KErrNotFound;
+ }
+ }
+
+/**
+ * CalDavUtils::FixExportIssues
+ * fix export issues, hopefully can be removed in the future
+ */
+void CalDavUtils::FixExportIssues(TDes8 &aDes)
+ {
+ FixSameTime(aDes);
+ FindAndRemoveMethod(aDes);
+ FixBYMONTHDAY(aDes);
+ FixLineFeed(aDes);
+ //TODO: using public, nothing is exported
+ }
+
+/**
+ * CalDavUtils::FixLineFeed
+ * fix lidne feed
+ */
+void CalDavUtils::FixLineFeed(TDes8 &aDes)
+ {
+ _LIT8(lf1,"
");
+ _LIT8(KBackSlashN,"\\n");
+ TInt ret = aDes.Find(lf1);
+ while (ret != KErrNotFound)
+ {
+ aDes.Replace(ret, lf1().Length(), KBackSlashN);
+ ret = aDes.Find(lf1);
+ }
+ }
+
+/**
+ * CalDavUtils::FixSameTime
+ * fix same time
+ */
+void CalDavUtils::FixSameTime(TDes8 &aDes)
+ {
+#define DATELENGTH 15
+ _LIT8(DTSTART,"DTSTART:");
+ _LIT8(DTEND,"DTEND:");
+ _LIT8(DUE,"DUE:");
+ _LIT8(nine,"9");
+ _LIT8(five,"5");
+ _LIT8(VEVENT,"VEVENT");
+ _LIT8(VTODO,"VTODO");
+
+ // add one second if DTSTART and DTEND is the same
+ // ATTENTION: works only for very simple cases right now
+ // DTSTART:20090630T000000
+ // DTEND:20090630T000000
+ if (aDes.Find(VEVENT) != KErrNone)
+ {
+ TInt PosStart = aDes.Find(DTSTART);
+ TInt PosDue = aDes.Find(DTEND);
+
+ if ((PosStart != KErrNone) && (PosDue != KErrNone))
+ {
+ TPtrC8 PtrStart = aDes.Mid(PosStart + DTSTART().Length(),
+ DATELENGTH);
+ TPtrC8 PtrStop = aDes.Mid(PosDue + DTEND().Length(), DATELENGTH);
+
+ if (PtrStart == PtrStop)
+ {
+ aDes.Replace(PosDue + DTEND().Length() + DATELENGTH - 1, 1,
+ nine);
+ aDes.Replace(PosDue + DTEND().Length() + DATELENGTH - 2, 1,
+ five);
+ aDes.Replace(PosDue + DTEND().Length() + DATELENGTH - 3, 1,
+ nine);
+ }
+ }
+ }
+
+ // add one second if DTSTART and DUE is the same
+ // ATTENTION: works only for very simple cases right now
+ // DTSTART:20090630T000000
+ // DUE:20090630T000000
+
+ if (aDes.Find(VTODO) != KErrNone)
+ {
+ TInt PosStart = aDes.Find(DTSTART);
+ TInt PosDue = aDes.Find(DUE);
+
+ if ((PosStart != KErrNone) && (PosDue != KErrNone))
+ {
+ TPtrC8 PtrStart = aDes.Mid(PosStart + DTSTART().Length(),
+ DATELENGTH);
+ TPtrC8 PtrStop = aDes.Mid(PosDue + DUE().Length(), DATELENGTH);
+
+ if (PtrStart == PtrStop)
+ {
+ aDes.Replace(PosDue + DUE().Length() + DATELENGTH - 1, 1, nine);
+ aDes.Replace(PosDue + DUE().Length() + DATELENGTH - 2, 1, five);
+ aDes.Replace(PosDue + DUE().Length() + DATELENGTH - 3, 1, nine);
+ }
+ }
+ }
+ }
+
+/**
+ * CalDavUtils::FindAndRemoveMethod
+ * fix wrong method export
+ */
+void CalDavUtils::FindAndRemoveMethod(TDes8 &aDes)
+ {
+ _LIT8(method,"METHOD:PUBLISH\r\n");
+ TInt Ret = aDes.Find(method);
+ while (Ret != KErrNotFound)
+ {
+ aDes.Delete(Ret, method().Length());
+ Ret = aDes.Find(method);
+ }
+ }
+
+/**
+ * CalDavUtils::FixBYMONTHDAY
+ * fix wrong BYMONTHDAY export
+ */
+void CalDavUtils::FixBYMONTHDAY(TDes8 &aDes)
+ {
+ _LIT8(method0,"BYMONTHDAY=0");
+ _LIT8(method1,"BYMONTHDAY=1");
+ TInt ret = aDes.Find(method0);
+ while (ret != KErrNotFound)
+ {
+ aDes.Replace(ret, method1().Length(), method1);
+ ret = aDes.Find(method0);
+ }
+ }
+
+/**
+ * CalDavUtils::ScanAllowHeaderL
+ * fix scan allow header
+ */
+void CalDavUtils::ScanAllowHeaderL(RHTTPTransaction &aTransaction,
+ TCalDAVOptions &aOptions)
+ {
+ RStringF Header = aTransaction.Session().StringPool().OpenFStringL(ALLOW);
+ THTTPHdrVal HeaderVal;
+ if (aTransaction.Response().GetHeaderCollection().GetField(Header, 0,
+ HeaderVal) == KErrNone)
+ {
+ RStringF FieldValStr = aTransaction.Session().StringPool().StringF(
+ HeaderVal.StrF());
+ const TDesC8 &FieldValDesC = FieldValStr.DesC();
+ HBufC8 *FieldVal = FieldValDesC.AllocLC();
+ // delete all colons
+ TInt Pos = FieldVal->Find(colon);
+ while (Pos != KErrNotFound)
+ {
+ FieldVal->Des().Delete(Pos, 1);
+ Pos = FieldVal->Find(colon);
+ }
+ TLex8 Lex(FieldVal->Des());
+ TBool stop = EFalse;
+ while (!stop)
+ {
+ TPtrC8 Ptr = Lex.NextToken();
+ stop = Ptr.Length() == 0;
+ if (Ptr == DELETE)
+ aOptions.DELETE = ETrue;
+ else if (Ptr == GET)
+ aOptions.GET = ETrue;
+ else if (Ptr == HEAD)
+ aOptions.HEAD = ETrue;
+ else if (Ptr == MKCALENDAR)
+ aOptions.MKCALENDAR = ETrue;
+ else if (Ptr == MKCOL)
+ aOptions.MKCOL = ETrue;
+ else if (Ptr == OPTIONS)
+ aOptions.OPTIONS = ETrue;
+ else if (Ptr == PROPFIND)
+ aOptions.PROPFIND = ETrue;
+ else if (Ptr == PROPPATCH)
+ aOptions.PROPPATCH = ETrue;
+ else if (Ptr == PUT)
+ aOptions.PUT = ETrue;
+ else if (Ptr == REPORT)
+ aOptions.REPORT = ETrue;
+ else if (Ptr == COPY)
+ aOptions.COPY = ETrue;
+ else if (Ptr == POST)
+ aOptions.POST = ETrue;
+ else if (Ptr == MOVE)
+ aOptions.MOVE = ETrue;
+ else if (Ptr == ACL)
+ aOptions.ACL = ETrue;
+ else if (Ptr == LOCK)
+ aOptions.LOCK = ETrue;
+ else if (Ptr == UNLOCK)
+ aOptions.UNLOCK = ETrue;
+ }
+ CleanupStack::PopAndDestroy(FieldVal);
+ }
+ Header.Close();
+ }
+
+/**
+ * CalDavUtils::ScanDAVHeaderL
+ * scan DAV header
+ */
+void CalDavUtils::ScanDAVHeaderL(RHTTPTransaction &aTransaction,
+ TCalDAVOptions &aOptions)
+ {
+ RStringF Header = aTransaction.Session().StringPool().OpenFStringL(DAV);
+ THTTPHdrVal aHeaderVal;
+ if (aTransaction.Response().GetHeaderCollection().GetField(Header, 0,
+ aHeaderVal) == KErrNone)
+ {
+ RStringF FieldValStr = aTransaction.Session().StringPool().StringF(
+ aHeaderVal.StrF());
+ const TDesC8 &FieldValDesC = FieldValStr.DesC();
+ HBufC8 *FieldVal = FieldValDesC.AllocLC();
+ // delete all colons
+ TInt Pos = FieldVal->Find(colon);
+ while (Pos != KErrNotFound)
+ {
+ FieldVal->Des().Delete(Pos, 1);
+ Pos = FieldVal->Find(colon);
+ }
+ TLex8 Lex(FieldVal->Des());
+ TBool stop = EFalse;
+ while (!stop)
+ {
+ TPtrC8 Ptr = Lex.NextToken();
+ stop = Ptr.Length() == 0;
+ if (Ptr == ONE)
+ aOptions.ONE = ETrue;
+ else if (Ptr == TWO)
+ aOptions.TWO = ETrue;
+ else if (Ptr == THREE)
+ aOptions.THREE = ETrue;
+ else if (Ptr == access_control)
+ aOptions.access_control = ETrue;
+ else if (Ptr == calendar_access)
+ {
+ aOptions.calendar_access = ETrue;
+ // this is a CalDAV server for sure, MULTIGET and calendar-query is required
+ // we do not check for this anymore in CCaldavEngine::GetOptions()
+ aOptions.MULTIGET = ETrue;
+ aOptions.QUERY = ETrue;
+ }
+ else if (Ptr == calendar_schedule)
+ aOptions.calendar_schedule = ETrue;
+ else if (Ptr == calendar_auto_schedule)
+ aOptions.calendar_auto_schedule = ETrue;
+ else if (Ptr == sync_collection)
+ aOptions.sync_collection = ETrue;
+ else if (Ptr == extended_mkcol)
+ aOptions.extended_mkcol = ETrue;
+ }
+ CleanupStack::PopAndDestroy(FieldVal);
+ }
+ Header.Close();
+ }
+
+/**
+ * CalDavUtils::EnsureSlashL
+ * ensure trailing slash
+ */
+HBufC8* CalDavUtils::EnsureSlashL(HBufC8* aIn)
+ {
+ if ((aIn == NULL) || (aIn->Right(KSlash().Length()) == KSlash))
+ return aIn;
+ else
+ {
+ HBufC8 *out = HBufC8::NewL(aIn->Length() + KSlash().Length());
+ out->Des().Append(*aIn);
+ out->Des().Append(KSlash);
+ delete aIn;
+ aIn = NULL;
+ return out;
+ }
+ }
+
+/**
+ * CalDavUtils::EnsureSlashL
+ * ensure trailing slash
+ */
+HBufC8* CalDavUtils::EnsureSlashL(const TDesC8 &aIn)
+ {
+ HBufC8 *out = aIn.AllocL();
+ return CalDavUtils::EnsureSlashL(out);
+ }
--- a/calendarengines/caldav/src/httpclient.cpp Mon Mar 08 21:43:23 2010 +0000
+++ b/calendarengines/caldav/src/httpclient.cpp Sun Mar 14 13:09:26 2010 +0000
@@ -1,687 +1,687 @@
-/*
-* Copyright (c) 2010 Sun Microsystems, Inc. and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributor:
-* Maximilian Odendahl
-*
-* Contributors:
-*
-* Description: basic http/webdav functionality
-* handles all needed internet access for Caldav
-*/
-
-#include "httpclient.h"
-#include "caldavutils.h"
-#include <uri8.h>
-#include <http.h>
-#include <EIKENV.H>
-
-_LIT8(KTextXml,"text/xml");
-_LIT8(KTextCalendar,"text/calendar");
-_LIT8(KDepth,"depth");
-
-/**
- * CHttpClient::CHttpClient
- * default constructor
- */
-CHttpClient::CHttpClient() :
- iUser(0), iPassword(0), iEtag(0), iCredentialCount(0)
- {
- }
-
-/**
- * CHttpClient::~CHttpClient
- * default destructor
- */
-CHttpClient::~CHttpClient()
- {
- delete iUser;
- delete iPassword;
- delete iEtag;
-
- iSess.Close();
- iRConnection.Close();
- iSocketServ.Close();
-
- }
-
-/**
- * CHttpClient::NewLC
- * first phase constructor
- */
-CHttpClient* CHttpClient::NewLC()
- {
- CHttpClient* me = new (ELeave) CHttpClient;
- CleanupStack::PushL(me);
- me->ConstructL();
- return me;
- }
-
-/**
- * CHttpClient::NewL
- * first phase construction
- */
-CHttpClient* CHttpClient::NewL()
- {
- CHttpClient* me = NewLC();
- CleanupStack::Pop(me);
- return me;
- }
-
-/**
- * CHttpClient::OpenSessionL
- * open session and instal authentification
- */
-void CHttpClient::OpenSessionL()
- {
- TRAPD(err, iSess.OpenL());
-
- if (err != KErrNone)
- {
- _LIT(KErrMsg, "Cannot create session. Is internet access point configured?");
- _LIT(KExitingApp, "Exiting app.");
- CEikonEnv::Static()->InfoWinL(KErrMsg, KExitingApp);
- User::Leave(err);
- }
-
- // Install this class as the callback for authentication requests
- InstallAuthenticationL(iSess);
-
- // Set the session's connection info...
- RHTTPConnectionInfo connInfo = iSess.ConnectionInfo();
- // ...to use the socket server
- connInfo.SetPropertyL(iSess.StringPool().StringF(HTTP::EHttpSocketServ,
- RHTTPSession::GetTable()), THTTPHdrVal(iSocketServ.Handle()));
- // ...to use the connection
- connInfo.SetPropertyL(
- iSess.StringPool().StringF(HTTP::EHttpSocketConnection,
- RHTTPSession::GetTable()),
- THTTPHdrVal(REINTERPRET_CAST(TInt, &(iRConnection))));
-
- }
-
-/**
- * CHttpClient::ConstructL
- * second phase construction
- */
-void CHttpClient::ConstructL()
- {
- User::LeaveIfError(iSocketServ.Connect());
- User::LeaveIfError(iRConnection.Open(iSocketServ));
-
- iExtPrefs.SetSnapPurpose( CMManager::ESnapPurposeInternet );
- iExtPrefs.SetNoteBehaviour( TExtendedConnPref::ENoteBehaviourConnDisableNotes);
- iPrefList.AppendL(&iExtPrefs);
- iRConnection.Start(iPrefList);
-
- OpenSessionL();
- }
-
-/**
- * CHttpClient::DeleteL
- * HTTP DELETE
- */
-TInt CHttpClient::DeleteL(const TDesC8 &aUrl, const TDesC8 &aETag)
- {
- iReturnCode = ERROR;
-
- TUriParser8 uri;
- uri.Parse(aUrl);
-
- iTrans = iSess.OpenTransactionL(uri, *this, iSess.StringPool().StringF(
- HTTP::EDELETE, RHTTPSession::GetTable()));
- if (aETag != KNullDesC8)
- SetHeaderL(iTrans.Request().GetHeaderCollection(), HTTP::EIfMatch,
- aETag);
- SetHeaderL(iTrans.Request().GetHeaderCollection(), HTTP::EUserAgent,
- KUserAgent);
- iTrans.SubmitL();
-
- CActiveScheduler::Start();
- return iReturnCode;
- }
-
-/**
- * CHttpClient::HeadL
- * HTTP HEAD
- */
-TInt CHttpClient::HeadL(const TDesC8 &aUrl)
- {
- iReturnCode = ERROR;
-
- TUriParser8 uri;
- uri.Parse(aUrl);
-
- iTrans = iSess.OpenTransactionL(uri, *this, iSess.StringPool().StringF(
- HTTP::EHEAD, RHTTPSession::GetTable()));
- SetHeaderL(iTrans.Request().GetHeaderCollection(), HTTP::EUserAgent,
- KUserAgent);
- iTrans.SubmitL();
- CActiveScheduler::Start();
- return iReturnCode;
- }
-
-/**
- * CHttpClient::GetL
- * HTTP Get
- */
-TInt CHttpClient::GetL(const TDesC8 &aUrl, CBufFlat *aResponse)
- {
- iReturnCode = ERROR;
-
- iBodyResponse = aResponse;
-
- TUriParser8 uri;
- uri.Parse(aUrl);
-
- iTrans = iSess.OpenTransactionL(uri, *this, iSess.StringPool().StringF(
- HTTP::EGET, RHTTPSession::GetTable()));
- SetHeaderL(iTrans.Request().GetHeaderCollection(), HTTP::EUserAgent,
- KUserAgent);
- iTrans.SubmitL();
- CActiveScheduler::Start();
- iBodyResponse = NULL;
- return iReturnCode;
- }
-
-/**
- * CHttpClient::MkCalendarL
- * Caldav MKCALENDAR
- */
-TInt CHttpClient::MkCalendarL(const TDesC8 &aUrl, const TDesC8 &aBody,
- CBufFlat *aResponse)
- {
- iReturnCode = ERROR;
-
- if (aBody != KNullDesC8)
- {
- iBodyRequest = aBody.Alloc();
- iTrans.Request().SetBody(*this);
- }
-
- iBodyResponse = aResponse;
-
- TUriParser8 uri;
- uri.Parse(aUrl);
-
- RStringF mkcalendar = iSess.StringPool().OpenFStringL(MKCALENDAR);
- iTrans = iSess.OpenTransactionL(uri, *this, mkcalendar);
- RHTTPHeaders hdr = iTrans.Request().GetHeaderCollection();
-
- SetHeaderL(hdr, HTTP::EUserAgent, KUserAgent);
- SetHeaderL(hdr, HTTP::EContentType, KTextXml);
-
- iTrans.SubmitL();
- CActiveScheduler::Start();
-
- mkcalendar.Close();
- if (iBodyRequest)
- {
- delete iBodyRequest;
- iBodyRequest = NULL;
- }
- iBodyResponse = NULL;
-
- return iReturnCode;
- }
-
-/**
- * CHttpClient::PutL
- * HTTP PUT
- */
-TInt CHttpClient::PutL(const TDesC8 &aUrl, const TDesC8 &aIcs,
- CBufFlat *aResponse, const TDesC8 &aEtag)
- {
- iReturnCode = ERROR;
-
- iBodyRequest = aIcs.Alloc();
- iBodyResponse = aResponse;
-
- TUriParser8 uri;
- uri.Parse(aUrl);
-
- iTrans = iSess.OpenTransactionL(uri, *this, iSess.StringPool().StringF(
- HTTP::EPUT, RHTTPSession::GetTable()));
- RHTTPHeaders hdr = iTrans.Request().GetHeaderCollection();
-
- iTrans.Request().SetBody(*this);
-
- if (aEtag == KNullDesC8)
- {
- _LIT8(KStar, "*");
- SetHeaderL(hdr, HTTP::EIfNoneMatch, KStar);
- }
- else
- {
-#ifdef ETAG
- SetHeaderL(hdr,HTTP::EIfMatch,aEtag);
-#endif
- }
-
- SetHeaderL(hdr, HTTP::EUserAgent, KUserAgent);
- SetHeaderL(hdr, HTTP::EContentType, KTextCalendar);
-
- iTrans.SubmitL();
- CActiveScheduler::Start();
-
- delete iBodyRequest;
- iBodyRequest = NULL;
- iBodyResponse = NULL;
-
- return iReturnCode;
- }
-
-/**
- * CHttpClient::ReportL
- * Caldav REPORT
- */
-TInt CHttpClient::ReportL(const TDesC8 &aUrl, const TDesC8 &aBodyRequest,
- CBufFlat *aResponse)
- {
- iReturnCode = ERROR;
- iBodyResponse = aResponse;
-
- TUriParser8 uri;
- uri.Parse(aUrl);
-
- RStringF report = iSess.StringPool().OpenFStringL(REPORT);
- iTrans = iSess.OpenTransactionL(uri, *this, report);
- if (aBodyRequest.Length())
- {
- iBodyRequest = aBodyRequest.Alloc();
- iTrans.Request().SetBody(*this);
- }
-
- RHTTPHeaders hdr = iTrans.Request().GetHeaderCollection();
- SetHeaderL(hdr, HTTP::EContentType, KTextXml);
- SetHeaderL(hdr, KDepth, ONE);
- SetHeaderL(hdr, HTTP::EUserAgent, KUserAgent);
- iTrans.SubmitL();
- CActiveScheduler::Start();
-
- report.Close();
-
- delete iBodyRequest;
- iBodyRequest = NULL;
- iBodyResponse = NULL;
-
- return iReturnCode;
- }
-
-/**
- * CHttpClient::PropfindL
- * WebDAV PROPFIND
- */
-TInt CHttpClient::PropfindL(const TDesC8 &aUrl, const TDesC8 &aBodyRequest,
- CBufFlat *aResponse, TBool depth)
- {
- iReturnCode = ERROR;
- iBodyResponse = aResponse;
-
- TUriParser8 uri;
- uri.Parse(aUrl);
-
- RStringF propfind = iSess.StringPool().OpenFStringL(PROPFIND);
- iTrans = iSess.OpenTransactionL(uri, *this, propfind);
- if (aBodyRequest.Length())
- {
- iBodyRequest = aBodyRequest.Alloc();
- iTrans.Request().SetBody(*this);
- }
-
- RHTTPHeaders hdr = iTrans.Request().GetHeaderCollection();
- SetHeaderL(hdr, HTTP::EContentType, KTextXml);
- SetHeaderL(hdr, HTTP::EUserAgent, KUserAgent);
- if (depth)
- SetHeaderL(hdr, KDepth, ZERO);
- else
- SetHeaderL(hdr, KDepth, ONE);
-
- iTrans.SubmitL();
- CActiveScheduler::Start();
-
- propfind.Close();
-
- delete iBodyRequest;
- iBodyRequest = NULL;
- iBodyResponse = NULL;
-
- return iReturnCode;
- }
-
-/**
- * CHttpClient::ProppatchL
- * Webdav PROPPATCH
- */
-TInt CHttpClient::ProppatchL(const TDesC8 &aUrl, const TDesC8 &aBodyRequest, CBufFlat *aResponse)
- {
- iReturnCode = ERROR;
- iBodyResponse = aResponse;
-
- TUriParser8 uri;
- uri.Parse(aUrl);
-
- RStringF proppatch = iSess.StringPool().OpenFStringL(PROPPATCH);
- iTrans = iSess.OpenTransactionL(uri, *this, proppatch);
- RHTTPHeaders hdr = iTrans.Request().GetHeaderCollection();
- SetHeaderL(hdr, HTTP::EUserAgent, KUserAgent);
- SetHeaderL(hdr, HTTP::EContentType, KTextXml);
-
- iBodyRequest = aBodyRequest.Alloc();
- iTrans.Request().SetBody(*this);
-
- iTrans.SubmitL();
- CActiveScheduler::Start();
-
- proppatch.Close();
-
- delete iBodyRequest;
- iBodyRequest = NULL;
- iBodyResponse = NULL;
-
- return iReturnCode;
- }
-
-/**
- * CHttpClient::GetServerOptionsL
- * HTTP OPTIONS
- */
-TInt CHttpClient::GetServerOptionsL(const TDesC8 &aUrl,
- TCalDAVOptions &aOptions)
- {
- iReturnCode = ERROR;
- iAction = EActionOption;
- iOptions = &aOptions;
-
- TUriParser8 uri;
- uri.Parse(aUrl);
-
- RStringF options = iSess.StringPool().OpenFStringL(OPTIONS);
- iTrans = iSess.OpenTransactionL(uri, *this, options);
- SetHeaderL(iTrans.Request().GetHeaderCollection(), HTTP::EUserAgent,
- KUserAgent);
- iTrans.SubmitL();
-
- CActiveScheduler::Start();
-
- options.Close();
-
- iAction = EActionNone;
- return iReturnCode;
- }
-
-/**
- * CHttpClient::GetNextDataPart
- * GetNextDataPart callback
- */
-TBool CHttpClient::GetNextDataPart(TPtrC8& aDataPart)
- {
- aDataPart.Set(iBodyRequest->Des());
- return ETrue;
- }
-
-/**
- * CHttpClient::ReleaseData
- * ReleaseData callback
- */
-void CHttpClient::ReleaseData()
- {
- }
-
-/**
- * CHttpClient::OverallDataSize
- * OverallDataSize callback
- */
-TInt CHttpClient::OverallDataSize()
- {
- if (iBodyRequest)
- return iBodyRequest->Length();
- else
- return 0;
- }
-
-/**
- * CHttpClient::Reset
- * Reset callback
- */
-TInt CHttpClient::Reset()
- {
- return KErrNone;
- }
-
-/**
- * CHttpClient::SetHeaderL
- * sets int header at session headers
- */
-void CHttpClient::SetHeaderL(RHTTPHeaders aHeaders, TInt aHdrField,
- const TDesC8& aHdrValue)
- {
- RStringF valStr = iSess.StringPool().OpenFStringL(aHdrValue);
- CleanupClosePushL(valStr);
- THTTPHdrVal val(valStr);
- aHeaders.SetFieldL(iSess.StringPool().StringF(aHdrField,
- RHTTPSession::GetTable()), val);
- CleanupStack::PopAndDestroy(&valStr);
- }
-
-/**
- * CHttpClient::SetHeaderL
- * set string header at session headers
- */
-void CHttpClient::SetHeaderL(RHTTPHeaders aHeaders, const TDesC8 &aField,
- const TDesC8 &aValue)
- {
- RStringF FieldVal = iSess.StringPool().OpenFStringL(aField);
- CleanupClosePushL(FieldVal);
- RStringF valStr = iSess.StringPool().OpenFStringL(aValue);
- CleanupClosePushL(valStr);
- THTTPHdrVal val(valStr);
- aHeaders.SetFieldL(FieldVal, val);
- CleanupStack::PopAndDestroy(&valStr);
- CleanupStack::PopAndDestroy(&FieldVal);
- }
-
-/**
- * CHttpClient::GetCredentialsL
- * ask for username and password for authentification
- */
-TBool CHttpClient::GetCredentialsL(const TUriC8& /*aURI*/, RString aRealm,
- RStringF /*aAuthenticationType*/, RString& aUsername,
- RString& aPassword)
- {
- if (iCredentialCount)
- {
- iCredentialCount = 0;
- User::Leave(KErrAccessDenied);
- }
- iCredentialCount++;
- aUsername = aRealm.Pool().OpenStringL(*iUser);
- aPassword = aRealm.Pool().OpenStringL(*iPassword);
- return ETrue;
- }
-
-/**
- * CHttpClient::GetEtagHeaderL
- * check for ETag and save it
- */
-void CHttpClient::GetEtagHeaderL(RHTTPTransaction &aTransaction)
- {
- RStringF Header = aTransaction.Session().StringPool().StringF(HTTP::EETag,
- RHTTPSession::GetTable());
- THTTPHdrVal HeaderVal;
- if (aTransaction.Response().GetHeaderCollection().GetField(Header, 0,
- HeaderVal) == KErrNone)
- {
- RStringF FieldValStr = aTransaction.Session().StringPool().StringF(
- HeaderVal.StrF());
- const TDesC8 &FieldValDesC = FieldValStr.DesC();
- delete iEtag;
- iEtag = NULL;
- iEtag = FieldValDesC.AllocL();
- }
- }
-
-/**
- * CHttpClient::MHFRunL
- * http state machine callback
- */
-void CHttpClient::MHFRunL(RHTTPTransaction aTransaction,
- const THTTPEvent& aEvent)
- {
- switch (aEvent.iStatus)
- {
- case THTTPEvent::EGotResponseHeaders:
- {
- // HTTP response headers have been received. We can determine now if there is
- // going to be a response body to save.
- RHTTPResponse resp = aTransaction.Response();
- iReturnCode = resp.StatusCode();
-
- if (iAction == EActionOption)
- {
- CalDavUtils::ScanAllowHeaderL(aTransaction, *iOptions);
- CalDavUtils::ScanDAVHeaderL(aTransaction, *iOptions);
- }
-
- GetEtagHeaderL(aTransaction);
-
- TBool cancelling = ETrue;
- if (resp.HasBody() && (iReturnCode >= OK) && (iReturnCode
- < MUTIPLECHOICES))
- cancelling = EFalse;
-
- if (cancelling)
- {
- aTransaction.Close();
- CActiveScheduler::Stop();
- }
- }
- break;
- case THTTPEvent::EGotResponseBodyData:
- {
- // Get the body data supplier
- MHTTPDataSupplier* body = aTransaction.Response().Body();
- TPtrC8 dataChunk;
- TBool isLast = body->GetNextDataPart(dataChunk);
- if (iBodyResponse)
- iBodyResponse->InsertL(iBodyResponse->Size(), dataChunk);
- // Done with that bit of body data
- body->ReleaseData();
- }
- break;
- case THTTPEvent::EResponseComplete:
- {
- // The transaction's response is complete
- }
- break;
- case THTTPEvent::ESucceeded:
- {
- aTransaction.Close();
- CActiveScheduler::Stop();
- }
- break;
- case THTTPEvent::EFailed:
- {
- aTransaction.Close();
- CActiveScheduler::Stop();
- }
- break;
- case THTTPEvent::ERedirectedPermanently:
- {
- }
- break;
- case THTTPEvent::ERedirectedTemporarily:
- {
- }
- break;
- default:
- {
- // close off the transaction if it's an error
- if (aEvent.iStatus < 0)
- {
- iReturnCode = aEvent.iStatus;
- aTransaction.Close();
- CActiveScheduler::Stop();
- }
- }
- break;
- }
- }
-
-/**
- * CHttpClient::MHFRunError
- * http stack erros
- */
-TInt CHttpClient::MHFRunError(TInt aError, RHTTPTransaction /*aTransaction*/,
- const THTTPEvent& /*aEvent*/)
- {
- iReturnCode = aError;
- return KErrNone;
- }
-
-/**
- * CHttpClient::SetUserL
- * set username for authentification
- */
-void CHttpClient::SetUserL(const TDesC8 &aUser)
- {
- if (iUser)
- delete iUser;
- iUser = aUser.Alloc();
- iSess.Close();
- OpenSessionL();
- }
-
-/**
- * CHttpClient::SetPasswordL
- * Set Password for authentification
- */
-void CHttpClient::SetPasswordL(const TDesC8 &aPassword)
- {
- if (iPassword)
- delete iPassword;
- iPassword = aPassword.Alloc();
- iSess.Close();
- OpenSessionL();
- }
-
-/**
- * CHttpClient::User
- * get username
- */
-TPtrC8 CHttpClient::User()
- {
- return iUser ? *iUser : KNullDesC8();
- }
-
-/**
- * CHttpClient::Password
- * get password
- */
-TPtrC8 CHttpClient::Password()
- {
- return iPassword ? *iPassword : KNullDesC8();
- }
-
-/**
- * CHttpClient::ReturnCode
- * get returned HTTP code
- */
-TInt CHttpClient::ReturnCode()
- {
- return iReturnCode;
- }
-
-/**
- * CHttpClient::ETag
- * get ETag
- */
-TPtrC8 CHttpClient::ETag()
- {
- return iEtag ? *iEtag : KNullDesC8();
- }
+/*
+* Copyright (c) 2010 Sun Microsystems, Inc. and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributor:
+* Maximilian Odendahl
+*
+* Contributors:
+*
+* Description: basic http/webdav functionality
+* handles all needed internet access for Caldav
+*/
+
+#include "httpclient.h"
+#include "caldavutils.h"
+#include <uri8.h>
+#include <http.h>
+#include <EIKENV.H>
+
+_LIT8(KTextXml,"text/xml");
+_LIT8(KTextCalendar,"text/calendar");
+_LIT8(KDepth,"depth");
+
+/**
+ * CHttpClient::CHttpClient
+ * default constructor
+ */
+CHttpClient::CHttpClient() :
+ iUser(0), iPassword(0), iEtag(0), iCredentialCount(0)
+ {
+ }
+
+/**
+ * CHttpClient::~CHttpClient
+ * default destructor
+ */
+CHttpClient::~CHttpClient()
+ {
+ delete iUser;
+ delete iPassword;
+ delete iEtag;
+
+ iSess.Close();
+ iRConnection.Close();
+ iSocketServ.Close();
+
+ }
+
+/**
+ * CHttpClient::NewLC
+ * first phase constructor
+ */
+CHttpClient* CHttpClient::NewLC()
+ {
+ CHttpClient* me = new (ELeave) CHttpClient;
+ CleanupStack::PushL(me);
+ me->ConstructL();
+ return me;
+ }
+
+/**
+ * CHttpClient::NewL
+ * first phase construction
+ */
+CHttpClient* CHttpClient::NewL()
+ {
+ CHttpClient* me = NewLC();
+ CleanupStack::Pop(me);
+ return me;
+ }
+
+/**
+ * CHttpClient::OpenSessionL
+ * open session and instal authentification
+ */
+void CHttpClient::OpenSessionL()
+ {
+ TRAPD(err, iSess.OpenL());
+
+ if (err != KErrNone)
+ {
+ _LIT(KErrMsg, "Cannot create session. Is internet access point configured?");
+ _LIT(KExitingApp, "Exiting app.");
+ CEikonEnv::Static()->InfoWinL(KErrMsg, KExitingApp);
+ User::Leave(err);
+ }
+
+ // Install this class as the callback for authentication requests
+ InstallAuthenticationL(iSess);
+
+ // Set the session's connection info...
+ RHTTPConnectionInfo connInfo = iSess.ConnectionInfo();
+ // ...to use the socket server
+ connInfo.SetPropertyL(iSess.StringPool().StringF(HTTP::EHttpSocketServ,
+ RHTTPSession::GetTable()), THTTPHdrVal(iSocketServ.Handle()));
+ // ...to use the connection
+ connInfo.SetPropertyL(
+ iSess.StringPool().StringF(HTTP::EHttpSocketConnection,
+ RHTTPSession::GetTable()),
+ THTTPHdrVal(REINTERPRET_CAST(TInt, &(iRConnection))));
+
+ }
+
+/**
+ * CHttpClient::ConstructL
+ * second phase construction
+ */
+void CHttpClient::ConstructL()
+ {
+ User::LeaveIfError(iSocketServ.Connect());
+ User::LeaveIfError(iRConnection.Open(iSocketServ));
+
+ iExtPrefs.SetSnapPurpose( CMManager::ESnapPurposeInternet );
+ iExtPrefs.SetNoteBehaviour( TExtendedConnPref::ENoteBehaviourConnDisableNotes);
+ iPrefList.AppendL(&iExtPrefs);
+ iRConnection.Start(iPrefList);
+
+ OpenSessionL();
+ }
+
+/**
+ * CHttpClient::DeleteL
+ * HTTP DELETE
+ */
+TInt CHttpClient::DeleteL(const TDesC8 &aUrl, const TDesC8 &aETag)
+ {
+ iReturnCode = ERROR;
+
+ TUriParser8 uri;
+ uri.Parse(aUrl);
+
+ iTrans = iSess.OpenTransactionL(uri, *this, iSess.StringPool().StringF(
+ HTTP::EDELETE, RHTTPSession::GetTable()));
+ if (aETag != KNullDesC8)
+ SetHeaderL(iTrans.Request().GetHeaderCollection(), HTTP::EIfMatch,
+ aETag);
+ SetHeaderL(iTrans.Request().GetHeaderCollection(), HTTP::EUserAgent,
+ KUserAgent);
+ iTrans.SubmitL();
+
+ CActiveScheduler::Start();
+ return iReturnCode;
+ }
+
+/**
+ * CHttpClient::HeadL
+ * HTTP HEAD
+ */
+TInt CHttpClient::HeadL(const TDesC8 &aUrl)
+ {
+ iReturnCode = ERROR;
+
+ TUriParser8 uri;
+ uri.Parse(aUrl);
+
+ iTrans = iSess.OpenTransactionL(uri, *this, iSess.StringPool().StringF(
+ HTTP::EHEAD, RHTTPSession::GetTable()));
+ SetHeaderL(iTrans.Request().GetHeaderCollection(), HTTP::EUserAgent,
+ KUserAgent);
+ iTrans.SubmitL();
+ CActiveScheduler::Start();
+ return iReturnCode;
+ }
+
+/**
+ * CHttpClient::GetL
+ * HTTP Get
+ */
+TInt CHttpClient::GetL(const TDesC8 &aUrl, CBufFlat *aResponse)
+ {
+ iReturnCode = ERROR;
+
+ iBodyResponse = aResponse;
+
+ TUriParser8 uri;
+ uri.Parse(aUrl);
+
+ iTrans = iSess.OpenTransactionL(uri, *this, iSess.StringPool().StringF(
+ HTTP::EGET, RHTTPSession::GetTable()));
+ SetHeaderL(iTrans.Request().GetHeaderCollection(), HTTP::EUserAgent,
+ KUserAgent);
+ iTrans.SubmitL();
+ CActiveScheduler::Start();
+ iBodyResponse = NULL;
+ return iReturnCode;
+ }
+
+/**
+ * CHttpClient::MkCalendarL
+ * Caldav MKCALENDAR
+ */
+TInt CHttpClient::MkCalendarL(const TDesC8 &aUrl, const TDesC8 &aBody,
+ CBufFlat *aResponse)
+ {
+ iReturnCode = ERROR;
+
+ if (aBody != KNullDesC8)
+ {
+ iBodyRequest = aBody.Alloc();
+ iTrans.Request().SetBody(*this);
+ }
+
+ iBodyResponse = aResponse;
+
+ TUriParser8 uri;
+ uri.Parse(aUrl);
+
+ RStringF mkcalendar = iSess.StringPool().OpenFStringL(MKCALENDAR);
+ iTrans = iSess.OpenTransactionL(uri, *this, mkcalendar);
+ RHTTPHeaders hdr = iTrans.Request().GetHeaderCollection();
+
+ SetHeaderL(hdr, HTTP::EUserAgent, KUserAgent);
+ SetHeaderL(hdr, HTTP::EContentType, KTextXml);
+
+ iTrans.SubmitL();
+ CActiveScheduler::Start();
+
+ mkcalendar.Close();
+ if (iBodyRequest)
+ {
+ delete iBodyRequest;
+ iBodyRequest = NULL;
+ }
+ iBodyResponse = NULL;
+
+ return iReturnCode;
+ }
+
+/**
+ * CHttpClient::PutL
+ * HTTP PUT
+ */
+TInt CHttpClient::PutL(const TDesC8 &aUrl, const TDesC8 &aIcs,
+ CBufFlat *aResponse, const TDesC8 &aEtag)
+ {
+ iReturnCode = ERROR;
+
+ iBodyRequest = aIcs.Alloc();
+ iBodyResponse = aResponse;
+
+ TUriParser8 uri;
+ uri.Parse(aUrl);
+
+ iTrans = iSess.OpenTransactionL(uri, *this, iSess.StringPool().StringF(
+ HTTP::EPUT, RHTTPSession::GetTable()));
+ RHTTPHeaders hdr = iTrans.Request().GetHeaderCollection();
+
+ iTrans.Request().SetBody(*this);
+
+ if (aEtag == KNullDesC8)
+ {
+ _LIT8(KStar, "*");
+ SetHeaderL(hdr, HTTP::EIfNoneMatch, KStar);
+ }
+ else
+ {
+#ifdef ETAG
+ SetHeaderL(hdr,HTTP::EIfMatch,aEtag);
+#endif
+ }
+
+ SetHeaderL(hdr, HTTP::EUserAgent, KUserAgent);
+ SetHeaderL(hdr, HTTP::EContentType, KTextCalendar);
+
+ iTrans.SubmitL();
+ CActiveScheduler::Start();
+
+ delete iBodyRequest;
+ iBodyRequest = NULL;
+ iBodyResponse = NULL;
+
+ return iReturnCode;
+ }
+
+/**
+ * CHttpClient::ReportL
+ * Caldav REPORT
+ */
+TInt CHttpClient::ReportL(const TDesC8 &aUrl, const TDesC8 &aBodyRequest,
+ CBufFlat *aResponse)
+ {
+ iReturnCode = ERROR;
+ iBodyResponse = aResponse;
+
+ TUriParser8 uri;
+ uri.Parse(aUrl);
+
+ RStringF report = iSess.StringPool().OpenFStringL(REPORT);
+ iTrans = iSess.OpenTransactionL(uri, *this, report);
+ if (aBodyRequest.Length())
+ {
+ iBodyRequest = aBodyRequest.Alloc();
+ iTrans.Request().SetBody(*this);
+ }
+
+ RHTTPHeaders hdr = iTrans.Request().GetHeaderCollection();
+ SetHeaderL(hdr, HTTP::EContentType, KTextXml);
+ SetHeaderL(hdr, KDepth, ONE);
+ SetHeaderL(hdr, HTTP::EUserAgent, KUserAgent);
+ iTrans.SubmitL();
+ CActiveScheduler::Start();
+
+ report.Close();
+
+ delete iBodyRequest;
+ iBodyRequest = NULL;
+ iBodyResponse = NULL;
+
+ return iReturnCode;
+ }
+
+/**
+ * CHttpClient::PropfindL
+ * WebDAV PROPFIND
+ */
+TInt CHttpClient::PropfindL(const TDesC8 &aUrl, const TDesC8 &aBodyRequest,
+ CBufFlat *aResponse, TBool depth)
+ {
+ iReturnCode = ERROR;
+ iBodyResponse = aResponse;
+
+ TUriParser8 uri;
+ uri.Parse(aUrl);
+
+ RStringF propfind = iSess.StringPool().OpenFStringL(PROPFIND);
+ iTrans = iSess.OpenTransactionL(uri, *this, propfind);
+ if (aBodyRequest.Length())
+ {
+ iBodyRequest = aBodyRequest.Alloc();
+ iTrans.Request().SetBody(*this);
+ }
+
+ RHTTPHeaders hdr = iTrans.Request().GetHeaderCollection();
+ SetHeaderL(hdr, HTTP::EContentType, KTextXml);
+ SetHeaderL(hdr, HTTP::EUserAgent, KUserAgent);
+ if (depth)
+ SetHeaderL(hdr, KDepth, ZERO);
+ else
+ SetHeaderL(hdr, KDepth, ONE);
+
+ iTrans.SubmitL();
+ CActiveScheduler::Start();
+
+ propfind.Close();
+
+ delete iBodyRequest;
+ iBodyRequest = NULL;
+ iBodyResponse = NULL;
+
+ return iReturnCode;
+ }
+
+/**
+ * CHttpClient::ProppatchL
+ * Webdav PROPPATCH
+ */
+TInt CHttpClient::ProppatchL(const TDesC8 &aUrl, const TDesC8 &aBodyRequest, CBufFlat *aResponse)
+ {
+ iReturnCode = ERROR;
+ iBodyResponse = aResponse;
+
+ TUriParser8 uri;
+ uri.Parse(aUrl);
+
+ RStringF proppatch = iSess.StringPool().OpenFStringL(PROPPATCH);
+ iTrans = iSess.OpenTransactionL(uri, *this, proppatch);
+ RHTTPHeaders hdr = iTrans.Request().GetHeaderCollection();
+ SetHeaderL(hdr, HTTP::EUserAgent, KUserAgent);
+ SetHeaderL(hdr, HTTP::EContentType, KTextXml);
+
+ iBodyRequest = aBodyRequest.Alloc();
+ iTrans.Request().SetBody(*this);
+
+ iTrans.SubmitL();
+ CActiveScheduler::Start();
+
+ proppatch.Close();
+
+ delete iBodyRequest;
+ iBodyRequest = NULL;
+ iBodyResponse = NULL;
+
+ return iReturnCode;
+ }
+
+/**
+ * CHttpClient::GetServerOptionsL
+ * HTTP OPTIONS
+ */
+TInt CHttpClient::GetServerOptionsL(const TDesC8 &aUrl,
+ TCalDAVOptions &aOptions)
+ {
+ iReturnCode = ERROR;
+ iAction = EActionOption;
+ iOptions = &aOptions;
+
+ TUriParser8 uri;
+ uri.Parse(aUrl);
+
+ RStringF options = iSess.StringPool().OpenFStringL(OPTIONS);
+ iTrans = iSess.OpenTransactionL(uri, *this, options);
+ SetHeaderL(iTrans.Request().GetHeaderCollection(), HTTP::EUserAgent,
+ KUserAgent);
+ iTrans.SubmitL();
+
+ CActiveScheduler::Start();
+
+ options.Close();
+
+ iAction = EActionNone;
+ return iReturnCode;
+ }
+
+/**
+ * CHttpClient::GetNextDataPart
+ * GetNextDataPart callback
+ */
+TBool CHttpClient::GetNextDataPart(TPtrC8& aDataPart)
+ {
+ aDataPart.Set(iBodyRequest->Des());
+ return ETrue;
+ }
+
+/**
+ * CHttpClient::ReleaseData
+ * ReleaseData callback
+ */
+void CHttpClient::ReleaseData()
+ {
+ }
+
+/**
+ * CHttpClient::OverallDataSize
+ * OverallDataSize callback
+ */
+TInt CHttpClient::OverallDataSize()
+ {
+ if (iBodyRequest)
+ return iBodyRequest->Length();
+ else
+ return 0;
+ }
+
+/**
+ * CHttpClient::Reset
+ * Reset callback
+ */
+TInt CHttpClient::Reset()
+ {
+ return KErrNone;
+ }
+
+/**
+ * CHttpClient::SetHeaderL
+ * sets int header at session headers
+ */
+void CHttpClient::SetHeaderL(RHTTPHeaders aHeaders, TInt aHdrField,
+ const TDesC8& aHdrValue)
+ {
+ RStringF valStr = iSess.StringPool().OpenFStringL(aHdrValue);
+ CleanupClosePushL(valStr);
+ THTTPHdrVal val(valStr);
+ aHeaders.SetFieldL(iSess.StringPool().StringF(aHdrField,
+ RHTTPSession::GetTable()), val);
+ CleanupStack::PopAndDestroy(&valStr);
+ }
+
+/**
+ * CHttpClient::SetHeaderL
+ * set string header at session headers
+ */
+void CHttpClient::SetHeaderL(RHTTPHeaders aHeaders, const TDesC8 &aField,
+ const TDesC8 &aValue)
+ {
+ RStringF FieldVal = iSess.StringPool().OpenFStringL(aField);
+ CleanupClosePushL(FieldVal);
+ RStringF valStr = iSess.StringPool().OpenFStringL(aValue);
+ CleanupClosePushL(valStr);
+ THTTPHdrVal val(valStr);
+ aHeaders.SetFieldL(FieldVal, val);
+ CleanupStack::PopAndDestroy(&valStr);
+ CleanupStack::PopAndDestroy(&FieldVal);
+ }
+
+/**
+ * CHttpClient::GetCredentialsL
+ * ask for username and password for authentification
+ */
+TBool CHttpClient::GetCredentialsL(const TUriC8& /*aURI*/, RString aRealm,
+ RStringF /*aAuthenticationType*/, RString& aUsername,
+ RString& aPassword)
+ {
+ if (iCredentialCount)
+ {
+ iCredentialCount = 0;
+ User::Leave(KErrAccessDenied);
+ }
+ iCredentialCount++;
+ aUsername = aRealm.Pool().OpenStringL(*iUser);
+ aPassword = aRealm.Pool().OpenStringL(*iPassword);
+ return ETrue;
+ }
+
+/**
+ * CHttpClient::GetEtagHeaderL
+ * check for ETag and save it
+ */
+void CHttpClient::GetEtagHeaderL(RHTTPTransaction &aTransaction)
+ {
+ RStringF Header = aTransaction.Session().StringPool().StringF(HTTP::EETag,
+ RHTTPSession::GetTable());
+ THTTPHdrVal HeaderVal;
+ if (aTransaction.Response().GetHeaderCollection().GetField(Header, 0,
+ HeaderVal) == KErrNone)
+ {
+ RStringF FieldValStr = aTransaction.Session().StringPool().StringF(
+ HeaderVal.StrF());
+ const TDesC8 &FieldValDesC = FieldValStr.DesC();
+ delete iEtag;
+ iEtag = NULL;
+ iEtag = FieldValDesC.AllocL();
+ }
+ }
+
+/**
+ * CHttpClient::MHFRunL
+ * http state machine callback
+ */
+void CHttpClient::MHFRunL(RHTTPTransaction aTransaction,
+ const THTTPEvent& aEvent)
+ {
+ switch (aEvent.iStatus)
+ {
+ case THTTPEvent::EGotResponseHeaders:
+ {
+ // HTTP response headers have been received. We can determine now if there is
+ // going to be a response body to save.
+ RHTTPResponse resp = aTransaction.Response();
+ iReturnCode = resp.StatusCode();
+
+ if (iAction == EActionOption)
+ {
+ CalDavUtils::ScanAllowHeaderL(aTransaction, *iOptions);
+ CalDavUtils::ScanDAVHeaderL(aTransaction, *iOptions);
+ }
+
+ GetEtagHeaderL(aTransaction);
+
+ TBool cancelling = ETrue;
+ if (resp.HasBody() && (iReturnCode >= OK) && (iReturnCode
+ < MUTIPLECHOICES))
+ cancelling = EFalse;
+
+ if (cancelling)
+ {
+ aTransaction.Close();
+ CActiveScheduler::Stop();
+ }
+ }
+ break;
+ case THTTPEvent::EGotResponseBodyData:
+ {
+ // Get the body data supplier
+ MHTTPDataSupplier* body = aTransaction.Response().Body();
+ TPtrC8 dataChunk;
+ TBool isLast = body->GetNextDataPart(dataChunk);
+ if (iBodyResponse)
+ iBodyResponse->InsertL(iBodyResponse->Size(), dataChunk);
+ // Done with that bit of body data
+ body->ReleaseData();
+ }
+ break;
+ case THTTPEvent::EResponseComplete:
+ {
+ // The transaction's response is complete
+ }
+ break;
+ case THTTPEvent::ESucceeded:
+ {
+ aTransaction.Close();
+ CActiveScheduler::Stop();
+ }
+ break;
+ case THTTPEvent::EFailed:
+ {
+ aTransaction.Close();
+ CActiveScheduler::Stop();
+ }
+ break;
+ case THTTPEvent::ERedirectedPermanently:
+ {
+ }
+ break;
+ case THTTPEvent::ERedirectedTemporarily:
+ {
+ }
+ break;
+ default:
+ {
+ // close off the transaction if it's an error
+ if (aEvent.iStatus < 0)
+ {
+ iReturnCode = aEvent.iStatus;
+ aTransaction.Close();
+ CActiveScheduler::Stop();
+ }
+ }
+ break;
+ }
+ }
+
+/**
+ * CHttpClient::MHFRunError
+ * http stack erros
+ */
+TInt CHttpClient::MHFRunError(TInt aError, RHTTPTransaction /*aTransaction*/,
+ const THTTPEvent& /*aEvent*/)
+ {
+ iReturnCode = aError;
+ return KErrNone;
+ }
+
+/**
+ * CHttpClient::SetUserL
+ * set username for authentification
+ */
+void CHttpClient::SetUserL(const TDesC8 &aUser)
+ {
+ if (iUser)
+ delete iUser;
+ iUser = aUser.Alloc();
+ iSess.Close();
+ OpenSessionL();
+ }
+
+/**
+ * CHttpClient::SetPasswordL
+ * Set Password for authentification
+ */
+void CHttpClient::SetPasswordL(const TDesC8 &aPassword)
+ {
+ if (iPassword)
+ delete iPassword;
+ iPassword = aPassword.Alloc();
+ iSess.Close();
+ OpenSessionL();
+ }
+
+/**
+ * CHttpClient::User
+ * get username
+ */
+TPtrC8 CHttpClient::User()
+ {
+ return iUser ? *iUser : KNullDesC8();
+ }
+
+/**
+ * CHttpClient::Password
+ * get password
+ */
+TPtrC8 CHttpClient::Password()
+ {
+ return iPassword ? *iPassword : KNullDesC8();
+ }
+
+/**
+ * CHttpClient::ReturnCode
+ * get returned HTTP code
+ */
+TInt CHttpClient::ReturnCode()
+ {
+ return iReturnCode;
+ }
+
+/**
+ * CHttpClient::ETag
+ * get ETag
+ */
+TPtrC8 CHttpClient::ETag()
+ {
+ return iEtag ? *iEtag : KNullDesC8();
+ }
--- a/calendarengines/caldav/tsrc/CalDavTest.cpp Mon Mar 08 21:43:23 2010 +0000
+++ b/calendarengines/caldav/tsrc/CalDavTest.cpp Sun Mar 14 13:09:26 2010 +0000
@@ -1,936 +1,936 @@
-/*
-* Copyright (c) 2010 Sun Microsystems, Inc. and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributor:
-* Maximilian Odendahl
-*
-* Contributors:
-*
-* Description: Caldav Test Suite
-*
-*/
-
-#include "CalDavTest.h"
-#include <e32base.h>
-#include <e32std.h>
-#include <e32base.h>
-#include <calentry.h>
-#include <calentryview.h>
-#include <caleninterimutils2.h>
-#include <calcalendarinfo.h>
-#include <calsession.h>
-#include "caldavengine.h"
-#include "httpclient.h"
-#include <caldavsession.h>
-_LIT(KTextConsoleTitle, "Console");
-_LIT(KTextFailed, " failed, leave code = %d");
-_LIT(KTextPressAnyKey, " [press any key]\n");
-// Global Variables
-LOCAL_D CConsoleBase* console; // write all messages to this
-
-_LIT8(urlAries,"http://aries.demo.sun.com:3080/davserver/dav/home/modendahl@demo.sun.com/calendar/");
-_LIT8(urlAriesPrincipal,"http://aries.demo.sun.com:3080/davserver/dav/principals/modendahl/");
-_LIT8(urlAriesHome,"http://aries.demo.sun.com:3080/davserver/dav/home/modendahl@demo.sun.com/");
-_LIT8(urlWN,"http://whatsnew.demo.iplanet.com:3080/dav/home/modendahl/calendar/");
-_LIT8(userSUN,"modendahl");
-_LIT8(passwordSUN,"secret");
-_LIT8(urlGoogle,"https://www.google.com/calendar/dav/maximilian.odendahl@sun.com/events/");
-_LIT8(urlGooglePrincipal,"https://www.google.com/calendar/dav/maximilian.odendahl@sun.com/user/");
-_LIT8(userGoogle,"maximilian.odendahl@sun.com");
-_LIT8(passwordGoogle,"iplanetiplanet");
-_LIT8(urlChandler,"https://hub.chandlerproject.org/dav/mod/f16c9eb0-6373-11de-979e-cdd32d46e10a11111/");
-_LIT8(urlChandlerPrincipal,"https://hub.chandlerproject.org/dav/users/mod/");
-_LIT8(userChandler,"mod");
-_LIT8(passwordChandler,"modmod");
-_LIT8(urlBedework,"http://bedework.org:8585/ucaldav/user/testuser29/calendar/");
-_LIT8(urlBedeWorkPrincipal,"http://bedework.org:8585/ucaldav/principals/users/testuser29");
-_LIT8(userBedework,"testuser29");
-_LIT8(passwordbedework,"bedework");
-_LIT8(urlYahoo,"https://caldav.calendar.yahoo.com/dav/lkz633/Calendar/lkz633/");
-_LIT8(urlYahooPrincipal,"https://caldav.calendar.yahoo.com/principals/users/lkz633/");
-_LIT8(userYahoo,"lkz633");
-_LIT8(passwordYahoo,"iplanetiplanet");
-_LIT8(urlOracle,"http://kingsknight.sfbay.sun.com:7777/caldav/Sun/home/7B7B.65E6.user.6FCA54EE73AD4821811999F4D7679F6E000000000070%40email.invalid/calendars/MyCalendar");
-_LIT8(urlOraclePrincipal,"http://kingsknight.sfbay.sun.com:7777/caldav/Sun/principals/individuals/7B7B.65E6.user.6FCA54EE73AD4821811999F4D7679F6E000000000070%40email.invalid");
-_LIT8(userOracle,"symbian");
-_LIT8(passwordOracle,"Secret12");
-_LIT8(urlSogo,"http://sogo-demo.inverse.ca/SOGo/dav/sogo3/Calendar/personal/");
-_LIT8(userSogo,"sogo3");
-_LIT8(passwordSogo,"sogo3");
-_LIT8(urlDAV,"http://dhcp-usca15-127-168.red.iplanet.com/dav/calendar/");
-_LIT8(userDAV,"max");
-_LIT8(passwordDAV,"max");
-_LIT8(urlApple,"http://zeta.macosforge.org:8008/calendars/__uids__/1E872019-0078-412D-8EE0-85A5680365C2/calendar/");
-_LIT8(principalAplle,"http://zeta.macosforge.org:8008/calendars/__uids__/1E872019-0078-412D-8EE0-85A5680365C2/calendar/");
-_LIT8(userApple,"trial1");
-_LIT8(passwordApple,"lompywickets");
-_LIT8(urlKerio,"http://iop.test.kerio.com/calendars/iop.test.kerio.com/user1/Calendar");
-_LIT8(principalKerio,"http://iop.test.kerio.com/caldav/iop.test.kerio.com/user1/");
-_LIT8(userKerio,"user1");
-_LIT8(passwordkerio,"x");
-_LIT8(urlDaviCal,"http://dev.davical.org:8008/caldav.php/user1/home/");
-_LIT8(principalDaviCal,"http://dev.davical.org:8008/caldav.php/user1/");
-_LIT8(userDaviCal,"user1");
-_LIT8(passwordDaviCal,"user1");
-_LIT8(urlblabla,"http://www.blablabalbalabal.com/calendar/");
-_LIT8(passwordblabla,"bla");
-_LIT8(userblabla,"blabla");
-_LIT(calendar, "c:calendar12345");
-_LIT8(KFixedUIDics,"123456.ics");
-
-#define TWOSECONDS TTimeIntervalMicroSeconds32(2000000)
-
-void CreateCalFileL()
- {
- CCalSession* session = CCalSession::NewL();
- CleanupStack::PushL(session);
- TRAPD(err, session->CreateCalFileL(calendar));
- if (err == KErrAlreadyExists)
- {
- session->DeleteCalFileL(calendar);
- session->CreateCalFileL(calendar);
- }
- CleanupStack::PopAndDestroy(session);
- }
-
-void DeleteCalFileL()
- {
- CCalSession* session = CCalSession::NewL();
- CleanupStack::PushL(session);
- session->DeleteCalFileL(calendar);
- CleanupStack::PopAndDestroy(session);
- }
-
-TBool GetBoolFromProperties2(CCalCalendarInfo* info, const TDesC8 &aKey)
- {
- TBool boolean;
- TPckgC<TBool> pckgboolean(boolean);
- pckgboolean.Set(info->PropertyValueL(aKey));
- return pckgboolean();
- }
-
-TCalTime GetTimeFromProperties2(CCalCalendarInfo* info, const TDesC8 &aKey)
- {
- TCalTime time;
- TPckgC<TCalTime> pckgtime(time);
- pckgtime.Set(info->PropertyValueL(aKey));
- return pckgtime();
- }
-
-void NewApptL(HBufC8* aUid, TBool aEvent, CCalEntryView* iCalEntryView)
- {
- CCalEntry* appt = CCalEntry::NewL(aEvent ? CCalEntry::EEvent
- : CCalEntry::ETodo, aUid, CCalEntry::EMethodNone, 0);
- CleanupStack::PushL(appt);
-
- //Some data
- TBuf16<100> summary;
- summary.Copy(*aUid);
- appt->SetSummaryL(summary);
- appt->SetLocationL(_L("Location2"));
- appt->SetDescriptionL(_L("Description3"));
-
- //Start / end date
- TTime start;
- start.UniversalTime();
- TTime end;
- end.UniversalTime();
- TCalTime startCalTime;
- startCalTime.SetTimeUtcL(start);
- TCalTime endCalTime;
- endCalTime.SetTimeUtcL(end);
-
- //Set it
- appt->SetStartAndEndTimeL(startCalTime, endCalTime);
-
- //Store this new Entry
-
- RPointerArray<CCalEntry> entryArray;
- CleanupClosePushL(entryArray);
- entryArray.AppendL(appt);
- TInt success(0);
- iCalEntryView->StoreL(entryArray, success);
- entryArray.Reset();
- CleanupStack::PopAndDestroy(&entryArray);
- CleanupStack::PopAndDestroy(appt);
- }
-
-CalDavTest::CalDavTest(CConsoleBase* console)
- {
- iConsole = console;
- TInt connect = iFileLogger.Connect();
- TTime home;
- home.UniversalTime();
- _LIT(KDateFormat,"%H%T%S");
- TBuf<20> StringTime;
- home.FormatL(StringTime, KDateFormat);
- StringTime.Append(_L(".txt"));
- iFileLogger.CreateLog(_L("CalDav"),StringTime, EFileLoggingModeOverwrite);
- }
-
-CalDavTest::~CalDavTest()
- {
- iFileLogger.CloseLog();
- iFileLogger.Close();
- }
-
-void CalDavTest::Write(TBool aSuccess, const char* aMessage)
- {
- TBuf<500> buffer;
- TPtrC8 ptr(reinterpret_cast<const TUint8*> (aMessage));
- buffer.Copy(ptr);
-
- Write(aSuccess, buffer);
- }
-
-void CalDavTest::Write(TBool aSuccess, const TDesC &aMessage)
- {
- // convert char* into tbug
- TBuf<500> buffer;
- buffer.Append(aMessage);
-
- if (aSuccess)
- buffer.Append(_L("....PASSED\n"));
- else
- buffer.Append(_L("....FAILED\n"));
-
- // write to console and file
- Write(buffer);
- }
-
-void CalDavTest::TestClientServerL(TInt aSucces, const TDesC8 &aUrl,
- const TDesC8 &aUser, const TDesC8 &aPassword)
- {
- TBuf16<500> url;
- url.Copy(aUrl);
- Write(_L("\n\nStarting CalDav client-server test..."));
- Write(url);
-
- CreateCalFileL();
-
- CCalDavSession *server = CCalDavSession::NewLC();
- iSession = server;
-
- if (ConfigureSessionL(aSucces, aUrl, aUser, aPassword) == KErrNone)
- {
- OptionSession();
- }
-
- CleanupStack::PopAndDestroy(server);
- iSession = NULL;
- DeleteCalFileL();
-
- Write(_L("\nFinished CalDav client-server test..."));
- Write(_L("\n\n"));
- }
-
-void CalDavTest::TestGeneralEngineL()
- {
- CreateCalFileL();
- CCalDavEngine* store = CCalDavEngine::NewLC(calendar);
- iEngine = store;
-
- CalendarInfoL();
- GetUIDByUrl();
- GetBaseUrl();
-
- CleanupStack::PopAndDestroy(store);
- iEngine = NULL;
- DeleteCalFileL();
- }
-
-void CalDavTest::TestEngineL(TInt aSucces, const TDesC8 &aUrl,
- const TDesC8 &aUser, const TDesC8 &aPassword, TBool aWebdavsync,
- TBool aCtag, TBool aEvent, TBool aTodo, TBool aFreeBusy, TBool aJournal)
- {
- Write(_L("\n\nStarting CalDav Engine test..."));
- TBuf16<500> url;
- url.Copy(aUrl);
- Write(url);
- Write(_L("\n"));
-
- CreateCalFileL();
-
- CCalDavEngine* store = CCalDavEngine::NewLC(calendar);
-
- iEngine = store;
- iWebdavSync = aWebdavsync;
- iCtag = aCtag;
-
- iVEVENT = aEvent;
- iVTODO = aTodo;
- iVFREEBUSY = aFreeBusy;
- iVJOURNAL = aJournal;
-
- Write(_L("\n\nStarting init and option tests...\n"));
-
- Enabled(EFalse);
- if (EnableL(aSucces, aUrl, aUser, aPassword) == KErrNone)
- {
- Enabled(ETrue);
- OptionsL();
- CTagL(ETrue);
- SynctokenL(ETrue);
-
- /******* Test events ******/
- Write(_L("\nStarting VEvent engine tests...\n\n"));
-
- HBufC8* newuid = iEngine->iCalIntermimUtils2->GlobalUidL();
- // need to save it, as it will be destroyed by CCalEntry::NewL
- TBuf8<100> uid;
- uid.Append(*newuid);
- // does entry exists locally
- DoesExistL(EFalse, uid);
- // add new local event with UID
- NewApptL(newuid, ETrue, iEngine->iCalEntryView);
- // does entry exists locally
- DoesExistL(ETrue, uid);
-
- // send to server using handle
- unsigned long local = iEngine->DoesEntryExistL(uid);
- // send existing event to server
- SendL(local);
- // available on server
- if (iEngine->iOptions.VEVENT)
- {
- HeadL(ETrue, uid);
- //download from server
- DownloadLGetL(local);
- DownloadLMultiGetL(local);
- // delete on server
- DeleteServerL(local);
- // available on server
- HeadL(EFalse, uid);
- }
- else
- HeadL(EFalse, uid);
-
- // delete locally
- DeleteClientL(uid);
- // should be gone now
- DoesExistL(EFalse, uid);
- /**************************/
-
- CTagL(!iEngine->iOptions.VEVENT);
- SynctokenL(!iEngine->iOptions.VEVENT);
-
- User::After(TWOSECONDS);
- SyncL();
-
- CTagL(ETrue);
- SynctokenL(ETrue);
-
- // test synchronization method, put/delete on server using http calls
- if (iEngine->iOptions.VEVENT)
- {
- Write(_L("\nStarting VEvent http and sync tests...\n\n"));
- // create directly on server using only http calls
- SendL(ETrue);
- // we should not have this yet
- DoesExistL(EFalse, KFixedUIDics);
- User::After(TWOSECONDS);
- SyncL();
- // now we should
- DoesExistL(ETrue, KFixedUIDics);
- // delete directly on server
- DeleteServerL();
- // we should still have it
- DoesExistL(ETrue, KFixedUIDics);
- User::After(TWOSECONDS);
- SyncL();
- // now it should be gone locally
- DoesExistL(EFalse, KFixedUIDics);
- }
-
- /******* Test VTodo ******/
-
- Write(_L("\n\nStarting VTodo tests...\n\n"));
-
- HBufC8* newuid2 = iEngine->iCalIntermimUtils2->GlobalUidL();
- // need to save it, as it will be destroyed by CCalEntry::NewL
- TBuf8<100> uid2;
- uid2.Append(*newuid2);
- // does entry exists locally
- DoesExistL(EFalse, uid2);
- // add new local event with UID
- NewApptL(newuid2, EFalse, iEngine->iCalEntryView);
- // does entry exists locally
- DoesExistL(ETrue, uid2);
-
- // send to server using handle
- unsigned long local2 = iEngine->DoesEntryExistL(uid2);
- // send existing event to server
- SendL(local2);
-
- if (iEngine->iOptions.VTODO)
- {
- // available on server
- HeadL(ETrue, uid2);
- //download from server
- DownloadLGetL(local2);
- DownloadLMultiGetL(local2);
- // delete on server
- DeleteServerL(local2);
- // available on server
- HeadL(EFalse, uid2);
- }
- else
- HeadL(EFalse, uid2);
- // delete locally
- DeleteClientL(uid2);
- // should be gone now
- DoesExistL(EFalse, uid2);
- /**************************/
-
- CTagL(!iEngine->iOptions.VTODO);
- SynctokenL(!iEngine->iOptions.VTODO);
-
- // test synchronization method, put/delete on server using http calls
- if (iEngine->iOptions.VTODO)
- {
- Write(_L("\nStarting VTodo http and sync tests...\n\n"));
- // create directly on server using only http calls
- SendL(EFalse);
- // we should not have this yet
- DoesExistL(EFalse, KFixedUIDics);
- User::After(TWOSECONDS);
- SyncL();
- // now we should
- DoesExistL(ETrue, KFixedUIDics);
- // delete directly on server
- DeleteServerL();
- // we should still have it
- DoesExistL(ETrue, KFixedUIDics);
- User::After(TWOSECONDS);
- SyncL();
- // now it should be gone locally as well
- DoesExistL(EFalse, KFixedUIDics);
- }
-
- /**** Test Calendar ******/
- /*
- // creating calendars under home calendar should not be allowed
- if (iEngine->iOptions.MKCALENDAR)
- {
- Write(_L("\n\nStarting Calendar tests...\n\n"));
- _LIT8(howareyou, "howareyoudoingtoday");
- MkCalendarL(KErrNone, howareyou);
- MkCalendarL(KErrArgument, howareyou);
- DeleteCalendarL(howareyou);
- }
- */
- /**************************/
- iEngine->DisableL();
- }
-
- CleanupStack::PopAndDestroy(store);
- iEngine = NULL;
- DeleteCalFileL();
-
- Write(_L("\n\nFinished CalDav Engine test..."));
- Write(_L("\n\n"));
- }
-
-void CalDavTest::Write(const TDesC &aMessage)
- {
- iConsole->Write(aMessage);
- iFileLogger.Write(aMessage);
- }
-
-void CalDavTest::Enabled(TBool aEnabled)
- {
- Write(iEngine->EnabledSync() == aEnabled, __FUNCTION__);
- }
-
-void CalDavTest::DoesExistL(TBool aExists, const unsigned long localuid)
- {
- CCalEntry* entry = iEngine->iCalEntryView->FetchL(localuid);
- CleanupStack::PushL(entry);
- unsigned long uid = iEngine->DoesEntryExistL(entry->UidL());
- Write(aExists ? uid > 0 : uid == 0, __FUNCTION__);
-
- CleanupStack::PopAndDestroy(entry);
- }
-
-void CalDavTest::DoesExistL(TBool aExists, const TDesC8 &aUID)
- {
- unsigned long uid = iEngine->DoesEntryExistL(aUID);
- Write(aExists ? uid > 0 : uid == 0, __FUNCTION__);
- }
-
-void CalDavTest::HeadL(TBool aExists, const TDesC8 &aUid)
- {
- TBool del = iEngine->HeadL(aUid) == OK;
- Write(aExists == del, __FUNCTION__);
- }
-
-void CalDavTest::MkCalendarL(TInt aSuccess, const TDesC8 &aName)
- {
- TInt ret = iEngine->MkcalendarL(aName);
- Write(ret == aSuccess, __FUNCTION__);
- }
-
-void CalDavTest::DeleteCalendarL(const TDesC8 &aName)
- {
- Write(iEngine->DeleteCalendarL(aName) == KErrNone, __FUNCTION__);
- }
-
-void CalDavTest::OptionsL()
- {
- TBuf<500> message;
- message.Append(_L("Options Displayname "));
- CCalCalendarInfo* info = iEngine->iCalSession->CalendarInfoL();
- TBuf<500> display;
- display.Copy(info->NameL());
- message.Append(display);
- delete info;
- Write(display != KNullDesC, message);
- Write(iEngine->iOptions.sync_collection == iWebdavSync, _L("Options Webdav Sync"));
- Write(iEngine->iOptions.sync_ctag == iCtag, _L("Options Ctag"));
- Write(iEngine->iOptions.VEVENT == iVEVENT, _L("Options VEVENT"));
- Write(iEngine->iOptions.VTODO == iVTODO, _L("Options VTODO"));
- Write(iEngine->iOptions.VFREEBUSY == iVFREEBUSY, _L("FREEBUSY"));
- Write(iEngine->iOptions.VJOURNAL == iVJOURNAL, _L("VJOURNAL"));
- }
-
-void CalDavTest::CalendarInfoL()
- {
- _LIT8(user,"user");
- _LIT8(password,"pass");
- _LIT8(url,"http://neindanke/");
- iEngine->SetUserL(user);
- iEngine->SetUrlL(url);
- iEngine->SetPasswordL(password);
- iEngine->SetSyncIntervalL(TTimeIntervalMinutes(5));
- iEngine->SetPastDaysL(TTimeIntervalDays(10));
- iEngine->SetKeepServerEntryL(EFalse);
- iEngine->SetImmediateSyncL(ETrue);
- iEngine->EnableL();
-
- iEngine->iCalSession = CCalSession::NewL();
- iEngine->iCalSession->OpenL(calendar);
-
- CCalCalendarInfo* calendarInfo = iEngine->iCalSession->CalendarInfoL();
- CleanupStack::PushL(calendarInfo);
-
- Write(!GetBoolFromProperties2(calendarInfo, KCaldavEnabled), _L("CalendarInfo: enabled"));
- Write(!GetBoolFromProperties2(calendarInfo, KCaldavKeepServer), _L("CalendarInfo: Keepserver"));
- Write(GetBoolFromProperties2(calendarInfo, KCaldavImmediateSync), _L("CalendarInfo: ImmediateSync"));
- Write(calendarInfo->PropertyValueL(KCaldavUrl) == url, _L("CalendarInfo: url"));
- Write(calendarInfo->PropertyValueL(KCaldavUser) == user, _L("CalendarInfo: user"));
- Write(calendarInfo->PropertyValueL(KCaldavPassword) == password, _L("CalendarInfo: password"));
-
- TTimeIntervalDays pastday;
- TPckgC<TTimeIntervalDays> pastdays(pastday);
- pastdays.Set(calendarInfo->PropertyValueL(KCaldavPastDays));
- Write(TTimeIntervalDays(10) == pastdays(), _L("CalendarInfo: pastdays"));
-
- TTimeIntervalMinutes syncintervals;
- TPckgC<TTimeIntervalMinutes> syncinterval(syncintervals);
- syncinterval.Set(calendarInfo->PropertyValueL(KCaldavSyncInterval));
- Write(TTimeIntervalMinutes(5) == syncinterval(), _L("CalendarInfo: syncinterval"));
-
- /*
- Write(calendarInfo->PropertyValueL(KCaldavSynctoken) ==KNullDesC8, _L("CalendarInfo: SyncToken"));
- Write(calendarInfo->PropertyValueL(KCaldavCtag) == KNullDesC8, _L("CalendarInfo: CTag"));
- Write(GetTimeFromProperties2(calendarInfo,KCaldavTime).TimeUtcL()== TCalTime().TimeUtcL(), _L("CalendarInfo: LastTime"));
- */
-
- // access point
- CleanupStack::PopAndDestroy(calendarInfo);
-
- delete iEngine->iCalSession;
- iEngine->iCalSession = NULL;
- }
-
-void CalDavTest::GetUIDByUrl()
- {
- _LIT8(url,"1234");
- _LIT8(url1,"/hi/1234.ics");
- _LIT8(url2,"/1234.ics");
- _LIT8(url3,"1234.ics");
- _LIT8(url4,"1234");
-
- Write(iEngine->GetUIDByUrl(url1) == url, __FUNCTION__);
- Write(iEngine->GetUIDByUrl(url2) == url, __FUNCTION__);
- Write(iEngine->GetUIDByUrl(url3) == url, __FUNCTION__);
- Write(iEngine->GetUIDByUrl(url4) == url, __FUNCTION__);
- }
-
-void CalDavTest::GetBaseUrl()
- {
- _LIT8(url1,"http://www.ok.de/1234.ics");
- _LIT8(url,"http://www.ok.de");
- _LIT8(url2,"https://www.ok.de:80/123444444.ics");
- _LIT8(urlport,"https://www.ok.de:80");
-
- iEngine->GetBaseUrl(url1);
- Write(*iEngine->iBaseUrl == url, __FUNCTION__);
-
- iEngine->GetBaseUrl(url2);
- Write(*iEngine->iBaseUrl == urlport, __FUNCTION__);
- }
-
-void CalDavTest::CTagL(TBool aEqual)
- {
- if (iEngine->iOptions.sync_ctag && !iEngine->iOptions.sync_collection)
- {
- HBufC8* tag = iEngine->GetCTagL();
- Write(aEqual ? *tag == *iEngine->iCTag : *tag != *iEngine->iCTag, _L("CTag"));
- if (aEqual && (*tag != *iEngine->iCTag))
- {
- TBuf<500> name;
- name.Append(_L("saved cTag: "));
- TBuf<100> one;
- one.Copy(*iEngine->iCTag);
- name.Append(one);
- name.Append(_L(" current server cTag: "));
- TBuf<100> two;
- two.Copy(*tag);
- name.Append(two);
- Write(ETrue, name);
- }
- delete tag;
- }
- }
-
-void CalDavTest::SynctokenL(TBool aEqual)
- {
- if (iEngine->iOptions.sync_collection)
- {
- HBufC8* tag = iEngine->GetSyncTokenL();
- Write(aEqual ? *tag == *iEngine->iSynctoken : *tag
- != *iEngine->iSynctoken, _L("SyncToken"));
- if (aEqual && (*tag != *iEngine->iSynctoken))
- {
- TBuf<500> name;
- name.Append(_L("saved Syntoken: "));
- TBuf<100> one;
- one.Copy(*iEngine->iSynctoken);
- name.Append(one);
- name.Append(_L(" current server Synctoken: "));
- TBuf<100> two;
- two.Copy(*tag);
- name.Append(two);
- Write(ETrue, name);
- }
- delete tag;
- }
- }
-
-void CalDavTest::SendL(const unsigned long localuid)
- {
- Write(iEngine->UploadEntryL(localuid, MCalChangeCallBack2::EChangeAdd,
- MCalChangeCallBack2::EChangeEntryAll) == KErrNone, __FUNCTION__);
- }
-
-void CalDavTest::SendL(TBool aVEvent)
- {
- TBuf8<500> url;
- url.Append(*iEngine->iUrl);
- url.Append(KFixedUIDics);
- _LIT8(KEntry1, "BEGIN:VCALENDAR\r\n"
- "PRODID:Symbian\r\n"
- "VERSION:2.0\r\n"
- "BEGIN:VEVENT\r\n"
- "UID:123456\r\n"
- "SUMMARY:first entry\r\n"
- "DESCRIPTION:a description\r\n"
- "DTSTAMP:20100411T100000Z\r\n"
- "DTSTART:20100411T100000Z\r\n"
- "DTEND:20100412T120000Z\r\n"
- "END:VEVENT\r\n"
- "END:VCALENDAR\r\n");
- _LIT8(KEntry2, "BEGIN:VCALENDAR\r\n"
- "PRODID:Symbian\r\n"
- "VERSION:2.0\r\n"
- "BEGIN:VTODO\r\n"
- "DTSTAMP:20100205T235335Z\r\n"
- "DUE;VALUE=DATE:20110104\r\n"
- "SUMMARY:Task #1\r\n"
- "UID:123456\r\n"
- "END:VTODO\r\n"
- "END:VCALENDAR\r\n");
-
- CBufFlat* response = CBufFlat::NewL(500);
- CleanupStack::PushL(response);
- TInt Ret = iEngine->iHttp->PutL(url, aVEvent ? KEntry1() : KEntry2(),
- response);
- CleanupStack::PopAndDestroy(response);
-
- if (Ret==PRECONDFAILED)
- {
- //might be still there from an older run
- TBuf8<500> url;
- url.Append(*iEngine->iUrl);
- url.Append(KFixedUIDics);
- iEngine->iHttp->DeleteL(url);
-
- CBufFlat* response = CBufFlat::NewL(500);
- CleanupStack::PushL(response);
- Ret = iEngine->iHttp->PutL(url, aVEvent ? KEntry1() : KEntry2(),
- response);
- CleanupStack::PopAndDestroy(response);
-
- // locally as well maybe:
- iEngine->DeleteLocalEntryL(KFixedUIDics);
- }
- Write((Ret == CREATED) || (Ret == NOCONTENT) || (Ret == OK), __FUNCTION__);
- }
-
-void CalDavTest::SyncL()
- {
- Write(iEngine->SyncL(), __FUNCTION__);
- }
-
-void CalDavTest::DownloadLGetL(const unsigned long localuid)
- {
- TInt aPos = iEngine->iLocalUidArray.Find(localuid);
- if (aPos != KErrNotFound)
- Write(iEngine->DownloadEntryL(iEngine->iGlobalUidArray[aPos])
- == KErrNone, __FUNCTION__);
- else
- Write(EFalse, __FUNCTION__);
- }
-void CalDavTest::DownloadLMultiGetL(const unsigned long localuid)
- {
- if (iEngine->iOptions.MULTIGET)
- {
- TInt aPos = iEngine->iLocalUidArray.Find(localuid);
- if (aPos != KErrNotFound)
- {
- TBuf8<500> url;
- url.Append(iEngine->iUrl->Mid(iEngine->iBaseUrl->Length()));
- url.Append(iEngine->iGlobalUidArray[aPos]);
- url.Append(KIcs);
- CDesC8ArrayFlat *multiget = new (ELeave) CDesC8ArrayFlat(4);
- CleanupStack::PushL(multiget);
- multiget->AppendL(url);
- multiget->AppendL(url);
- Write(iEngine->DownloadEntryL(multiget) == KErrNone, __FUNCTION__);
- multiget->Reset();
- CleanupStack::PopAndDestroy(multiget);
- }
- else
- Write(EFalse, __FUNCTION__);
- }
- }
-
-TInt CalDavTest::ConfigureSessionL(TInt aSucces, const TDesC8 &aUrl,
- const TDesC8 &aUser, const TDesC8 &aPassword)
- {
- iSession->SetUrl(calendar, aUrl);
- iSession->SetUsername(calendar, aUser);
- iSession->SetPassword(calendar, aPassword);
- TInt ret = iSession->Enable(calendar);
- Write(ret == aSucces, __FUNCTION__);
- return ret;
- }
-
-void CalDavTest::OptionSession()
- {
- TTimeIntervalDays pastdays = 0;
- TTimeIntervalMinutes syncinterval = 0;
- TBool immediatesync = EFalse;
- TBool keepserverentry = EFalse;
- TBuf8<500> url, username, password;
-
- // retreive standard values
- iSession->PastDays(calendar, pastdays);
- iSession->SyncInterval(calendar, syncinterval);
- iSession->ImmediateSync(calendar, immediatesync);
- iSession->KeepServerEntry(calendar, keepserverentry);
- iSession->Url(calendar, url);
- iSession->Username(calendar, username);
- iSession->Password(calendar, password);
-
- Write(pastdays.Int() == DEFAULT_PAST_DAYS, __FUNCTION__);
- Write(syncinterval.Int() == DEFAULT_SYNC_MINUTES, __FUNCTION__);
- Write(immediatesync, __FUNCTION__);
- Write(keepserverentry, __FUNCTION__);
- Write(url == urlAries, __FUNCTION__);
- Write(password == passwordSUN, __FUNCTION__);
- Write(username == userSUN, __FUNCTION__);
-
- // set new values
- pastdays = TTimeIntervalDays(100);
- syncinterval = TTimeIntervalMinutes(4);
- immediatesync = EFalse;
- keepserverentry = EFalse;
- iSession->SetPastDays(calendar, pastdays);
- iSession->SetSyncInterval(calendar, syncinterval);
- iSession->SetImmediateSync(calendar, immediatesync);
- iSession->SetKeepServerEntry(calendar, keepserverentry);
- iSession->SetUrl(calendar, urlGooglePrincipal);
- iSession->SetUsername(calendar, userGoogle);
- iSession->SetPassword(calendar, passwordGoogle);
-
- // check if new values are set correctly
- TTimeIntervalDays pastdays1(10000);
- TTimeIntervalMinutes syncinterval1(4000);
- TBool immediatesync1 = ETrue;
- TBool keepserverentry1 = ETrue;
- TBuf8<500> url1, username1, password1;
-
- iSession->PastDays(calendar, pastdays1);
- iSession->SyncInterval(calendar, syncinterval1);
- iSession->ImmediateSync(calendar, immediatesync1);
- iSession->KeepServerEntry(calendar, keepserverentry1);
- iSession->Url(calendar, url1);
- iSession->Username(calendar, username1);
- iSession->Password(calendar, password1);
-
- Write(pastdays1.Int() == 100, __FUNCTION__);
- Write(syncinterval1.Int() == 4, __FUNCTION__);
- Write(!immediatesync1, __FUNCTION__);
- Write(!keepserverentry1, __FUNCTION__);
- Write(url1 == urlGooglePrincipal, __FUNCTION__);
- Write(username1 == userGoogle, __FUNCTION__);
- Write(password1 == passwordGoogle, __FUNCTION__);
- }
-
-TInt CalDavTest::EnableL(TInt aSucces, const TDesC8 &aUrl, const TDesC8 &aUser,
- const TDesC8 &aPassword)
- {
- iEngine->SetUrlL(aUrl);
- iEngine->SetUserL(aUser);
- iEngine->SetPasswordL(aPassword);
- TInt ret = iEngine->EnableL();
- Write(ret == aSucces, __FUNCTION__);
- return ret;
- }
-
-void CalDavTest::DeleteServerL(const unsigned long localuid)
- {
- Write(iEngine->DeleteEntryL(localuid) == KErrNone, __FUNCTION__);
- }
-
-void CalDavTest::DeleteServerL()
- {
- TBuf8<500> url;
- url.Append(*iEngine->iUrl);
- url.Append(KFixedUIDics);
- TInt Return = iEngine->iHttp->DeleteL(url);
- Write((Return == NOCONTENT) || (Return == OK), __FUNCTION__);
- }
-
-void CalDavTest::DeleteClientL(const TDesC8 &aUid)
- {
- Write(iEngine->DeleteLocalEntryL(aUid) == KErrNone, __FUNCTION__);
- }
-
-LOCAL_C void DoStartL()
- {
-
- CActiveScheduler* scheduler = new (ELeave) CActiveScheduler();
- CleanupStack::PushL(scheduler);
- CActiveScheduler::Install(scheduler);
-
- for (TInt i = 0; i <= 10; i++)
- {
- CalDavTest* aTest = new (ELeave) CalDavTest(console);
-
- aTest->TestClientServerL(KErrNone, urlAries, userSUN, passwordSUN);
- aTest->TestClientServerL(KErrArgument, urlblabla, userblabla,
- passwordblabla);
-
- aTest->TestGeneralEngineL();
-
- //Test syntax: (url, username,password,webdav sync,ctag, aEvent, aTodo, aFreeBusy, aJournal)
-
- aTest->TestEngineL(KErrNone, urlWN, userSUN, passwordSUN, ETrue, ETrue,
- ETrue, ETrue, ETrue, EFalse);
-
- aTest->TestEngineL(KErrNone, urlAriesHome, userSUN, passwordSUN, ETrue,
- ETrue, ETrue, ETrue, ETrue, EFalse);
- aTest->TestEngineL(KErrNone, urlAries, userSUN, passwordSUN, ETrue,
- ETrue, ETrue, ETrue, ETrue, EFalse);
- aTest->TestEngineL(KErrNone, urlAriesPrincipal, userSUN, passwordSUN,
- ETrue, ETrue, ETrue, ETrue, ETrue, EFalse);
-
- aTest->TestEngineL(KErrNone, urlApple, userApple, passwordApple,
- EFalse, ETrue, ETrue, ETrue, ETrue, ETrue);
- aTest->TestEngineL(KErrNone, principalAplle, userApple, passwordApple,
- EFalse, ETrue, ETrue, ETrue, ETrue, ETrue);
-
- aTest->TestEngineL(KErrNone, urlGoogle, userGoogle, passwordGoogle,
- EFalse, ETrue, ETrue, EFalse, EFalse, EFalse);
- aTest->TestEngineL(KErrNone, urlGooglePrincipal, userGoogle,
- passwordGoogle, EFalse, ETrue, ETrue, EFalse, EFalse, EFalse);
-
- aTest->TestEngineL(KErrNone, urlChandler, userChandler,
- passwordChandler, EFalse, ETrue, ETrue, ETrue, ETrue, ETrue);
- aTest->TestEngineL(KErrNone, urlChandlerPrincipal, userChandler,
- passwordChandler, EFalse, ETrue, ETrue, ETrue, ETrue, ETrue);
-
- aTest->TestEngineL(KErrNone, urlOracle, userOracle, passwordOracle,
- EFalse, ETrue, ETrue, ETrue, EFalse, EFalse);
- aTest->TestEngineL(KErrNone, urlOraclePrincipal, userOracle,
- passwordOracle, EFalse, ETrue, ETrue, ETrue, EFalse, EFalse);
-
- aTest->TestEngineL(KErrNone, urlSogo, userSogo, passwordSogo, EFalse,
- ETrue, ETrue, ETrue, EFalse, EFalse);
- aTest->TestEngineL(KErrNone, urlDAV, userDAV, passwordDAV, EFalse,
- EFalse, ETrue, ETrue, EFalse, EFalse);
-
- aTest->TestEngineL(KErrNone, urlYahoo, userYahoo, passwordYahoo,
- EFalse, ETrue, ETrue, EFalse, ETrue, EFalse);
- aTest->TestEngineL(KErrNone, urlYahooPrincipal, userYahoo,
- passwordYahoo, EFalse, ETrue, ETrue, EFalse, ETrue, EFalse);
-
- aTest->TestEngineL(KErrNone, urlDaviCal, userDaviCal, passwordDaviCal,
- EFalse, ETrue, ETrue, ETrue, ETrue, ETrue);
- aTest->TestEngineL(KErrNone, principalDaviCal, userDaviCal,
- passwordDaviCal, EFalse, ETrue, ETrue, ETrue, ETrue, ETrue);
-
- aTest->TestEngineL(KErrNone, urlKerio, userKerio, passwordkerio,
- EFalse, ETrue, ETrue, ETrue, ETrue, EFalse);
- aTest->TestEngineL(KErrNone, principalKerio, userKerio, passwordkerio,
- EFalse, ETrue, ETrue, ETrue, ETrue, EFalse);
-
- aTest->TestEngineL(KErrNone, urlBedework, userBedework,
- passwordbedework, EFalse, ETrue, ETrue, ETrue,
- EFalse, EFalse);
- aTest->TestEngineL(KErrNone, urlBedeWorkPrincipal, userBedework,
- passwordbedework, EFalse, ETrue, ETrue, ETrue,
- EFalse, EFalse);
-
- aTest->TestEngineL(KErrArgument, urlAries, userSUN, passwordblabla,
- ETrue, ETrue, ETrue, ETrue, ETrue, EFalse);
-
- aTest->TestEngineL(KErrArgument, urlblabla, userblabla, passwordblabla,
- EFalse, EFalse, ETrue, ETrue, EFalse, EFalse);
-
- delete aTest;
- }
-
- // Delete active scheduler
- CleanupStack::PopAndDestroy(scheduler);
- }
-
-// Global Functions
-GLDEF_C TInt E32Main()
- {
- __UHEAP_MARK;
- CTrapCleanup* cleanup = CTrapCleanup::New();
- TRAPD(createError, console = Console::NewL(KTextConsoleTitle, TSize(
- KConsFullScreen, KConsFullScreen)));
- if (createError)
- return createError;
- TRAPD(mainError, DoStartL());
- if (mainError)
- console->Printf(KTextFailed, mainError);
- console->Printf(KTextPressAnyKey);
- console->Getch();
-
- delete console;
- delete cleanup;
- __UHEAP_MARKEND;
- return KErrNone;
- }
-
+/*
+* Copyright (c) 2010 Sun Microsystems, Inc. and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributor:
+* Maximilian Odendahl
+*
+* Contributors:
+*
+* Description: Caldav Test Suite
+*
+*/
+
+#include "CalDavTest.h"
+#include <e32base.h>
+#include <e32std.h>
+#include <e32base.h>
+#include <calentry.h>
+#include <calentryview.h>
+#include <caleninterimutils2.h>
+#include <calcalendarinfo.h>
+#include <calsession.h>
+#include "caldavengine.h"
+#include "httpclient.h"
+#include <caldavsession.h>
+_LIT(KTextConsoleTitle, "Console");
+_LIT(KTextFailed, " failed, leave code = %d");
+_LIT(KTextPressAnyKey, " [press any key]\n");
+// Global Variables
+LOCAL_D CConsoleBase* console; // write all messages to this
+
+_LIT8(urlAries,"http://aries.demo.sun.com:3080/davserver/dav/home/modendahl@demo.sun.com/calendar/");
+_LIT8(urlAriesPrincipal,"http://aries.demo.sun.com:3080/davserver/dav/principals/modendahl/");
+_LIT8(urlAriesHome,"http://aries.demo.sun.com:3080/davserver/dav/home/modendahl@demo.sun.com/");
+_LIT8(urlWN,"http://whatsnew.demo.iplanet.com:3080/dav/home/modendahl/calendar/");
+_LIT8(userSUN,"modendahl");
+_LIT8(passwordSUN,"secret");
+_LIT8(urlGoogle,"https://www.google.com/calendar/dav/maximilian.odendahl@sun.com/events/");
+_LIT8(urlGooglePrincipal,"https://www.google.com/calendar/dav/maximilian.odendahl@sun.com/user/");
+_LIT8(userGoogle,"maximilian.odendahl@sun.com");
+_LIT8(passwordGoogle,"iplanetiplanet");
+_LIT8(urlChandler,"https://hub.chandlerproject.org/dav/mod/f16c9eb0-6373-11de-979e-cdd32d46e10a11111/");
+_LIT8(urlChandlerPrincipal,"https://hub.chandlerproject.org/dav/users/mod/");
+_LIT8(userChandler,"mod");
+_LIT8(passwordChandler,"modmod");
+_LIT8(urlBedework,"http://bedework.org:8585/ucaldav/user/testuser29/calendar/");
+_LIT8(urlBedeWorkPrincipal,"http://bedework.org:8585/ucaldav/principals/users/testuser29");
+_LIT8(userBedework,"testuser29");
+_LIT8(passwordbedework,"bedework");
+_LIT8(urlYahoo,"https://caldav.calendar.yahoo.com/dav/lkz633/Calendar/lkz633/");
+_LIT8(urlYahooPrincipal,"https://caldav.calendar.yahoo.com/principals/users/lkz633/");
+_LIT8(userYahoo,"lkz633");
+_LIT8(passwordYahoo,"iplanetiplanet");
+_LIT8(urlOracle,"http://kingsknight.sfbay.sun.com:7777/caldav/Sun/home/7B7B.65E6.user.6FCA54EE73AD4821811999F4D7679F6E000000000070%40email.invalid/calendars/MyCalendar");
+_LIT8(urlOraclePrincipal,"http://kingsknight.sfbay.sun.com:7777/caldav/Sun/principals/individuals/7B7B.65E6.user.6FCA54EE73AD4821811999F4D7679F6E000000000070%40email.invalid");
+_LIT8(userOracle,"symbian");
+_LIT8(passwordOracle,"Secret12");
+_LIT8(urlSogo,"http://sogo-demo.inverse.ca/SOGo/dav/sogo3/Calendar/personal/");
+_LIT8(userSogo,"sogo3");
+_LIT8(passwordSogo,"sogo3");
+_LIT8(urlDAV,"http://dhcp-usca15-127-168.red.iplanet.com/dav/calendar/");
+_LIT8(userDAV,"max");
+_LIT8(passwordDAV,"max");
+_LIT8(urlApple,"http://zeta.macosforge.org:8008/calendars/__uids__/1E872019-0078-412D-8EE0-85A5680365C2/calendar/");
+_LIT8(principalAplle,"http://zeta.macosforge.org:8008/calendars/__uids__/1E872019-0078-412D-8EE0-85A5680365C2/calendar/");
+_LIT8(userApple,"trial1");
+_LIT8(passwordApple,"lompywickets");
+_LIT8(urlKerio,"http://iop.test.kerio.com/calendars/iop.test.kerio.com/user1/Calendar");
+_LIT8(principalKerio,"http://iop.test.kerio.com/caldav/iop.test.kerio.com/user1/");
+_LIT8(userKerio,"user1");
+_LIT8(passwordkerio,"x");
+_LIT8(urlDaviCal,"http://dev.davical.org:8008/caldav.php/user1/home/");
+_LIT8(principalDaviCal,"http://dev.davical.org:8008/caldav.php/user1/");
+_LIT8(userDaviCal,"user1");
+_LIT8(passwordDaviCal,"user1");
+_LIT8(urlblabla,"http://www.blablabalbalabal.com/calendar/");
+_LIT8(passwordblabla,"bla");
+_LIT8(userblabla,"blabla");
+_LIT(calendar, "c:calendar12345");
+_LIT8(KFixedUIDics,"123456.ics");
+
+#define TWOSECONDS TTimeIntervalMicroSeconds32(2000000)
+
+void CreateCalFileL()
+ {
+ CCalSession* session = CCalSession::NewL();
+ CleanupStack::PushL(session);
+ TRAPD(err, session->CreateCalFileL(calendar));
+ if (err == KErrAlreadyExists)
+ {
+ session->DeleteCalFileL(calendar);
+ session->CreateCalFileL(calendar);
+ }
+ CleanupStack::PopAndDestroy(session);
+ }
+
+void DeleteCalFileL()
+ {
+ CCalSession* session = CCalSession::NewL();
+ CleanupStack::PushL(session);
+ session->DeleteCalFileL(calendar);
+ CleanupStack::PopAndDestroy(session);
+ }
+
+TBool GetBoolFromProperties2(CCalCalendarInfo* info, const TDesC8 &aKey)
+ {
+ TBool boolean;
+ TPckgC<TBool> pckgboolean(boolean);
+ pckgboolean.Set(info->PropertyValueL(aKey));
+ return pckgboolean();
+ }
+
+TCalTime GetTimeFromProperties2(CCalCalendarInfo* info, const TDesC8 &aKey)
+ {
+ TCalTime time;
+ TPckgC<TCalTime> pckgtime(time);
+ pckgtime.Set(info->PropertyValueL(aKey));
+ return pckgtime();
+ }
+
+void NewApptL(HBufC8* aUid, TBool aEvent, CCalEntryView* iCalEntryView)
+ {
+ CCalEntry* appt = CCalEntry::NewL(aEvent ? CCalEntry::EEvent
+ : CCalEntry::ETodo, aUid, CCalEntry::EMethodNone, 0);
+ CleanupStack::PushL(appt);
+
+ //Some data
+ TBuf16<100> summary;
+ summary.Copy(*aUid);
+ appt->SetSummaryL(summary);
+ appt->SetLocationL(_L("Location2"));
+ appt->SetDescriptionL(_L("Description3"));
+
+ //Start / end date
+ TTime start;
+ start.UniversalTime();
+ TTime end;
+ end.UniversalTime();
+ TCalTime startCalTime;
+ startCalTime.SetTimeUtcL(start);
+ TCalTime endCalTime;
+ endCalTime.SetTimeUtcL(end);
+
+ //Set it
+ appt->SetStartAndEndTimeL(startCalTime, endCalTime);
+
+ //Store this new Entry
+
+ RPointerArray<CCalEntry> entryArray;
+ CleanupClosePushL(entryArray);
+ entryArray.AppendL(appt);
+ TInt success(0);
+ iCalEntryView->StoreL(entryArray, success);
+ entryArray.Reset();
+ CleanupStack::PopAndDestroy(&entryArray);
+ CleanupStack::PopAndDestroy(appt);
+ }
+
+CalDavTest::CalDavTest(CConsoleBase* console)
+ {
+ iConsole = console;
+ TInt connect = iFileLogger.Connect();
+ TTime home;
+ home.UniversalTime();
+ _LIT(KDateFormat,"%H%T%S");
+ TBuf<20> StringTime;
+ home.FormatL(StringTime, KDateFormat);
+ StringTime.Append(_L(".txt"));
+ iFileLogger.CreateLog(_L("CalDav"),StringTime, EFileLoggingModeOverwrite);
+ }
+
+CalDavTest::~CalDavTest()
+ {
+ iFileLogger.CloseLog();
+ iFileLogger.Close();
+ }
+
+void CalDavTest::Write(TBool aSuccess, const char* aMessage)
+ {
+ TBuf<500> buffer;
+ TPtrC8 ptr(reinterpret_cast<const TUint8*> (aMessage));
+ buffer.Copy(ptr);
+
+ Write(aSuccess, buffer);
+ }
+
+void CalDavTest::Write(TBool aSuccess, const TDesC &aMessage)
+ {
+ // convert char* into tbug
+ TBuf<500> buffer;
+ buffer.Append(aMessage);
+
+ if (aSuccess)
+ buffer.Append(_L("....PASSED\n"));
+ else
+ buffer.Append(_L("....FAILED\n"));
+
+ // write to console and file
+ Write(buffer);
+ }
+
+void CalDavTest::TestClientServerL(TInt aSucces, const TDesC8 &aUrl,
+ const TDesC8 &aUser, const TDesC8 &aPassword)
+ {
+ TBuf16<500> url;
+ url.Copy(aUrl);
+ Write(_L("\n\nStarting CalDav client-server test..."));
+ Write(url);
+
+ CreateCalFileL();
+
+ CCalDavSession *server = CCalDavSession::NewLC();
+ iSession = server;
+
+ if (ConfigureSessionL(aSucces, aUrl, aUser, aPassword) == KErrNone)
+ {
+ OptionSession();
+ }
+
+ CleanupStack::PopAndDestroy(server);
+ iSession = NULL;
+ DeleteCalFileL();
+
+ Write(_L("\nFinished CalDav client-server test..."));
+ Write(_L("\n\n"));
+ }
+
+void CalDavTest::TestGeneralEngineL()
+ {
+ CreateCalFileL();
+ CCalDavEngine* store = CCalDavEngine::NewLC(calendar);
+ iEngine = store;
+
+ CalendarInfoL();
+ GetUIDByUrl();
+ GetBaseUrl();
+
+ CleanupStack::PopAndDestroy(store);
+ iEngine = NULL;
+ DeleteCalFileL();
+ }
+
+void CalDavTest::TestEngineL(TInt aSucces, const TDesC8 &aUrl,
+ const TDesC8 &aUser, const TDesC8 &aPassword, TBool aWebdavsync,
+ TBool aCtag, TBool aEvent, TBool aTodo, TBool aFreeBusy, TBool aJournal)
+ {
+ Write(_L("\n\nStarting CalDav Engine test..."));
+ TBuf16<500> url;
+ url.Copy(aUrl);
+ Write(url);
+ Write(_L("\n"));
+
+ CreateCalFileL();
+
+ CCalDavEngine* store = CCalDavEngine::NewLC(calendar);
+
+ iEngine = store;
+ iWebdavSync = aWebdavsync;
+ iCtag = aCtag;
+
+ iVEVENT = aEvent;
+ iVTODO = aTodo;
+ iVFREEBUSY = aFreeBusy;
+ iVJOURNAL = aJournal;
+
+ Write(_L("\n\nStarting init and option tests...\n"));
+
+ Enabled(EFalse);
+ if (EnableL(aSucces, aUrl, aUser, aPassword) == KErrNone)
+ {
+ Enabled(ETrue);
+ OptionsL();
+ CTagL(ETrue);
+ SynctokenL(ETrue);
+
+ /******* Test events ******/
+ Write(_L("\nStarting VEvent engine tests...\n\n"));
+
+ HBufC8* newuid = iEngine->iCalIntermimUtils2->GlobalUidL();
+ // need to save it, as it will be destroyed by CCalEntry::NewL
+ TBuf8<100> uid;
+ uid.Append(*newuid);
+ // does entry exists locally
+ DoesExistL(EFalse, uid);
+ // add new local event with UID
+ NewApptL(newuid, ETrue, iEngine->iCalEntryView);
+ // does entry exists locally
+ DoesExistL(ETrue, uid);
+
+ // send to server using handle
+ unsigned long local = iEngine->DoesEntryExistL(uid);
+ // send existing event to server
+ SendL(local);
+ // available on server
+ if (iEngine->iOptions.VEVENT)
+ {
+ HeadL(ETrue, uid);
+ //download from server
+ DownloadLGetL(local);
+ DownloadLMultiGetL(local);
+ // delete on server
+ DeleteServerL(local);
+ // available on server
+ HeadL(EFalse, uid);
+ }
+ else
+ HeadL(EFalse, uid);
+
+ // delete locally
+ DeleteClientL(uid);
+ // should be gone now
+ DoesExistL(EFalse, uid);
+ /**************************/
+
+ CTagL(!iEngine->iOptions.VEVENT);
+ SynctokenL(!iEngine->iOptions.VEVENT);
+
+ User::After(TWOSECONDS);
+ SyncL();
+
+ CTagL(ETrue);
+ SynctokenL(ETrue);
+
+ // test synchronization method, put/delete on server using http calls
+ if (iEngine->iOptions.VEVENT)
+ {
+ Write(_L("\nStarting VEvent http and sync tests...\n\n"));
+ // create directly on server using only http calls
+ SendL(ETrue);
+ // we should not have this yet
+ DoesExistL(EFalse, KFixedUIDics);
+ User::After(TWOSECONDS);
+ SyncL();
+ // now we should
+ DoesExistL(ETrue, KFixedUIDics);
+ // delete directly on server
+ DeleteServerL();
+ // we should still have it
+ DoesExistL(ETrue, KFixedUIDics);
+ User::After(TWOSECONDS);
+ SyncL();
+ // now it should be gone locally
+ DoesExistL(EFalse, KFixedUIDics);
+ }
+
+ /******* Test VTodo ******/
+
+ Write(_L("\n\nStarting VTodo tests...\n\n"));
+
+ HBufC8* newuid2 = iEngine->iCalIntermimUtils2->GlobalUidL();
+ // need to save it, as it will be destroyed by CCalEntry::NewL
+ TBuf8<100> uid2;
+ uid2.Append(*newuid2);
+ // does entry exists locally
+ DoesExistL(EFalse, uid2);
+ // add new local event with UID
+ NewApptL(newuid2, EFalse, iEngine->iCalEntryView);
+ // does entry exists locally
+ DoesExistL(ETrue, uid2);
+
+ // send to server using handle
+ unsigned long local2 = iEngine->DoesEntryExistL(uid2);
+ // send existing event to server
+ SendL(local2);
+
+ if (iEngine->iOptions.VTODO)
+ {
+ // available on server
+ HeadL(ETrue, uid2);
+ //download from server
+ DownloadLGetL(local2);
+ DownloadLMultiGetL(local2);
+ // delete on server
+ DeleteServerL(local2);
+ // available on server
+ HeadL(EFalse, uid2);
+ }
+ else
+ HeadL(EFalse, uid2);
+ // delete locally
+ DeleteClientL(uid2);
+ // should be gone now
+ DoesExistL(EFalse, uid2);
+ /**************************/
+
+ CTagL(!iEngine->iOptions.VTODO);
+ SynctokenL(!iEngine->iOptions.VTODO);
+
+ // test synchronization method, put/delete on server using http calls
+ if (iEngine->iOptions.VTODO)
+ {
+ Write(_L("\nStarting VTodo http and sync tests...\n\n"));
+ // create directly on server using only http calls
+ SendL(EFalse);
+ // we should not have this yet
+ DoesExistL(EFalse, KFixedUIDics);
+ User::After(TWOSECONDS);
+ SyncL();
+ // now we should
+ DoesExistL(ETrue, KFixedUIDics);
+ // delete directly on server
+ DeleteServerL();
+ // we should still have it
+ DoesExistL(ETrue, KFixedUIDics);
+ User::After(TWOSECONDS);
+ SyncL();
+ // now it should be gone locally as well
+ DoesExistL(EFalse, KFixedUIDics);
+ }
+
+ /**** Test Calendar ******/
+ /*
+ // creating calendars under home calendar should not be allowed
+ if (iEngine->iOptions.MKCALENDAR)
+ {
+ Write(_L("\n\nStarting Calendar tests...\n\n"));
+ _LIT8(howareyou, "howareyoudoingtoday");
+ MkCalendarL(KErrNone, howareyou);
+ MkCalendarL(KErrArgument, howareyou);
+ DeleteCalendarL(howareyou);
+ }
+ */
+ /**************************/
+ iEngine->DisableL();
+ }
+
+ CleanupStack::PopAndDestroy(store);
+ iEngine = NULL;
+ DeleteCalFileL();
+
+ Write(_L("\n\nFinished CalDav Engine test..."));
+ Write(_L("\n\n"));
+ }
+
+void CalDavTest::Write(const TDesC &aMessage)
+ {
+ iConsole->Write(aMessage);
+ iFileLogger.Write(aMessage);
+ }
+
+void CalDavTest::Enabled(TBool aEnabled)
+ {
+ Write(iEngine->EnabledSync() == aEnabled, __FUNCTION__);
+ }
+
+void CalDavTest::DoesExistL(TBool aExists, const unsigned long localuid)
+ {
+ CCalEntry* entry = iEngine->iCalEntryView->FetchL(localuid);
+ CleanupStack::PushL(entry);
+ unsigned long uid = iEngine->DoesEntryExistL(entry->UidL());
+ Write(aExists ? uid > 0 : uid == 0, __FUNCTION__);
+
+ CleanupStack::PopAndDestroy(entry);
+ }
+
+void CalDavTest::DoesExistL(TBool aExists, const TDesC8 &aUID)
+ {
+ unsigned long uid = iEngine->DoesEntryExistL(aUID);
+ Write(aExists ? uid > 0 : uid == 0, __FUNCTION__);
+ }
+
+void CalDavTest::HeadL(TBool aExists, const TDesC8 &aUid)
+ {
+ TBool del = iEngine->HeadL(aUid) == OK;
+ Write(aExists == del, __FUNCTION__);
+ }
+
+void CalDavTest::MkCalendarL(TInt aSuccess, const TDesC8 &aName)
+ {
+ TInt ret = iEngine->MkcalendarL(aName);
+ Write(ret == aSuccess, __FUNCTION__);
+ }
+
+void CalDavTest::DeleteCalendarL(const TDesC8 &aName)
+ {
+ Write(iEngine->DeleteCalendarL(aName) == KErrNone, __FUNCTION__);
+ }
+
+void CalDavTest::OptionsL()
+ {
+ TBuf<500> message;
+ message.Append(_L("Options Displayname "));
+ CCalCalendarInfo* info = iEngine->iCalSession->CalendarInfoL();
+ TBuf<500> display;
+ display.Copy(info->NameL());
+ message.Append(display);
+ delete info;
+ Write(display != KNullDesC, message);
+ Write(iEngine->iOptions.sync_collection == iWebdavSync, _L("Options Webdav Sync"));
+ Write(iEngine->iOptions.sync_ctag == iCtag, _L("Options Ctag"));
+ Write(iEngine->iOptions.VEVENT == iVEVENT, _L("Options VEVENT"));
+ Write(iEngine->iOptions.VTODO == iVTODO, _L("Options VTODO"));
+ Write(iEngine->iOptions.VFREEBUSY == iVFREEBUSY, _L("FREEBUSY"));
+ Write(iEngine->iOptions.VJOURNAL == iVJOURNAL, _L("VJOURNAL"));
+ }
+
+void CalDavTest::CalendarInfoL()
+ {
+ _LIT8(user,"user");
+ _LIT8(password,"pass");
+ _LIT8(url,"http://neindanke/");
+ iEngine->SetUserL(user);
+ iEngine->SetUrlL(url);
+ iEngine->SetPasswordL(password);
+ iEngine->SetSyncIntervalL(TTimeIntervalMinutes(5));
+ iEngine->SetPastDaysL(TTimeIntervalDays(10));
+ iEngine->SetKeepServerEntryL(EFalse);
+ iEngine->SetImmediateSyncL(ETrue);
+ iEngine->EnableL();
+
+ iEngine->iCalSession = CCalSession::NewL();
+ iEngine->iCalSession->OpenL(calendar);
+
+ CCalCalendarInfo* calendarInfo = iEngine->iCalSession->CalendarInfoL();
+ CleanupStack::PushL(calendarInfo);
+
+ Write(!GetBoolFromProperties2(calendarInfo, KCaldavEnabled), _L("CalendarInfo: enabled"));
+ Write(!GetBoolFromProperties2(calendarInfo, KCaldavKeepServer), _L("CalendarInfo: Keepserver"));
+ Write(GetBoolFromProperties2(calendarInfo, KCaldavImmediateSync), _L("CalendarInfo: ImmediateSync"));
+ Write(calendarInfo->PropertyValueL(KCaldavUrl) == url, _L("CalendarInfo: url"));
+ Write(calendarInfo->PropertyValueL(KCaldavUser) == user, _L("CalendarInfo: user"));
+ Write(calendarInfo->PropertyValueL(KCaldavPassword) == password, _L("CalendarInfo: password"));
+
+ TTimeIntervalDays pastday;
+ TPckgC<TTimeIntervalDays> pastdays(pastday);
+ pastdays.Set(calendarInfo->PropertyValueL(KCaldavPastDays));
+ Write(TTimeIntervalDays(10) == pastdays(), _L("CalendarInfo: pastdays"));
+
+ TTimeIntervalMinutes syncintervals;
+ TPckgC<TTimeIntervalMinutes> syncinterval(syncintervals);
+ syncinterval.Set(calendarInfo->PropertyValueL(KCaldavSyncInterval));
+ Write(TTimeIntervalMinutes(5) == syncinterval(), _L("CalendarInfo: syncinterval"));
+
+ /*
+ Write(calendarInfo->PropertyValueL(KCaldavSynctoken) ==KNullDesC8, _L("CalendarInfo: SyncToken"));
+ Write(calendarInfo->PropertyValueL(KCaldavCtag) == KNullDesC8, _L("CalendarInfo: CTag"));
+ Write(GetTimeFromProperties2(calendarInfo,KCaldavTime).TimeUtcL()== TCalTime().TimeUtcL(), _L("CalendarInfo: LastTime"));
+ */
+
+ // access point
+ CleanupStack::PopAndDestroy(calendarInfo);
+
+ delete iEngine->iCalSession;
+ iEngine->iCalSession = NULL;
+ }
+
+void CalDavTest::GetUIDByUrl()
+ {
+ _LIT8(url,"1234");
+ _LIT8(url1,"/hi/1234.ics");
+ _LIT8(url2,"/1234.ics");
+ _LIT8(url3,"1234.ics");
+ _LIT8(url4,"1234");
+
+ Write(iEngine->GetUIDByUrl(url1) == url, __FUNCTION__);
+ Write(iEngine->GetUIDByUrl(url2) == url, __FUNCTION__);
+ Write(iEngine->GetUIDByUrl(url3) == url, __FUNCTION__);
+ Write(iEngine->GetUIDByUrl(url4) == url, __FUNCTION__);
+ }
+
+void CalDavTest::GetBaseUrl()
+ {
+ _LIT8(url1,"http://www.ok.de/1234.ics");
+ _LIT8(url,"http://www.ok.de");
+ _LIT8(url2,"https://www.ok.de:80/123444444.ics");
+ _LIT8(urlport,"https://www.ok.de:80");
+
+ iEngine->GetBaseUrl(url1);
+ Write(*iEngine->iBaseUrl == url, __FUNCTION__);
+
+ iEngine->GetBaseUrl(url2);
+ Write(*iEngine->iBaseUrl == urlport, __FUNCTION__);
+ }
+
+void CalDavTest::CTagL(TBool aEqual)
+ {
+ if (iEngine->iOptions.sync_ctag && !iEngine->iOptions.sync_collection)
+ {
+ HBufC8* tag = iEngine->GetCTagL();
+ Write(aEqual ? *tag == *iEngine->iCTag : *tag != *iEngine->iCTag, _L("CTag"));
+ if (aEqual && (*tag != *iEngine->iCTag))
+ {
+ TBuf<500> name;
+ name.Append(_L("saved cTag: "));
+ TBuf<100> one;
+ one.Copy(*iEngine->iCTag);
+ name.Append(one);
+ name.Append(_L(" current server cTag: "));
+ TBuf<100> two;
+ two.Copy(*tag);
+ name.Append(two);
+ Write(ETrue, name);
+ }
+ delete tag;
+ }
+ }
+
+void CalDavTest::SynctokenL(TBool aEqual)
+ {
+ if (iEngine->iOptions.sync_collection)
+ {
+ HBufC8* tag = iEngine->GetSyncTokenL();
+ Write(aEqual ? *tag == *iEngine->iSynctoken : *tag
+ != *iEngine->iSynctoken, _L("SyncToken"));
+ if (aEqual && (*tag != *iEngine->iSynctoken))
+ {
+ TBuf<500> name;
+ name.Append(_L("saved Syntoken: "));
+ TBuf<100> one;
+ one.Copy(*iEngine->iSynctoken);
+ name.Append(one);
+ name.Append(_L(" current server Synctoken: "));
+ TBuf<100> two;
+ two.Copy(*tag);
+ name.Append(two);
+ Write(ETrue, name);
+ }
+ delete tag;
+ }
+ }
+
+void CalDavTest::SendL(const unsigned long localuid)
+ {
+ Write(iEngine->UploadEntryL(localuid, MCalChangeCallBack2::EChangeAdd,
+ MCalChangeCallBack2::EChangeEntryAll) == KErrNone, __FUNCTION__);
+ }
+
+void CalDavTest::SendL(TBool aVEvent)
+ {
+ TBuf8<500> url;
+ url.Append(*iEngine->iUrl);
+ url.Append(KFixedUIDics);
+ _LIT8(KEntry1, "BEGIN:VCALENDAR\r\n"
+ "PRODID:Symbian\r\n"
+ "VERSION:2.0\r\n"
+ "BEGIN:VEVENT\r\n"
+ "UID:123456\r\n"
+ "SUMMARY:first entry\r\n"
+ "DESCRIPTION:a description\r\n"
+ "DTSTAMP:20100411T100000Z\r\n"
+ "DTSTART:20100411T100000Z\r\n"
+ "DTEND:20100412T120000Z\r\n"
+ "END:VEVENT\r\n"
+ "END:VCALENDAR\r\n");
+ _LIT8(KEntry2, "BEGIN:VCALENDAR\r\n"
+ "PRODID:Symbian\r\n"
+ "VERSION:2.0\r\n"
+ "BEGIN:VTODO\r\n"
+ "DTSTAMP:20100205T235335Z\r\n"
+ "DUE;VALUE=DATE:20110104\r\n"
+ "SUMMARY:Task #1\r\n"
+ "UID:123456\r\n"
+ "END:VTODO\r\n"
+ "END:VCALENDAR\r\n");
+
+ CBufFlat* response = CBufFlat::NewL(500);
+ CleanupStack::PushL(response);
+ TInt Ret = iEngine->iHttp->PutL(url, aVEvent ? KEntry1() : KEntry2(),
+ response);
+ CleanupStack::PopAndDestroy(response);
+
+ if (Ret==PRECONDFAILED)
+ {
+ //might be still there from an older run
+ TBuf8<500> url;
+ url.Append(*iEngine->iUrl);
+ url.Append(KFixedUIDics);
+ iEngine->iHttp->DeleteL(url);
+
+ CBufFlat* response = CBufFlat::NewL(500);
+ CleanupStack::PushL(response);
+ Ret = iEngine->iHttp->PutL(url, aVEvent ? KEntry1() : KEntry2(),
+ response);
+ CleanupStack::PopAndDestroy(response);
+
+ // locally as well maybe:
+ iEngine->DeleteLocalEntryL(KFixedUIDics);
+ }
+ Write((Ret == CREATED) || (Ret == NOCONTENT) || (Ret == OK), __FUNCTION__);
+ }
+
+void CalDavTest::SyncL()
+ {
+ Write(iEngine->SyncL(), __FUNCTION__);
+ }
+
+void CalDavTest::DownloadLGetL(const unsigned long localuid)
+ {
+ TInt aPos = iEngine->iLocalUidArray.Find(localuid);
+ if (aPos != KErrNotFound)
+ Write(iEngine->DownloadEntryL(iEngine->iGlobalUidArray[aPos])
+ == KErrNone, __FUNCTION__);
+ else
+ Write(EFalse, __FUNCTION__);
+ }
+void CalDavTest::DownloadLMultiGetL(const unsigned long localuid)
+ {
+ if (iEngine->iOptions.MULTIGET)
+ {
+ TInt aPos = iEngine->iLocalUidArray.Find(localuid);
+ if (aPos != KErrNotFound)
+ {
+ TBuf8<500> url;
+ url.Append(iEngine->iUrl->Mid(iEngine->iBaseUrl->Length()));
+ url.Append(iEngine->iGlobalUidArray[aPos]);
+ url.Append(KIcs);
+ CDesC8ArrayFlat *multiget = new (ELeave) CDesC8ArrayFlat(4);
+ CleanupStack::PushL(multiget);
+ multiget->AppendL(url);
+ multiget->AppendL(url);
+ Write(iEngine->DownloadEntryL(multiget) == KErrNone, __FUNCTION__);
+ multiget->Reset();
+ CleanupStack::PopAndDestroy(multiget);
+ }
+ else
+ Write(EFalse, __FUNCTION__);
+ }
+ }
+
+TInt CalDavTest::ConfigureSessionL(TInt aSucces, const TDesC8 &aUrl,
+ const TDesC8 &aUser, const TDesC8 &aPassword)
+ {
+ iSession->SetUrl(calendar, aUrl);
+ iSession->SetUsername(calendar, aUser);
+ iSession->SetPassword(calendar, aPassword);
+ TInt ret = iSession->Enable(calendar);
+ Write(ret == aSucces, __FUNCTION__);
+ return ret;
+ }
+
+void CalDavTest::OptionSession()
+ {
+ TTimeIntervalDays pastdays = 0;
+ TTimeIntervalMinutes syncinterval = 0;
+ TBool immediatesync = EFalse;
+ TBool keepserverentry = EFalse;
+ TBuf8<500> url, username, password;
+
+ // retreive standard values
+ iSession->PastDays(calendar, pastdays);
+ iSession->SyncInterval(calendar, syncinterval);
+ iSession->ImmediateSync(calendar, immediatesync);
+ iSession->KeepServerEntry(calendar, keepserverentry);
+ iSession->Url(calendar, url);
+ iSession->Username(calendar, username);
+ iSession->Password(calendar, password);
+
+ Write(pastdays.Int() == DEFAULT_PAST_DAYS, __FUNCTION__);
+ Write(syncinterval.Int() == DEFAULT_SYNC_MINUTES, __FUNCTION__);
+ Write(immediatesync, __FUNCTION__);
+ Write(keepserverentry, __FUNCTION__);
+ Write(url == urlAries, __FUNCTION__);
+ Write(password == passwordSUN, __FUNCTION__);
+ Write(username == userSUN, __FUNCTION__);
+
+ // set new values
+ pastdays = TTimeIntervalDays(100);
+ syncinterval = TTimeIntervalMinutes(4);
+ immediatesync = EFalse;
+ keepserverentry = EFalse;
+ iSession->SetPastDays(calendar, pastdays);
+ iSession->SetSyncInterval(calendar, syncinterval);
+ iSession->SetImmediateSync(calendar, immediatesync);
+ iSession->SetKeepServerEntry(calendar, keepserverentry);
+ iSession->SetUrl(calendar, urlGooglePrincipal);
+ iSession->SetUsername(calendar, userGoogle);
+ iSession->SetPassword(calendar, passwordGoogle);
+
+ // check if new values are set correctly
+ TTimeIntervalDays pastdays1(10000);
+ TTimeIntervalMinutes syncinterval1(4000);
+ TBool immediatesync1 = ETrue;
+ TBool keepserverentry1 = ETrue;
+ TBuf8<500> url1, username1, password1;
+
+ iSession->PastDays(calendar, pastdays1);
+ iSession->SyncInterval(calendar, syncinterval1);
+ iSession->ImmediateSync(calendar, immediatesync1);
+ iSession->KeepServerEntry(calendar, keepserverentry1);
+ iSession->Url(calendar, url1);
+ iSession->Username(calendar, username1);
+ iSession->Password(calendar, password1);
+
+ Write(pastdays1.Int() == 100, __FUNCTION__);
+ Write(syncinterval1.Int() == 4, __FUNCTION__);
+ Write(!immediatesync1, __FUNCTION__);
+ Write(!keepserverentry1, __FUNCTION__);
+ Write(url1 == urlGooglePrincipal, __FUNCTION__);
+ Write(username1 == userGoogle, __FUNCTION__);
+ Write(password1 == passwordGoogle, __FUNCTION__);
+ }
+
+TInt CalDavTest::EnableL(TInt aSucces, const TDesC8 &aUrl, const TDesC8 &aUser,
+ const TDesC8 &aPassword)
+ {
+ iEngine->SetUrlL(aUrl);
+ iEngine->SetUserL(aUser);
+ iEngine->SetPasswordL(aPassword);
+ TInt ret = iEngine->EnableL();
+ Write(ret == aSucces, __FUNCTION__);
+ return ret;
+ }
+
+void CalDavTest::DeleteServerL(const unsigned long localuid)
+ {
+ Write(iEngine->DeleteEntryL(localuid) == KErrNone, __FUNCTION__);
+ }
+
+void CalDavTest::DeleteServerL()
+ {
+ TBuf8<500> url;
+ url.Append(*iEngine->iUrl);
+ url.Append(KFixedUIDics);
+ TInt Return = iEngine->iHttp->DeleteL(url);
+ Write((Return == NOCONTENT) || (Return == OK), __FUNCTION__);
+ }
+
+void CalDavTest::DeleteClientL(const TDesC8 &aUid)
+ {
+ Write(iEngine->DeleteLocalEntryL(aUid) == KErrNone, __FUNCTION__);
+ }
+
+LOCAL_C void DoStartL()
+ {
+
+ CActiveScheduler* scheduler = new (ELeave) CActiveScheduler();
+ CleanupStack::PushL(scheduler);
+ CActiveScheduler::Install(scheduler);
+
+ for (TInt i = 0; i <= 10; i++)
+ {
+ CalDavTest* aTest = new (ELeave) CalDavTest(console);
+
+ aTest->TestClientServerL(KErrNone, urlAries, userSUN, passwordSUN);
+ aTest->TestClientServerL(KErrArgument, urlblabla, userblabla,
+ passwordblabla);
+
+ aTest->TestGeneralEngineL();
+
+ //Test syntax: (url, username,password,webdav sync,ctag, aEvent, aTodo, aFreeBusy, aJournal)
+
+ aTest->TestEngineL(KErrNone, urlWN, userSUN, passwordSUN, ETrue, ETrue,
+ ETrue, ETrue, ETrue, EFalse);
+
+ aTest->TestEngineL(KErrNone, urlAriesHome, userSUN, passwordSUN, ETrue,
+ ETrue, ETrue, ETrue, ETrue, EFalse);
+ aTest->TestEngineL(KErrNone, urlAries, userSUN, passwordSUN, ETrue,
+ ETrue, ETrue, ETrue, ETrue, EFalse);
+ aTest->TestEngineL(KErrNone, urlAriesPrincipal, userSUN, passwordSUN,
+ ETrue, ETrue, ETrue, ETrue, ETrue, EFalse);
+
+ aTest->TestEngineL(KErrNone, urlApple, userApple, passwordApple,
+ EFalse, ETrue, ETrue, ETrue, ETrue, ETrue);
+ aTest->TestEngineL(KErrNone, principalAplle, userApple, passwordApple,
+ EFalse, ETrue, ETrue, ETrue, ETrue, ETrue);
+
+ aTest->TestEngineL(KErrNone, urlGoogle, userGoogle, passwordGoogle,
+ EFalse, ETrue, ETrue, EFalse, EFalse, EFalse);
+ aTest->TestEngineL(KErrNone, urlGooglePrincipal, userGoogle,
+ passwordGoogle, EFalse, ETrue, ETrue, EFalse, EFalse, EFalse);
+
+ aTest->TestEngineL(KErrNone, urlChandler, userChandler,
+ passwordChandler, EFalse, ETrue, ETrue, ETrue, ETrue, ETrue);
+ aTest->TestEngineL(KErrNone, urlChandlerPrincipal, userChandler,
+ passwordChandler, EFalse, ETrue, ETrue, ETrue, ETrue, ETrue);
+
+ aTest->TestEngineL(KErrNone, urlOracle, userOracle, passwordOracle,
+ EFalse, ETrue, ETrue, ETrue, EFalse, EFalse);
+ aTest->TestEngineL(KErrNone, urlOraclePrincipal, userOracle,
+ passwordOracle, EFalse, ETrue, ETrue, ETrue, EFalse, EFalse);
+
+ aTest->TestEngineL(KErrNone, urlSogo, userSogo, passwordSogo, EFalse,
+ ETrue, ETrue, ETrue, EFalse, EFalse);
+ aTest->TestEngineL(KErrNone, urlDAV, userDAV, passwordDAV, EFalse,
+ EFalse, ETrue, ETrue, EFalse, EFalse);
+
+ aTest->TestEngineL(KErrNone, urlYahoo, userYahoo, passwordYahoo,
+ EFalse, ETrue, ETrue, EFalse, ETrue, EFalse);
+ aTest->TestEngineL(KErrNone, urlYahooPrincipal, userYahoo,
+ passwordYahoo, EFalse, ETrue, ETrue, EFalse, ETrue, EFalse);
+
+ aTest->TestEngineL(KErrNone, urlDaviCal, userDaviCal, passwordDaviCal,
+ EFalse, ETrue, ETrue, ETrue, ETrue, ETrue);
+ aTest->TestEngineL(KErrNone, principalDaviCal, userDaviCal,
+ passwordDaviCal, EFalse, ETrue, ETrue, ETrue, ETrue, ETrue);
+
+ aTest->TestEngineL(KErrNone, urlKerio, userKerio, passwordkerio,
+ EFalse, ETrue, ETrue, ETrue, ETrue, EFalse);
+ aTest->TestEngineL(KErrNone, principalKerio, userKerio, passwordkerio,
+ EFalse, ETrue, ETrue, ETrue, ETrue, EFalse);
+
+ aTest->TestEngineL(KErrNone, urlBedework, userBedework,
+ passwordbedework, EFalse, ETrue, ETrue, ETrue,
+ EFalse, EFalse);
+ aTest->TestEngineL(KErrNone, urlBedeWorkPrincipal, userBedework,
+ passwordbedework, EFalse, ETrue, ETrue, ETrue,
+ EFalse, EFalse);
+
+ aTest->TestEngineL(KErrArgument, urlAries, userSUN, passwordblabla,
+ ETrue, ETrue, ETrue, ETrue, ETrue, EFalse);
+
+ aTest->TestEngineL(KErrArgument, urlblabla, userblabla, passwordblabla,
+ EFalse, EFalse, ETrue, ETrue, EFalse, EFalse);
+
+ delete aTest;
+ }
+
+ // Delete active scheduler
+ CleanupStack::PopAndDestroy(scheduler);
+ }
+
+// Global Functions
+GLDEF_C TInt E32Main()
+ {
+ __UHEAP_MARK;
+ CTrapCleanup* cleanup = CTrapCleanup::New();
+ TRAPD(createError, console = Console::NewL(KTextConsoleTitle, TSize(
+ KConsFullScreen, KConsFullScreen)));
+ if (createError)
+ return createError;
+ TRAPD(mainError, DoStartL());
+ if (mainError)
+ console->Printf(KTextFailed, mainError);
+ console->Printf(KTextPressAnyKey);
+ console->Getch();
+
+ delete console;
+ delete cleanup;
+ __UHEAP_MARKEND;
+ return KErrNone;
+ }
+
--- a/calendarui/application/data/Calendar.rss Mon Mar 08 21:43:23 2010 +0000
+++ b/calendarui/application/data/Calendar.rss Sun Mar 14 13:09:26 2010 +0000
@@ -2705,12 +2705,12 @@
RESOURCE TBUF r_cale_db_calendar
{
- buf = "Calendar";
+ buf = qtn_cale_db_calendar_name;
}
RESOURCE TBUF r_cale_db_calendar_default_name
{
- buf = "Calendar(%U)";
+ buf = "Calendar(%U)"; //qtn_cale_db_calendar_default_name
}
RESOURCE TBUF r_calen_illegal_characters
--- a/calendarui/caldav/data/2002B503.rss Mon Mar 08 21:43:23 2010 +0000
+++ b/calendarui/caldav/data/2002B503.rss Sun Mar 14 13:09:26 2010 +0000
@@ -1,52 +1,52 @@
-/*
-* Copyright (c) 2010 Sun Microsystems, Inc. and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributor:
-* Maximilian Odendahl
-*
-* Contributors:
-*
-* Description: registration file for Caldav ECOM plugin
-*
-*/
-
-#ifndef CALENCALDAVPLUGINREG_H
-#define CALENCALDAVPLUGINREG_H
-
-
-#include "CalDavUids.h"
-#include "caldav.loc"
-
-#include <ecom/registryinfo.rh>
-#include <calendar.loc>
-
-RESOURCE REGISTRY_INFO registry_info
- {
- dll_uid = CALENCALDAVPLUGIN_DLL_UID;
- interfaces =
- {
- INTERFACE_INFO
- {
- interface_uid = CALENUIPLUGININTERFACE_ECOM_INTERFACE_UID;
- implementations =
- {
- IMPLEMENTATION_INFO
- {
- implementation_uid = CALEN_CALDAV_IMPLEMENTATION_UID;
- version_no = 1;
- display_name = qtn_caldav;
- default_data = "language(*)";
- opaque_data = "";
- }
- };
- }
- };
- }
-
-#endif
-// End of file
+/*
+* Copyright (c) 2010 Sun Microsystems, Inc. and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributor:
+* Maximilian Odendahl
+*
+* Contributors:
+*
+* Description: registration file for Caldav ECOM plugin
+*
+*/
+
+#ifndef CALENCALDAVPLUGINREG_H
+#define CALENCALDAVPLUGINREG_H
+
+
+#include "CalDavUids.h"
+#include "caldav.loc"
+
+#include <ecom/registryinfo.rh>
+#include <calendar.loc>
+
+RESOURCE REGISTRY_INFO registry_info
+ {
+ dll_uid = CALENCALDAVPLUGIN_DLL_UID;
+ interfaces =
+ {
+ INTERFACE_INFO
+ {
+ interface_uid = CALENUIPLUGININTERFACE_ECOM_INTERFACE_UID;
+ implementations =
+ {
+ IMPLEMENTATION_INFO
+ {
+ implementation_uid = CALEN_CALDAV_IMPLEMENTATION_UID;
+ version_no = 1;
+ display_name = qtn_caldav;
+ default_data = "language(*)";
+ opaque_data = "";
+ }
+ };
+ }
+ };
+ }
+
+#endif
+// End of file
--- a/calendarui/caldav/data/caldav.loc Mon Mar 08 21:43:23 2010 +0000
+++ b/calendarui/caldav/data/caldav.loc Sun Mar 14 13:09:26 2010 +0000
@@ -1,55 +1,55 @@
-/*
-* Copyright (c) 2010 Sun Microsystems, Inc. and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributor:
-* Maximilian Odendahl
-*
-* Contributors:
-*
-* Description: caldav user interface strings
-*
-*/
-
-#define qtn_caldav "CalDAV Synchronisation"
-
-#define qtn_caldav_query_disconnect "This change will disable synchronisation. Do you want to continue?"
-#define qtn_caldav_query_fail "Synchronization could not be enabled. Please check url, username and password"
-#define qtn_caldav_query_success "Synchronization was enabled successfully."
-
-#define qtn_caldav_access_point "Access Point"
-
-#define qtn_caldav_username "Username"
-#define qtn_caldav_url "Url"
-#define qtn_caldav_password "Password"
-#define qtn_caldav_syncinterval "Sync Interval"
-
-#define qtn_caldav_conflictaction "Conflict resolution"
-#define qtn_caldav_keep_server "Keep server"
-#define qtn_caldav_keep_device "Keep device"
-
-#define qtn_caldav_immediatesync "New entries"
-#define qtn_caldav_immediatesync_yes "Sync immediatly"
-#define qtn_caldav_immediatesync_no "Wait until next sync"
-
-#define qtn_caldav_enable "Enabled synchronization"
-#define qtn_caldav_yes "Yes"
-#define qtn_caldav_no "No"
-
-#define qtn_caldav_range "Time range"
-#define qtn_caldav_range_two "2 weeks back"
-#define qtn_caldav_range_three "3 month back"
-#define qtn_caldav_range_six "6 month back"
-#define qtn_caldav_range_all "all events"
-
-#define qtn_caldav_time "Sync interval"
-
-#define qtn_caldav_time_always "Always on"
-#define qtn_caldav_time_one "One minute"
-#define qtn_caldav_time_five "Five minutes"
-#define qtn_caldav_time_fifteen "Fifteen minutes"
-#define qtn_caldav_time_thirty "Thirty minutes"
+/*
+* Copyright (c) 2010 Sun Microsystems, Inc. and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributor:
+* Maximilian Odendahl
+*
+* Contributors:
+*
+* Description: caldav user interface strings
+*
+*/
+
+#define qtn_caldav "CalDAV Synchronisation"
+
+#define qtn_caldav_query_disconnect "This change will disable synchronisation. Do you want to continue?"
+#define qtn_caldav_query_fail "Synchronization could not be enabled. Please check url, username and password"
+#define qtn_caldav_query_success "Synchronization was enabled successfully."
+
+#define qtn_caldav_access_point "Access Point"
+
+#define qtn_caldav_username "Username"
+#define qtn_caldav_url "Url"
+#define qtn_caldav_password "Password"
+#define qtn_caldav_syncinterval "Sync Interval"
+
+#define qtn_caldav_conflictaction "Conflict resolution"
+#define qtn_caldav_keep_server "Keep server"
+#define qtn_caldav_keep_device "Keep device"
+
+#define qtn_caldav_immediatesync "New entries"
+#define qtn_caldav_immediatesync_yes "Sync immediatly"
+#define qtn_caldav_immediatesync_no "Wait until next sync"
+
+#define qtn_caldav_enable "Enabled synchronization"
+#define qtn_caldav_yes "Yes"
+#define qtn_caldav_no "No"
+
+#define qtn_caldav_range "Time range"
+#define qtn_caldav_range_two "2 weeks back"
+#define qtn_caldav_range_three "3 month back"
+#define qtn_caldav_range_six "6 month back"
+#define qtn_caldav_range_all "all events"
+
+#define qtn_caldav_time "Sync interval"
+
+#define qtn_caldav_time_always "Always on"
+#define qtn_caldav_time_one "One minute"
+#define qtn_caldav_time_five "Five minutes"
+#define qtn_caldav_time_fifteen "Fifteen minutes"
+#define qtn_caldav_time_thirty "Thirty minutes"
--- a/calendarui/caldav/data/calencaldavpluginData.rss Mon Mar 08 21:43:23 2010 +0000
+++ b/calendarui/caldav/data/calencaldavpluginData.rss Sun Mar 14 13:09:26 2010 +0000
@@ -1,351 +1,351 @@
-/*
-* Copyright (c) 2010 Sun Microsystems, Inc. and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributor:
-* Maximilian Odendahl
-*
-* Contributors:
-*
-* Description: Caldav ECOM plugin resource file
-*
-*/
-
-#include <eikon.rh>
-#include <avkon.hrh>
-#include <avkon.rh>
-#include <avkon.rsg>
-
-#include <Calendar.loc>
-#include "caldav.loc"
-
-NAME CLU2
-
-RESOURCE RSS_SIGNATURE { }
-
-
-
-RESOURCE TBUF r_caldav
- {
- buf = qtn_caldav;
- }
-
-RESOURCE TBUF r_caldav_query_disconnect
- {
- buf = qtn_caldav_query_disconnect;
- }
-
-RESOURCE TBUF r_caldav_query_fail
- {
- buf = qtn_caldav_query_fail;
- }
-
-RESOURCE TBUF r_caldav_query_success
- {
- buf = qtn_caldav_query_success;
- }
-
-RESOURCE DIALOG r_query
- {
- flags = EGeneralQueryFlags;
- buttons = R_AVKON_SOFTKEYS_YES_NO;
- title = qtn_caldav;
- items =
- {
- DLG_LINE
- {
- type = EAknCtQuery;
- id = EGeneralQuery;
- control = AVKON_CONFIRMATION_QUERY
- {
- layout = EConfirmationQueryLayout;
- animation = R_QGN_NOTE_INFO_ANIM;
- };
- }
- };
- }
-
-RESOURCE TBUF r_caldav_access_point
- {
- buf = qtn_caldav_access_point;
- }
-
-RESOURCE TBUF r_caldav_username
- {
- buf = qtn_caldav_username;
- }
-
-RESOURCE TBUF r_caldav_url
- {
- buf = qtn_caldav_url;
- }
-
-RESOURCE TBUF r_caldav_password
- {
- buf = qtn_caldav_password;
- }
-
-RESOURCE TBUF r_caldav_syncinterval
- {
- buf = qtn_caldav_syncinterval;
- }
-
-RESOURCE AVKON_SETTING_PAGE r_url_setting_page
-{
- type = EEikCtEdwin;
- editor_resource_id = r_url_editor_resource;
-}
-
-RESOURCE EDWIN r_url_editor_resource
- {
- maxlength = 255;
- default_case = EAknEditorTextCase;
- allowed_case_modes = EAknEditorAllCaseModes;
- numeric_keymap = EAknEditorStandardNumberModeKeymap;
- default_input_mode = EAknEditorTextInputMode;
- allowed_input_modes = EAknEditorTextInputMode
- | EAknEditorNumericInputMode
- | EAknEditorSecretAlphaInputMode
- | EAknEditorKatakanaInputMode
- | EAknEditorFullWidthTextInputMode
- | EAknEditorFullWidthNumericInputMode
- | EAknEditorFullWidthKatakanaInputMode
- | EAknEditorHiraganaKanjiInputMode
- | EAknEditorHalfWidthTextInputMode;
- special_character_table = R_AVKON_URL_SPECIAL_CHARACTER_TABLE_DIALOG;
- lines = 0;
- }
-
-RESOURCE AVKON_SETTING_PAGE r_username_setting_page
-{
- type = EEikCtEdwin;
- editor_resource_id = r_username_editor_resource;
-}
-
-RESOURCE EDWIN r_username_editor_resource
-{
- maxlength = 255;
- default_case = EAknEditorTextCase;
- allowed_case_modes = EAknEditorAllCaseModes;
- numeric_keymap = EAknEditorStandardNumberModeKeymap;
- default_input_mode = EAknEditorTextInputMode;
- allowed_input_modes = EAknEditorTextInputMode | EAknEditorNumericInputMode | EAknEditorSecretAlphaInputMode | EAknEditorKatakanaInputMode | EAknEditorFullWidthTextInputMode | EAknEditorFullWidthNumericInputMode | EAknEditorFullWidthKatakanaInputMode | EAknEditorHiraganaKanjiInputMode | EAknEditorHalfWidthTextInputMode;
- lines = 0;
-}
-
-RESOURCE AVKON_SETTING_PAGE r_password_setting_page
-{
- //type = EEikCtEdwin;
- //editor_resource_id = r_password_editor_resource;
- type = EEikCtSecretEd;
- editor_resource_id = r_settinglist_alpha_password;
-}
-
-RESOURCE EDWIN r_password_editor_resource
- {
- maxlength = 255;
- default_case = EAknEditorTextCase;
- allowed_case_modes = EAknEditorAllCaseModes;
- numeric_keymap = EAknEditorStandardNumberModeKeymap;
- default_input_mode = EAknEditorTextInputMode;
- allowed_input_modes = EAknEditorTextInputMode | EAknEditorNumericInputMode | EAknEditorSecretAlphaInputMode | EAknEditorKatakanaInputMode | EAknEditorFullWidthTextInputMode | EAknEditorFullWidthNumericInputMode | EAknEditorFullWidthKatakanaInputMode | EAknEditorHiraganaKanjiInputMode | EAknEditorHalfWidthTextInputMode;
- lines = 0;
- }
-
-RESOURCE SECRETED r_settinglist_alpha_password
- {
- num_letters = 100;
- }
-
-
-RESOURCE TBUF r_caldav_time
- {
- buf = qtn_caldav_time;
- }
-
-RESOURCE AVKON_SETTING_PAGE r_caldav_time_page
-
- {
- number = 1;
- type = EEikCtTimeOffsetEditor;
- editor_resource_id = r_caldav_time_editor;
- }
-
-RESOURCE TIME_OFFSET_EDITOR r_caldav_time_editor
- {
- minTimeOffset = TIME_OFFSET { seconds = 0; };
- maxTimeOffset = TIME_OFFSET { seconds = 43200; };
- flags = EEikTimeWithoutSecondsField | EEikTimeZoneOffsetFormat;
- }
-
-RESOURCE AVKON_SETTING_PAGE r_caldav_binary_page
-{
- label = "";
- type = EAknCtPopupSettingList;
- editor_resource_id = r_cl_setting_list_ed;
-}
-
-RESOURCE POPUP_SETTING_LIST r_cl_setting_list_ed
-{
- flags = 0;
-}
-
-RESOURCE TBUF r_caldav_conflictaction
- {
- buf = qtn_caldav_conflictaction;
- }
-
-RESOURCE AVKON_POPUP_SETTING_TEXTS r_caldav_conflictaction_texts
- {
- flags = 0;
- setting_texts_resource = r_caldav_conflictaction_setting_array;
- popped_up_texts_resource = r_caldav_conflictaction_popup_array;
- }
-
-RESOURCE ARRAY r_caldav_conflictaction_setting_array
- {
- items =
- {
- AVKON_ENUMERATED_TEXT { value = 1; text = qtn_caldav_keep_server; },
- AVKON_ENUMERATED_TEXT { value = 0; text = qtn_caldav_keep_device; }
- };
- }
-
-RESOURCE ARRAY r_caldav_conflictaction_popup_array
- {
- items =
- {
- LBUF { txt = qtn_caldav_keep_server; },
- LBUF { txt = qtn_caldav_keep_device; }
- };
- }
-
-RESOURCE TBUF r_caldav_immediatesync
- {
- buf = qtn_caldav_immediatesync;
- }
-
-RESOURCE AVKON_POPUP_SETTING_TEXTS r_caldav_immediatesync_texts
- {
- flags = 0;
- setting_texts_resource = r_caldav_immediatesync_setting_array;
- popped_up_texts_resource = r_caldav_immediatesync_popup_array;
- }
-
-RESOURCE ARRAY r_caldav_immediatesync_setting_array
- {
- items =
- {
- AVKON_ENUMERATED_TEXT { value = 1; text = qtn_caldav_immediatesync_yes; },
- AVKON_ENUMERATED_TEXT { value = 0; text = qtn_caldav_immediatesync_no; }
- };
- }
-
-RESOURCE ARRAY r_caldav_immediatesync_popup_array
- {
- items =
- {
- LBUF { txt = qtn_caldav_immediatesync_yes; },
- LBUF { txt = qtn_caldav_immediatesync_no; }
- };
- }
-
-RESOURCE TBUF r_caldav_enable
- {
- buf = qtn_caldav_enable;
- }
-
-RESOURCE AVKON_POPUP_SETTING_TEXTS r_caldav_enable_texts
- {
- flags = 0;
- setting_texts_resource = r_caldav_enable_setting_array;
- popped_up_texts_resource = r_caldav_enable_popup_array;
- }
-
-RESOURCE ARRAY r_caldav_enable_setting_array
- {
- items =
- {
- AVKON_ENUMERATED_TEXT { value = 1; text = qtn_caldav_yes; },
- AVKON_ENUMERATED_TEXT { value = 0; text = qtn_caldav_no; }
- };
- }
-
-RESOURCE ARRAY r_caldav_enable_popup_array
- {
- items =
- {
- LBUF { txt = qtn_caldav_yes; },
- LBUF { txt = qtn_caldav_no; }
- };
- }
-
-RESOURCE TBUF r_caldav_range
- {
- buf = qtn_caldav_range;
- }
-
-RESOURCE AVKON_POPUP_SETTING_TEXTS r_caldav_range_texts
- {
- flags = 0;
- setting_texts_resource = r_caldav_range_setting_array;
- popped_up_texts_resource = r_caldav_range_popup_array;
- }
-
-RESOURCE ARRAY r_caldav_range_setting_array
- {
- items =
- {
- AVKON_ENUMERATED_TEXT { value = 0; text = qtn_caldav_range_two; },
- AVKON_ENUMERATED_TEXT { value = 1; text = qtn_caldav_range_three; },
- AVKON_ENUMERATED_TEXT { value = 2; text = qtn_caldav_range_six; },
- AVKON_ENUMERATED_TEXT { value = 3; text = qtn_caldav_range_all; }
- };
- }
-
-RESOURCE ARRAY r_caldav_range_popup_array
- {
- items =
- {
- LBUF { txt = qtn_caldav_range_two; },
- LBUF { txt = qtn_caldav_range_three; },
- LBUF { txt = qtn_caldav_range_six; },
- LBUF { txt = qtn_caldav_range_all; }
-
- };
- }
-
-RESOURCE AVKON_POPUP_SETTING_TEXTS r_caldav_time_texts
- {
- flags = 0;
- setting_texts_resource = r_caldav_time_setting_array;
- popped_up_texts_resource = r_caldav_time_popup_array;
- }
-
-RESOURCE ARRAY r_caldav_time_setting_array
- {
- items =
- {
- AVKON_ENUMERATED_TEXT { value = 0; text = qtn_caldav_time_always; },
- AVKON_ENUMERATED_TEXT { value = 1; text = qtn_caldav_time_one; },
- AVKON_ENUMERATED_TEXT { value = 2; text = qtn_caldav_time_five; },
- AVKON_ENUMERATED_TEXT { value = 3; text = qtn_caldav_time_fifteen; },
- AVKON_ENUMERATED_TEXT { value = 4; text = qtn_caldav_time_thirty; }
- };
- }
-
-RESOURCE ARRAY r_caldav_time_popup_array
- {
- items =
- {
- LBUF { txt = qtn_caldav_time_always; },
- LBUF { txt = qtn_caldav_time_one; },
- LBUF { txt = qtn_caldav_time_five; },
- LBUF { txt = qtn_caldav_time_fifteen; },
- LBUF { txt = qtn_caldav_time_thirty; }
- };
- }
+/*
+* Copyright (c) 2010 Sun Microsystems, Inc. and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributor:
+* Maximilian Odendahl
+*
+* Contributors:
+*
+* Description: Caldav ECOM plugin resource file
+*
+*/
+
+#include <eikon.rh>
+#include <avkon.hrh>
+#include <avkon.rh>
+#include <avkon.rsg>
+
+#include <Calendar.loc>
+#include "caldav.loc"
+
+NAME CLU2
+
+RESOURCE RSS_SIGNATURE { }
+
+
+
+RESOURCE TBUF r_caldav
+ {
+ buf = qtn_caldav;
+ }
+
+RESOURCE TBUF r_caldav_query_disconnect
+ {
+ buf = qtn_caldav_query_disconnect;
+ }
+
+RESOURCE TBUF r_caldav_query_fail
+ {
+ buf = qtn_caldav_query_fail;
+ }
+
+RESOURCE TBUF r_caldav_query_success
+ {
+ buf = qtn_caldav_query_success;
+ }
+
+RESOURCE DIALOG r_query
+ {
+ flags = EGeneralQueryFlags;
+ buttons = R_AVKON_SOFTKEYS_YES_NO;
+ title = qtn_caldav;
+ items =
+ {
+ DLG_LINE
+ {
+ type = EAknCtQuery;
+ id = EGeneralQuery;
+ control = AVKON_CONFIRMATION_QUERY
+ {
+ layout = EConfirmationQueryLayout;
+ animation = R_QGN_NOTE_INFO_ANIM;
+ };
+ }
+ };
+ }
+
+RESOURCE TBUF r_caldav_access_point
+ {
+ buf = qtn_caldav_access_point;
+ }
+
+RESOURCE TBUF r_caldav_username
+ {
+ buf = qtn_caldav_username;
+ }
+
+RESOURCE TBUF r_caldav_url
+ {
+ buf = qtn_caldav_url;
+ }
+
+RESOURCE TBUF r_caldav_password
+ {
+ buf = qtn_caldav_password;
+ }
+
+RESOURCE TBUF r_caldav_syncinterval
+ {
+ buf = qtn_caldav_syncinterval;
+ }
+
+RESOURCE AVKON_SETTING_PAGE r_url_setting_page
+{
+ type = EEikCtEdwin;
+ editor_resource_id = r_url_editor_resource;
+}
+
+RESOURCE EDWIN r_url_editor_resource
+ {
+ maxlength = 255;
+ default_case = EAknEditorTextCase;
+ allowed_case_modes = EAknEditorAllCaseModes;
+ numeric_keymap = EAknEditorStandardNumberModeKeymap;
+ default_input_mode = EAknEditorTextInputMode;
+ allowed_input_modes = EAknEditorTextInputMode
+ | EAknEditorNumericInputMode
+ | EAknEditorSecretAlphaInputMode
+ | EAknEditorKatakanaInputMode
+ | EAknEditorFullWidthTextInputMode
+ | EAknEditorFullWidthNumericInputMode
+ | EAknEditorFullWidthKatakanaInputMode
+ | EAknEditorHiraganaKanjiInputMode
+ | EAknEditorHalfWidthTextInputMode;
+ special_character_table = R_AVKON_URL_SPECIAL_CHARACTER_TABLE_DIALOG;
+ lines = 0;
+ }
+
+RESOURCE AVKON_SETTING_PAGE r_username_setting_page
+{
+ type = EEikCtEdwin;
+ editor_resource_id = r_username_editor_resource;
+}
+
+RESOURCE EDWIN r_username_editor_resource
+{
+ maxlength = 255;
+ default_case = EAknEditorTextCase;
+ allowed_case_modes = EAknEditorAllCaseModes;
+ numeric_keymap = EAknEditorStandardNumberModeKeymap;
+ default_input_mode = EAknEditorTextInputMode;
+ allowed_input_modes = EAknEditorTextInputMode | EAknEditorNumericInputMode | EAknEditorSecretAlphaInputMode | EAknEditorKatakanaInputMode | EAknEditorFullWidthTextInputMode | EAknEditorFullWidthNumericInputMode | EAknEditorFullWidthKatakanaInputMode | EAknEditorHiraganaKanjiInputMode | EAknEditorHalfWidthTextInputMode;
+ lines = 0;
+}
+
+RESOURCE AVKON_SETTING_PAGE r_password_setting_page
+{
+ //type = EEikCtEdwin;
+ //editor_resource_id = r_password_editor_resource;
+ type = EEikCtSecretEd;
+ editor_resource_id = r_settinglist_alpha_password;
+}
+
+RESOURCE EDWIN r_password_editor_resource
+ {
+ maxlength = 255;
+ default_case = EAknEditorTextCase;
+ allowed_case_modes = EAknEditorAllCaseModes;
+ numeric_keymap = EAknEditorStandardNumberModeKeymap;
+ default_input_mode = EAknEditorTextInputMode;
+ allowed_input_modes = EAknEditorTextInputMode | EAknEditorNumericInputMode | EAknEditorSecretAlphaInputMode | EAknEditorKatakanaInputMode | EAknEditorFullWidthTextInputMode | EAknEditorFullWidthNumericInputMode | EAknEditorFullWidthKatakanaInputMode | EAknEditorHiraganaKanjiInputMode | EAknEditorHalfWidthTextInputMode;
+ lines = 0;
+ }
+
+RESOURCE SECRETED r_settinglist_alpha_password
+ {
+ num_letters = 100;
+ }
+
+
+RESOURCE TBUF r_caldav_time
+ {
+ buf = qtn_caldav_time;
+ }
+
+RESOURCE AVKON_SETTING_PAGE r_caldav_time_page
+
+ {
+ number = 1;
+ type = EEikCtTimeOffsetEditor;
+ editor_resource_id = r_caldav_time_editor;
+ }
+
+RESOURCE TIME_OFFSET_EDITOR r_caldav_time_editor
+ {
+ minTimeOffset = TIME_OFFSET { seconds = 0; };
+ maxTimeOffset = TIME_OFFSET { seconds = 43200; };
+ flags = EEikTimeWithoutSecondsField | EEikTimeZoneOffsetFormat;
+ }
+
+RESOURCE AVKON_SETTING_PAGE r_caldav_binary_page
+{
+ label = "";
+ type = EAknCtPopupSettingList;
+ editor_resource_id = r_cl_setting_list_ed;
+}
+
+RESOURCE POPUP_SETTING_LIST r_cl_setting_list_ed
+{
+ flags = 0;
+}
+
+RESOURCE TBUF r_caldav_conflictaction
+ {
+ buf = qtn_caldav_conflictaction;
+ }
+
+RESOURCE AVKON_POPUP_SETTING_TEXTS r_caldav_conflictaction_texts
+ {
+ flags = 0;
+ setting_texts_resource = r_caldav_conflictaction_setting_array;
+ popped_up_texts_resource = r_caldav_conflictaction_popup_array;
+ }
+
+RESOURCE ARRAY r_caldav_conflictaction_setting_array
+ {
+ items =
+ {
+ AVKON_ENUMERATED_TEXT { value = 1; text = qtn_caldav_keep_server; },
+ AVKON_ENUMERATED_TEXT { value = 0; text = qtn_caldav_keep_device; }
+ };
+ }
+
+RESOURCE ARRAY r_caldav_conflictaction_popup_array
+ {
+ items =
+ {
+ LBUF { txt = qtn_caldav_keep_server; },
+ LBUF { txt = qtn_caldav_keep_device; }
+ };
+ }
+
+RESOURCE TBUF r_caldav_immediatesync
+ {
+ buf = qtn_caldav_immediatesync;
+ }
+
+RESOURCE AVKON_POPUP_SETTING_TEXTS r_caldav_immediatesync_texts
+ {
+ flags = 0;
+ setting_texts_resource = r_caldav_immediatesync_setting_array;
+ popped_up_texts_resource = r_caldav_immediatesync_popup_array;
+ }
+
+RESOURCE ARRAY r_caldav_immediatesync_setting_array
+ {
+ items =
+ {
+ AVKON_ENUMERATED_TEXT { value = 1; text = qtn_caldav_immediatesync_yes; },
+ AVKON_ENUMERATED_TEXT { value = 0; text = qtn_caldav_immediatesync_no; }
+ };
+ }
+
+RESOURCE ARRAY r_caldav_immediatesync_popup_array
+ {
+ items =
+ {
+ LBUF { txt = qtn_caldav_immediatesync_yes; },
+ LBUF { txt = qtn_caldav_immediatesync_no; }
+ };
+ }
+
+RESOURCE TBUF r_caldav_enable
+ {
+ buf = qtn_caldav_enable;
+ }
+
+RESOURCE AVKON_POPUP_SETTING_TEXTS r_caldav_enable_texts
+ {
+ flags = 0;
+ setting_texts_resource = r_caldav_enable_setting_array;
+ popped_up_texts_resource = r_caldav_enable_popup_array;
+ }
+
+RESOURCE ARRAY r_caldav_enable_setting_array
+ {
+ items =
+ {
+ AVKON_ENUMERATED_TEXT { value = 1; text = qtn_caldav_yes; },
+ AVKON_ENUMERATED_TEXT { value = 0; text = qtn_caldav_no; }
+ };
+ }
+
+RESOURCE ARRAY r_caldav_enable_popup_array
+ {
+ items =
+ {
+ LBUF { txt = qtn_caldav_yes; },
+ LBUF { txt = qtn_caldav_no; }
+ };
+ }
+
+RESOURCE TBUF r_caldav_range
+ {
+ buf = qtn_caldav_range;
+ }
+
+RESOURCE AVKON_POPUP_SETTING_TEXTS r_caldav_range_texts
+ {
+ flags = 0;
+ setting_texts_resource = r_caldav_range_setting_array;
+ popped_up_texts_resource = r_caldav_range_popup_array;
+ }
+
+RESOURCE ARRAY r_caldav_range_setting_array
+ {
+ items =
+ {
+ AVKON_ENUMERATED_TEXT { value = 0; text = qtn_caldav_range_two; },
+ AVKON_ENUMERATED_TEXT { value = 1; text = qtn_caldav_range_three; },
+ AVKON_ENUMERATED_TEXT { value = 2; text = qtn_caldav_range_six; },
+ AVKON_ENUMERATED_TEXT { value = 3; text = qtn_caldav_range_all; }
+ };
+ }
+
+RESOURCE ARRAY r_caldav_range_popup_array
+ {
+ items =
+ {
+ LBUF { txt = qtn_caldav_range_two; },
+ LBUF { txt = qtn_caldav_range_three; },
+ LBUF { txt = qtn_caldav_range_six; },
+ LBUF { txt = qtn_caldav_range_all; }
+
+ };
+ }
+
+RESOURCE AVKON_POPUP_SETTING_TEXTS r_caldav_time_texts
+ {
+ flags = 0;
+ setting_texts_resource = r_caldav_time_setting_array;
+ popped_up_texts_resource = r_caldav_time_popup_array;
+ }
+
+RESOURCE ARRAY r_caldav_time_setting_array
+ {
+ items =
+ {
+ AVKON_ENUMERATED_TEXT { value = 0; text = qtn_caldav_time_always; },
+ AVKON_ENUMERATED_TEXT { value = 1; text = qtn_caldav_time_one; },
+ AVKON_ENUMERATED_TEXT { value = 2; text = qtn_caldav_time_five; },
+ AVKON_ENUMERATED_TEXT { value = 3; text = qtn_caldav_time_fifteen; },
+ AVKON_ENUMERATED_TEXT { value = 4; text = qtn_caldav_time_thirty; }
+ };
+ }
+
+RESOURCE ARRAY r_caldav_time_popup_array
+ {
+ items =
+ {
+ LBUF { txt = qtn_caldav_time_always; },
+ LBUF { txt = qtn_caldav_time_one; },
+ LBUF { txt = qtn_caldav_time_five; },
+ LBUF { txt = qtn_caldav_time_fifteen; },
+ LBUF { txt = qtn_caldav_time_thirty; }
+ };
+ }
--- a/calendarui/caldav/group/bld.inf Mon Mar 08 21:43:23 2010 +0000
+++ b/calendarui/caldav/group/bld.inf Sun Mar 14 13:09:26 2010 +0000
@@ -1,27 +1,27 @@
-/*
-* Copyright (c) 2010 Sun Microsystems, Inc. and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributor:
-* Maximilian Odendahl
-*
-* Contributors:
-*
-* Description: provides the information required for building
-* caldav ecom plugin, integrates into calendar
-*/
-
-#include <platform_paths.hrh>
-
-PRJ_PLATFORMS
-DEFAULT
-
-
-PRJ_MMPFILES
-calencaldavplugin.mmp
-
-// End of File
+/*
+* Copyright (c) 2010 Sun Microsystems, Inc. and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributor:
+* Maximilian Odendahl
+*
+* Contributors:
+*
+* Description: provides the information required for building
+* caldav ecom plugin, integrates into calendar
+*/
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+
+PRJ_MMPFILES
+calencaldavplugin.mmp
+
+// End of File
--- a/calendarui/caldav/group/calencaldavplugin.mmp Mon Mar 08 21:43:23 2010 +0000
+++ b/calendarui/caldav/group/calencaldavplugin.mmp Sun Mar 14 13:09:26 2010 +0000
@@ -1,78 +1,78 @@
-/*
-* Copyright (c) 2010 Sun Microsystems, Inc. and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributor:
-* Maximilian Odendahl
-*
-* Contributors:
-*
-* Description: This is the project specification file for the
-* Caldav ECOM plugin, integrates into calendar app
-*/
-
-#include <platform_paths.hrh>
-#include <data_caging_paths.hrh>
-#include "../inc/CalDavUids.h"
-
-TARGET calencaldavplugin.dll
-TARGETTYPE PLUGIN
-UID SYMBIAN_ECOM_PLUGIN_UID CALENCALDAVPLUGIN_DLL_UID
-
-CAPABILITY CAP_APPLICATION
-
-//Includes
-USERINCLUDE ../inc
-USERINCLUDE ../../inc
-
-APP_LAYER_SYSTEMINCLUDE
-SYSTEMINCLUDE ../../../inc
-SYSTEMINCLUDE /epoc32/include/
-SYSTEMINCLUDE /epoc32/include/ecom
-
-SOURCEPATH ../src
-SOURCE calencaldavplugin.cpp
-SOURCE calencaldavpluginProxy.cpp
-SOURCE caldavsettingitems.cpp
-
-USERINCLUDE ../../settings/settingsui/inc
-SOURCEPATH ../../settings/settingsui/src
-SOURCE calennestedsettingitem.cpp
-SOURCE calennestedsettingdialog.cpp
-
-// Resources
-SOURCEPATH ../data
-START RESOURCE 2002B503.rss
- TARGET calencaldavplugin.rsc
-END
-
-START RESOURCE ../data/calencaldavplugindata.rss
-HEADER
-TARGETPATH RESOURCE_FILES_DIR
-LANGUAGE_IDS
-END
-
-LIBRARY avkon.lib
-LIBRARY calinterimapi.lib
-LIBRARY cone.lib
-LIBRARY ecom.lib
-LIBRARY eikcoctl.lib
-LIBRARY eikcore.lib
-LIBRARY euser.lib
-LIBRARY bafl.lib
-LIBRARY CommonEngine.lib
-LIBRARY eikdlg.lib
-LIBRARY hlplch.lib
-LIBRARY FeatMgr.lib
-LIBRARY aknskins.lib
-LIBRARY aknicon.lib
-LIBRARY flogger.lib
-LIBRARY caldavclient.lib
-LIBRARY commdb.lib
-LIBRARY cmmanager.lib
-LIBRARY charconv.lib
-LIBRARY esock.lib
+/*
+* Copyright (c) 2010 Sun Microsystems, Inc. and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributor:
+* Maximilian Odendahl
+*
+* Contributors:
+*
+* Description: This is the project specification file for the
+* Caldav ECOM plugin, integrates into calendar app
+*/
+
+#include <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+#include "../inc/CalDavUids.h"
+
+TARGET calencaldavplugin.dll
+TARGETTYPE PLUGIN
+UID SYMBIAN_ECOM_PLUGIN_UID CALENCALDAVPLUGIN_DLL_UID
+
+CAPABILITY CAP_APPLICATION
+
+//Includes
+USERINCLUDE ../inc
+USERINCLUDE ../../inc
+
+APP_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE ../../../inc
+SYSTEMINCLUDE /epoc32/include/
+SYSTEMINCLUDE /epoc32/include/ecom
+
+SOURCEPATH ../src
+SOURCE calencaldavplugin.cpp
+SOURCE calencaldavpluginProxy.cpp
+SOURCE caldavsettingitems.cpp
+
+USERINCLUDE ../../settings/settingsui/inc
+SOURCEPATH ../../settings/settingsui/src
+SOURCE calennestedsettingitem.cpp
+SOURCE calennestedsettingdialog.cpp
+
+// Resources
+SOURCEPATH ../data
+START RESOURCE 2002B503.rss
+ TARGET calencaldavplugin.rsc
+END
+
+START RESOURCE ../data/calencaldavplugindata.rss
+HEADER
+TARGETPATH RESOURCE_FILES_DIR
+LANGUAGE_IDS
+END
+
+LIBRARY avkon.lib
+LIBRARY calinterimapi.lib
+LIBRARY cone.lib
+LIBRARY ecom.lib
+LIBRARY eikcoctl.lib
+LIBRARY eikcore.lib
+LIBRARY euser.lib
+LIBRARY bafl.lib
+LIBRARY CommonEngine.lib
+LIBRARY eikdlg.lib
+LIBRARY hlplch.lib
+LIBRARY FeatMgr.lib
+LIBRARY aknskins.lib
+LIBRARY aknicon.lib
+LIBRARY flogger.lib
+LIBRARY caldavclient.lib
+LIBRARY commdb.lib
+LIBRARY cmmanager.lib
+LIBRARY charconv.lib
+LIBRARY esock.lib
--- a/calendarui/caldav/inc/CalDavUids.h Mon Mar 08 21:43:23 2010 +0000
+++ b/calendarui/caldav/inc/CalDavUids.h Sun Mar 14 13:09:26 2010 +0000
@@ -1,27 +1,27 @@
-/*
-* Copyright (c) 2010 Sun Microsystems, Inc. and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributor:
-* Maximilian Odendahl
-*
-* Contributors:
-*
-* Description: Caldav UIDs
-*
-*/
-
-#ifndef CALDAVUIDS_H_
-#define CALDAVUIDS_H_
-
-#define SYMBIAN_ECOM_PLUGIN_UID 0x10009D8D
-#define CALENUIPLUGININTERFACE_ECOM_INTERFACE_UID 0x1028336F
-
-#define CALENCALDAVPLUGIN_DLL_UID 0x2002B503
-#define CALEN_CALDAV_IMPLEMENTATION_UID 0x2002B81E
-
-#endif /* CALDAVUIDS_H_ */
+/*
+* Copyright (c) 2010 Sun Microsystems, Inc. and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributor:
+* Maximilian Odendahl
+*
+* Contributors:
+*
+* Description: Caldav UIDs
+*
+*/
+
+#ifndef CALDAVUIDS_H_
+#define CALDAVUIDS_H_
+
+#define SYMBIAN_ECOM_PLUGIN_UID 0x10009D8D
+#define CALENUIPLUGININTERFACE_ECOM_INTERFACE_UID 0x1028336F
+
+#define CALENCALDAVPLUGIN_DLL_UID 0x2002B503
+#define CALEN_CALDAV_IMPLEMENTATION_UID 0x2002B81E
+
+#endif /* CALDAVUIDS_H_ */
--- a/calendarui/caldav/inc/caldavsettingitems.h Mon Mar 08 21:43:23 2010 +0000
+++ b/calendarui/caldav/inc/caldavsettingitems.h Sun Mar 14 13:09:26 2010 +0000
@@ -1,158 +1,158 @@
-/*
-* Copyright (c) 2010 Sun Microsystems, Inc. and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributor:
-* Maximilian Odendahl
-*
-* Contributors:
-*
-* Description: Caldav setting items
-*
-*/
-
-#ifndef SETTINGITEMS_H
-#define SETTINGITEMS_H
-
-// INCLUDES
-#include <e32std.h>
-#include <e32base.h>
-
-#include <aknsettingitemlist.h>
-
-class CCalDavSession;
-
-class CCalDavTextSettingItem : public CAknTextSettingItem
- {
- public:
-
- static CCalDavTextSettingItem* NewL(TInt aId, CCalDavSession* aSession, const TDesC &aCalendar);
- static CCalDavTextSettingItem* NewLC(TInt aId,CCalDavSession* aSession, const TDesC &aCalendar);
- ~CCalDavTextSettingItem();
-
- void SetEnableSettingItem(CAknSettingItem* aItem);
-
- private:
- CCalDavTextSettingItem(TInt aId, CCalDavSession* aSession);
-
- void ConstructL(const TDesC &aCalendar);
-
- protected:// From base classes
- void EditItemL( TBool aCalledFromMenu );
- virtual void StoreL();
- virtual void LoadL();
-
- private:
- TBuf<500> iInternalValue;
- CCalDavSession* iSession;
- HBufC* iCalendar;
- CAknSettingItem* iEnableSettingItem; // not owned
- };
-
-class CCalDavPasswordSettingItem : public CAknPasswordSettingItem
- {
- public:
-
- static CCalDavPasswordSettingItem* NewL(TInt aId, CCalDavSession* aSession, const TDesC &aCalendar);
- static CCalDavPasswordSettingItem* NewLC(TInt aId, CCalDavSession* aSession, const TDesC &aCalendar);
- ~CCalDavPasswordSettingItem();
-
- void SetEnableSettingItem(CAknSettingItem* aItem);
-
- private:
- CCalDavPasswordSettingItem(TInt aId, CCalDavSession* aSession);
-
- void ConstructL(const TDesC &aCalendar);
-
- protected:// From base classes
- void EditItemL( TBool aCalledFromMenu );
- virtual void StoreL();
- virtual void LoadL();
-
- private:
- TBuf<500> iInternalValue;
- CCalDavSession* iSession;
- HBufC* iCalendar;
- CAknSettingItem* iEnableSettingItem; // not owned
- };
-
-class CCalDavBooleanSettingItem : public CAknBinaryPopupSettingItem
- {
- public:
-
- static CCalDavBooleanSettingItem* NewL(TInt aId, CCalDavSession* aSession, const TDesC &aCalendar);
- static CCalDavBooleanSettingItem* NewLC(TInt aId, CCalDavSession* aSession, const TDesC &aCalendar);
- ~CCalDavBooleanSettingItem();
-
- private:
- CCalDavBooleanSettingItem(TInt aId, CCalDavSession* aSession);
-
- void ConstructL(const TDesC &aCalendar);
-
- protected:// From base classes
- void EditItemL( TBool aCalledFromMenu );
- virtual void StoreL();
- virtual void LoadL();
-
- private:
- TBool iInternalValue;
- CCalDavSession* iSession;
- HBufC* iCalendar;
- };
-
-class CCalDavEnumeratedTextSettingItem : public CAknEnumeratedTextPopupSettingItem
- {
- public:
-
- static CCalDavEnumeratedTextSettingItem* NewL(TInt aId, CCalDavSession* aSession, const TDesC &aCalendar);
- static CCalDavEnumeratedTextSettingItem* NewLC(TInt aId, CCalDavSession* aSession, const TDesC &aCalendar);
- ~CCalDavEnumeratedTextSettingItem();
-
- private:
- CCalDavEnumeratedTextSettingItem(TInt aId, CCalDavSession* aSession);
-
- void ConstructL(const TDesC &aCalendar);
-
- protected:// From base classes
- void EditItemL( TBool aCalledFromMenu );
- virtual void StoreL();
- virtual void LoadL();
-
- private:
- TInt iInternalValue;
- CCalDavSession* iSession;
- HBufC* iCalendar;
- };
-
-class CCalDavAccessPointSettingItem : public CAknSettingItem
- {
- public:
- static CCalDavAccessPointSettingItem*
- CCalDavAccessPointSettingItem::NewL( TInt aSettingId, CCalDavSession* aSession, const TDesC &aCalendar);
- ~CCalDavAccessPointSettingItem();
- private:
- CCalDavAccessPointSettingItem ( TInt aSettingId, CCalDavSession* aSession);
- void ConstructL(const TDesC &aCalendar);
-
-
- protected: // from CAknSettingItem
- void EditItemL( TBool aCalledFromMenu );
- virtual void StoreL();
- virtual void LoadL();
-
- const TDesC& SettingTextL();
-
- private:
- TBool EditAccessPointItemL();
-
- private:
- HBufC* iSettingText;
- CCalDavSession* iSession;
- };
-
-
-#endif // SETTINGITEMS_H
+/*
+* Copyright (c) 2010 Sun Microsystems, Inc. and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributor:
+* Maximilian Odendahl
+*
+* Contributors:
+*
+* Description: Caldav setting items
+*
+*/
+
+#ifndef SETTINGITEMS_H
+#define SETTINGITEMS_H
+
+// INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+
+#include <aknsettingitemlist.h>
+
+class CCalDavSession;
+
+class CCalDavTextSettingItem : public CAknTextSettingItem
+ {
+ public:
+
+ static CCalDavTextSettingItem* NewL(TInt aId, CCalDavSession* aSession, const TDesC &aCalendar);
+ static CCalDavTextSettingItem* NewLC(TInt aId,CCalDavSession* aSession, const TDesC &aCalendar);
+ ~CCalDavTextSettingItem();
+
+ void SetEnableSettingItem(CAknSettingItem* aItem);
+
+ private:
+ CCalDavTextSettingItem(TInt aId, CCalDavSession* aSession);
+
+ void ConstructL(const TDesC &aCalendar);
+
+ protected:// From base classes
+ void EditItemL( TBool aCalledFromMenu );
+ virtual void StoreL();
+ virtual void LoadL();
+
+ private:
+ TBuf<500> iInternalValue;
+ CCalDavSession* iSession;
+ HBufC* iCalendar;
+ CAknSettingItem* iEnableSettingItem; // not owned
+ };
+
+class CCalDavPasswordSettingItem : public CAknPasswordSettingItem
+ {
+ public:
+
+ static CCalDavPasswordSettingItem* NewL(TInt aId, CCalDavSession* aSession, const TDesC &aCalendar);
+ static CCalDavPasswordSettingItem* NewLC(TInt aId, CCalDavSession* aSession, const TDesC &aCalendar);
+ ~CCalDavPasswordSettingItem();
+
+ void SetEnableSettingItem(CAknSettingItem* aItem);
+
+ private:
+ CCalDavPasswordSettingItem(TInt aId, CCalDavSession* aSession);
+
+ void ConstructL(const TDesC &aCalendar);
+
+ protected:// From base classes
+ void EditItemL( TBool aCalledFromMenu );
+ virtual void StoreL();
+ virtual void LoadL();
+
+ private:
+ TBuf<500> iInternalValue;
+ CCalDavSession* iSession;
+ HBufC* iCalendar;
+ CAknSettingItem* iEnableSettingItem; // not owned
+ };
+
+class CCalDavBooleanSettingItem : public CAknBinaryPopupSettingItem
+ {
+ public:
+
+ static CCalDavBooleanSettingItem* NewL(TInt aId, CCalDavSession* aSession, const TDesC &aCalendar);
+ static CCalDavBooleanSettingItem* NewLC(TInt aId, CCalDavSession* aSession, const TDesC &aCalendar);
+ ~CCalDavBooleanSettingItem();
+
+ private:
+ CCalDavBooleanSettingItem(TInt aId, CCalDavSession* aSession);
+
+ void ConstructL(const TDesC &aCalendar);
+
+ protected:// From base classes
+ void EditItemL( TBool aCalledFromMenu );
+ virtual void StoreL();
+ virtual void LoadL();
+
+ private:
+ TBool iInternalValue;
+ CCalDavSession* iSession;
+ HBufC* iCalendar;
+ };
+
+class CCalDavEnumeratedTextSettingItem : public CAknEnumeratedTextPopupSettingItem
+ {
+ public:
+
+ static CCalDavEnumeratedTextSettingItem* NewL(TInt aId, CCalDavSession* aSession, const TDesC &aCalendar);
+ static CCalDavEnumeratedTextSettingItem* NewLC(TInt aId, CCalDavSession* aSession, const TDesC &aCalendar);
+ ~CCalDavEnumeratedTextSettingItem();
+
+ private:
+ CCalDavEnumeratedTextSettingItem(TInt aId, CCalDavSession* aSession);
+
+ void ConstructL(const TDesC &aCalendar);
+
+ protected:// From base classes
+ void EditItemL( TBool aCalledFromMenu );
+ virtual void StoreL();
+ virtual void LoadL();
+
+ private:
+ TInt iInternalValue;
+ CCalDavSession* iSession;
+ HBufC* iCalendar;
+ };
+
+class CCalDavAccessPointSettingItem : public CAknSettingItem
+ {
+ public:
+ static CCalDavAccessPointSettingItem*
+ CCalDavAccessPointSettingItem::NewL( TInt aSettingId, CCalDavSession* aSession, const TDesC &aCalendar);
+ ~CCalDavAccessPointSettingItem();
+ private:
+ CCalDavAccessPointSettingItem ( TInt aSettingId, CCalDavSession* aSession);
+ void ConstructL(const TDesC &aCalendar);
+
+
+ protected: // from CAknSettingItem
+ void EditItemL( TBool aCalledFromMenu );
+ virtual void StoreL();
+ virtual void LoadL();
+
+ const TDesC& SettingTextL();
+
+ private:
+ TBool EditAccessPointItemL();
+
+ private:
+ HBufC* iSettingText;
+ CCalDavSession* iSession;
+ };
+
+
+#endif // SETTINGITEMS_H
--- a/calendarui/caldav/inc/calencaldavplugin.h Mon Mar 08 21:43:23 2010 +0000
+++ b/calendarui/caldav/inc/calencaldavplugin.h Sun Mar 14 13:09:26 2010 +0000
@@ -1,105 +1,105 @@
-/*
-* Copyright (c) 2010 Sun Microsystems, Inc. and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributor:
-* Maximilian Odendahl
-*
-* Contributors:
-*
-* Description: CalDav ECOM plugin
-*
-*/
-
-#ifndef __CALENLUNARPLUGIN_H__
-#define __CALENLUNARPLUGIN_H__
-
-//SYSTEM INCLUDES
-#include <e32base.h>
-#include <ecom.h>
-
-//CALENDAR INCLUDES
-#include <calencommandhandler.h>
-#include <calennotificationhandler.h>
-#include "calencustomisation.h"
-#include "CalendarVariant.hrh"
-
-//FORWARD DECLARE
-class CEikonEnv;
-class CCalenLunarInfoProvider;
-class CEikLabel;
-class CCoeControl;
-class TRect;
-class CEikMenuPane;
-class CCalDavSession;
-
-enum TCalDavSettingItem
-{
- ECalDavSettingUrl = 0,
- ECalDavSettingUser,
- ECalDavSettingPassword,
- ECalDavSettingEnable,
- ECalDavSettingKeepServer,
- ECalDavSettingSyncImmediate,
- ECalDavSettingSyncInterval,
- ECalDavSettingSyncRange,
- ECalDavSettingAccess
-};
-
-//CLASS DECLARATION
-NONSHARABLE_CLASS(CCalenCalDavPlugin) : public CCalenCustomisation,
- public MCalenCommandHandler,
- public MCalenNotificationHandler
-
- {
- public:
-
- static CCalenCalDavPlugin* NewL( MCalenServices* aServices );
- virtual ~CCalenCalDavPlugin();
-
- private:
- CCalenCalDavPlugin( MCalenServices* aServices);
- void ConstructL();
-
- public: //From CCalenCustomisation
- void GetCustomViewsL( RPointerArray<CCalenView>& aCustomViewArray );
- void GetCustomSettingsL( RPointerArray<CAknSettingItem>& aCustomSettingArray );
- CCoeControl* InfobarL( const TRect& aRect );
- const TDesC& InfobarL();
- MCalenPreview* CustomPreviewPaneL( TRect& aRect );
- CCoeControl* PreviewPaneL( TRect& aRect );
- MCalenCommandHandler* CommandHandlerL( TInt aCommand );
- void RemoveViewsFromCycle( RArray<TInt>& aViews );
- TBool CustomiseMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane );
- TBool CanBeEnabledDisabled();
- TAny* CalenCustomisationExtensionL( TUid aExtensionUid );
-
- public:// From MCalenCommandHandler
- TBool HandleCommandL( const TCalenCommand& aCommand );
- TAny* CalenCommandHandlerExtensionL( TUid aExtensionUid );
-
- public://From MCalenNotificationHandler
- void HandleNotification( const TCalenNotification aNotification );
-
- private:
-
- MCalenServices* iServices;
-
- TInt iStart;
- TInt iEnd;
- TRect iRect;
- TInt iResourceFileOffset;
-
- CCalDavSession* iSession;
-
- };
-
-#endif //__CALENLUNARPLUGIN_H__
-
-
-
-
+/*
+* Copyright (c) 2010 Sun Microsystems, Inc. and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributor:
+* Maximilian Odendahl
+*
+* Contributors:
+*
+* Description: CalDav ECOM plugin
+*
+*/
+
+#ifndef __CALENLUNARPLUGIN_H__
+#define __CALENLUNARPLUGIN_H__
+
+//SYSTEM INCLUDES
+#include <e32base.h>
+#include <ecom.h>
+
+//CALENDAR INCLUDES
+#include <calencommandhandler.h>
+#include <calennotificationhandler.h>
+#include "calencustomisation.h"
+#include "CalendarVariant.hrh"
+
+//FORWARD DECLARE
+class CEikonEnv;
+class CCalenLunarInfoProvider;
+class CEikLabel;
+class CCoeControl;
+class TRect;
+class CEikMenuPane;
+class CCalDavSession;
+
+enum TCalDavSettingItem
+{
+ ECalDavSettingUrl = 0,
+ ECalDavSettingUser,
+ ECalDavSettingPassword,
+ ECalDavSettingEnable,
+ ECalDavSettingKeepServer,
+ ECalDavSettingSyncImmediate,
+ ECalDavSettingSyncInterval,
+ ECalDavSettingSyncRange,
+ ECalDavSettingAccess
+};
+
+//CLASS DECLARATION
+NONSHARABLE_CLASS(CCalenCalDavPlugin) : public CCalenCustomisation,
+ public MCalenCommandHandler,
+ public MCalenNotificationHandler
+
+ {
+ public:
+
+ static CCalenCalDavPlugin* NewL( MCalenServices* aServices );
+ virtual ~CCalenCalDavPlugin();
+
+ private:
+ CCalenCalDavPlugin( MCalenServices* aServices);
+ void ConstructL();
+
+ public: //From CCalenCustomisation
+ void GetCustomViewsL( RPointerArray<CCalenView>& aCustomViewArray );
+ void GetCustomSettingsL( RPointerArray<CAknSettingItem>& aCustomSettingArray );
+ CCoeControl* InfobarL( const TRect& aRect );
+ const TDesC& InfobarL();
+ MCalenPreview* CustomPreviewPaneL( TRect& aRect );
+ CCoeControl* PreviewPaneL( TRect& aRect );
+ MCalenCommandHandler* CommandHandlerL( TInt aCommand );
+ void RemoveViewsFromCycle( RArray<TInt>& aViews );
+ TBool CustomiseMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane );
+ TBool CanBeEnabledDisabled();
+ TAny* CalenCustomisationExtensionL( TUid aExtensionUid );
+
+ public:// From MCalenCommandHandler
+ TBool HandleCommandL( const TCalenCommand& aCommand );
+ TAny* CalenCommandHandlerExtensionL( TUid aExtensionUid );
+
+ public://From MCalenNotificationHandler
+ void HandleNotification( const TCalenNotification aNotification );
+
+ private:
+
+ MCalenServices* iServices;
+
+ TInt iStart;
+ TInt iEnd;
+ TRect iRect;
+ TInt iResourceFileOffset;
+
+ CCalDavSession* iSession;
+
+ };
+
+#endif //__CALENLUNARPLUGIN_H__
+
+
+
+
--- a/calendarui/caldav/sis/caldavplugin.pkg Mon Mar 08 21:43:23 2010 +0000
+++ b/calendarui/caldav/sis/caldavplugin.pkg Sun Mar 14 13:09:26 2010 +0000
@@ -1,43 +1,43 @@
-/*
-* Copyright (c) 2010 Sun Microsystems, Inc. and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributor:
-* Maximilian Odendahl
-*
-* Contributors:
-*
-* Description: sis file to package all Caldav components
-*
-*/
-
-; Languages
-&EN
-
-; Header
-#{"CalDAV plugin"}, (0x2002B775), 1, 0, 0
-
-; Localised Vendor name
-%{"Sun Microsystems"}
-
-; Unique Vendor name
-:"Sun Microsystems"
-
-;Platform Dependency
-[0x1028315f],0 ,0 ,0,{"S60ProductID"}
-
-; ------ files -----
-
-; caldav client-server
-"\epoc32\release\armv5\urel\CalDavServer.exe "-"!:\sys\bin\CalDavServer.exe"
-"\epoc32\release\armv5\urel\CalDavClient.dll "-"!:\sys\bin\CalDavClient.dll"
-
-;caldav calendarui ecom plugin
-"\epoc32\release\armv5\urel\calencaldavplugin.dll"-"!:\sys\Bin\calencaldavplugin.dll"
-"\epoc32\data\z\resource\calencaldavplugindata.rsc"-"!:\resource\plugins\calencaldavplugindata.rsc"
-"\epoc32\data\z\resource\calencaldavplugindata.r01" - "!:\resource\calencaldavplugindata.r01"
+/*
+* Copyright (c) 2010 Sun Microsystems, Inc. and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributor:
+* Maximilian Odendahl
+*
+* Contributors:
+*
+* Description: sis file to package all Caldav components
+*
+*/
+
+; Languages
+&EN
+
+; Header
+#{"CalDAV plugin"}, (0x2002B775), 1, 0, 0
+
+; Localised Vendor name
+%{"Sun Microsystems"}
+
+; Unique Vendor name
+:"Sun Microsystems"
+
+;Platform Dependency
+[0x1028315f],0 ,0 ,0,{"S60ProductID"}
+
+; ------ files -----
+
+; caldav client-server
+"\epoc32\release\armv5\urel\CalDavServer.exe "-"!:\sys\bin\CalDavServer.exe"
+"\epoc32\release\armv5\urel\CalDavClient.dll "-"!:\sys\bin\CalDavClient.dll"
+
+;caldav calendarui ecom plugin
+"\epoc32\release\armv5\urel\calencaldavplugin.dll"-"!:\sys\Bin\calencaldavplugin.dll"
+"\epoc32\data\z\resource\calencaldavplugindata.rsc"-"!:\resource\plugins\calencaldavplugindata.rsc"
+"\epoc32\data\z\resource\calencaldavplugindata.r01" - "!:\resource\calencaldavplugindata.r01"
"\epoc32\data\z\resource\plugins\calencaldavplugin.rsc"-"!:\resource\plugins\calencaldavplugin.rsc"
\ No newline at end of file
--- a/calendarui/caldav/src/caldavsettingitems.cpp Mon Mar 08 21:43:23 2010 +0000
+++ b/calendarui/caldav/src/caldavsettingitems.cpp Sun Mar 14 13:09:26 2010 +0000
@@ -1,887 +1,887 @@
-/*
-* Copyright (c) 2010 Sun Microsystems, Inc. and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributor:
-* Maximilian Odendahl
-*
-* Contributors:
-*
-* Description: Caldav setting items
-*
-*/
-
-#include "caldavsettingitems.h"
-
-#include <StringLoader.h>
-#include <aknnotewrappers.h>
-#include <cmapplicationsettingsui.h>
-#include <CommDbConnPref.h>
-#include <UTF.H>
-
-#include <caldavsession.h>
-#include "calencaldavplugin.h"
-#include <calencaldavplugindata.rsg>
-
-#define KMAXSETTINGLENGTH 500
-
-#define KTIMETWOWEEKS 14
-#define KTIMETHREEMONTH 30*3
-#define KTIMESIXMONTH 30*6
-#define KTIMEALL 1000
-
-#define KTIMEALWAYSON 0
-#define KTIMEONEMINUTE 1
-#define KTIMEFIVEMINUTES 5
-#define KTIMEFIFTEENMINUTES 15
-#define KTIMETHIRTYMINUTES 30
-
-/**
+/*
+* Copyright (c) 2010 Sun Microsystems, Inc. and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributor:
+* Maximilian Odendahl
+*
+* Contributors:
+*
+* Description: Caldav setting items
+*
+*/
+
+#include "caldavsettingitems.h"
+
+#include <StringLoader.h>
+#include <aknnotewrappers.h>
+#include <cmapplicationsettingsui.h>
+#include <CommDbConnPref.h>
+#include <UTF.H>
+
+#include <caldavsession.h>
+#include "calencaldavplugin.h"
+#include <calencaldavplugindata.rsg>
+
+#define KMAXSETTINGLENGTH 500
+
+#define KTIMETWOWEEKS 14
+#define KTIMETHREEMONTH 30*3
+#define KTIMESIXMONTH 30*6
+#define KTIMEALL 1000
+
+#define KTIMEALWAYSON 0
+#define KTIMEONEMINUTE 1
+#define KTIMEFIVEMINUTES 5
+#define KTIMEFIFTEENMINUTES 15
+#define KTIMETHIRTYMINUTES 30
+
+/**
* show a global info note
- */
-void ShowNoteL(TInt aResource)
- {
- HBufC* text = StringLoader::LoadLC(aResource);
- CAknConfirmationNote* note = new (ELeave) CAknConfirmationNote();
- note->ExecuteLD(*text);
- CleanupStack::PopAndDestroy(text);
- }
-
-/**
- * CCalDavTextSettingItem::CCalDavTextSettingItem
+ */
+void ShowNoteL(TInt aResource)
+ {
+ HBufC* text = StringLoader::LoadLC(aResource);
+ CAknConfirmationNote* note = new (ELeave) CAknConfirmationNote();
+ note->ExecuteLD(*text);
+ CleanupStack::PopAndDestroy(text);
+ }
+
+/**
+ * CCalDavTextSettingItem::CCalDavTextSettingItem
+ * default constructor
+ */
+CCalDavTextSettingItem::CCalDavTextSettingItem(TInt aId,
+ CCalDavSession* aSession) :
+ CAknTextSettingItem(aId, iInternalValue), iSession(aSession)
+ {
+
+ }
+
+/**
+ * CCalDavTextSettingItem::~CCalDavTextSettingItem
+ * destructor
+ */
+CCalDavTextSettingItem::~CCalDavTextSettingItem()
+ {
+ delete iCalendar;
+ }
+
+/**
+ * CCalDavTextSettingItem::NewLC
+ * 1st-phase construction
+ */
+CCalDavTextSettingItem* CCalDavTextSettingItem::NewLC(TInt aId,
+ CCalDavSession* aSession, const TDesC &aCalendar)
+ {
+ CCalDavTextSettingItem* self = new (ELeave) CCalDavTextSettingItem(aId,
+ aSession);
+ CleanupStack::PushL(self);
+ self->ConstructL(aCalendar);
+ return self;
+ }
+
+/**
+ * CCalDavTextSettingItem::NewL
+ * 1st-phase construction
+ */
+CCalDavTextSettingItem* CCalDavTextSettingItem::NewL(TInt aId,
+ CCalDavSession* aSession, const TDesC &aCalendar)
+ {
+ CCalDavTextSettingItem* self = CCalDavTextSettingItem::NewLC(aId, aSession,
+ aCalendar);
+ CleanupStack::Pop(); // self;
+ return self;
+ }
+
+/**
+ * CCalDavTextSettingItem::ConstructL
+ * 2nd-phase construction
+ */
+void CCalDavTextSettingItem::ConstructL(const TDesC &aCalendar)
+ {
+ iCalendar = aCalendar.AllocL();
+ HBufC* title = NULL;
+ TInt page = 0;
+ switch (Identifier())
+ {
+ case ECalDavSettingUrl:
+ title = StringLoader::LoadLC(R_CALDAV_URL);
+ page = R_URL_SETTING_PAGE;
+ break;
+ case ECalDavSettingUser:
+ title = StringLoader::LoadLC(R_CALDAV_USERNAME);
+ page = R_USERNAME_SETTING_PAGE;
+ break;
+ case ECalDavSettingPassword:
+ title = StringLoader::LoadLC(R_CALDAV_PASSWORD);
+ page = R_PASSWORD_SETTING_PAGE;
+ break;
+ }
+ SetEmptyItemTextL(KNullDesC);
+ CAknTextSettingItem::ConstructL(EFalse, 0, *title, NULL,page, -1);
+ CleanupStack::PopAndDestroy(title);
+ }
+
+/**
+ * CCalDavTextSettingItem::EditItemL
+ * Edits the item
+ */
+void CCalDavTextSettingItem::EditItemL(TBool aCalledFromMenu)
+ {
+ TBool enabled;
+ iSession->EnabledSync(*iCalendar, enabled);
+ if (enabled)
+ {
+ HBufC* text = StringLoader::LoadLC(R_CALDAV_QUERY_DISCONNECT);
+ CAknQueryDialog* dlg = CAknQueryDialog::NewL();
+ if (dlg->ExecuteLD(R_QUERY, *text))
+ {
+ CAknTextSettingItem::EditItemL(aCalledFromMenu);
+ // TODO: disable Enabled-Setting-Item
+ }
+ CleanupStack::PopAndDestroy(text);
+ }
+ else
+ CAknTextSettingItem::EditItemL(aCalledFromMenu);
+ }
+
+/**
+ * CCalDavTextSettingItem::StoreL
+ * Stores the item
+ */
+void CCalDavTextSettingItem::StoreL()
+ {
+ CAknTextSettingItem::StoreL();
+
+ HBufC8* text = CnvUtfConverter::ConvertFromUnicodeToUtf8L(iInternalValue);
+ CleanupStack::PushL(text);
+
+ switch (Identifier())
+ {
+ case ECalDavSettingUrl:
+ iSession->SetUrl(*iCalendar, *text);
+ break;
+ case ECalDavSettingUser:
+ iSession->SetUsername(*iCalendar, *text);
+ break;
+ case ECalDavSettingPassword:
+ iSession->SetPassword(*iCalendar, *text);
+ break;
+ }
+ CleanupStack::PopAndDestroy(text);
+
+ if (iEnableSettingItem)
+ {
+ iEnableSettingItem->LoadL();
+ iEnableSettingItem->UpdateListBoxTextL();
+ }
+ }
+
+/**
+ * CCalDavTextSettingItem::LoadL
+ * loades the item
+ */
+void CCalDavTextSettingItem::LoadL()
+ {
+ HBufC8* buf = HBufC8::NewL(KMAXSETTINGLENGTH);
+ TPtr8 ptr(buf->Des());
+ switch (Identifier())
+ {
+ case ECalDavSettingUrl:
+ iSession->Url(*iCalendar, ptr);
+ break;
+ case ECalDavSettingUser:
+ iSession->Username(*iCalendar, ptr);
+ break;
+ case ECalDavSettingPassword:
+ iSession->Password(*iCalendar, ptr);
+ break;
+ }
+ CnvUtfConverter::ConvertToUnicodeFromUtf8(iInternalValue, ptr);
+ delete buf;
+ CAknTextSettingItem::LoadL();
+ }
+
+/**
+ * CCalDavTextSettingItem::StoreL
+ * Save a pointer to the Enable Item, this is used to set current
+ * enable/disable state
+ */
+void CCalDavTextSettingItem::SetEnableSettingItem(CAknSettingItem* aItem)
+ {
+ iEnableSettingItem = aItem;
+ }
+
+/**
+ * CCalDavPasswordSettingItem::CCalDavPasswordSettingItem
+ * default constructor
+ */
+CCalDavPasswordSettingItem::CCalDavPasswordSettingItem(TInt aId,
+ CCalDavSession* aSession) :
+ CAknPasswordSettingItem(aId, CAknPasswordSettingItem::EAlpha,
+ iInternalValue), iSession(aSession)
+ {
+
+ }
+
+/**
+ * CCalDavPasswordSettingItem::~CCalDavPasswordSettingItem
+ * default destructor
+ */
+CCalDavPasswordSettingItem::~CCalDavPasswordSettingItem()
+ {
+ delete iCalendar;
+ }
+
+/**
+ * CCalDavPasswordSettingItem::NewLC
+ * first phase construction
+ */
+CCalDavPasswordSettingItem* CCalDavPasswordSettingItem::NewLC(TInt aId,
+ CCalDavSession* aSession, const TDesC &aCalendar)
+ {
+ CCalDavPasswordSettingItem* self = new (ELeave) CCalDavPasswordSettingItem(
+ aId, aSession);
+ CleanupStack::PushL(self);
+ self->ConstructL(aCalendar);
+ return self;
+ }
+
+/**
+ * CCalDavPasswordSettingItem::NewL
+ * first phase construction
+ */
+CCalDavPasswordSettingItem* CCalDavPasswordSettingItem::NewL(TInt aId,
+ CCalDavSession* aSession, const TDesC &aCalendar)
+ {
+ CCalDavPasswordSettingItem* self = CCalDavPasswordSettingItem::NewLC(aId,
+ aSession, aCalendar);
+ CleanupStack::Pop(); // self;
+ return self;
+ }
+
+/**
+ * CCalDavPasswordSettingItem::SetEnableSettingItem
+ * Save a pointer to the Enable Item, this is used to set current
+ * enable/disable state
+ */
+void CCalDavPasswordSettingItem::SetEnableSettingItem(CAknSettingItem* aItem)
+ {
+ iEnableSettingItem = aItem;
+ }
+
+/**
+ * CCalDavPasswordSettingItem::ConstructL
+ * second phase construction
+ */
+void CCalDavPasswordSettingItem::ConstructL(const TDesC &aCalendar)
+ {
+ iCalendar = aCalendar.AllocL();
+ HBufC* title = NULL;
+ TInt page = 0;
+ switch (Identifier())
+ {
+ case ECalDavSettingPassword:
+ title = StringLoader::LoadLC(R_CALDAV_PASSWORD);
+ page = R_PASSWORD_SETTING_PAGE;
+ break;
+ }
+ SetEmptyItemTextL(KNullDesC);
+ CAknPasswordSettingItem::ConstructL(EFalse, 0, *title, NULL,page, -1);
+ CleanupStack::PopAndDestroy(title);
+ }
+
+/**
+ * CCalDavPasswordSettingItem::EditItemL
+ * edits the item
+ */
+void CCalDavPasswordSettingItem::EditItemL(TBool aCalledFromMenu)
+ {
+ TBool enabled;
+ iSession->EnabledSync(*iCalendar, enabled);
+ if (enabled)
+ {
+ HBufC* text = StringLoader::LoadLC(R_CALDAV_QUERY_DISCONNECT);
+ CAknQueryDialog* dlg = CAknQueryDialog::NewL();
+ if (dlg->ExecuteLD(R_QUERY, *text))
+ CAknPasswordSettingItem::EditItemL(aCalledFromMenu);
+ CleanupStack::PopAndDestroy(text);
+ }
+ else
+ CAknPasswordSettingItem::EditItemL(aCalledFromMenu);
+ CAknSettingItem::UpdateListBoxTextL();
+ }
+
+/**
+ * CCalDavPasswordSettingItem::StoreL
+ * stores the item
+ */
+void CCalDavPasswordSettingItem::StoreL()
+ {
+ CAknPasswordSettingItem::StoreL();
+
+ HBufC8* text = CnvUtfConverter::ConvertFromUnicodeToUtf8L(iInternalValue);
+ CleanupStack::PushL(text);
+
+ switch (Identifier())
+ {
+ case ECalDavSettingPassword:
+ iSession->SetPassword(*iCalendar, *text);
+ break;
+ }
+ CleanupStack::PopAndDestroy(text);
+ }
+
+/**
+ * CCalDavPasswordSettingItem::LoadL
+ * loads the item
+ */
+void CCalDavPasswordSettingItem::LoadL()
+ {
+ HBufC8* buf = HBufC8::NewL(KMAXSETTINGLENGTH);
+ TPtr8 ptr(buf->Des());
+ switch (Identifier())
+ {
+ case ECalDavSettingPassword:
+ iSession->Password(*iCalendar, ptr);
+ break;
+ }
+ CnvUtfConverter::ConvertToUnicodeFromUtf8(iInternalValue, ptr);
+ delete buf;
+ CAknPasswordSettingItem::LoadL();
+ }
+
+/**
+ * CCalDavBooleanSettingItem::CCalDavBooleanSettingItem
* default constructor
- */
-CCalDavTextSettingItem::CCalDavTextSettingItem(TInt aId,
- CCalDavSession* aSession) :
- CAknTextSettingItem(aId, iInternalValue), iSession(aSession)
- {
-
- }
-
-/**
- * CCalDavTextSettingItem::~CCalDavTextSettingItem
- * destructor
- */
-CCalDavTextSettingItem::~CCalDavTextSettingItem()
- {
- delete iCalendar;
- }
-
-/**
- * CCalDavTextSettingItem::NewLC
- * 1st-phase construction
- */
-CCalDavTextSettingItem* CCalDavTextSettingItem::NewLC(TInt aId,
- CCalDavSession* aSession, const TDesC &aCalendar)
- {
- CCalDavTextSettingItem* self = new (ELeave) CCalDavTextSettingItem(aId,
- aSession);
- CleanupStack::PushL(self);
- self->ConstructL(aCalendar);
- return self;
- }
-
-/**
- * CCalDavTextSettingItem::NewL
- * 1st-phase construction
- */
-CCalDavTextSettingItem* CCalDavTextSettingItem::NewL(TInt aId,
- CCalDavSession* aSession, const TDesC &aCalendar)
- {
- CCalDavTextSettingItem* self = CCalDavTextSettingItem::NewLC(aId, aSession,
- aCalendar);
- CleanupStack::Pop(); // self;
- return self;
- }
-
-/**
- * CCalDavTextSettingItem::ConstructL
- * 2nd-phase construction
- */
-void CCalDavTextSettingItem::ConstructL(const TDesC &aCalendar)
- {
- iCalendar = aCalendar.AllocL();
- HBufC* title = NULL;
- TInt page = 0;
- switch (Identifier())
- {
- case ECalDavSettingUrl:
- title = StringLoader::LoadLC(R_CALDAV_URL);
- page = R_URL_SETTING_PAGE;
- break;
- case ECalDavSettingUser:
- title = StringLoader::LoadLC(R_CALDAV_USERNAME);
- page = R_USERNAME_SETTING_PAGE;
- break;
- case ECalDavSettingPassword:
- title = StringLoader::LoadLC(R_CALDAV_PASSWORD);
- page = R_PASSWORD_SETTING_PAGE;
- break;
- }
- SetEmptyItemTextL(KNullDesC);
- CAknTextSettingItem::ConstructL(EFalse, 0, *title, NULL,page, -1);
- CleanupStack::PopAndDestroy(title);
- }
-
-/**
- * CCalDavTextSettingItem::EditItemL
- * Edits the item
- */
-void CCalDavTextSettingItem::EditItemL(TBool aCalledFromMenu)
- {
- TBool enabled;
- iSession->EnabledSync(*iCalendar, enabled);
- if (enabled)
- {
- HBufC* text = StringLoader::LoadLC(R_CALDAV_QUERY_DISCONNECT);
- CAknQueryDialog* dlg = CAknQueryDialog::NewL();
- if (dlg->ExecuteLD(R_QUERY, *text))
- {
- CAknTextSettingItem::EditItemL(aCalledFromMenu);
- // TODO: disable Enabled-Setting-Item
- }
- CleanupStack::PopAndDestroy(text);
- }
- else
- CAknTextSettingItem::EditItemL(aCalledFromMenu);
- }
-
-/**
- * CCalDavTextSettingItem::StoreL
- * Stores the item
- */
-void CCalDavTextSettingItem::StoreL()
- {
- CAknTextSettingItem::StoreL();
-
- HBufC8* text = CnvUtfConverter::ConvertFromUnicodeToUtf8L(iInternalValue);
- CleanupStack::PushL(text);
-
- switch (Identifier())
- {
- case ECalDavSettingUrl:
- iSession->SetUrl(*iCalendar, *text);
- break;
- case ECalDavSettingUser:
- iSession->SetUsername(*iCalendar, *text);
- break;
- case ECalDavSettingPassword:
- iSession->SetPassword(*iCalendar, *text);
- break;
- }
- CleanupStack::PopAndDestroy(text);
-
- if (iEnableSettingItem)
- {
- iEnableSettingItem->LoadL();
- iEnableSettingItem->UpdateListBoxTextL();
- }
- }
-
-/**
- * CCalDavTextSettingItem::LoadL
- * loades the item
- */
-void CCalDavTextSettingItem::LoadL()
- {
- HBufC8* buf = HBufC8::NewL(KMAXSETTINGLENGTH);
- TPtr8 ptr(buf->Des());
- switch (Identifier())
- {
- case ECalDavSettingUrl:
- iSession->Url(*iCalendar, ptr);
- break;
- case ECalDavSettingUser:
- iSession->Username(*iCalendar, ptr);
- break;
- case ECalDavSettingPassword:
- iSession->Password(*iCalendar, ptr);
- break;
- }
- CnvUtfConverter::ConvertToUnicodeFromUtf8(iInternalValue, ptr);
- delete buf;
- CAknTextSettingItem::LoadL();
- }
-
-/**
- * CCalDavTextSettingItem::StoreL
- * Save a pointer to the Enable Item, this is used to set current
- * enable/disable state
- */
-void CCalDavTextSettingItem::SetEnableSettingItem(CAknSettingItem* aItem)
- {
- iEnableSettingItem = aItem;
- }
-
-/**
- * CCalDavPasswordSettingItem::CCalDavPasswordSettingItem
- * default constructor
- */
-CCalDavPasswordSettingItem::CCalDavPasswordSettingItem(TInt aId,
- CCalDavSession* aSession) :
- CAknPasswordSettingItem(aId, CAknPasswordSettingItem::EAlpha,
- iInternalValue), iSession(aSession)
- {
-
- }
-
-/**
- * CCalDavPasswordSettingItem::~CCalDavPasswordSettingItem
- * default destructor
- */
-CCalDavPasswordSettingItem::~CCalDavPasswordSettingItem()
- {
- delete iCalendar;
- }
-
-/**
- * CCalDavPasswordSettingItem::NewLC
- * first phase construction
- */
-CCalDavPasswordSettingItem* CCalDavPasswordSettingItem::NewLC(TInt aId,
- CCalDavSession* aSession, const TDesC &aCalendar)
- {
- CCalDavPasswordSettingItem* self = new (ELeave) CCalDavPasswordSettingItem(
- aId, aSession);
- CleanupStack::PushL(self);
- self->ConstructL(aCalendar);
- return self;
- }
-
-/**
- * CCalDavPasswordSettingItem::NewL
- * first phase construction
- */
-CCalDavPasswordSettingItem* CCalDavPasswordSettingItem::NewL(TInt aId,
- CCalDavSession* aSession, const TDesC &aCalendar)
- {
- CCalDavPasswordSettingItem* self = CCalDavPasswordSettingItem::NewLC(aId,
- aSession, aCalendar);
- CleanupStack::Pop(); // self;
- return self;
- }
-
-/**
- * CCalDavPasswordSettingItem::SetEnableSettingItem
- * Save a pointer to the Enable Item, this is used to set current
- * enable/disable state
- */
-void CCalDavPasswordSettingItem::SetEnableSettingItem(CAknSettingItem* aItem)
- {
- iEnableSettingItem = aItem;
- }
-
-/**
- * CCalDavPasswordSettingItem::ConstructL
- * second phase construction
- */
-void CCalDavPasswordSettingItem::ConstructL(const TDesC &aCalendar)
- {
- iCalendar = aCalendar.AllocL();
- HBufC* title = NULL;
- TInt page = 0;
- switch (Identifier())
- {
- case ECalDavSettingPassword:
- title = StringLoader::LoadLC(R_CALDAV_PASSWORD);
- page = R_PASSWORD_SETTING_PAGE;
- break;
- }
- SetEmptyItemTextL(KNullDesC);
- CAknPasswordSettingItem::ConstructL(EFalse, 0, *title, NULL,page, -1);
- CleanupStack::PopAndDestroy(title);
- }
-
-/**
- * CCalDavPasswordSettingItem::EditItemL
- * edits the item
- */
-void CCalDavPasswordSettingItem::EditItemL(TBool aCalledFromMenu)
- {
- TBool enabled;
- iSession->EnabledSync(*iCalendar, enabled);
- if (enabled)
- {
- HBufC* text = StringLoader::LoadLC(R_CALDAV_QUERY_DISCONNECT);
- CAknQueryDialog* dlg = CAknQueryDialog::NewL();
- if (dlg->ExecuteLD(R_QUERY, *text))
- CAknPasswordSettingItem::EditItemL(aCalledFromMenu);
- CleanupStack::PopAndDestroy(text);
- }
- else
- CAknPasswordSettingItem::EditItemL(aCalledFromMenu);
- CAknSettingItem::UpdateListBoxTextL();
- }
-
-/**
- * CCalDavPasswordSettingItem::StoreL
- * stores the item
- */
-void CCalDavPasswordSettingItem::StoreL()
- {
- CAknPasswordSettingItem::StoreL();
-
- HBufC8* text = CnvUtfConverter::ConvertFromUnicodeToUtf8L(iInternalValue);
- CleanupStack::PushL(text);
-
- switch (Identifier())
- {
- case ECalDavSettingPassword:
- iSession->SetPassword(*iCalendar, *text);
- break;
- }
- CleanupStack::PopAndDestroy(text);
- }
-
-/**
- * CCalDavPasswordSettingItem::LoadL
- * loads the item
- */
-void CCalDavPasswordSettingItem::LoadL()
- {
- HBufC8* buf = HBufC8::NewL(KMAXSETTINGLENGTH);
- TPtr8 ptr(buf->Des());
- switch (Identifier())
- {
- case ECalDavSettingPassword:
- iSession->Password(*iCalendar, ptr);
- break;
- }
- CnvUtfConverter::ConvertToUnicodeFromUtf8(iInternalValue, ptr);
- delete buf;
- CAknPasswordSettingItem::LoadL();
- }
-
-/**
- * CCalDavBooleanSettingItem::CCalDavBooleanSettingItem
- * default constructor
- */
-CCalDavBooleanSettingItem::CCalDavBooleanSettingItem(TInt aId,
- CCalDavSession* aSession) :
- CAknBinaryPopupSettingItem(aId, iInternalValue), iSession(aSession)
- {
-
- }
-
-/**
- * CCalDavBooleanSettingItem::~CCalDavBooleanSettingItem
- * default destructor
- */
-CCalDavBooleanSettingItem::~CCalDavBooleanSettingItem()
- {
- delete iCalendar;
- }
-
-/**
- * CCalDavBooleanSettingItem::NewLC
- * first phase construction
- */
-CCalDavBooleanSettingItem* CCalDavBooleanSettingItem::NewLC(TInt aId,
- CCalDavSession* aSession, const TDesC &aCalendar)
- {
- CCalDavBooleanSettingItem* self = new (ELeave) CCalDavBooleanSettingItem(
- aId, aSession);
- CleanupStack::PushL(self);
- self->ConstructL(aCalendar);
- return self;
- }
-
-/**
- * CCalDavBooleanSettingItem::NewLC
- * first phase construction
- */
-CCalDavBooleanSettingItem* CCalDavBooleanSettingItem::NewL(TInt aId,
- CCalDavSession* aSession, const TDesC &aCalendar)
- {
- CCalDavBooleanSettingItem* self = CCalDavBooleanSettingItem::NewLC(aId,
- aSession, aCalendar);
- CleanupStack::Pop(); // self;
- return self;
- }
-
-/**
- * CCalDavBooleanSettingItem::ConstructL
- * second phase construction
- */
-void CCalDavBooleanSettingItem::ConstructL(const TDesC &aCalendar)
- {
- iCalendar = aCalendar.AllocL();
- HBufC* title = NULL;
- TInt text = 0;
- TInt page = R_CALDAV_BINARY_PAGE;
- switch (Identifier())
- {
- case ECalDavSettingKeepServer:
- title = StringLoader::LoadLC(R_CALDAV_CONFLICTACTION);
- text = R_CALDAV_CONFLICTACTION_TEXTS;
- break;
- case ECalDavSettingSyncImmediate:
- title = StringLoader::LoadLC(R_CALDAV_IMMEDIATESYNC);
- text = R_CALDAV_IMMEDIATESYNC_TEXTS;
- break;
- case ECalDavSettingEnable:
- title = StringLoader::LoadLC(R_CALDAV_ENABLE);
- text = R_CALDAV_ENABLE_TEXTS;
- break;
- }
- SetEmptyItemTextL(KNullDesC);
- CAknBinaryPopupSettingItem::ConstructL(EFalse, 0, *title, NULL,page,
- EAknCtPopupSettingList, NULL, text);
- CleanupStack::PopAndDestroy(title);
- }
-
-/**
- * CCalDavBooleanSettingItem::EditItemL
- * edits the item
- */
-void CCalDavBooleanSettingItem::EditItemL(TBool aCalledFromMenu)
- {
- if (Identifier() == ECalDavSettingEnable)
- {
- TBool enabled_old;
- iSession->EnabledSync(*iCalendar, enabled_old);
- if (enabled_old)
- {
- HBufC* text = StringLoader::LoadLC(R_CALDAV_QUERY_DISCONNECT);
- CAknQueryDialog* dlg = CAknQueryDialog::NewL();
- if (dlg->ExecuteLD(R_QUERY, *text))
- {
- iSession->Disable(*iCalendar);
- CAknBinaryPopupSettingItem::EditItemL(aCalledFromMenu);
- }
- CleanupStack::PopAndDestroy(text);
- }
- else
- {
- iSession->Enable(*iCalendar);
- // TODO: progressbar
- TBool enabled_new;
- iSession->EnabledSync(*iCalendar, enabled_new);
- if (!enabled_new)
- {
- ShowNoteL(R_CALDAV_QUERY_FAIL);
- }
- else
- {
- ShowNoteL(R_CALDAV_QUERY_SUCCESS);
- CAknBinaryPopupSettingItem::EditItemL(aCalledFromMenu);
- }
- }
- }
- else
- CAknBinaryPopupSettingItem::EditItemL(aCalledFromMenu);
- }
-
-/**
- * CCalDavBooleanSettingItem::StoreL
- * stores the item
- */
-void CCalDavBooleanSettingItem::StoreL()
- {
- CAknBinaryPopupSettingItem::StoreL();
-
- switch (Identifier())
- {
- case ECalDavSettingKeepServer:
- iSession->SetKeepServerEntry(*iCalendar, iInternalValue);
- break;
- case ECalDavSettingSyncImmediate:
- iSession->SetImmediateSync(*iCalendar, iInternalValue);
- break;
- }
- }
-
-/**
- * CCalDavBooleanSettingItem::LoadL
- * loads the item
- */
-void CCalDavBooleanSettingItem::LoadL()
- {
- switch (Identifier())
- {
- case ECalDavSettingKeepServer:
- iSession->KeepServerEntry(*iCalendar, iInternalValue);
- break;
- case ECalDavSettingSyncImmediate:
- iSession->ImmediateSync(*iCalendar, iInternalValue);
- break;
- case ECalDavSettingEnable:
- iSession->EnabledSync(*iCalendar, iInternalValue);
- break;
- }
- CAknBinaryPopupSettingItem::LoadL();
- }
-
-/**
- * CCalDavEnumeratedTextSettingItem::CCalDavEnumeratedTextSettingItem
- * default constructor
- */
-CCalDavEnumeratedTextSettingItem::CCalDavEnumeratedTextSettingItem(TInt aId,
- CCalDavSession* aSession) :
- CAknEnumeratedTextPopupSettingItem(aId, iInternalValue), iSession(aSession)
- {
-
- }
-
-/**
- * CCalDavEnumeratedTextSettingItem::~CCalDavEnumeratedTextSettingItem
- * default destructor
- */
-CCalDavEnumeratedTextSettingItem::~CCalDavEnumeratedTextSettingItem()
- {
- delete iCalendar;
- }
-
-/**
- * CCalDavEnumeratedTextSettingItem::NewLC
- * first phase construction
- */
-CCalDavEnumeratedTextSettingItem* CCalDavEnumeratedTextSettingItem::NewLC(
- TInt aId, CCalDavSession* aSession, const TDesC &aCalendar)
- {
- CCalDavEnumeratedTextSettingItem* self =
- new (ELeave) CCalDavEnumeratedTextSettingItem(aId, aSession);
- CleanupStack::PushL(self);
- self->ConstructL(aCalendar);
- return self;
- }
-
-/**
- * CCalDavEnumeratedTextSettingItem::NewL
- * first phase construction
- */
-CCalDavEnumeratedTextSettingItem* CCalDavEnumeratedTextSettingItem::NewL(
- TInt aId, CCalDavSession* aSession, const TDesC &aCalendar)
- {
- CCalDavEnumeratedTextSettingItem* self =
- CCalDavEnumeratedTextSettingItem::NewLC(aId, aSession, aCalendar);
- CleanupStack::Pop(); // self;
- return self;
- }
-
-/**
- * CCalDavEnumeratedTextSettingItem::ConstructL
- * second phase construction
- */
-void CCalDavEnumeratedTextSettingItem::ConstructL(const TDesC &aCalendar)
- {
- iCalendar = aCalendar.AllocL();
- HBufC* title = NULL;
- TInt text = 0;
- TInt page = R_CALDAV_BINARY_PAGE;
- switch (Identifier())
- {
- case ECalDavSettingSyncRange:
- title = StringLoader::LoadLC(R_CALDAV_RANGE);
- text = R_CALDAV_RANGE_TEXTS;
- break;
- case ECalDavSettingSyncInterval:
- title = StringLoader::LoadLC(R_CALDAV_TIME);
- text = R_CALDAV_TIME_TEXTS;
- break;
-
- }
- SetEmptyItemTextL(KNullDesC);
- CAknEnumeratedTextSettingItem::ConstructL(EFalse, 0, *title, NULL,page,
- EAknCtPopupSettingList, NULL, text);
- CleanupStack::PopAndDestroy(title);
- }
-
-/**
- * CCalDavEnumeratedTextSettingItem::EditItemL
- * edits the item
- */
-void CCalDavEnumeratedTextSettingItem::EditItemL(TBool aCalledFromMenu)
- {
- CAknEnumeratedTextPopupSettingItem::EditItemL(aCalledFromMenu);
- }
-
-/**
- * CCalDavEnumeratedTextSettingItem::StoreL
- * stores the item
- */
-void CCalDavEnumeratedTextSettingItem::StoreL()
- {
- CAknEnumeratedTextPopupSettingItem::StoreL();
-
- switch (iInternalValue)
- {
- case 0:
- {
- if (Identifier() == ECalDavSettingSyncRange)
- iSession->SetPastDays(*iCalendar, TTimeIntervalDays(
- KTIMETWOWEEKS));
- else
- iSession->SetSyncInterval(*iCalendar, TTimeIntervalMinutes(
- KTIMEALWAYSON));
- break;
- }
- case 1:
- {
- if (Identifier() == ECalDavSettingSyncRange)
- iSession->SetPastDays(*iCalendar, TTimeIntervalDays(
- KTIMETHREEMONTH));
- else
- iSession->SetSyncInterval(*iCalendar, TTimeIntervalMinutes(
- KTIMEONEMINUTE));
- break;
- }
- case 2:
- {
- if (Identifier() == ECalDavSettingSyncRange)
- iSession->SetPastDays(*iCalendar, TTimeIntervalDays(
- KTIMESIXMONTH));
- else
- iSession->SetSyncInterval(*iCalendar, TTimeIntervalMinutes(
- KTIMEFIVEMINUTES));
- break;
- }
- case 3:
- {
- if (Identifier() == ECalDavSettingSyncRange)
- iSession->SetPastDays(*iCalendar, TTimeIntervalDays(KTIMEALL));
- else
- iSession->SetSyncInterval(*iCalendar, TTimeIntervalMinutes(
- KTIMEFIFTEENMINUTES));
- break;
- }
- case 4:
- {
- if (Identifier() == ECalDavSettingSyncInterval)
- iSession->SetSyncInterval(*iCalendar, TTimeIntervalMinutes(
- KTIMETHIRTYMINUTES));
- break;
- }
- default:
- if (Identifier() == ECalDavSettingSyncRange)
- iSession->SetPastDays(*iCalendar, TTimeIntervalDays(
- KTIMETWOWEEKS));
- else
- iSession->SetSyncInterval(*iCalendar, TTimeIntervalMinutes(
- KTIMEALWAYSON));
-
- break;
- }
- }
-
-/**
- * CCalDavEnumeratedTextSettingItem::LoadL
- * loads the item
- */
-void CCalDavEnumeratedTextSettingItem::LoadL()
- {
- switch (Identifier())
- {
- case ECalDavSettingSyncRange:
- {
- TTimeIntervalDays days;
- iSession->PastDays(*iCalendar, days);
- switch (days.Int())
- {
- case KTIMETWOWEEKS:
- {
- iInternalValue = 0;
- break;
- }
- case KTIMETHREEMONTH:
- {
- iInternalValue = 1;
- break;
- }
- case KTIMESIXMONTH:
- {
- iInternalValue = 2;
- break;
- }
- case KTIMEALL:
- {
- iInternalValue = 3;
- break;
- }
- default:
- iInternalValue = 0;
- break;
- }
- break;
- }
- case ECalDavSettingSyncInterval:
- {
- TTimeIntervalMinutes minutes;
- iSession->SyncInterval(*iCalendar, minutes);
- switch (minutes.Int())
- {
- case KTIMEALWAYSON:
- {
- iInternalValue = 0;
- break;
- }
- case KTIMEONEMINUTE:
- {
- iInternalValue = 1;
- break;
- }
- case KTIMEFIVEMINUTES:
- {
- iInternalValue = 2;
- break;
- }
- case KTIMEFIFTEENMINUTES:
- {
- iInternalValue = 3;
- break;
- }
- case KTIMETHIRTYMINUTES:
- {
- iInternalValue = 4;
- break;
- }
- default:
- iInternalValue = 0;
- break;
- }
- break;
- }
- }
- CAknEnumeratedTextPopupSettingItem::LoadL();
- }
-
-/**
- * CCalDavAccessPointSettingItem::NewL
- * first phase construction
- */
-CCalDavAccessPointSettingItem* CCalDavAccessPointSettingItem::NewL(
- TInt aSettingId, CCalDavSession* aSession, const TDesC &aCalendar)
- {
- CCalDavAccessPointSettingItem * item =
- new (ELeave) CCalDavAccessPointSettingItem(aSettingId, aSession);
- CleanupStack::PushL(item);
- item->ConstructL(aCalendar);
- CleanupStack::Pop(item);
- return item;
- }
-
-/**
- * CCalDavAccessPointSettingItem::CCalDavAccessPointSettingItem
- * default constructor
- */
-CCalDavAccessPointSettingItem::CCalDavAccessPointSettingItem(TInt aSettingId,
- CCalDavSession* aSession) :
- CAknSettingItem(aSettingId), iSession(aSession)
- {
- }
-
-/**
- * CCalDavAccessPointSettingItem::~CCalDavAccessPointSettingItem
- * default destructor
- */
-CCalDavAccessPointSettingItem::~CCalDavAccessPointSettingItem()
- {
- delete iSettingText;
- }
-
-/**
- * CCalDavAccessPointSettingItem::ConstructL
- * second phase construction
- */
-void CCalDavAccessPointSettingItem::ConstructL(const TDesC &/*aCalendar*/)
- {
- SetEmptyItemTextL(KNullDesC);
- HBufC* title = StringLoader::LoadLC(R_CALDAV_ACCESS_POINT);
- CAknSettingItem::ConstructL(EFalse, 0, *title, NULL,0, 0);
- CleanupStack::PopAndDestroy(title);
-
- _LIT(hi,"Default Connection");
- iSettingText = hi().Alloc();
- }
-
-/**
- * CCalDavAccessPointSettingItem::EditItemL
- * edits the item
- */
-void CCalDavAccessPointSettingItem::EditItemL(TBool /*aCalledFromMenu*/)
- {
- delete iSettingText;
- iSettingText = NULL;
-
- TCmSettingSelection userSelection;
- userSelection.iId = 0;
- userSelection.iResult = CMManager::EDefaultConnection;
-
- CCmApplicationSettingsUi* settings = CCmApplicationSettingsUi::NewL();
- CleanupStack::PushL(settings);
- TUint listedItems = CMManager::EShowDefaultConnection
- | CMManager::EShowDestinations | CMManager::EShowConnectionMethods;
- TBearerFilterArray filter;
- settings->RunApplicationSettingsL(userSelection, listedItems, filter);
- CleanupStack::PopAndDestroy(settings);
-
- switch (userSelection.iResult)
- {
- case CMManager::EDestination:
- {
- TConnSnapPref prefs;
- prefs.SetSnap(userSelection.iId);
- // iSettingText =
- // iConnection.Start( prefs, iStatus );
- break;
- }
- case CMManager::EConnectionMethod:
- {
- TCommDbConnPref prefs;
- prefs.SetIapId(userSelection.iId);
- prefs.SetDialogPreference(ECommDbDialogPrefDoNotPrompt);
-
- // iConnection.Start( prefs, iStatus );
- // iSettingText =
- break;
- }
- case CMManager::EDefaultConnection:
- {
- // iConnection.Start( iStatus );
- // iSettingText =
- break;
- }
- }
- UpdateListBoxTextL();
- }
-
-/**
- * CCalDavAccessPointSettingItem::SettingTextL
- * returns the setting text
- */
-const TDesC& CCalDavAccessPointSettingItem::SettingTextL()
- {
- if (!iSettingText)
- {
- return CAknSettingItem::SettingTextL();
- }
- else if (iSettingText->Length() == 0)
- {
- return CAknSettingItem::SettingTextL();
- }
-
- return *iSettingText;
- }
-
-/**
- * CCalDavAccessPointSettingItem::StoreL
- * stores the item
- */
-void CCalDavAccessPointSettingItem::StoreL()
- {
- CAknSettingItem::StoreL();
- }
-
-/**
- * CCalDavAccessPointSettingItem::LoadL
- * loads the item
- */
-void CCalDavAccessPointSettingItem::LoadL()
- {
- //CAknSettingItem::Load();
- }
-// End of File
+ */
+CCalDavBooleanSettingItem::CCalDavBooleanSettingItem(TInt aId,
+ CCalDavSession* aSession) :
+ CAknBinaryPopupSettingItem(aId, iInternalValue), iSession(aSession)
+ {
+
+ }
+
+/**
+ * CCalDavBooleanSettingItem::~CCalDavBooleanSettingItem
+ * default destructor
+ */
+CCalDavBooleanSettingItem::~CCalDavBooleanSettingItem()
+ {
+ delete iCalendar;
+ }
+
+/**
+ * CCalDavBooleanSettingItem::NewLC
+ * first phase construction
+ */
+CCalDavBooleanSettingItem* CCalDavBooleanSettingItem::NewLC(TInt aId,
+ CCalDavSession* aSession, const TDesC &aCalendar)
+ {
+ CCalDavBooleanSettingItem* self = new (ELeave) CCalDavBooleanSettingItem(
+ aId, aSession);
+ CleanupStack::PushL(self);
+ self->ConstructL(aCalendar);
+ return self;
+ }
+
+/**
+ * CCalDavBooleanSettingItem::NewLC
+ * first phase construction
+ */
+CCalDavBooleanSettingItem* CCalDavBooleanSettingItem::NewL(TInt aId,
+ CCalDavSession* aSession, const TDesC &aCalendar)
+ {
+ CCalDavBooleanSettingItem* self = CCalDavBooleanSettingItem::NewLC(aId,
+ aSession, aCalendar);
+ CleanupStack::Pop(); // self;
+ return self;
+ }
+
+/**
+ * CCalDavBooleanSettingItem::ConstructL
+ * second phase construction
+ */
+void CCalDavBooleanSettingItem::ConstructL(const TDesC &aCalendar)
+ {
+ iCalendar = aCalendar.AllocL();
+ HBufC* title = NULL;
+ TInt text = 0;
+ TInt page = R_CALDAV_BINARY_PAGE;
+ switch (Identifier())
+ {
+ case ECalDavSettingKeepServer:
+ title = StringLoader::LoadLC(R_CALDAV_CONFLICTACTION);
+ text = R_CALDAV_CONFLICTACTION_TEXTS;
+ break;
+ case ECalDavSettingSyncImmediate:
+ title = StringLoader::LoadLC(R_CALDAV_IMMEDIATESYNC);
+ text = R_CALDAV_IMMEDIATESYNC_TEXTS;
+ break;
+ case ECalDavSettingEnable:
+ title = StringLoader::LoadLC(R_CALDAV_ENABLE);
+ text = R_CALDAV_ENABLE_TEXTS;
+ break;
+ }
+ SetEmptyItemTextL(KNullDesC);
+ CAknBinaryPopupSettingItem::ConstructL(EFalse, 0, *title, NULL,page,
+ EAknCtPopupSettingList, NULL, text);
+ CleanupStack::PopAndDestroy(title);
+ }
+
+/**
+ * CCalDavBooleanSettingItem::EditItemL
+ * edits the item
+ */
+void CCalDavBooleanSettingItem::EditItemL(TBool aCalledFromMenu)
+ {
+ if (Identifier() == ECalDavSettingEnable)
+ {
+ TBool enabled_old;
+ iSession->EnabledSync(*iCalendar, enabled_old);
+ if (enabled_old)
+ {
+ HBufC* text = StringLoader::LoadLC(R_CALDAV_QUERY_DISCONNECT);
+ CAknQueryDialog* dlg = CAknQueryDialog::NewL();
+ if (dlg->ExecuteLD(R_QUERY, *text))
+ {
+ iSession->Disable(*iCalendar);
+ CAknBinaryPopupSettingItem::EditItemL(aCalledFromMenu);
+ }
+ CleanupStack::PopAndDestroy(text);
+ }
+ else
+ {
+ iSession->Enable(*iCalendar);
+ // TODO: progressbar
+ TBool enabled_new;
+ iSession->EnabledSync(*iCalendar, enabled_new);
+ if (!enabled_new)
+ {
+ ShowNoteL(R_CALDAV_QUERY_FAIL);
+ }
+ else
+ {
+ ShowNoteL(R_CALDAV_QUERY_SUCCESS);
+ CAknBinaryPopupSettingItem::EditItemL(aCalledFromMenu);
+ }
+ }
+ }
+ else
+ CAknBinaryPopupSettingItem::EditItemL(aCalledFromMenu);
+ }
+
+/**
+ * CCalDavBooleanSettingItem::StoreL
+ * stores the item
+ */
+void CCalDavBooleanSettingItem::StoreL()
+ {
+ CAknBinaryPopupSettingItem::StoreL();
+
+ switch (Identifier())
+ {
+ case ECalDavSettingKeepServer:
+ iSession->SetKeepServerEntry(*iCalendar, iInternalValue);
+ break;
+ case ECalDavSettingSyncImmediate:
+ iSession->SetImmediateSync(*iCalendar, iInternalValue);
+ break;
+ }
+ }
+
+/**
+ * CCalDavBooleanSettingItem::LoadL
+ * loads the item
+ */
+void CCalDavBooleanSettingItem::LoadL()
+ {
+ switch (Identifier())
+ {
+ case ECalDavSettingKeepServer:
+ iSession->KeepServerEntry(*iCalendar, iInternalValue);
+ break;
+ case ECalDavSettingSyncImmediate:
+ iSession->ImmediateSync(*iCalendar, iInternalValue);
+ break;
+ case ECalDavSettingEnable:
+ iSession->EnabledSync(*iCalendar, iInternalValue);
+ break;
+ }
+ CAknBinaryPopupSettingItem::LoadL();
+ }
+
+/**
+ * CCalDavEnumeratedTextSettingItem::CCalDavEnumeratedTextSettingItem
+ * default constructor
+ */
+CCalDavEnumeratedTextSettingItem::CCalDavEnumeratedTextSettingItem(TInt aId,
+ CCalDavSession* aSession) :
+ CAknEnumeratedTextPopupSettingItem(aId, iInternalValue), iSession(aSession)
+ {
+
+ }
+
+/**
+ * CCalDavEnumeratedTextSettingItem::~CCalDavEnumeratedTextSettingItem
+ * default destructor
+ */
+CCalDavEnumeratedTextSettingItem::~CCalDavEnumeratedTextSettingItem()
+ {
+ delete iCalendar;
+ }
+
+/**
+ * CCalDavEnumeratedTextSettingItem::NewLC
+ * first phase construction
+ */
+CCalDavEnumeratedTextSettingItem* CCalDavEnumeratedTextSettingItem::NewLC(
+ TInt aId, CCalDavSession* aSession, const TDesC &aCalendar)
+ {
+ CCalDavEnumeratedTextSettingItem* self =
+ new (ELeave) CCalDavEnumeratedTextSettingItem(aId, aSession);
+ CleanupStack::PushL(self);
+ self->ConstructL(aCalendar);
+ return self;
+ }
+
+/**
+ * CCalDavEnumeratedTextSettingItem::NewL
+ * first phase construction
+ */
+CCalDavEnumeratedTextSettingItem* CCalDavEnumeratedTextSettingItem::NewL(
+ TInt aId, CCalDavSession* aSession, const TDesC &aCalendar)
+ {
+ CCalDavEnumeratedTextSettingItem* self =
+ CCalDavEnumeratedTextSettingItem::NewLC(aId, aSession, aCalendar);
+ CleanupStack::Pop(); // self;
+ return self;
+ }
+
+/**
+ * CCalDavEnumeratedTextSettingItem::ConstructL
+ * second phase construction
+ */
+void CCalDavEnumeratedTextSettingItem::ConstructL(const TDesC &aCalendar)
+ {
+ iCalendar = aCalendar.AllocL();
+ HBufC* title = NULL;
+ TInt text = 0;
+ TInt page = R_CALDAV_BINARY_PAGE;
+ switch (Identifier())
+ {
+ case ECalDavSettingSyncRange:
+ title = StringLoader::LoadLC(R_CALDAV_RANGE);
+ text = R_CALDAV_RANGE_TEXTS;
+ break;
+ case ECalDavSettingSyncInterval:
+ title = StringLoader::LoadLC(R_CALDAV_TIME);
+ text = R_CALDAV_TIME_TEXTS;
+ break;
+
+ }
+ SetEmptyItemTextL(KNullDesC);
+ CAknEnumeratedTextSettingItem::ConstructL(EFalse, 0, *title, NULL,page,
+ EAknCtPopupSettingList, NULL, text);
+ CleanupStack::PopAndDestroy(title);
+ }
+
+/**
+ * CCalDavEnumeratedTextSettingItem::EditItemL
+ * edits the item
+ */
+void CCalDavEnumeratedTextSettingItem::EditItemL(TBool aCalledFromMenu)
+ {
+ CAknEnumeratedTextPopupSettingItem::EditItemL(aCalledFromMenu);
+ }
+
+/**
+ * CCalDavEnumeratedTextSettingItem::StoreL
+ * stores the item
+ */
+void CCalDavEnumeratedTextSettingItem::StoreL()
+ {
+ CAknEnumeratedTextPopupSettingItem::StoreL();
+
+ switch (iInternalValue)
+ {
+ case 0:
+ {
+ if (Identifier() == ECalDavSettingSyncRange)
+ iSession->SetPastDays(*iCalendar, TTimeIntervalDays(
+ KTIMETWOWEEKS));
+ else
+ iSession->SetSyncInterval(*iCalendar, TTimeIntervalMinutes(
+ KTIMEALWAYSON));
+ break;
+ }
+ case 1:
+ {
+ if (Identifier() == ECalDavSettingSyncRange)
+ iSession->SetPastDays(*iCalendar, TTimeIntervalDays(
+ KTIMETHREEMONTH));
+ else
+ iSession->SetSyncInterval(*iCalendar, TTimeIntervalMinutes(
+ KTIMEONEMINUTE));
+ break;
+ }
+ case 2:
+ {
+ if (Identifier() == ECalDavSettingSyncRange)
+ iSession->SetPastDays(*iCalendar, TTimeIntervalDays(
+ KTIMESIXMONTH));
+ else
+ iSession->SetSyncInterval(*iCalendar, TTimeIntervalMinutes(
+ KTIMEFIVEMINUTES));
+ break;
+ }
+ case 3:
+ {
+ if (Identifier() == ECalDavSettingSyncRange)
+ iSession->SetPastDays(*iCalendar, TTimeIntervalDays(KTIMEALL));
+ else
+ iSession->SetSyncInterval(*iCalendar, TTimeIntervalMinutes(
+ KTIMEFIFTEENMINUTES));
+ break;
+ }
+ case 4:
+ {
+ if (Identifier() == ECalDavSettingSyncInterval)
+ iSession->SetSyncInterval(*iCalendar, TTimeIntervalMinutes(
+ KTIMETHIRTYMINUTES));
+ break;
+ }
+ default:
+ if (Identifier() == ECalDavSettingSyncRange)
+ iSession->SetPastDays(*iCalendar, TTimeIntervalDays(
+ KTIMETWOWEEKS));
+ else
+ iSession->SetSyncInterval(*iCalendar, TTimeIntervalMinutes(
+ KTIMEALWAYSON));
+
+ break;
+ }
+ }
+
+/**
+ * CCalDavEnumeratedTextSettingItem::LoadL
+ * loads the item
+ */
+void CCalDavEnumeratedTextSettingItem::LoadL()
+ {
+ switch (Identifier())
+ {
+ case ECalDavSettingSyncRange:
+ {
+ TTimeIntervalDays days;
+ iSession->PastDays(*iCalendar, days);
+ switch (days.Int())
+ {
+ case KTIMETWOWEEKS:
+ {
+ iInternalValue = 0;
+ break;
+ }
+ case KTIMETHREEMONTH:
+ {
+ iInternalValue = 1;
+ break;
+ }
+ case KTIMESIXMONTH:
+ {
+ iInternalValue = 2;
+ break;
+ }
+ case KTIMEALL:
+ {
+ iInternalValue = 3;
+ break;
+ }
+ default:
+ iInternalValue = 0;
+ break;
+ }
+ break;
+ }
+ case ECalDavSettingSyncInterval:
+ {
+ TTimeIntervalMinutes minutes;
+ iSession->SyncInterval(*iCalendar, minutes);
+ switch (minutes.Int())
+ {
+ case KTIMEALWAYSON:
+ {
+ iInternalValue = 0;
+ break;
+ }
+ case KTIMEONEMINUTE:
+ {
+ iInternalValue = 1;
+ break;
+ }
+ case KTIMEFIVEMINUTES:
+ {
+ iInternalValue = 2;
+ break;
+ }
+ case KTIMEFIFTEENMINUTES:
+ {
+ iInternalValue = 3;
+ break;
+ }
+ case KTIMETHIRTYMINUTES:
+ {
+ iInternalValue = 4;
+ break;
+ }
+ default:
+ iInternalValue = 0;
+ break;
+ }
+ break;
+ }
+ }
+ CAknEnumeratedTextPopupSettingItem::LoadL();
+ }
+
+/**
+ * CCalDavAccessPointSettingItem::NewL
+ * first phase construction
+ */
+CCalDavAccessPointSettingItem* CCalDavAccessPointSettingItem::NewL(
+ TInt aSettingId, CCalDavSession* aSession, const TDesC &aCalendar)
+ {
+ CCalDavAccessPointSettingItem * item =
+ new (ELeave) CCalDavAccessPointSettingItem(aSettingId, aSession);
+ CleanupStack::PushL(item);
+ item->ConstructL(aCalendar);
+ CleanupStack::Pop(item);
+ return item;
+ }
+
+/**
+ * CCalDavAccessPointSettingItem::CCalDavAccessPointSettingItem
+ * default constructor
+ */
+CCalDavAccessPointSettingItem::CCalDavAccessPointSettingItem(TInt aSettingId,
+ CCalDavSession* aSession) :
+ CAknSettingItem(aSettingId), iSession(aSession)
+ {
+ }
+
+/**
+ * CCalDavAccessPointSettingItem::~CCalDavAccessPointSettingItem
+ * default destructor
+ */
+CCalDavAccessPointSettingItem::~CCalDavAccessPointSettingItem()
+ {
+ delete iSettingText;
+ }
+
+/**
+ * CCalDavAccessPointSettingItem::ConstructL
+ * second phase construction
+ */
+void CCalDavAccessPointSettingItem::ConstructL(const TDesC &/*aCalendar*/)
+ {
+ SetEmptyItemTextL(KNullDesC);
+ HBufC* title = StringLoader::LoadLC(R_CALDAV_ACCESS_POINT);
+ CAknSettingItem::ConstructL(EFalse, 0, *title, NULL,0, 0);
+ CleanupStack::PopAndDestroy(title);
+
+ _LIT(hi,"Default Connection");
+ iSettingText = hi().Alloc();
+ }
+
+/**
+ * CCalDavAccessPointSettingItem::EditItemL
+ * edits the item
+ */
+void CCalDavAccessPointSettingItem::EditItemL(TBool /*aCalledFromMenu*/)
+ {
+ delete iSettingText;
+ iSettingText = NULL;
+
+ TCmSettingSelection userSelection;
+ userSelection.iId = 0;
+ userSelection.iResult = CMManager::EDefaultConnection;
+
+ CCmApplicationSettingsUi* settings = CCmApplicationSettingsUi::NewL();
+ CleanupStack::PushL(settings);
+ TUint listedItems = CMManager::EShowDefaultConnection
+ | CMManager::EShowDestinations | CMManager::EShowConnectionMethods;
+ TBearerFilterArray filter;
+ settings->RunApplicationSettingsL(userSelection, listedItems, filter);
+ CleanupStack::PopAndDestroy(settings);
+
+ switch (userSelection.iResult)
+ {
+ case CMManager::EDestination:
+ {
+ TConnSnapPref prefs;
+ prefs.SetSnap(userSelection.iId);
+ // iSettingText =
+ // iConnection.Start( prefs, iStatus );
+ break;
+ }
+ case CMManager::EConnectionMethod:
+ {
+ TCommDbConnPref prefs;
+ prefs.SetIapId(userSelection.iId);
+ prefs.SetDialogPreference(ECommDbDialogPrefDoNotPrompt);
+
+ // iConnection.Start( prefs, iStatus );
+ // iSettingText =
+ break;
+ }
+ case CMManager::EDefaultConnection:
+ {
+ // iConnection.Start( iStatus );
+ // iSettingText =
+ break;
+ }
+ }
+ UpdateListBoxTextL();
+ }
+
+/**
+ * CCalDavAccessPointSettingItem::SettingTextL
+ * returns the setting text
+ */
+const TDesC& CCalDavAccessPointSettingItem::SettingTextL()
+ {
+ if (!iSettingText)
+ {
+ return CAknSettingItem::SettingTextL();
+ }
+ else if (iSettingText->Length() == 0)
+ {
+ return CAknSettingItem::SettingTextL();
+ }
+
+ return *iSettingText;
+ }
+
+/**
+ * CCalDavAccessPointSettingItem::StoreL
+ * stores the item
+ */
+void CCalDavAccessPointSettingItem::StoreL()
+ {
+ CAknSettingItem::StoreL();
+ }
+
+/**
+ * CCalDavAccessPointSettingItem::LoadL
+ * loads the item
+ */
+void CCalDavAccessPointSettingItem::LoadL()
+ {
+ //CAknSettingItem::Load();
+ }
+// End of File
--- a/calendarui/caldav/src/calencaldavplugin.cpp Mon Mar 08 21:43:23 2010 +0000
+++ b/calendarui/caldav/src/calencaldavplugin.cpp Sun Mar 14 13:09:26 2010 +0000
@@ -1,343 +1,343 @@
-/*
-* Copyright (c) 2010 Sun Microsystems, Inc. and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributor:
-* Maximilian Odendahl
-*
-* Contributors:
-*
-* Description: CalDav ECOM plugin
-*
-*/
-
-#include <eikenv.h>
-#include <aknutils.h>
-#include <eiklabel.h>
-#include <avkon.hrh>
-#include <StringLoader.h>
-#include <AknMessageQueryDialog.h>
-#include <data_caging_path_literals.hrh>
-#include <bautils.h>
-#include <aknbiditextutils.h>
-#include <aknsettingitemlist.h>
-
-#include <caldavsession.h>
-#include <calcalendarinfo.h>
-#include <calenservices.h>
-#include <calendar.rsg>
-
-#include <CalenCaldavPluginData.rsg>
-#include <calencommands.hrh>
-#include "caldavsettingitems.h"
-#include "calennestedsettingitem.h"
-#include "calendarui_debug.h"
-#include "CalenCaldavPlugin.h"
-
-_LIT( KResourceCCalDavPluginFile, "calencaldavplugindata.rsc" );
-
-#define KResourcePath KDC_RESOURCE_FILES_DIR
-
-/**
- * CCalenCalDavPlugin::CCalenCalDavPlugin
- * default constructor
- */
-CCalenCalDavPlugin::CCalenCalDavPlugin(MCalenServices* aServices) :
- iServices(aServices), iResourceFileOffset(NULL)
-
- {
- TRACE_ENTRY_POINT;TRACE_EXIT_POINT;
- }
-
-/**
- * CCalenCalDavPlugin::NewL
- * first phase construction
- */
-CCalenCalDavPlugin* CCalenCalDavPlugin::NewL(MCalenServices* aServices)
- {
- TRACE_ENTRY_POINT;
- CCalenCalDavPlugin* self = new (ELeave) CCalenCalDavPlugin(aServices);
- CleanupStack::PushL(self);
- self->ConstructL();
- CleanupStack::Pop(self);TRACE_EXIT_POINT;
- return self;
- }
-
-/**
- * CCalenCalDavPlugin::~CCalenCalDavPlugin
- * default destructor
- */
-CCalenCalDavPlugin::~CCalenCalDavPlugin()
- {
- TRACE_ENTRY_POINT;
-
- delete iSession;
-
- if (iServices)
- {
- iServices->CancelNotifications(this);
- iServices->Release();
- }
-
- if (iResourceFileOffset)
- {
- CCoeEnv::Static()->DeleteResourceFile(iResourceFileOffset);
- }TRACE_EXIT_POINT;
- }
-
-/**
- * CCalenCalDavPlugin::ConstructL
- * second phase construction
- */
-void CCalenCalDavPlugin::ConstructL()
- {
- TRACE_ENTRY_POINT;
-
- TFileName dllName;
- // Get the complate path of the DLL from where it is currently loaded
- Dll::FileName(dllName);
-
- TFileName resourceFilename;
- resourceFilename.Append(dllName.Mid(0, 2));
- resourceFilename.Append(KResourcePath);
- resourceFilename.Append(KResourceCCalDavPluginFile);
- BaflUtils::NearestLanguageFile(CEikonEnv::Static()->FsSession(),
- resourceFilename);
- // Add the resource file.
- iResourceFileOffset = CEikonEnv::Static()->AddResourceFileL(
- resourceFilename);
-
- iServices->GetCommandRange(iStart, iEnd);
-
- iSession = CCalDavSession::NewL();
-
- TRACE_EXIT_POINT;
- }
-
-/**
- * CCalenCalDavPlugin::InfobarL
- * show an additional infobar
- */
-CCoeControl* CCalenCalDavPlugin::InfobarL(const TRect& /*aRect*/)
- {
- TRACE_ENTRY_POINT;
- return NULL;TRACE_EXIT_POINT;
- }
-
-/**
- * CCalenCalDavPlugin::InfobarL
- * show an additional infobar
- */
-const TDesC& CCalenCalDavPlugin::InfobarL()
- {
- TRACE_ENTRY_POINT;
- return KNullDesC;
- TRACE_EXIT_POINT;
- }
-
-/**
- * CCalenCalDavPlugin::PreviewPaneL
- * show an additional preview pabe
- */
-CCoeControl* CCalenCalDavPlugin::PreviewPaneL(TRect& /* aRect */)
- {
- TRACE_ENTRY_POINT;
- return NULL;
- TRACE_EXIT_POINT;
- }
-
-/**
- * CCalenCalDavPlugin::CustomPreviewPaneL
- * show an additional custom preview pane
- */
-MCalenPreview* CCalenCalDavPlugin::CustomPreviewPaneL(TRect& /* aRect */)
- {
- TRACE_ENTRY_POINT;
- return NULL;
- TRACE_EXIT_POINT;
- }
-
-/**
- * CCalenCalDavPlugin::CustomiseMenuPaneL
- * customize menu pane
- */
-TBool CCalenCalDavPlugin::CustomiseMenuPaneL(TInt /*aResourceId*/,
- CEikMenuPane* /*aMenuPane*/)
- {
- TRACE_ENTRY_POINT;
- return EFalse;
- TRACE_EXIT_POINT;
- }
-
-/**
- * CCalenCalDavPlugin::HandleCommandL
- * let this plugin handle its own commands
- */
-TBool CCalenCalDavPlugin::HandleCommandL(const TCalenCommand& /*aCommand*/)
- {
- TRACE_ENTRY_POINT;TRACE_EXIT_POINT;
- return EFalse;
- }
-
-/**
- * CCalenCalDavPlugin::CommandHandlerL
- * let this plugin handle its own commands
- */
-MCalenCommandHandler* CCalenCalDavPlugin::CommandHandlerL(TInt /*aCommand*/)
- {
- TRACE_ENTRY_POINT;
- MCalenCommandHandler* commandHandler = NULL;
- return commandHandler;TRACE_EXIT_POINT;
- }
-
-/**
- * CCalenCalDavPlugin::RemoveViewsFromCycle
- * remove added views from cycle
- */
-void CCalenCalDavPlugin::RemoveViewsFromCycle(RArray<TInt>& /*aViews*/)
- {
- TRACE_ENTRY_POINT;TRACE_EXIT_POINT;
- }
-
-/**
- * CCalenCalDavPlugin::GetCustomSettingsL
- * add custom settings to calendar setting pane
- * all CalDav settings are added here into UI
- */
-void CCalenCalDavPlugin::GetCustomSettingsL(
- RPointerArray<CAknSettingItem>& aCustomSettingArray)
- {
- TRACE_ENTRY_POINT
-
- RPointerArray<CCalCalendarInfo> calendarInfoList;
- iServices->GetAllCalendarInfoL(calendarInfoList);
- CleanupClosePushL(calendarInfoList);
-
- TInt count = calendarInfoList.Count();
- for (TInt i = 0; i < count; i++)
- {
- TPtrC calendar = calendarInfoList[i]->FileNameL();
-
- RPointerArray<CAknSettingItem> settings;
-
- CCalDavBooleanSettingItem * enable = CCalDavBooleanSettingItem::NewL(
- ECalDavSettingEnable, iSession, calendar);
-
- CCalDavTextSettingItem* url = CCalDavTextSettingItem::NewL(
- ECalDavSettingUrl, iSession, calendar);
- url->SetEnableSettingItem(enable);
- settings.Append(url);
-
- CCalDavTextSettingItem* user = CCalDavTextSettingItem::NewL(
- ECalDavSettingUser, iSession, calendar);
- user->SetEnableSettingItem(enable);
- settings.Append(user);
-
- CCalDavPasswordSettingItem* password = CCalDavPasswordSettingItem::NewL(
- ECalDavSettingPassword, iSession, calendar);
- password->SetEnableSettingItem(enable);
- settings.Append(password);
-
- CCalDavBooleanSettingItem * keepserver =
- CCalDavBooleanSettingItem::NewL(ECalDavSettingKeepServer,
- iSession, calendar);
- settings.Append(keepserver);
-
- // CCalDavBooleanSettingItem * immediatesync = CCalDavBooleanSettingItem::NewL(ECalDavSettingSyncImmediate,iSession, calendar);
- // settings.Append(immediatesync);
-
- CCalDavEnumeratedTextSettingItem* range =
- CCalDavEnumeratedTextSettingItem::NewL(ECalDavSettingSyncRange,
- iSession, calendar);
- settings.Append(range);
-
- CCalDavEnumeratedTextSettingItem* time =
- CCalDavEnumeratedTextSettingItem::NewL(
- ECalDavSettingSyncInterval, iSession, calendar);
- settings.Append(time);
- settings.Append(enable);
-
- CCalenNestedSettingItem* item = new (ELeave) CCalenNestedSettingItem(0,
- settings, calendarInfoList[i]->NameL());
- CleanupStack::PushL(item);
-
- item->SetEmptyItemTextL(KNullDesC);
-
- if (count == 1)
- {
- HBufC16* name = StringLoader::LoadLC(R_CALDAV);
- item->ConstructL(EFalse, 0, *name, NULL,
- R_CALEN_EMPTY_SETTING_PAGE, EAknSetListBox, NULL,
- R_CALEN_EMPTY_POPUP_SETTING_TEXTS );
- CleanupStack::PopAndDestroy(name);
- }
- else
- {
- item->ConstructL(EFalse, 0, calendarInfoList[i]->NameL(), NULL,
- R_CALEN_EMPTY_SETTING_PAGE, EAknSetListBox, NULL,
- R_CALEN_EMPTY_POPUP_SETTING_TEXTS );
- }
- aCustomSettingArray.Append(item);
- CleanupStack::Pop(item);
- }
- CleanupStack::PopAndDestroy(&calendarInfoList);
-
- TRACE_EXIT_POINT;
- }
-
-/**
- * CCalenCalDavPlugin::GetCustomViewsL
- * add custom views
- */
-void CCalenCalDavPlugin::GetCustomViewsL(RPointerArray<CCalenView>&
-/*aCustomViewArray*/)
- {
- TRACE_ENTRY_POINT;
- TRACE_EXIT_POINT;
- }
-
-/**
- * CCalenCalDavPlugin::HandleNotification
- * handle received notifications in this plugin
- */
-void CCalenCalDavPlugin::HandleNotification(const TCalenNotification /*aNotification*/)
- {
- TRACE_ENTRY_POINT;
- TRACE_EXIT_POINT;
- }
-
-/**
- * CCalenCalDavPlugin::CanBeEnabledDisabled
- * can the plugin be disabled or enabled, called by customization manager
- */
-TBool CCalenCalDavPlugin::CanBeEnabledDisabled()
- {
- return EFalse;
- }
-
-/**
- * CCalenCalDavPlugin::CalenCustomisationExtensionL
- * add custom extensions
- */
-TAny* CCalenCalDavPlugin::CalenCustomisationExtensionL(TUid /*aExtensionUid*/)
- {
- TRACE_ENTRY_POINT;
- TRACE_EXIT_POINT;
- return NULL;
- }
-
-/**
- * CCalenCalDavPlugin::CalenCommandHandlerExtensionL
- * CalenCommandHandlerExtensionL
- */
-TAny* CCalenCalDavPlugin::CalenCommandHandlerExtensionL(TUid /*aExtensionUid*/)
- {
- TRACE_ENTRY_POINT;
- TRACE_EXIT_POINT;
- return NULL;
- }
-//EOF
+/*
+* Copyright (c) 2010 Sun Microsystems, Inc. and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributor:
+* Maximilian Odendahl
+*
+* Contributors:
+*
+* Description: CalDav ECOM plugin
+*
+*/
+
+#include <eikenv.h>
+#include <aknutils.h>
+#include <eiklabel.h>
+#include <avkon.hrh>
+#include <StringLoader.h>
+#include <AknMessageQueryDialog.h>
+#include <data_caging_path_literals.hrh>
+#include <bautils.h>
+#include <aknbiditextutils.h>
+#include <aknsettingitemlist.h>
+
+#include <caldavsession.h>
+#include <calcalendarinfo.h>
+#include <calenservices.h>
+#include <calendar.rsg>
+
+#include <CalenCaldavPluginData.rsg>
+#include <calencommands.hrh>
+#include "caldavsettingitems.h"
+#include "calennestedsettingitem.h"
+#include "calendarui_debug.h"
+#include "CalenCaldavPlugin.h"
+
+_LIT( KResourceCCalDavPluginFile, "calencaldavplugindata.rsc" );
+
+#define KResourcePath KDC_RESOURCE_FILES_DIR
+
+/**
+ * CCalenCalDavPlugin::CCalenCalDavPlugin
+ * default constructor
+ */
+CCalenCalDavPlugin::CCalenCalDavPlugin(MCalenServices* aServices) :
+ iServices(aServices), iResourceFileOffset(NULL)
+
+ {
+ TRACE_ENTRY_POINT;TRACE_EXIT_POINT;
+ }
+
+/**
+ * CCalenCalDavPlugin::NewL
+ * first phase construction
+ */
+CCalenCalDavPlugin* CCalenCalDavPlugin::NewL(MCalenServices* aServices)
+ {
+ TRACE_ENTRY_POINT;
+ CCalenCalDavPlugin* self = new (ELeave) CCalenCalDavPlugin(aServices);
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop(self);TRACE_EXIT_POINT;
+ return self;
+ }
+
+/**
+ * CCalenCalDavPlugin::~CCalenCalDavPlugin
+ * default destructor
+ */
+CCalenCalDavPlugin::~CCalenCalDavPlugin()
+ {
+ TRACE_ENTRY_POINT;
+
+ delete iSession;
+
+ if (iServices)
+ {
+ iServices->CancelNotifications(this);
+ iServices->Release();
+ }
+
+ if (iResourceFileOffset)
+ {
+ CCoeEnv::Static()->DeleteResourceFile(iResourceFileOffset);
+ }TRACE_EXIT_POINT;
+ }
+
+/**
+ * CCalenCalDavPlugin::ConstructL
+ * second phase construction
+ */
+void CCalenCalDavPlugin::ConstructL()
+ {
+ TRACE_ENTRY_POINT;
+
+ TFileName dllName;
+ // Get the complate path of the DLL from where it is currently loaded
+ Dll::FileName(dllName);
+
+ TFileName resourceFilename;
+ resourceFilename.Append(dllName.Mid(0, 2));
+ resourceFilename.Append(KResourcePath);
+ resourceFilename.Append(KResourceCCalDavPluginFile);
+ BaflUtils::NearestLanguageFile(CEikonEnv::Static()->FsSession(),
+ resourceFilename);
+ // Add the resource file.
+ iResourceFileOffset = CEikonEnv::Static()->AddResourceFileL(
+ resourceFilename);
+
+ iServices->GetCommandRange(iStart, iEnd);
+
+ iSession = CCalDavSession::NewL();
+
+ TRACE_EXIT_POINT;
+ }
+
+/**
+ * CCalenCalDavPlugin::InfobarL
+ * show an additional infobar
+ */
+CCoeControl* CCalenCalDavPlugin::InfobarL(const TRect& /*aRect*/)
+ {
+ TRACE_ENTRY_POINT;
+ return NULL;TRACE_EXIT_POINT;
+ }
+
+/**
+ * CCalenCalDavPlugin::InfobarL
+ * show an additional infobar
+ */
+const TDesC& CCalenCalDavPlugin::InfobarL()
+ {
+ TRACE_ENTRY_POINT;
+ return KNullDesC;
+ TRACE_EXIT_POINT;
+ }
+
+/**
+ * CCalenCalDavPlugin::PreviewPaneL
+ * show an additional preview pabe
+ */
+CCoeControl* CCalenCalDavPlugin::PreviewPaneL(TRect& /* aRect */)
+ {
+ TRACE_ENTRY_POINT;
+ return NULL;
+ TRACE_EXIT_POINT;
+ }
+
+/**
+ * CCalenCalDavPlugin::CustomPreviewPaneL
+ * show an additional custom preview pane
+ */
+MCalenPreview* CCalenCalDavPlugin::CustomPreviewPaneL(TRect& /* aRect */)
+ {
+ TRACE_ENTRY_POINT;
+ return NULL;
+ TRACE_EXIT_POINT;
+ }
+
+/**
+ * CCalenCalDavPlugin::CustomiseMenuPaneL
+ * customize menu pane
+ */
+TBool CCalenCalDavPlugin::CustomiseMenuPaneL(TInt /*aResourceId*/,
+ CEikMenuPane* /*aMenuPane*/)
+ {
+ TRACE_ENTRY_POINT;
+ return EFalse;
+ TRACE_EXIT_POINT;
+ }
+
+/**
+ * CCalenCalDavPlugin::HandleCommandL
+ * let this plugin handle its own commands
+ */
+TBool CCalenCalDavPlugin::HandleCommandL(const TCalenCommand& /*aCommand*/)
+ {
+ TRACE_ENTRY_POINT;TRACE_EXIT_POINT;
+ return EFalse;
+ }
+
+/**
+ * CCalenCalDavPlugin::CommandHandlerL
+ * let this plugin handle its own commands
+ */
+MCalenCommandHandler* CCalenCalDavPlugin::CommandHandlerL(TInt /*aCommand*/)
+ {
+ TRACE_ENTRY_POINT;
+ MCalenCommandHandler* commandHandler = NULL;
+ return commandHandler;TRACE_EXIT_POINT;
+ }
+
+/**
+ * CCalenCalDavPlugin::RemoveViewsFromCycle
+ * remove added views from cycle
+ */
+void CCalenCalDavPlugin::RemoveViewsFromCycle(RArray<TInt>& /*aViews*/)
+ {
+ TRACE_ENTRY_POINT;TRACE_EXIT_POINT;
+ }
+
+/**
+ * CCalenCalDavPlugin::GetCustomSettingsL
+ * add custom settings to calendar setting pane
+ * all CalDav settings are added here into UI
+ */
+void CCalenCalDavPlugin::GetCustomSettingsL(
+ RPointerArray<CAknSettingItem>& aCustomSettingArray)
+ {
+ TRACE_ENTRY_POINT
+
+ RPointerArray<CCalCalendarInfo> calendarInfoList;
+ iServices->GetAllCalendarInfoL(calendarInfoList);
+ CleanupClosePushL(calendarInfoList);
+
+ TInt count = calendarInfoList.Count();
+ for (TInt i = 0; i < count; i++)
+ {
+ TPtrC calendar = calendarInfoList[i]->FileNameL();
+
+ RPointerArray<CAknSettingItem> settings;
+
+ CCalDavBooleanSettingItem * enable = CCalDavBooleanSettingItem::NewL(
+ ECalDavSettingEnable, iSession, calendar);
+
+ CCalDavTextSettingItem* url = CCalDavTextSettingItem::NewL(
+ ECalDavSettingUrl, iSession, calendar);
+ url->SetEnableSettingItem(enable);
+ settings.Append(url);
+
+ CCalDavTextSettingItem* user = CCalDavTextSettingItem::NewL(
+ ECalDavSettingUser, iSession, calendar);
+ user->SetEnableSettingItem(enable);
+ settings.Append(user);
+
+ CCalDavPasswordSettingItem* password = CCalDavPasswordSettingItem::NewL(
+ ECalDavSettingPassword, iSession, calendar);
+ password->SetEnableSettingItem(enable);
+ settings.Append(password);
+
+ CCalDavBooleanSettingItem * keepserver =
+ CCalDavBooleanSettingItem::NewL(ECalDavSettingKeepServer,
+ iSession, calendar);
+ settings.Append(keepserver);
+
+ // CCalDavBooleanSettingItem * immediatesync = CCalDavBooleanSettingItem::NewL(ECalDavSettingSyncImmediate,iSession, calendar);
+ // settings.Append(immediatesync);
+
+ CCalDavEnumeratedTextSettingItem* range =
+ CCalDavEnumeratedTextSettingItem::NewL(ECalDavSettingSyncRange,
+ iSession, calendar);
+ settings.Append(range);
+
+ CCalDavEnumeratedTextSettingItem* time =
+ CCalDavEnumeratedTextSettingItem::NewL(
+ ECalDavSettingSyncInterval, iSession, calendar);
+ settings.Append(time);
+ settings.Append(enable);
+
+ CCalenNestedSettingItem* item = new (ELeave) CCalenNestedSettingItem(0,
+ settings, calendarInfoList[i]->NameL());
+ CleanupStack::PushL(item);
+
+ item->SetEmptyItemTextL(KNullDesC);
+
+ if (count == 1)
+ {
+ HBufC16* name = StringLoader::LoadLC(R_CALDAV);
+ item->ConstructL(EFalse, 0, *name, NULL,
+ R_CALEN_EMPTY_SETTING_PAGE, EAknSetListBox, NULL,
+ R_CALEN_EMPTY_POPUP_SETTING_TEXTS );
+ CleanupStack::PopAndDestroy(name);
+ }
+ else
+ {
+ item->ConstructL(EFalse, 0, calendarInfoList[i]->NameL(), NULL,
+ R_CALEN_EMPTY_SETTING_PAGE, EAknSetListBox, NULL,
+ R_CALEN_EMPTY_POPUP_SETTING_TEXTS );
+ }
+ aCustomSettingArray.Append(item);
+ CleanupStack::Pop(item);
+ }
+ CleanupStack::PopAndDestroy(&calendarInfoList);
+
+ TRACE_EXIT_POINT;
+ }
+
+/**
+ * CCalenCalDavPlugin::GetCustomViewsL
+ * add custom views
+ */
+void CCalenCalDavPlugin::GetCustomViewsL(RPointerArray<CCalenView>&
+/*aCustomViewArray*/)
+ {
+ TRACE_ENTRY_POINT;
+ TRACE_EXIT_POINT;
+ }
+
+/**
+ * CCalenCalDavPlugin::HandleNotification
+ * handle received notifications in this plugin
+ */
+void CCalenCalDavPlugin::HandleNotification(const TCalenNotification /*aNotification*/)
+ {
+ TRACE_ENTRY_POINT;
+ TRACE_EXIT_POINT;
+ }
+
+/**
+ * CCalenCalDavPlugin::CanBeEnabledDisabled
+ * can the plugin be disabled or enabled, called by customization manager
+ */
+TBool CCalenCalDavPlugin::CanBeEnabledDisabled()
+ {
+ return EFalse;
+ }
+
+/**
+ * CCalenCalDavPlugin::CalenCustomisationExtensionL
+ * add custom extensions
+ */
+TAny* CCalenCalDavPlugin::CalenCustomisationExtensionL(TUid /*aExtensionUid*/)
+ {
+ TRACE_ENTRY_POINT;
+ TRACE_EXIT_POINT;
+ return NULL;
+ }
+
+/**
+ * CCalenCalDavPlugin::CalenCommandHandlerExtensionL
+ * CalenCommandHandlerExtensionL
+ */
+TAny* CCalenCalDavPlugin::CalenCommandHandlerExtensionL(TUid /*aExtensionUid*/)
+ {
+ TRACE_ENTRY_POINT;
+ TRACE_EXIT_POINT;
+ return NULL;
+ }
+//EOF
--- a/calendarui/caldav/src/calencaldavpluginProxy.cpp Mon Mar 08 21:43:23 2010 +0000
+++ b/calendarui/caldav/src/calencaldavpluginProxy.cpp Sun Mar 14 13:09:26 2010 +0000
@@ -1,47 +1,47 @@
-/*
-* Copyright (c) 2010 Sun Microsystems, Inc. and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributor:
-* Maximilian Odendahl
-*
-* Contributors:
-*
-* Description: calav ecom plugin proxy implementation
-*
-*/
-
-#include <implementationproxy.h>
-
-#include "CalDavUids.h"
-#include "calencaldavplugin.h"
-
-
-// ----------------------------------------------------------------------------
-// ImplementationTable
-// ----------------------------------------------------------------------------
-const TImplementationProxy ImplementationTable[] =
- {
- IMPLEMENTATION_PROXY_ENTRY( CALEN_CALDAV_IMPLEMENTATION_UID,
- CCalenCalDavPlugin::NewL )
-
- };
-
-
-// ----------------------------------------------------------------------------
-// ImplementationGroupProxy
-// ----------------------------------------------------------------------------
-EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
- {
- aTableCount = sizeof(ImplementationTable) / sizeof (TImplementationProxy);
- return ImplementationTable;
- }
-
-// ----------------------------------------------------------------------------
-// End of file
-// ----------------------------------------------------------------------------
-
+/*
+* Copyright (c) 2010 Sun Microsystems, Inc. and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributor:
+* Maximilian Odendahl
+*
+* Contributors:
+*
+* Description: calav ecom plugin proxy implementation
+*
+*/
+
+#include <implementationproxy.h>
+
+#include "CalDavUids.h"
+#include "calencaldavplugin.h"
+
+
+// ----------------------------------------------------------------------------
+// ImplementationTable
+// ----------------------------------------------------------------------------
+const TImplementationProxy ImplementationTable[] =
+ {
+ IMPLEMENTATION_PROXY_ENTRY( CALEN_CALDAV_IMPLEMENTATION_UID,
+ CCalenCalDavPlugin::NewL )
+
+ };
+
+
+// ----------------------------------------------------------------------------
+// ImplementationGroupProxy
+// ----------------------------------------------------------------------------
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
+ {
+ aTableCount = sizeof(ImplementationTable) / sizeof (TImplementationProxy);
+ return ImplementationTable;
+ }
+
+// ----------------------------------------------------------------------------
+// End of file
+// ----------------------------------------------------------------------------
+
--- a/calendarui/cenrep/CalendarInternalCRKeys.h Mon Mar 08 21:43:23 2010 +0000
+++ b/calendarui/cenrep/CalendarInternalCRKeys.h Sun Mar 14 13:09:26 2010 +0000
@@ -123,26 +123,21 @@
**/
const TUint32 KCalendarStartupStatus = 0x0000000E;
-/**
-* Text string containing default calendar names separated by commas
-* Used for creating default calendars at the startup of the device
-* Default value: "Personal,Family,Friends"
-*/
-const TUint32 KCalendarDefaultCalendars = 0x0000000F;
+
/**
* Text string containing default calendar colors separated by commas
* Used for creating default calendars at the startup of the device
* Default value: "16711680,65280,255"
*/
-const TUint32 KCalendarDefaultColors = 0x00000010;
+const TUint32 KCalendarDefaultColors = 0x0000000F;
/**
* String value containing unique calendar value
* Used for identifying an entry by LUID + unique calendar value
* Default value:"0"
*/
-const TUint32 KCalendarAvailableValue = 0x00000011;
+const TUint32 KCalendarAvailableValue = 0x00000010;
#endif // CALENDARINTERNALCRKEYS_H
--- a/calendarui/commonutils/src/calenactionuiutils.cpp Mon Mar 08 21:43:23 2010 +0000
+++ b/calendarui/commonutils/src/calenactionuiutils.cpp Sun Mar 14 13:09:26 2010 +0000
@@ -419,7 +419,7 @@
// match the LocalUid to the incorrect instance in a series.
for ( TInt i=0; i < instances.Count() && !result; ++i )
{
- if( instances[i]->Entry().LocalUidL() == aId.iEntryLocalUid )
+ if( (instances[i]->InstanceIdL().iCollectionId == aId.iColId) && (instances[i]->Entry().LocalUidL() == aId.iEntryLocalUid )) // comparing the collection id and Local Uid
{
// Check the instance time matches.
if( instances[i]->StartTimeL().TimeLocalL() == aId.iInstanceTime )
Binary file calendarui/conf/calendarUI.confml has changed
Binary file calendarui/conf/calendarUI_101F874B.crml has changed
--- a/calendarui/controller/data/calencommonui.rss Mon Mar 08 21:43:23 2010 +0000
+++ b/calendarui/controller/data/calencommonui.rss Sun Mar 14 13:09:26 2010 +0000
@@ -397,6 +397,33 @@
}
};
}
+//----------------------------------------------------
+//
+// Button state extensions for toolbar and toolbar extension buttons.
+// These is required to support skinned graphics for the buttons.
+//
+//----------------------------------------------------
+//
+RESOURCE AVKON_BUTTON_STATE_EXTENSION r_calen_tb_ext_qgn_indi_cale_tb_repeat_add
+ {
+ bmbSkinIdMajor = EAknsMajorGeneric;
+ bmbSkinIdMinor = EAknsMinorGenericQgnIndiRepeatAdd;
+ //skin KAknsIIDQgnIndiRepeatAdd
+ }
+
+RESOURCE AVKON_BUTTON_STATE_EXTENSION r_calen_tb_ext_qgn_indi_cale_tb_right
+ {
+ bmbSkinIdMajor = EAknsMajorGeneric;
+ bmbSkinIdMinor = EAknsMinorGenericQgnIndiCaleTbRight;
+ //skin KAknsIIDQgnIndiCaleTbRight
+ }
+
+RESOURCE AVKON_BUTTON_STATE_EXTENSION r_calen_tb_ext_qgn_indi_cale_tb_new_entry
+ {
+ bmbSkinIdMajor = EAknsMajorGeneric;
+ bmbSkinIdMinor = EAknsMinorGenericQgnIndiCaleTbNewEntry;
+ //skin KAknsIIDQgnIndiCaleTbNewEntry
+ }
// ---------------------------------------------------------
// r_calen_toolbar_extension
// Resource for calendar toolbar
@@ -422,6 +449,7 @@
bmpfile = BITMAP_DIR"\\calendar.mif";
bmpid = EMbmCalendarQgn_indi_cale_tb_new_entry;
bmpmask = EMbmCalendarQgn_indi_cale_tb_new_entry_mask;
+ extension = r_calen_tb_ext_qgn_indi_cale_tb_new_entry;
}
};
};
@@ -441,6 +469,7 @@
bmpfile = BITMAP_DIR"\\calendar.mif";
bmpid = EMbmCalendarQgn_indi_repeat_add;
bmpmask = EMbmCalendarQgn_indi_repeat_add_mask;
+ extension = r_calen_tb_ext_qgn_indi_cale_tb_repeat_add;
}
};
};
@@ -455,6 +484,7 @@
bmpFile = BITMAP_DIR"\\calendar.mif";
bmpId = EMbmCalendarQgn_indi_cale_tb_right;
bmpMask = EMbmCalendarQgn_indi_cale_tb_right_mask ;
+ extension = r_calen_tb_ext_qgn_indi_cale_tb_right;
items =
{
TBAR_CTRL
@@ -472,6 +502,7 @@
bmpfile = BITMAP_DIR"\\calendar.mif";
bmpid = EMbmCalendarQgn_indi_cale_tb_right;
bmpmask = EMbmCalendarQgn_indi_cale_tb_right_mask;
+ extension = r_calen_tb_ext_qgn_indi_cale_tb_right;
}
};
};
@@ -503,6 +534,7 @@
bmpFile = BITMAP_DIR"\\calendar.mif";
bmpId = EMbmCalendarQgn_indi_cale_tb_right;
bmpMask = EMbmCalendarQgn_indi_cale_tb_right_mask ;
+ extension = r_calen_tb_ext_qgn_indi_cale_tb_right;
items =
{
TBAR_CTRL
@@ -520,6 +552,7 @@
bmpfile = BITMAP_DIR"\\calendar.mif";
bmpid = EMbmCalendarQgn_indi_cale_tb_right;
bmpmask = EMbmCalendarQgn_indi_cale_tb_right_mask;
+ extension = r_calen_tb_ext_qgn_indi_cale_tb_right;
}
};
};
@@ -542,6 +575,7 @@
bmpfile = BITMAP_DIR"\\calendar.mif";
bmpid = EMbmCalendarQgn_indi_repeat_add;
bmpmask = EMbmCalendarQgn_indi_repeat_add_mask;
+ extension = r_calen_tb_ext_qgn_indi_cale_tb_repeat_add;
}
};
};
@@ -561,6 +595,7 @@
bmpfile = BITMAP_DIR"\\calendar.mif";
bmpid = EMbmCalendarQgn_indi_cale_tb_new_entry;
bmpmask = EMbmCalendarQgn_indi_cale_tb_new_entry_mask;
+ extension = r_calen_tb_ext_qgn_indi_cale_tb_new_entry;
}
};
};
@@ -719,8 +754,7 @@
//
RESOURCE TBUF r_cale_multipledb_delete
{
- buf = "Delete calendar %U and all entries in it?";
- //qtn_cale_db_delete_calendar_conf_query;
+ buf = qtn_cale_db_delete_calendar_conf_query;
}
// ---------------------------------------------------------
@@ -778,7 +812,7 @@
{
array_id = r_attachment_list_query_array;
};
- heading = "Select:";
+ heading = qtn_cale_attachment_query_heading;
};
}
};
--- a/calendarui/controller/inc/calenmultipledbui.h Mon Mar 08 21:43:23 2010 +0000
+++ b/calendarui/controller/inc/calenmultipledbui.h Sun Mar 14 13:09:26 2010 +0000
@@ -309,6 +309,7 @@
TInt iAsyncExitCmd;
CCalenMultiDBEditor* iDbEditor;//Not not owned
TBool iConflictOccured;
+ TBool iIsDbEditorOpen ;
};
--- a/calendarui/controller/src/calenattachmentui.cpp Mon Mar 08 21:43:23 2010 +0000
+++ b/calendarui/controller/src/calenattachmentui.cpp Sun Mar 14 13:09:26 2010 +0000
@@ -108,7 +108,7 @@
notificationArray.Append(ECalenNotifyInstanceDeleted);
notificationArray.Append(ECalenNotifyMarkedEntryDeleted);
notificationArray.Append(ECalenNotifyMultipleEntriesDeleted);
- notificationArray.Append(ECalenNotifyDialogClosed);
+ //notificationArray.Append(ECalenNotifyDialogClosed);
notificationArray.Append(ECalenNotifyAttachmentViewerClosed);
iController.RegisterForNotificationsL( this, notificationArray );
notificationArray.Reset();
@@ -161,12 +161,12 @@
{
iAttachmentModel->Reset();
iController.BroadcastNotification(ECalenNotifyAttachmentRemoved);
+ RemoveTemporaryFiles();
}
else
{
iAttachmentModel->DeleteAttachment(0);
}
- RemoveTemporaryFiles();
attachmentInfoList.Close();
}
break;
@@ -231,7 +231,7 @@
case ECalenNotifyEntryClosed:
case ECalenNotifyMarkedEntryDeleted:
case ECalenNotifyMultipleEntriesDeleted:
- case ECalenNotifyDialogClosed:
+ //case ECalenNotifyDialogClosed:
{
if(!(iAddAttachmentFromViewer) && !(iAttachmentAlreadyExists))
{
@@ -245,12 +245,13 @@
{
if(iAddAttachmentFromViewer)
{
- // add attachments to the entry being viewed in event viewer
- AddAttachmentsToEntryL();
+
// Do not reset the model if the attachment list has been opened from the editor.
if(!iController.IsEditorActive())
{
+ // add attachments to the entry being viewed in event viewer
+ AddAttachmentsToEntryL();
// clear calendar editor's folder
RemoveTemporaryFiles();
@@ -693,9 +694,7 @@
attachmentInfoList.Close();
- // If user is adding it from editors, then dont save it now as there is a chance that user discards these
- // changes. If user saves it, then editors will save these newly added attachments.
- if(iController.IsEditorActive())
+ if(!iController.IsEditorActive())
{
CCalEntryView* entryView = iController.Services().EntryViewL(context.InstanceId().iColId);
CCalenInterimUtils2::StoreL( *entryView, *entry, ETrue );
--- a/calendarui/controller/src/calenbackgroundstate.cpp Mon Mar 08 21:43:23 2010 +0000
+++ b/calendarui/controller/src/calenbackgroundstate.cpp Sun Mar 14 13:09:26 2010 +0000
@@ -165,7 +165,14 @@
{
case ECalenNotifyAppForegrounded:
{
- SetCurrentState( aStateMachine, iPreviousState );
+ if( iPreviousState == CCalenStateMachine::ECalenSendingState )
+ {
+ SetCurrentState( aStateMachine, CCalenStateMachine::ECalenIdleState );
+ }
+ else
+ {
+ SetCurrentState( aStateMachine, iPreviousState );
+ }
// We set iOutstandingNotifications for two reasons.
// 1. The new state i.e. the state we are moving back can have notification info.
// 2. When we move to newstate we broadcast all notification from iOutstandingNotifications
--- a/calendarui/controller/src/calencmdlinelauncher.cpp Mon Mar 08 21:43:23 2010 +0000
+++ b/calendarui/controller/src/calencmdlinelauncher.cpp Sun Mar 14 13:09:26 2010 +0000
@@ -191,7 +191,7 @@
TCalTime focusTime;
if( focusOnTime )
{
- focusTime.SetTimeUtcL( iCmdParameters.iTime );
+ focusTime.SetTimeLocalL( iCmdParameters.iTime );
}
else
{
--- a/calendarui/controller/src/calencontextfwlistener.cpp Mon Mar 08 21:43:23 2010 +0000
+++ b/calendarui/controller/src/calencontextfwlistener.cpp Sun Mar 14 13:09:26 2010 +0000
@@ -72,43 +72,57 @@
TRACE_ENTRY_POINT;
const CCFContextObject& co = aChangedContext.Context();
+#ifdef _DEBUG
RDebug::Print( _L("----- CalendarUI - context indication:") );
RDebug::RawPrint( co.Source() );
RDebug::RawPrint( co.Type() );
RDebug::RawPrint( co.Value() );
+#endif
// exit alarm mode as soon as alarm is snoozed or stopped
if( co.Source() == KAlarmUISource() && co.Type() == KAlarmUISourceResult() )
{
+#ifdef _DEBUG
RDebug::Print( _L("### source OK!") );
+#endif
if( co.Value() == TPtrC( KAlarmUISourceResultValues[EResultAlarmStopped] ) )
{
+#ifdef _DEBUG
RDebug::Print( _L("### EResultAlarmStopped") );
+#endif
// should close the Event view open
iAlarmManager.StopAlarmContextListener();
}
else if( co.Value() == TPtrC( KAlarmUISourceResultValues[EResultAlarmSnoozed] ) )
{
+#ifdef _DEBUG
RDebug::Print( _L("### EResultAlarmSnoozed") );
+#endif
// should leave the Event view
iAlarmManager.StopAlarmContextListener(ETrue);
}
//should close the event view in case of power on/off and missed alarm.
else if( co.Value() == TPtrC( KAlarmUISourceResultValues[EResultAlarmStoppedAndExit] ) )
{
+#ifdef _DEBUG
RDebug::Print( _L("### EResultAlarmMissed") );
+#endif
// should leave the Event view
//iAlarmManager.StopAlarmContextListener(ETrue);
iAlarmManager.StopContextListenerForAutoSnooze();
}
else
{
+#ifdef _DEBUG
RDebug::Print( _L("### value didn't match!") );
+#endif
}
}
else
{
+#ifdef _DEBUG
RDebug::Print( _L("### source didn't match!") );
+#endif
}
UnsubscribeContexts();
CloseCFClient();
@@ -123,8 +137,10 @@
void CCalenContextFWListener::ActionIndicationL(const CCFActionIndication& aActionToExecute)
{
TRACE_ENTRY_POINT;
+#ifdef _DEBUG
RDebug::Print( _L("----- CalendarUI - action:") );
RDebug::RawPrint( aActionToExecute.Identifier() );
+#endif
TRACE_EXIT_POINT;
}
@@ -139,11 +155,13 @@
{
TRACE_ENTRY_POINT;
// no implementation
+#ifdef _DEBUG
RDebug::Print( _L("----- CalendarUI - CF error:") );
RDebug::Print( _L("aError: %d"), aError );
RDebug::RawPrint( aSource );
RDebug::RawPrint( aType );
RDebug::Print( _L("-----------------------------") );
+#endif
ASSERT( !aError );
TRACE_EXIT_POINT;
}
@@ -201,7 +219,9 @@
const TInt err = iCFClient->PublishContext( *co );
CleanupStack::PopAndDestroy( co );
+#ifdef _DEBUG
RDebug::Print( _L("### PublishContext - err: %d"), err );
+#endif
User::LeaveIfError( err );
TRACE_EXIT_POINT;
}
@@ -313,7 +333,9 @@
for( TInt i(0); i < arr.Count(); i++ )
{
CCFContextObject* obj = arr[i];
+#ifdef _DEBUG
RDebug::Print( _L("### found alarm context: %S"), &(obj->Value()) );
+#endif
if( obj->Value() == TPtrC( KAlarmUISourceStateValues[EStateCalendarAlarm] ) )
{
--- a/calendarui/controller/src/calenicons.cpp Mon Mar 08 21:43:23 2010 +0000
+++ b/calendarui/controller/src/calenicons.cpp Sun Mar 14 13:09:26 2010 +0000
@@ -574,7 +574,7 @@
break;
case MCalenServices::ECalenMeetingIconMissed:
{
- icon = CreateBitmapSkinnedIconL( KAknsIIDQgnIndiCdrMeeting,
+ icon = CreateBitmapSkinnedIconL( KAknsIIDQgnIndiCdrMeetingMissedNew,
iIconFile,
EMbmCalendarQgn_indi_cdr_meeting_missed_new,
EMbmCalendarQgn_indi_cdr_meeting_missed_new_mask );
@@ -582,7 +582,7 @@
break;
case MCalenServices::ECalenBirthdayIconMissed:
{
- icon = CreateBitmapSkinnedIconL( KAknsIIDQgnIndiCdrBirthday,
+ icon = CreateBitmapSkinnedIconL(KAknsIIDQgnIndiCdrBirthdayMissedNew,
iIconFile,
EMbmCalendarQgn_indi_cdr_birthday_missed_new,
EMbmCalendarQgn_indi_cdr_birthday_missed_new_mask );
@@ -590,7 +590,7 @@
break;
case MCalenServices::ECalenDaynoteIconMissed:
{
- icon = CreateBitmapSkinnedIconL( KAknsIIDQgnIndiCdrReminder,
+ icon = CreateBitmapSkinnedIconL( KAknsIIDQgnIndiCdrReminderMissedNew,
iIconFile,
EMbmCalendarQgn_indi_cdr_reminder_missed_new,
EMbmCalendarQgn_indi_cdr_reminder_missed_new_mask );
@@ -598,7 +598,7 @@
break;
case MCalenServices::ECalenToDoIconMissed:
{
- icon = CreateBitmapSkinnedIconL( KAknsIIDQgnIndiCdrTodo,
+ icon = CreateBitmapSkinnedIconL( KAknsIIDQgnIndiCdrTodoUndoneMissedNew,
iIconFile,
EMbmCalendarQgn_indi_cdr_todo_undone_missed_new,
EMbmCalendarQgn_indi_cdr_todo_undone_missed_new_mask );
--- a/calendarui/controller/src/calenmultidbeditor.cpp Mon Mar 08 21:43:23 2010 +0000
+++ b/calendarui/controller/src/calenmultidbeditor.cpp Sun Mar 14 13:09:26 2010 +0000
@@ -430,6 +430,26 @@
{
TRACE_ENTRY_POINT;
+ if(iEditFlag)
+ {
+ TBuf8<KBuffLength> keyBuff;
+ keyBuff.AppendNum(ESyncConfigEnabled);
+ TBool syncConfigEnabled = EFalse;
+ TPckgC<TBool> pkgSyncConfigEnabled(syncConfigEnabled);
+
+ TRAPD(err,pkgSyncConfigEnabled.Set(iCalendarInfo.PropertyValueL(keyBuff)));
+ syncConfigEnabled = pkgSyncConfigEnabled();
+
+ //If this sync property(ESyncConfigEnabled) is set and enabled ,
+ //then sync on/off should not be shown be to the user.
+ //This behaviour is only for certain calendars created
+ //from device sync with this property set.
+ if(err == KErrNone && syncConfigEnabled)
+ {
+ DeleteLine(ECalenMultiDbSyncStatus);
+ }
+ }
+
// Set data to controls in the editor.
SetDataToFormL();
@@ -742,12 +762,15 @@
}
//Filling the sync value into metadata
- TBuf8<KBuffLength> keyBuff;
- keyBuff.Zero();
- keyBuff.AppendNum(ESyncStatus);
+ if(ControlOrNull(ECalenMultiDbSyncStatus))
+ {
+ TBuf8<KBuffLength> keyBuff;
+ keyBuff.Zero();
+ keyBuff.AppendNum(ESyncStatus);
- TPckgC<TBool> pkgSyncStatus(iSyncStatus);
- iCalendarInfo.SetPropertyL(keyBuff, pkgSyncStatus);
+ TPckgC<TBool> pkgSyncStatus(iSyncStatus);
+ iCalendarInfo.SetPropertyL(keyBuff, pkgSyncStatus);
+ }
if( IsVisiblityFieldEditedL( iCalendarStatus ) )
{
@@ -1128,6 +1151,12 @@
void CCalenMultiDBEditor::SetSyncFieldL( TBool aSyncVal )
{
TRACE_ENTRY_POINT;
+
+ if(!ControlOrNull(ECalenMultiDbSyncStatus))
+ {
+ return;
+ }
+
HBufC* syncString( NULL );
CEikEdwin* syncFieldText =( CEikEdwin* )Control( ECalenMultiDbSyncStatus );
if( EFalse == aSyncVal )
--- a/calendarui/controller/src/calenmultipledbui.cpp Mon Mar 08 21:43:23 2010 +0000
+++ b/calendarui/controller/src/calenmultipledbui.cpp Sun Mar 14 13:09:26 2010 +0000
@@ -1347,9 +1347,11 @@
aEventType == EEventItemSingleClicked )
{
const TInt index(iListBox->CurrentItemIndex());
- if ( index != KErrNotFound )
+ if ( index != KErrNotFound && !iIsDbEditorOpen )
{
+ iIsDbEditorOpen = ETrue ;
ProcessCommandL( ECalenCmdEdit );
+ iIsDbEditorOpen = EFalse ;
}
}
}
--- a/calendarui/controller/src/calennotifier.cpp Mon Mar 08 21:43:23 2010 +0000
+++ b/calendarui/controller/src/calennotifier.cpp Sun Mar 14 13:09:26 2010 +0000
@@ -80,6 +80,8 @@
// Release the global data
if( iGlobalData )
{
+ // stop listening for calendar file change notifications
+ iGlobalData->CalSessionL().StopFileChangeNotification();
iGlobalData->Release();
}
@@ -109,8 +111,7 @@
iHandlers.Reset();
iBroadcastQueue.Reset();
- // stop listening for calendar file change notifications
- iGlobalData->CalSessionL().StopFileChangeNotification();
+
iAsyncCallback->Cancel();
delete iAsyncCallback;
--- a/calendarui/editors/data/CalenDefaultEditorsData.rss Mon Mar 08 21:43:23 2010 +0000
+++ b/calendarui/editors/data/CalenDefaultEditorsData.rss Sun Mar 14 13:09:26 2010 +0000
@@ -1656,42 +1656,4 @@
};
}
-// ---------------------------------------------------------
-// Description list query
-// List query for the description types
-// ---------------------------------------------------------
-RESOURCE AVKON_MULTISELECTION_LIST_QUERY r_description_list_query
- {
- flags = EGeneralQueryFlags;
- softkeys = R_AVKON_SOFTKEYS_SELECT_CANCEL__SELECT;
- items =
- {
- AVKON_MULTISELECTION_LIST_QUERY_DLG_LINE
- {
- control = AVKON_LIST_QUERY_CONTROL
- {
- listtype = EAknCtSinglePopupMenuListBox;
- listbox = AVKON_LIST_QUERY_LIST
- {
- array_id = r_description_list_query_array;
- };
- heading = text_softkey_select;
- };
- }
- };
- }
-
-// ---------------------------------------------------------
-// Description list query array
-// List of the description types
-// ---------------------------------------------------------
-RESOURCE ARRAY r_description_list_query_array
- {
- items=
- {
- LBUF { txt = qtn_cale_om_descript_new; },
- LBUF { txt = qtn_cale_om_descript_exist; }
- };
- }
-
// End of File
--- a/calendarui/editors/inc/CalenDescription.h Mon Mar 08 21:43:23 2010 +0000
+++ b/calendarui/editors/inc/CalenDescription.h Sun Mar 14 13:09:26 2010 +0000
@@ -181,11 +181,7 @@
*/
HBufC* ExecTextViewerL(TInt& aStatus, const TDesC& aDescription);
- /**
- * Handles ECalenCmdAddDescription command
- */
- TBool HandleAddDescriptionL();
-
+
private:
/**
--- a/calendarui/editors/inc/calenunifiededitorcontrol.h Mon Mar 08 21:43:23 2010 +0000
+++ b/calendarui/editors/inc/calenunifiededitorcontrol.h Sun Mar 14 13:09:26 2010 +0000
@@ -270,6 +270,12 @@
const TDesC& GetCalendarNameForEntryL();
+ /**
+ * @brief Handle error codes related to the editor fields.
+ * @param aError
+ */
+ void HandleErrorL( const TInt& aError );
+
private:
/**
--- a/calendarui/editors/src/CalenDescription.cpp Mon Mar 08 21:43:23 2010 +0000
+++ b/calendarui/editors/src/CalenDescription.cpp Sun Mar 14 13:09:26 2010 +0000
@@ -16,7 +16,6 @@
*/
// system includes
-#include <aknlistquerydialog.h>
#include <aknnotewrappers.h>
#include <AknQueryDialog.h>
#include <calentry.h>
@@ -193,17 +192,24 @@
TBool processed = EFalse;
switch( aCommandId )
{
- case ECalenCmdAddDescription:
- {
- processed = HandleAddDescriptionL();
- break;
- }
case ECalenCmdShowDescription:
{
ShowL();
processed = ETrue;
break;
}
+ case ECalenCmdAddDescriptionNew:
+ {
+ AddNewL();
+ processed = ETrue;
+ break;
+ }
+ case ECalenCmdAddDescriptionExisting:
+ {
+ AddMemoL();
+ processed = ETrue;
+ break;
+ }
case ECalenCmdRemoveDescription:
{
RemoveL();
@@ -577,45 +583,4 @@
TRACE_EXIT_POINT;
return desc;
}
-
-// ----------------------------------------------------------------------------
-// CCalenDescription::HandleAddDescriptionL
-// Handles the command ECalenAddDescription
-// ----------------------------------------------------------------------------
-//
-TBool CCalenDescription::HandleAddDescriptionL()
- {
- TRACE_ENTRY_POINT;
-
- TBool processed = EFalse;
- TInt selectedIndex(0);
- CAknListQueryDialog* dlg = new (ELeave) CAknListQueryDialog(&selectedIndex);
- dlg->PrepareLC( R_DESCRIPTION_LIST_QUERY );
-
- if(dlg->RunLD())
- {
- switch(selectedIndex)
- {
- case 0: //ECalenCmdAddDescriptionNew
- {
- AddNewL();
- processed = ETrue;
- break;
- }
- case 1: //ECalenCmdAddDescriptionExisting
- {
- AddMemoL();
- processed = ETrue;
- break;
- }
- default:
- break;
- }
- }
-
- TRACE_EXIT_POINT;
-
- return processed;
-
- }
// End of File
--- a/calendarui/editors/src/calenunifiededitor.cpp Mon Mar 08 21:43:23 2010 +0000
+++ b/calendarui/editors/src/calenunifiededitor.cpp Sun Mar 14 13:09:26 2010 +0000
@@ -1242,19 +1242,7 @@
}
break;
}
- case ECalenEditorDescription:
- {
- CEikEdwin* edwin = static_cast<CEikEdwin*>( Control( focusControl ) );
- if ( edwin && edwin->Text()->DocumentLength() == 0 )
- {
- ProcessCommandL( ECalenCmdAddDescription );
- }
- else
- {
- ProcessCommandL( ECalenCmdShowDescription );
- }
- break;
- }
+
default:
{
break;
@@ -2185,7 +2173,7 @@
{
// If save error occurs, display error message.
DisplayErrorMsgL( error );
- // HandleErrorL(error);
+ iUnifiedEditorControl->HandleErrorL(error);
TRACE_EXIT_POINT;
return EFalse;
}
@@ -2248,7 +2236,7 @@
}
}
- if(!IsCreatingNewEntry())
+ if(!IsCreatingNewEntry() && !iEditorDataHandler->IsCalendarEditedL())
{
iServices->EntryViewL(iEditorDataHandler->PreviousDbCollectionId())
->DeleteL(*iOriginalCalEntry);
@@ -2278,7 +2266,11 @@
newInstanceEndDate,
iUnifiedEditorControl->GetCalendarNameForEntryL() ) );
}
-
+ if(!IsCreatingNewEntry() && iEditorDataHandler->IsCalendarEditedL())
+ {
+ iServices->EntryViewL(iEditorDataHandler->PreviousDbCollectionId())
+ ->DeleteL(*iOriginalCalEntry);
+ }
iEntryUiOutParams.iSpare = (TUint32) entry->LocalUidL();
CleanupStack::PopAndDestroy(entry);
@@ -2314,7 +2306,6 @@
CCalenEditorDataHandler::TAction action =
EditorDataHandler().ShouldSaveOrDeleteOrDoNothingL();
-
if( iHasChosenRepeatType && iRepeatType == CalCommon::EThisAndAll )
{
// Check for the errors, with the entered data
--- a/calendarui/editors/src/calenunifiededitorcontrol.cpp Mon Mar 08 21:43:23 2010 +0000
+++ b/calendarui/editors/src/calenunifiededitorcontrol.cpp Sun Mar 14 13:09:26 2010 +0000
@@ -1478,5 +1478,48 @@
TRACE_EXIT_POINT;
}
+// -----------------------------------------------------------------------------
+// CCalenUnifiedEditorControl::HandleErrorL()
+// Handles errors. This function may be called on saving note.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCalenUnifiedEditorControl::HandleErrorL(const TInt& aError)
+ {
+ TRACE_ENTRY_POINT;
+ if( aError == CCalenEditorDataHandler::EFormErrDurationGreaterThanRepeatInterval )
+ {
+ iUnifiedEditor.TryChangeFocusToL(ECalenEditorRepeat);
+ }
+ else if( aError == CCalenEditorDataHandler::EFormErrOutOfSequence )
+ {
+ iUnifiedEditor.TryChangeFocusToL(ECalenEditorStartDate);
+ }
+ else if( aError == CCalenEditorDataHandler::EFormErrOverlapsExistingInstance )
+ {
+ iUnifiedEditor.TryChangeFocusToL(ECalenEditorStartDate);
+ }
+ else
+ {
+ if( aError == CCalenEditorDataHandler::EFormErrInstanceAlreadyExistsOnThisDay )
+ {
+ iUnifiedEditor.TryChangeFocusToL(ECalenEditorStartDate);
+ }
+ }
+ if (iReminderField->HandleErrorL(aError) )
+ {
+ TRACE_EXIT_POINT;
+ return;
+ }
+ if ( iRepeatField->HandleErrorL(aError) )
+ {
+ TRACE_EXIT_POINT;
+ return;
+ }
+
+ TRACE_EXIT_POINT;
+ }
// End of file
+
+
Binary file calendarui/help/data/xhtml.zip has changed
--- a/calendarui/help/inc/cale.hlp.hrh Mon Mar 08 21:43:23 2010 +0000
+++ b/calendarui/help/inc/cale.hlp.hrh Sun Mar 14 13:09:26 2010 +0000
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
--- a/calendarui/loc/calendar.loc Mon Mar 08 21:43:23 2010 +0000
+++ b/calendarui/loc/calendar.loc Sun Mar 14 13:09:26 2010 +0000
@@ -2593,5 +2593,35 @@
//w:
//r: 9.2
#define qtn_options_mark_undone "Not Done"
+
+//d: Default calendar name.
+//l: list_double_pane_t1
+//w:
+//r: 9.2
+#define qtn_cale_db_calendar_name "Calendar"
+
+//d: Default calendar name with Calendar(01), Calendar(02) etc..
+//l: list_double_pane_t1
+//w:
+//r: 9.2
+#define qtn_cale_db_calendar_default_name "Calendar(%U)"
+
+//d: Name for personal calendar.
+//l: list_double_pane_t1
+//w:
+//r: 9.2
+#define qtn_cale_db_personal "Personal"
+
+//d: name for family calendar.
+//l: list_double_pane_t1
+//w:
+//r: 9.2
+#define qtn_cale_db_family "Family"
+
+//d: name for friends calendar.
+//l: list_double_pane_t1
+//w:
+//r: 9.2
+#define qtn_cale_db_friends "Friends"
// End of File
--- a/calendarui/organizerplugin/aiagendaplugin2/data/aicalendarplugin2.rss Mon Mar 08 21:43:23 2010 +0000
+++ b/calendarui/organizerplugin/aiagendaplugin2/data/aicalendarplugin2.rss Sun Mar 14 13:09:26 2010 +0000
@@ -18,7 +18,7 @@
// INCLUDES
#include "aicalendarplugin2uids.hrh"
-#include <aicontentpublisheruid.hrh>
+#include <hscontentpublisheruid.hrh>
#include <ecom/registryinfov2.rh>
// RESOURCE DEFINITIONS
@@ -40,7 +40,7 @@
INTERFACE_INFO
{
// UID of the implemented interface
- interface_uid = AI_UID_ECOM_INTERFACE_CONTENTPUBLISHER;
+ interface_uid = HS_UID_ECOM_INTERFACE_CONTENTPUBLISHER;
implementations =
{
--- a/calendarui/organizerplugin/aiagendaplugin2/inc/aicalendarplugin2.h Mon Mar 08 21:43:23 2010 +0000
+++ b/calendarui/organizerplugin/aiagendaplugin2/inc/aicalendarplugin2.h Sun Mar 14 13:09:26 2010 +0000
@@ -21,9 +21,7 @@
#include <AknsDrawUtils.h>
#include <AknUtils.h>
-#include <aicontentpublisher.h>
-#include <aipropertyextension.h>
-#include <aieventhandlerextension.h>
+#include <hscontentpublisher.h>
#include "PluginDataChangeObserver.h"
class CAIAgendaPluginEngineIf;
@@ -40,9 +38,7 @@
* @lib aicalendarplugin2
* @since S60 3.2
*/
-NONSHARABLE_CLASS( CAICalendarPlugin2 ): public CAiContentPublisher,
- public MAiPropertyExtension,
- public MAiEventHandlerExtension,
+NONSHARABLE_CLASS( CAICalendarPlugin2 ): public CHsContentPublisher,
public MPluginDataChangeObserver
{
public:
@@ -53,30 +49,48 @@
~CAICalendarPlugin2();
- // From CAiContentPublisher
+ // From CHsContentPublisher
- void Resume( TAiTransitionReason aReason );
+ /**
+ * @see CHsContentPublisher
+ */
+ void Start( TStartReason aReason );
+
+ /**
+ * @see CHsContentPublisher
+ */
+ void Stop( TStopReason aReason );
- void Suspend( TAiTransitionReason aReason );
+ /**
+ * @see CHsContentPublisher
+ */
+ void Resume( TResumeReason aReason );
- void Stop( TAiTransitionReason aReason );
+ /**
+ * @see CHsContentPublisher
+ */
+ void Suspend( TSuspendReason aReason );
+ /**
+ * @see CHsContentPublisher
+ */
void SubscribeL( MAiContentObserver& aObserver );
+ /**
+ * @see CHsContentPublisher
+ */
void ConfigureL( RAiSettingsItemArray& aSettings );
- TAny* Extension( TUid aUid );
-
- // from MAiPropertyExtension
-
- TAny* GetPropertyL( TInt aProperty );
+ /**
+ * @see CHsContentPublisher
+ */
+ TAny* GetProperty( TProperty aProperty );
- void SetPropertyL( TInt aProperty, TAny* aValue );
-
- // from MAiEventHandlerExtension
-
+ /**
+ * @see CHsContentPublisher
+ */
void HandleEvent( TInt aEvent, const TDesC& aParam );
-
+
// From MPluginDataChangeObserver
void PluginDataChanged( const RPointerArray<CCalInstance>& aEntryArray,
@@ -92,7 +106,7 @@
// New methods
- void DoResumeL( TAiTransitionReason aReason );
+ void DoResumeL( TResumeReason aReason );
void CreateIconsL();
--- a/calendarui/organizerplugin/aiagendaplugin2/inc/aicalendarplugin2constantdata.h Mon Mar 08 21:43:23 2010 +0000
+++ b/calendarui/organizerplugin/aiagendaplugin2/inc/aicalendarplugin2constantdata.h Sun Mar 14 13:09:26 2010 +0000
@@ -21,11 +21,12 @@
// INCLUDES
#include <e32base.h>
-#include <aipropertyextension.h>
+#include <hscontentpublisher.h>
// FORWARD DECLARATIONS
class MAiContentItemIterator;
+
/**
* Constant data container.
* Active Idle Calendar plug-in 2 constant data container.
@@ -51,9 +52,7 @@
const TDesC& MakeEventOnL( const TTime& aTime );
- TAny* GetPropertyL( TInt aProperty );
-
- void SetPropertyL( TInt aProperty, TAny* aValue );
+ TAny* GetPropertyL( CHsContentPublisher::TProperty aProperty );
/**
* Tell if we need to append end time to "not today timed" events.
@@ -114,12 +113,6 @@
HBufC* iDateFormatWithoutYearWithZero;
/**
- * This plugins publisher info.
- * Own.
- */
- TAiPublisherInfo iInfo;
-
- /**
* Plugin content iterator.
* Own.
*/
--- a/calendarui/organizerplugin/aiagendaplugin2/inc/aicalendarplugin2constants.hrh Mon Mar 08 21:43:23 2010 +0000
+++ b/calendarui/organizerplugin/aiagendaplugin2/inc/aicalendarplugin2constants.hrh Sun Mar 14 13:09:26 2010 +0000
@@ -89,21 +89,21 @@
const TInt KAICal2DefaultBufferLen = 35;
_LIT( KAICal2WesternSummaryLocationSeparator, ", " );
-_LIT( KAICal2ArabicSummaryLocationSeparator, " /x060c" );
+_LIT( KAICal2ArabicSummaryLocationSeparator, " \x060c" );
/**
* KReplaceWhitespaceChars contains some characters that should be replaced by space
* in Calendar popup, day view etc.
* Following characters are replaced with space
- * /x0009 horizontal tab
- * /x000a new line
- * /x000b line tabulation (vertical
- * /x000c form feed
- * /x000d carriage return
- * /x2028 line separator
- * /x2029 paragraph separator
+ * \x0009 horizontal tab
+ * \x000a new line
+ * \x000b line tabulation (vertical
+ * \x000c form feed
+ * \x000d carriage return
+ * \x2028 line separator
+ * \x2029 paragraph separator
*/
_LIT( KAICal2ReplaceWhitespaceChars,
-"/x0009/x000A/x000B/x000C/x000D/x2028/x2029" );
+"\x0009\x000A\x000B\x000C\x000D\x2028\x2029" );
_LIT16( KAICal2CmdTODAY, "TODAY" ); // Calendar command parameter
_LIT16( KAICal2CmdDAY, "DAY " ); // Calendar command parameter
--- a/calendarui/organizerplugin/aiagendaplugin2/inc/aicalendarplugin2data.h Mon Mar 08 21:43:23 2010 +0000
+++ b/calendarui/organizerplugin/aiagendaplugin2/inc/aicalendarplugin2data.h Sun Mar 14 13:09:26 2010 +0000
@@ -21,7 +21,6 @@
// INCLUDES
#include <e32base.h>
-#include <aipropertyextension.h>
#include <aicontentobserver.h>
#include "aicalendarplugin2eventitem.h"
--- a/calendarui/organizerplugin/aiagendaplugin2/src/aicalendarplugin2.cpp Mon Mar 08 21:43:23 2010 +0000
+++ b/calendarui/organizerplugin/aiagendaplugin2/src/aicalendarplugin2.cpp Sun Mar 14 13:09:26 2010 +0000
@@ -320,23 +320,15 @@
iMasks.Compress();
}
-void CAICalendarPlugin2::Resume( TAiTransitionReason aReason )
+void CAICalendarPlugin2::Resume( TResumeReason aReason )
{
TRAP_IGNORE( DoResumeL( aReason ) );
}
-void CAICalendarPlugin2::DoResumeL( TAiTransitionReason aReason )
+void CAICalendarPlugin2::DoResumeL( TResumeReason aReason )
{
- if( aReason == EAiIdleForeground ||
- aReason == EAiBacklightOn ||
- aReason == EAiSystemStartup ||
- aReason == EAiGeneralThemeChanged )
+ if( aReason == EForeground )
{
- if( aReason == EAiGeneralThemeChanged )
- {
- // Reset for republishing. Especially icons!
- iPublishedDataStore.Reset();
- }
if( !iEngine )
{
iEngine = CAIAgendaPluginEngineIf::NewL( *this, ECalendarAndTodoObserver );
@@ -348,13 +340,20 @@
}
}
-void CAICalendarPlugin2::Suspend( TAiTransitionReason /*aReason*/ )
+void CAICalendarPlugin2::Suspend( TSuspendReason aReason )
{
- delete iEngine;
- iEngine = NULL;
+ if ( aReason == EGeneralThemeChange )
+ {
+ // Reset for republishing. Especially icons!
+ iPublishedDataStore.Reset();
+ }
+ }
+
+void CAICalendarPlugin2::Start( TStartReason /*aReason*/ )
+ {
}
-void CAICalendarPlugin2::Stop( TAiTransitionReason /*aReason*/ )
+void CAICalendarPlugin2::Stop( TStopReason /*aReason*/ )
{
delete iEngine;
iEngine = NULL;
@@ -462,31 +461,15 @@
aSettings.ResetAndDestroy();
}
-TAny* CAICalendarPlugin2::Extension( TUid aUid )
+TAny* CAICalendarPlugin2::GetProperty( TProperty aProperty )
{
- if (aUid == KExtensionUidProperty)
- {
- return static_cast<MAiPropertyExtension*>(this);
- }
- else if (aUid == KExtensionUidEventHandler)
- {
- return static_cast<MAiEventHandlerExtension*>(this);
- }
- return NULL;
+ TAny* result( NULL );
+
+ TRAP_IGNORE( result = iConstantData->GetPropertyL( aProperty ) );
+
+ return result;
}
-TAny* CAICalendarPlugin2::GetPropertyL( TInt aProperty )
- {
- return iConstantData->GetPropertyL( aProperty );
- }
-
-void CAICalendarPlugin2::SetPropertyL( TInt aProperty, TAny* aValue )
- {
- if( aValue )
- {
- iConstantData->SetPropertyL( aProperty, aValue );
- }
- }
void CAICalendarPlugin2::HandleEvent( TInt aEvent, const TDesC& aParam )
{
--- a/calendarui/organizerplugin/aiagendaplugin2/src/aicalendarplugin2constantdata.cpp Mon Mar 08 21:43:23 2010 +0000
+++ b/calendarui/organizerplugin/aiagendaplugin2/src/aicalendarplugin2constantdata.cpp Sun Mar 14 13:09:26 2010 +0000
@@ -22,7 +22,6 @@
#include <StringLoader.h>
#include <aicontentmodel.h>
#include <aiutility.h>
-#include <aipropertyextension.h>
#include <AknUtils.h>
// CONSTANTS
@@ -136,38 +135,25 @@
return *iNextEventOnCombined;
}
-void CAICalendarPlugin2ConstantData::SetPropertyL( TInt aProperty, TAny* aValue )
- {
- if( aProperty == EAiPublisherInfo )
- {
- ASSERT( aValue );
-
- const TAiPublisherInfo* info(
- static_cast<const TAiPublisherInfo*>( aValue ) );
-
- iInfo = *info;
- }
- }
-
-TAny* CAICalendarPlugin2ConstantData::GetPropertyL( TInt aProperty )
+TAny* CAICalendarPlugin2ConstantData::GetPropertyL( CHsContentPublisher::TProperty aProperty )
{
- switch( aProperty )
- {
- case EAiPublisherInfo:
- return &iInfo;
-
- case EAiPublisherContent:
+ if( aProperty == CHsContentPublisher::EPublisherContent )
+ {
return iContent;
-
- case EAiPublisherResources:
+ }
+ else if( aProperty == CHsContentPublisher::EPublisherResources )
+ {
return iResources;
-
- case EAiPublisherEvents:
+ }
+ else if( aProperty == CHsContentPublisher::EPublisherEvents )
+ {
return iEvents;
-
- case EAiPluginName:
+ }
+ else if( aProperty == CHsContentPublisher::EPluginName )
+ {
return StringLoader::LoadL( R_QTN_AI_CALE_PLUGIN_NAME );
- }
+ }
+
return NULL;
}
--- a/calendarui/organizerplugin/aiagendaplugin2/src/aicalendarplugin2data.cpp Mon Mar 08 21:43:23 2010 +0000
+++ b/calendarui/organizerplugin/aiagendaplugin2/src/aicalendarplugin2data.cpp Sun Mar 14 13:09:26 2010 +0000
@@ -19,7 +19,6 @@
#include "aicalendarplugin2contentmodel.h"
#include "aicalendarplugin2constants.hrh"
#include <aicontentmodel.h>
-#include <aipropertyextension.h>
#include <e32cmn.h>
// Helper for sort method
--- a/calendarui/organizerplugin/aiagendapluginengine/src/CalenAsyncCommands.cpp Mon Mar 08 21:43:23 2010 +0000
+++ b/calendarui/organizerplugin/aiagendapluginengine/src/CalenAsyncCommands.cpp Sun Mar 14 13:09:26 2010 +0000
@@ -195,6 +195,11 @@
{
iEngine.iInstanceView = CCalInstanceView::NewL( sessionArray, *this );
}
+ else
+ {
+ iState = ESignalCaller;
+ CompleteSelf();
+ }
}
break;
@@ -366,8 +371,8 @@
{
if( !iEngine.iInstanceView )
{
- // open command / instance view creation failed
- User::Leave( KErrNotFound );
+ iState = EFinalize;
+ CompleteSelf();
}
else
{
@@ -551,8 +556,15 @@
{
case EFetch:
{
- // create date range and fetch entries
-
+ if( !iEngine.iInstanceView )
+ {
+ iState = EFinalize;
+ CompleteSelf();
+ }
+ else
+ {
+ // create date range and fetch entries
+
CalCommon::TCalViewFilter filter = CalCommon::EIncludeAppts |
CalCommon::EIncludeReminder;
@@ -562,6 +574,7 @@
iState = EFinalize;
CompleteSelf();
+ }
}
break;
@@ -726,9 +739,11 @@
if( !iEngine.iInstanceView )
{
- User::Leave( KErrBadHandle ); // we have a null pointer
+ iState = ESignalCaller;
+ CompleteSelf();
}
-
+ else
+ {
iEngine.iInstanceView->FindInstanceL( iInstanceArray,
CalCommon::EIncludeIncompletedTodos |
// only fetch the first instance for repeating to-dos!
@@ -737,6 +752,7 @@
iState = ESignalCaller;
CompleteSelf();
+ }
}
break;
@@ -878,8 +894,8 @@
{
if( !iEngine.iInstanceView )
{
- // open command / instance view creation failed
- User::Leave( KErrNotFound );
+ iState = EFinalize;
+ CompleteSelf();
}
else
{
--- a/calendarui/organizerplugin/aiagendapluginengine/src/CalenEngine.cpp Mon Mar 08 21:43:23 2010 +0000
+++ b/calendarui/organizerplugin/aiagendapluginengine/src/CalenEngine.cpp Sun Mar 14 13:09:26 2010 +0000
@@ -143,8 +143,9 @@
for (TInt index = 0; index < iCalInfoArray.Count(); index++)
{
TPtrC calFileName = iCalInfoArray[index].iFileName;
-
+#ifdef _DEBUG
RDebug::Print(calFileName);
+#endif
if (!calFileName.CompareF(defaultSession->DefaultFileNameL()))
{
CleanupStack::PushL(defaultSession);
--- a/calendarui/organizerplugin/data/qhd_tch/organizer_2001f481/loc/organizerconfiguration.loc Mon Mar 08 21:43:23 2010 +0000
+++ b/calendarui/organizerplugin/data/qhd_tch/organizer_2001f481/loc/organizerconfiguration.loc Sun Mar 14 13:09:26 2010 +0000
@@ -25,4 +25,4 @@
// l: listrow_wgtman_pane_t2
// w:
// r: TB9.2
-#define qtn_organizer_widget_description "Organizer Widget"
\ No newline at end of file
+#define qtn_organizer_widget_description "Informs you of calendar events. Provides quick access to calendar."
--- a/calendarui/regionalplugins/calenregionalutil/src/calenextrarowformatter.cpp Mon Mar 08 21:43:23 2010 +0000
+++ b/calendarui/regionalplugins/calenregionalutil/src/calenextrarowformatter.cpp Sun Mar 14 13:09:26 2010 +0000
@@ -210,30 +210,40 @@
TInt subIx = subLabels.Find( field );
// Replace
subs->Delete(subIx);
- RDebug::Print( _L("A sub count %d"), subs->Count() );
+#ifdef _DEBUG
+ RDebug::Print( _L("A sub count %d"), subs->Count() );
+#endif
subs->InsertL(subIx, TPtrC( aLocInfo.GetField( field ) ) );
+#ifdef _DEBUG
RDebug::Print( _L("B sub count %d"), subs->Count() );
- RDebug::Print( _L("B field %S"), &(subs->At(subIx)) );
+ RDebug::Print( _L("B field %S"), &(subs->At(subIx)) );
+#endif
}
// Format all fields to extra row
HBufC* extraRowFmt = StringLoader::LoadLC( R_CALE_EXTRA_ROW_LUNAR );
+#ifdef _DEBUG
RDebug::RawPrint( *extraRowFmt );
+#endif
TBuf<1000> fmt = *extraRowFmt;
for (TInt i=0; i < subLabels.Count(); i++)
{
+#ifdef _DEBUG
RDebug::Print( _L("Before Format") );
RDebug::RawPrint( fmt );
+#endif
StringLoader::Format( iText,
fmt,
i + 1, // %0U is a separator
subs->At( i ) );
fmt = iText;
+#ifdef _DEBUG
RDebug::Print( _L("After Format") );
RDebug::RawPrint( fmt );
+#endif
}
// Now we have something like "Year of Dog%0U%0U6/11%0U%0U"
@@ -241,15 +251,19 @@
_LIT(KSeparatorFmt, "%0U");
CollapseDuplicatesL( iText, 0, KSeparatorFmt );
+#ifdef _DEBUG
RDebug::Print( _L("After collapse") );
RDebug::RawPrint( iText );
+#endif
// Remove leading and trailing %0U
// By now, we are sure that there is max 1 %0U in the beginning
// and in the end of string.
RemoveLeadingAndTrailingL( iText, KSeparatorFmt );
+#ifdef _DEBUG
RDebug::Print( _L("After leading and trailing removal") );
RDebug::RawPrint( iText );
+#endif
// If there are now separators anymore, then do not fill them
@@ -266,8 +280,10 @@
0, // %0U is a separator
*separator );
+#ifdef _DEBUG
RDebug::Print( _L("After separator insert") );
RDebug::RawPrint( iText );
+#endif
CleanupStack::PopAndDestroy( separator );
}
--- a/calendarui/regionalplugins/calenregionalutil/src/calenlunarlocalizer.cpp Mon Mar 08 21:43:23 2010 +0000
+++ b/calendarui/regionalplugins/calenregionalutil/src/calenlunarlocalizer.cpp Sun Mar 14 13:09:26 2010 +0000
@@ -180,13 +180,17 @@
yearSubs->AppendL( iTerrestialBranchNames->MdcaPoint( aInfo.iTerrestialBranch ) );
HBufC* tmp = StringLoader::LoadLC( R_CALE_LUNAR_YEAR, *yearSubs, iEikEnv );
+#ifdef _DEBUG
RDebug::Print( *tmp );
+#endif
localized->iLunarYear = *tmp;
CleanupStack::PopAndDestroy( tmp );
CleanupStack::PopAndDestroy( yearSubs );
+#ifdef _DEBUG
RDebug::Print( localized->iLunarYear );
-
+#endif
+
LocalizeMonthAndDayL(localized, aInfo);
// Full lunar date
--- a/calendarui/regionalplugins/lunarVietnamese/src/calenlunarvietnameseplugin.cpp Mon Mar 08 21:43:23 2010 +0000
+++ b/calendarui/regionalplugins/lunarVietnamese/src/calenlunarvietnameseplugin.cpp Sun Mar 14 13:09:26 2010 +0000
@@ -380,8 +380,7 @@
CEikMenuPane* aMenuPane )
{
TRACE_ENTRY_POINT;
- HBufC* itemText = HBufC::NewLC(100);//= StringLoader::LoadLC(R_CALENDAR_SHOW_LUNAR_DATA);
- itemText->Des().Append(_L("Viet No Settings"));
+ HBufC* itemText = StringLoader::LoadLC(R_CALENDAR_SHOW_LUNAR_DATA);
CEikMenuPaneItem::SData menuItem;
menuItem.iCommandId = iStart;
--- a/calendarui/rom/caldav.iby Mon Mar 08 21:43:23 2010 +0000
+++ b/calendarui/rom/caldav.iby Sun Mar 14 13:09:26 2010 +0000
@@ -1,29 +1,29 @@
-/*
- * This component and the accompanying materials are made available
- * under the terms of the License "Symbian Foundation License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
- *
- * Initial Contributors:
- * Maximilian Odendahl, Sun Microsystems, Inc.
- *
- * Contributors:
- *
- * Description: iby file to include Caldav into rom
- *
- */
-
-
-
-#ifndef CALDAV_IBY
-#define CALDAV_IBY
-
-file=ABI_DIR\BUILD_DIR\CalDavClient.dll SHARED_LIB_DIR\CalDavClient.dll
-file=ABI_DIR\BUILD_DIR\!CalDavServer.exe PROGRAMS_DIR\!CalDavServer.exe
-
-ECOM_PLUGIN( calencaldavplugin.dll , calencaldavplugin.rsc )
-
-
-#endif // CALDAV_IBY
-
+/*
+ * This component and the accompanying materials are made available
+ * under the terms of the License "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Maximilian Odendahl, Sun Microsystems, Inc.
+ *
+ * Contributors:
+ *
+ * Description: iby file to include Caldav into rom
+ *
+ */
+
+
+
+#ifndef CALDAV_IBY
+#define CALDAV_IBY
+
+file=ABI_DIR\BUILD_DIR\CalDavClient.dll SHARED_LIB_DIR\CalDavClient.dll
+file=ABI_DIR\BUILD_DIR\!CalDavServer.exe PROGRAMS_DIR\!CalDavServer.exe
+
+ECOM_PLUGIN( calencaldavplugin.dll , calencaldavplugin.rsc )
+
+
+#endif // CALDAV_IBY
+
// End of File
\ No newline at end of file
--- a/calendarui/server/CalenSvr/data/calensvrmissedalarmmanagerresource.rss Mon Mar 08 21:43:23 2010 +0000
+++ b/calendarui/server/CalenSvr/data/calensvrmissedalarmmanagerresource.rss Sun Mar 14 13:09:26 2010 +0000
@@ -28,6 +28,7 @@
#include <AvkonIcons.hrh>
#include <avkon.mbg>
#include <calensvrmissedalarmmanager.loc>
+#include <calendar.loc>
RESOURCE RSS_SIGNATURE
{
@@ -66,4 +67,20 @@
plural_label = r_missed_alarm_ungroup_plural;
}
+RESOURCE TBUF r_cale_db_personal
+ {
+ buf = qtn_cale_db_personal;
+ }
+
+RESOURCE TBUF r_cale_db_family
+ {
+ buf = qtn_cale_db_family;
+ }
+
+RESOURCE TBUF r_cale_db_friends
+ {
+ buf = qtn_cale_db_friends;
+ }
+
+
// End of File
--- a/calendarui/server/CalenSvr/group/CalenSvr.mmp Mon Mar 08 21:43:23 2010 +0000
+++ b/calendarui/server/CalenSvr/group/CalenSvr.mmp Sun Mar 14 13:09:26 2010 +0000
@@ -68,6 +68,8 @@
LIBRARY missedalarmstore.lib
LIBRARY calencommonutils.lib
LIBRARY caleninterimutils2.lib
+LIBRARY efsrv.lib
+LIBRARY PlatformEnv.lib
sourcepath ../data
--- a/calendarui/server/CalenSvr/inc/CalSvrSession.h Mon Mar 08 21:43:23 2010 +0000
+++ b/calendarui/server/CalenSvr/inc/CalSvrSession.h Sun Mar 14 13:09:26 2010 +0000
@@ -44,6 +44,7 @@
public: // From MCalenEngineOpenCallback
void DatabaseOpened();
void DatabaseTemporarilyClosed();
+ void HandleError();
private:
CCalenServer* Server() const;
--- a/calendarui/server/CalenSvr/inc/CalenServer.h Mon Mar 08 21:43:23 2010 +0000
+++ b/calendarui/server/CalenSvr/inc/CalenServer.h Sun Mar 14 13:09:26 2010 +0000
@@ -92,7 +92,7 @@
*
* @param aCalendarNames a reference to the calendar names list
*/
- void ReadCalendarNamesFromCenrepL(CDesC16ArrayFlat& aCalendarNames);
+ void ReadCalendarNamesFromResourceL(CDesC16ArrayFlat& aCalendarNames);
/**
* @brief read calendar colors from central repository
@@ -102,15 +102,6 @@
void ReadCalendarColorsFromCenrepL(RArray<TInt>& aCalendarColors);
/**
- * @brief populate calendar names list from central repository buffer
- *
- * @param aRepositoryBuffer a reference to central repository buffer
- * @param aCalendarNames a reference to calendar names list
- */
- void PopulateCalendarNamesListL( const TDesC& aRepositoryBuffer ,
- CDesC16ArrayFlat& aCalendarNames );
-
- /**
* @brief populate calendar colors list from central repository buffer
*
* @param aRepositoryBuffer a reference to central repository buffer
--- a/calendarui/server/CalenSvr/inc/CalenSvrDBManager.h Mon Mar 08 21:43:23 2010 +0000
+++ b/calendarui/server/CalenSvr/inc/CalenSvrDBManager.h Sun Mar 14 13:09:26 2010 +0000
@@ -53,6 +53,7 @@
public:
virtual void DatabaseOpened() = 0;
virtual void DatabaseTemporarilyClosed() = 0;
+ virtual void HandleError() = 0;
};
public: // Construction and destruction
@@ -84,7 +85,7 @@
void Progress(TInt aPercentageCompleted);
private:
- void OpenDatabaseCompletedL();
+ void OpenDatabaseCompletedL(TInt aErrorVal = KErrNone);
private: // Timer handling
void StartClosingTimer();
@@ -103,7 +104,7 @@
/**
*
**/
- void NotifyUsersL();
+ void NotifyUsersL(TInt aErrorVal = KErrNone);
private:
enum TState
--- a/calendarui/server/CalenSvr/src/CalSvrSession.cpp Mon Mar 08 21:43:23 2010 +0000
+++ b/calendarui/server/CalenSvr/src/CalSvrSession.cpp Sun Mar 14 13:09:26 2010 +0000
@@ -165,12 +165,16 @@
TRACE_EXIT_POINT;
return;
}
-
- Server()->UnregisterUserL(*this);
- iRegistered = EFalse;
-
- iInitMessage.Complete(KErrCancel);
- iInitActive = EFalse;
+ if(iRegistered)
+ {
+ Server()->UnregisterUserL(*this);
+ iRegistered = EFalse;
+ }
+ if(!iInitMessage.IsNull() )
+ {
+ iInitMessage.Complete(KErrCancel);
+ iInitActive = EFalse;
+ }
TRACE_EXIT_POINT;
}
@@ -231,6 +235,25 @@
TRACE_EXIT_POINT;
}
+
+// -----------------------------------------------------------------------------
+// ?classname::?member_function
+// ?implementation_description
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//srinath
+void CCalSvrSession::HandleError()
+ {
+ TRACE_ENTRY_POINT;
+
+ if(!iInitMessage.IsNull() )
+ {
+ iInitMessage.Complete(KErrNone);
+ }
+
+ TRACE_EXIT_POINT;
+ }
+
// -----------------------------------------------------------------------------
// ?classname::?member_function
// ?implementation_description
--- a/calendarui/server/CalenSvr/src/CalenServer.cpp Mon Mar 08 21:43:23 2010 +0000
+++ b/calendarui/server/CalenSvr/src/CalenServer.cpp Sun Mar 14 13:09:26 2010 +0000
@@ -22,6 +22,10 @@
#include <calcalendarinfo.h>
#include <calenmulticalutil.h>
#include <CalenInterimUtils2.h>
+#include <calensvrmissedalarmmanagerresource.rsg>
+#include <data_caging_path_literals.hrh>
+#include <bautils.h>
+#include <pathinfo.h>
//debug
#include "calendarui_debug.h"
@@ -35,14 +39,17 @@
#include "CalenSvrBootManager.h"
#include "CalenSvrDBManager.h"
#include "calensvrmissedalarmmanager.h"
+#include "calenmissedalarmconstants.h"
// LOCAL CONSTANTS AND MACROS
+
const TInt KCalenServerPriority(CActive::EPriorityStandard);
_LIT( KCalendarDatabaseFilePath, "c:calendar" );
const TInt KBufferStartingSize( 128 );
const TInt KBufferSizeIncrement( 64 );
const TInt KBuffLength = 128;
+
const TInt KComma( ',' );
// ================= MEMBER FUNCTIONS =======================
@@ -302,7 +309,7 @@
CDesC16ArrayFlat* calendarNamesList = new (ELeave) CDesC16ArrayFlat(2);
CleanupStack::PushL(calendarNamesList);
// read calendar names from central repository
- ReadCalendarNamesFromCenrepL(*calendarNamesList);
+ ReadCalendarNamesFromResourceL(*calendarNamesList);
RArray<TInt> calendarColors;
// read calendar colors from central repository
@@ -357,40 +364,50 @@
// Read calendar names from central repository
// -----------------------------------------------------------------------------
//
-void CCalenServer::ReadCalendarNamesFromCenrepL(CDesC16ArrayFlat& aCalendarNames)
+void CCalenServer::ReadCalendarNamesFromResourceL(CDesC16ArrayFlat& aCalendarNames)
{
TRACE_ENTRY_POINT;
- CRepository* repository = CRepository::NewL( KCRUidCalendar );
- CleanupStack::PushL( repository );
+ RFs fsSession;
+ CleanupClosePushL( fsSession );
+ RResourceFile resourceFile;
+ CleanupClosePushL( resourceFile );
+ User::LeaveIfError( fsSession.Connect() );
+ TFileName resourceFileName( KMissedAlarmResourceFile );
+
+ BaflUtils::NearestLanguageFile( fsSession, resourceFileName );
- TInt bufSize( KBufferStartingSize );
- TBool wasRead( EFalse );
- do
- {
- RBuf buf;
- CleanupClosePushL(buf);
- buf.CreateL(bufSize);
- // read default calendars information from cenrep
- TInt err = repository->Get(KCalendarDefaultCalendars, buf);
- if (err == KErrNone)
- {
- wasRead = ETrue;
- PopulateCalendarNamesListL(buf, aCalendarNames);
- }
- else if (err == KErrOverflow)
- {
- bufSize += KBufferSizeIncrement;
- }
- else
- {
- User::Leave(err);
- }
- CleanupStack::PopAndDestroy(&buf);
- }
- while (!wasRead);
+ // __PRINT(" resourcefileName : %s" , resourceFileName );
- CleanupStack::PopAndDestroy(repository);
+ resourceFile.OpenL(fsSession, resourceFileName );
+ resourceFile.ConfirmSignatureL( 0 );
+ // personal
+ HBufC8* personalBuffer = resourceFile.AllocReadLC( R_CALE_DB_PERSONAL );
+ const TPtrC16 ptrPBuffer(( TText16*) personalBuffer->Ptr(),
+ ( personalBuffer->Length()+1 )>>1 );
+ HBufC *personalCalendar = ptrPBuffer.AllocL();
+ aCalendarNames.AppendL( personalCalendar->Des() );
+ CleanupStack::PopAndDestroy( personalBuffer );
+
+ // famliy
+ HBufC8* familyBuffer=resourceFile.AllocReadLC( R_CALE_DB_FAMILY );
+ const TPtrC16 ptrFBuffer(( TText16*) familyBuffer->Ptr(),
+ ( familyBuffer->Length()+1 )>>1 );
+ HBufC *familyCalendar = ptrFBuffer.AllocL();
+ aCalendarNames.AppendL( familyCalendar->Des() );
+ CleanupStack::PopAndDestroy( familyBuffer );
+
+ //friends
+ HBufC8* friendsBuffer = resourceFile.AllocReadLC( R_CALE_DB_FRIENDS );
+ const TPtrC16 ptrFrBuffer(( TText16*) friendsBuffer->Ptr(),
+ ( friendsBuffer->Length()+1 )>>1 );
+ HBufC *friendsCalendar = ptrFrBuffer.AllocL();
+ aCalendarNames.AppendL( friendsCalendar->Des() );
+ CleanupStack::PopAndDestroy( friendsBuffer );
+
+ CleanupStack::PopAndDestroy(&resourceFile);
+ CleanupStack::PopAndDestroy(&fsSession);
+
TRACE_EXIT_POINT;
}
@@ -437,33 +454,6 @@
}
// -----------------------------------------------------------------------------
-// CCalenServer::PopulateCalendarNamesListL
-// Populate calendar names list from central repository buffer
-// -----------------------------------------------------------------------------
-//
-void CCalenServer::PopulateCalendarNamesListL( const TDesC& aRepositoryBuffer,
- CDesC16ArrayFlat& aCalendarNames)
- {
- TRACE_ENTRY_POINT;
-
- TPtrC marker = aRepositoryBuffer;
- TInt calendarNameOffset;
- while ((calendarNameOffset = marker.Locate(TChar(KComma)))
- != KErrNotFound)
- {
- // append calendar name to list
- aCalendarNames.AppendL(marker.Left(calendarNameOffset));
- marker.Set(marker.Mid(calendarNameOffset + 1));
-
- if (marker.Locate(TChar(KComma)) == KErrNotFound)
- {
- aCalendarNames.AppendL(marker.Left(marker.Length()));
- }
- }
- TRACE_EXIT_POINT;
- }
-
-// -----------------------------------------------------------------------------
// CCalenServer::PopulateCalendarColorListL
// Populate calendar colors list from central repository buffer
// -----------------------------------------------------------------------------
--- a/calendarui/server/CalenSvr/src/CalenSvrDBManager.cpp Mon Mar 08 21:43:23 2010 +0000
+++ b/calendarui/server/CalenSvr/src/CalenSvrDBManager.cpp Sun Mar 14 13:09:26 2010 +0000
@@ -260,6 +260,8 @@
case EStateDBClosed:
iState = EStateOpeningDB;
+ //Chances of leave due to file corruption or no memory.
+ TRAPD(err,
if( !iGlobalData )
{
iGlobalData = CCalenGlobalData::Instance();
@@ -270,7 +272,8 @@
}
}
iGlobalData->InstanceViewL();
- OpenDatabaseCompletedL();
+ );
+ OpenDatabaseCompletedL(err);
break;
default:
@@ -359,7 +362,7 @@
// (other items were commented in a header).
// -----------------------------------------------------------------------------
//
-void CCalenSvrDBManager::OpenDatabaseCompletedL()
+void CCalenSvrDBManager::OpenDatabaseCompletedL(TInt aErrorVal)
{
TRACE_ENTRY_POINT;
switch(iState)
@@ -368,7 +371,7 @@
{
if (iUsers.Count() > 0)
{
- NotifyUsersL();
+ NotifyUsersL(aErrorVal);
iState = EStateDBOpen;
}
else
@@ -581,7 +584,7 @@
// (other items were commented in a header).
// -----------------------------------------------------------------------------
//
-void CCalenSvrDBManager::NotifyUsersL(void)
+void CCalenSvrDBManager::NotifyUsersL(TInt aErrorVal)
{
TRACE_ENTRY_POINT;
@@ -595,7 +598,14 @@
for( TInt i(0); i < users.Count(); ++i )
{
- users[i]->DatabaseOpened();
+ if(aErrorVal != KErrNone)
+ {
+ users[i]->HandleError();
+ }
+ else
+ {
+ users[i]->DatabaseOpened();
+ }
}
CleanupStack::PopAndDestroy( &users );
--- a/calendarui/views/inc/calentodoview.h Mon Mar 08 21:43:23 2010 +0000
+++ b/calendarui/views/inc/calentodoview.h Sun Mar 14 13:09:26 2010 +0000
@@ -280,6 +280,7 @@
TInt iHighlightedRowNumber; // The row number highlighted.
TInt iFirstEntryOnScreenIndex; // The offset of the topmost item on screen to the first entry.
CListBoxView::CSelectionIndexArray* iMarkedTodoItems;
+ TBool iEventViewCommandHandled ;
};
#endif // TODOVIEW_H
--- a/calendarui/views/src/caleneventviewcontainer.cpp Mon Mar 08 21:43:23 2010 +0000
+++ b/calendarui/views/src/caleneventviewcontainer.cpp Sun Mar 14 13:09:26 2010 +0000
@@ -81,7 +81,7 @@
#include "calendar.hrh"
#include "calenentryutil.h"
#include "CalenUid.h" // KUidCalendar
-#include "calenlocationutil.h"
+#include <calenlocationutil.h>
#include "CalendarPrivateCRKeys.h"
#include "calenattachmentutils.h"
#include "calenglobaldata.h"
@@ -561,17 +561,20 @@
iTextEditor->SetFocus(ETrue);
// TODO: Uncomment this when enabling attachment support
-
- if(iEventViewData->AttachmentCount())
+ if(iEventViewData)
{
- CTextView *textView = iTextEditor->TextView();
+
+ if(iEventViewData->AttachmentCount())
+ {
+ CTextView *textView = iTextEditor->TextView();
- TTmPosInfo2 *posInfo = new(ELeave) TTmPosInfo2;
- textView->FindXyPosL(aPointerEvent.iPosition,*posInfo);
+ TTmPosInfo2 *posInfo = new(ELeave) TTmPosInfo2;
+ textView->FindXyPosL(aPointerEvent.iPosition,*posInfo);
- // Check if it is tapped on any attachment name, if yes then open that attachment
- CheckAndOpenTappedAttachment(posInfo);
- delete posInfo;
+ // Check if it is tapped on any attachment name, if yes then open that attachment
+ CheckAndOpenTappedAttachment(posInfo);
+ delete posInfo;
+ }
}
break;
}
@@ -2741,7 +2744,7 @@
// Get the file handler
RFile file = iServices.GetAttachmentData()->GetAttachmentFileL( attachmentToBeOpened );
-
+ CleanupClosePushL(file);
// Hide the toolbar before opening the attachment
MCalenToolbar* toolbar = iServices.ToolbarOrNull();
if(toolbar && toolbar->IsVisible())
@@ -2751,6 +2754,8 @@
//open the attachment
OpenAttachmentViewerL(file, *this);
+ CleanupStack::PopAndDestroy(&file);
+
// Unhide the toolbar after coming back
if(toolbar)
@@ -2923,49 +2928,31 @@
// Opens a particular attachment
// -----------------------------------------------------------------------------
//
-void CCalenEventViewContainer::OpenAttachmentViewerL(RFile& file, MAknServerAppExitObserver& /*aExitObserver*/)
+void CCalenEventViewContainer::OpenAttachmentViewerL(RFile& aFile, MAknServerAppExitObserver& /*aExitObserver*/)
{
TRACE_ENTRY_POINT;
TBuf<250> fileName;
- file.FullName(fileName);
- TDataType datatype( CCalenAttachmentUtils::GetMimeTypeL(fileName) );
-
+ aFile.FullName(fileName);
+ TDataType datatype( CCalenAttachmentUtils::GetMimeType(aFile) );
+
TInt ret = KErrNone;
- file.Close();
- RFs& fs = CEikonEnv::Static()->FsSession();
-
- //open the file, before giving it to Notepad.
- TInt err1 = file.Open( fs, fileName, EFileRead | EFileShareReadersOnly );
- CleanupClosePushL( file );
-
if(datatype == KNotePadTextDataType())
{
const TDesC& notepadTitle = _L("NotePad");
- // file handle ownership transferred.
-
- // 1.File handle from arg has problem for notes since junk chars are reported in file.
- // so we use another file handle exclusively open with filename an pass to note viewer.
- //
- // 2.Pass ETrue to 4th param ExecFileViewerL , to guess encoding.
- RFile fileForNotes;
- TInt err = fileForNotes.Open( fs, fileName, EFileRead | EFileShareReadersOnly );
- CleanupClosePushL( fileForNotes );
- ret = CNotepadApi::ExecFileViewerL( fileForNotes,
+ ret = CNotepadApi::ExecFileViewerL( aFile,
¬epadTitle,
ETrue,
ETrue,
KCharacterSetIdentifierIso88591 );
- CleanupStack::PopAndDestroy(&fileForNotes);
}
else
{
//doc handler will open the other files (other than text file).
- TRAP( ret, iDocHandler->OpenFileEmbeddedL( file, datatype ) );
+ TRAP( ret, iDocHandler->OpenFileEmbeddedL( aFile, datatype ) );
}
- CleanupStack::PopAndDestroy(&file);
switch(ret)
{
--- a/calendarui/views/src/calenmonthcontainer.cpp Mon Mar 08 21:43:23 2010 +0000
+++ b/calendarui/views/src/calenmonthcontainer.cpp Sun Mar 14 13:09:26 2010 +0000
@@ -1683,8 +1683,10 @@
/* Handle pointer event in months day area */
{
+#ifdef _DEBUG
RDebug::Print( _L("pointerEvent.iModifiers = 0x%08x"),
aPointerEvent.iModifiers );
+#endif
// Event modifiers are ignored for now because
// those are not needed but cause problems
TPointerEvent pointerEvent( aPointerEvent );
--- a/calendarui/views/src/calennativeview.cpp Mon Mar 08 21:43:23 2010 +0000
+++ b/calendarui/views/src/calennativeview.cpp Sun Mar 14 13:09:26 2010 +0000
@@ -409,11 +409,9 @@
break;
// The context should remain the same for these actions.
- case ECalenEventView:
case ECalenForwardsToDayView:
case ECalenNextView:
case ECalenPrevView:
- case ECalenSwitchView:
case ECalenViewCurrentEntry:
case ECalenEditCurrentEntry:
case ECalenCompleteTodo:
@@ -422,14 +420,15 @@
case ECalenDeleteCurrentEntry:
case ECalenDeleteEntriesBeforeDate:
//case ECalenGlobalSendAsCmdId:
- case ECalenSend:
+
- if( aCommand != ECalenSwitchView )
- {
- // Mark the flag telling that the command is being handled
SetCommandHandlingInProgress( ETrue );
- }
-
+ iServices.IssueCommandL( aCommand );
+ break;
+
+ case ECalenEventView:
+ case ECalenSwitchView:
+ case ECalenSend:
iServices.IssueCommandL( aCommand );
break;
--- a/calendarui/views/src/calentodoview.cpp Mon Mar 08 21:43:23 2010 +0000
+++ b/calendarui/views/src/calentodoview.cpp Sun Mar 14 13:09:26 2010 +0000
@@ -288,11 +288,13 @@
case ECalenViewCurrentEntry:
case EAknSoftkeyOpen:
SaveCurrentItemIndexL();
- if(!Container()->IsEmptyView())
+
+ if(!Container()->IsEmptyView() && !iEventViewCommandHandled)
{
if(!Container()->MarkedCount())
{
CCalenNativeView::HandleCommandL(ECalenEventView);
+ iEventViewCommandHandled = ETrue;
break;
}
@@ -731,6 +733,7 @@
// dim clear and clear all toolbar buttons
toolbar.SetItemDimmed(ECalenGotoToday,ETrue,ETrue);
}
+ iEventViewCommandHandled = EFalse;
TRACE_EXIT_POINT;
}
--- a/clock2/clockui/uilayer/clkdatetimeview/src/clkdatetimeview.cpp Mon Mar 08 21:43:23 2010 +0000
+++ b/clock2/clockui/uilayer/clkdatetimeview/src/clkdatetimeview.cpp Sun Mar 14 13:09:26 2010 +0000
@@ -3310,8 +3310,7 @@
default:
break;
}
-
- if( KHoursInDay > Abs( hourDifference.Int() ) )
+ if( ( KHoursInDay > Abs( hourDifference.Int() ) ) && tzHandle.IsDaylightSavingOnL( *timeZoneId,actualisedRule.iTimeOfChange ) )
{
// If there is a match, save the index and break.
// We've got the rule and there's no need to continue with other rules.
--- a/clock2/clockui/uilayer/clockmainview/src/clockmainview.cpp Mon Mar 08 21:43:23 2010 +0000
+++ b/clock2/clockui/uilayer/clockmainview/src/clockmainview.cpp Sun Mar 14 13:09:26 2010 +0000
@@ -488,11 +488,10 @@
// Re-initialize the alarm id array.
iAlarmArray->InitIdList();
- if( ( KClockAppMainViewId == aCustomMessageId ) && iContainer )
+ // To update the scroll bar when opened from indicator pane.
+ if( iContainer )
{
- AppUi()->RemoveFromStack( iContainer );
- delete iContainer;
- iContainer = NULL;
+ iContainer->ListBox()->SetCurrentItemIndexAndDraw( KZerothIndex );
}
CClockAppUi* clockAppUi( static_cast< CClockAppUi* > ( AppUi() ) );
--- a/clock2/clockui/uilayer/clockworldview/src/clockworldview.cpp Mon Mar 08 21:43:23 2010 +0000
+++ b/clock2/clockui/uilayer/clockworldview/src/clockworldview.cpp Sun Mar 14 13:09:26 2010 +0000
@@ -952,21 +952,13 @@
// Update the world array.
iWorldArray->RemoveCity( currentListItem );
- if( currentListItem >= iWorldArray->MdcaCount() )
- {
- currentListItem = iWorldArray->MdcaCount() - 1;
- }
- if( KNoCities <= currentListItem )
- {
- // Make the list to display the previous item.
- iContainer->ListBox()->SetCurrentItemIndex( currentListItem );
- }
+
// Update the document.
CClockDocument* clockDocument = static_cast< CClockDocument* > ( AppUi()->Document() );
clockDocument->StoreDataL();
// Update the container.
- iContainer->ListBox()->HandleItemRemovalL();
+
// If there are no more cities present, update the empty list text.
if( KNoCities == iWorldArray->MdcaCount() )
{
--- a/clock2/clockui/utilities/data/timezonegroups.rss Mon Mar 08 21:43:23 2010 +0000
+++ b/clock2/clockui/utilities/data/timezonegroups.rss Sun Mar 14 13:09:26 2010 +0000
@@ -1710,15 +1710,9 @@
}
-RESOURCE TIMEZONE_CITY_GROUP r_group_country_western_sahara
+RESOURCE TIMEZONE_CITY_GROUP r_group_region_macau
{
city_group_id = 241;
- city_group_name = qtn_clk_country_western_sahara;
- }
-
-RESOURCE TIMEZONE_CITY_GROUP r_group_region_macau
- {
- city_group_id = 242;
city_group_name = qtn_clk_region_macau;
}
--- a/clock2/clockui/utilities/data/timezonegroups_jerusalem.rss Mon Mar 08 21:43:23 2010 +0000
+++ b/clock2/clockui/utilities/data/timezonegroups_jerusalem.rss Sun Mar 14 13:09:26 2010 +0000
@@ -1710,15 +1710,9 @@
}
-RESOURCE TIMEZONE_CITY_GROUP r_group_country_western_sahara
+RESOURCE TIMEZONE_CITY_GROUP r_group_region_macau
{
city_group_id = 241;
- city_group_name = qtn_clk_country_western_sahara;
- }
-
-RESOURCE TIMEZONE_CITY_GROUP r_group_region_macau
- {
- city_group_id = 242;
city_group_name = qtn_clk_region_macau;
}
--- a/clock2/clockui/utilities/data/timezones.rss Mon Mar 08 21:43:23 2010 +0000
+++ b/clock2/clockui/utilities/data/timezones.rss Sun Mar 14 13:09:26 2010 +0000
@@ -5650,21 +5650,7 @@
}; }
-RESOURCE LOCALIZED_TIMEZONE r_tz_west_sahara_el_aaiun
- {
- time_zone_id = 256;
- standard_name = "default";
- daylight_name = "";
- short_standard_name = "";
- short_daylight_name = "";
- cities =
- {
- TIMEZONE_CITY
- {
- city_group_id = 241;
- city_name = qtn_clk_city_west_sahara_el_aaiun;
- }
- }; }
+
RESOURCE LOCALIZED_TIMEZONE r_tz_zambia_lusaka
@@ -5712,7 +5698,7 @@
{
TIMEZONE_CITY
{
- city_group_id = 242;
+ city_group_id = 241;
city_name = qtn_clk_city_macau;
}
}; }
@@ -5729,7 +5715,7 @@
{
TIMEZONE_CITY
{
- city_group_id = 243;
+ city_group_id = 242;
city_name = qtn_clk_city_usa_louisville;
}
}; }
--- a/clock2/clockui/utilities/data/timezones_tel_aviv.rss Mon Mar 08 21:43:23 2010 +0000
+++ b/clock2/clockui/utilities/data/timezones_tel_aviv.rss Sun Mar 14 13:09:26 2010 +0000
@@ -5654,21 +5654,6 @@
}; }
-RESOURCE LOCALIZED_TIMEZONE r_tz_west_sahara_el_aaiun
- {
- time_zone_id = 256;
- standard_name = "default";
- daylight_name = "";
- short_standard_name = "";
- short_daylight_name = "";
- cities =
- {
- TIMEZONE_CITY
- {
- city_group_id = 241;
- city_name = qtn_clk_city_west_sahara_el_aaiun;
- }
- }; }
RESOURCE LOCALIZED_TIMEZONE r_tz_zambia_lusaka
@@ -5716,7 +5701,7 @@
{
TIMEZONE_CITY
{
- city_group_id = 242;
+ city_group_id = 241;
city_name = qtn_clk_city_macau;
}
}; }
@@ -5732,7 +5717,7 @@
{
TIMEZONE_CITY
{
- city_group_id = 243;
+ city_group_id = 242;
city_name = qtn_clk_city_usa_louisville;
}
}; }
Binary file clock2/help/data/xhtml.zip has changed
--- a/clock2/help/inc/clk.hlp.hrh Mon Mar 08 21:43:23 2010 +0000
+++ b/clock2/help/inc/clk.hlp.hrh Sun Mar 14 13:09:26 2010 +0000
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
--- a/organizer_plat/calendar_common_utils_api/inc/calenmulticaluids.hrh Mon Mar 08 21:43:23 2010 +0000
+++ b/organizer_plat/calendar_common_utils_api/inc/calenmulticaluids.hrh Sun Mar 14 13:09:26 2010 +0000
@@ -30,7 +30,8 @@
EDeviceSyncServiceOwner,
EOwnerName,
EMarkAsDelete,
- EDeviceSyncProfileID
+ EDeviceSyncProfileID,
+ ESyncConfigEnabled
};
#endif /* CALENMULTICALUIDS_HRH_ */
--- a/organizer_plat/calendar_common_utils_api/tsrc/group/CalendarCommonUtilsTest_DoxyFile.txt Mon Mar 08 21:43:23 2010 +0000
+++ b/organizer_plat/calendar_common_utils_api/tsrc/group/CalendarCommonUtilsTest_DoxyFile.txt Sun Mar 14 13:09:26 2010 +0000
@@ -2,7 +2,7 @@
# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
# All rights reserved.
# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
+# under the terms of the License "Eclipse Public License v1.0"
# which accompanies this distribution, and is available
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
#
Binary file organizer_plat/calendar_common_utils_api/tsrc/group/rndcert.der has changed
--- a/organizer_plat/calendar_common_utils_api/tsrc/group/rndcert.key Mon Mar 08 21:43:23 2010 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,15 +0,0 @@
------BEGIN RSA PRIVATE KEY-----
-MIICXQIBAAKBgQC/TDP7KKIaf5+uW4OD2iVZuUMC2a+SeQTjf6srlKcOm+CpPNXn
-uLNm/8fdEnyOIuRXPRKmqhs1n0JkxEGHynELWMTuKXbQx9SRAGUXzyneGn+IJNnO
-vOKHWgKCouX2hfI8rtkdqJpqmO460gGsMgw+lsbeyWyW9lnfLxq+ZC7sqQIDAQAB
-AoGBALmUWZE8GBaQ3P4u9WUCSd3DJkkrmXIFSULSZeH/chlwCwDjbbhArHothVzo
-REE3hEFFlERvHbplZ+mNouzy7boduvgUzbksGrbGMLJ2qO1GzWWVwV+GzOWKd3ss
-/98Gwoy5R8pjnkqUE2wP1iJFw0FjvUTKcYv/z6t3LLJ0CsoBAkEA+c7ixvsviQ3J
-s0INytCKU2bf8fqFQJi1VI82ukxNsujGTQ9upVSjuvqPvWyDvvTdrUBHqO+3qPut
-sEh01Q8aiQJBAMQKDJPVRu4ud3mwUfEavzL5EjqwG1k9VCNGYsT4FwtrHcxu1oP/
-pk6M3rIZukqomoEEnHWPMwhrK3fhBqi0OSECQQDr40VXege4FnH5OI2Hj4afHMyp
-VdQQXGMWFyopnzXblFz0lXb43cTCIiorR9XcMqNFHybLypkWE5o+lRzlt55pAkBQ
-P/zeF5Sts//cpL0mgdh7OVKpC6ZmZaCnwAx2rUhhuDu+kDDoYCLoTOps5fNI1LRK
-1GRoC3LMo3Jr5IYhUYWBAkBpCpN6k4JU/mszq98EojHerQNxk8sPqvQKUzTutohT
-1gLX9yepGayB/TtT2EEJDkWOlnTy/dvN6W3vzbJYz97x
------END RSA PRIVATE KEY-----
Binary file organizer_plat/meeting_request_mailbox_utilities_api/tsrc/stiff/group/rndcert.der has changed
--- a/organizer_plat/meeting_request_mailbox_utilities_api/tsrc/stiff/group/rndcert.key Mon Mar 08 21:43:23 2010 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,15 +0,0 @@
------BEGIN RSA PRIVATE KEY-----
-MIICXQIBAAKBgQC/TDP7KKIaf5+uW4OD2iVZuUMC2a+SeQTjf6srlKcOm+CpPNXn
-uLNm/8fdEnyOIuRXPRKmqhs1n0JkxEGHynELWMTuKXbQx9SRAGUXzyneGn+IJNnO
-vOKHWgKCouX2hfI8rtkdqJpqmO460gGsMgw+lsbeyWyW9lnfLxq+ZC7sqQIDAQAB
-AoGBALmUWZE8GBaQ3P4u9WUCSd3DJkkrmXIFSULSZeH/chlwCwDjbbhArHothVzo
-REE3hEFFlERvHbplZ+mNouzy7boduvgUzbksGrbGMLJ2qO1GzWWVwV+GzOWKd3ss
-/98Gwoy5R8pjnkqUE2wP1iJFw0FjvUTKcYv/z6t3LLJ0CsoBAkEA+c7ixvsviQ3J
-s0INytCKU2bf8fqFQJi1VI82ukxNsujGTQ9upVSjuvqPvWyDvvTdrUBHqO+3qPut
-sEh01Q8aiQJBAMQKDJPVRu4ud3mwUfEavzL5EjqwG1k9VCNGYsT4FwtrHcxu1oP/
-pk6M3rIZukqomoEEnHWPMwhrK3fhBqi0OSECQQDr40VXege4FnH5OI2Hj4afHMyp
-VdQQXGMWFyopnzXblFz0lXb43cTCIiorR9XcMqNFHybLypkWE5o+lRzlt55pAkBQ
-P/zeF5Sts//cpL0mgdh7OVKpC6ZmZaCnwAx2rUhhuDu+kDDoYCLoTOps5fNI1LRK
-1GRoC3LMo3Jr5IYhUYWBAkBpCpN6k4JU/mszq98EojHerQNxk8sPqvQKUzTutohT
-1gLX9yepGayB/TtT2EEJDkWOlnTy/dvN6W3vzbJYz97x
------END RSA PRIVATE KEY-----
--- a/organizer_pub/calendar_interim_utils2_api/tsrc/stiff/group/CalenInterimUtils2Test_DoxyFile.txt Mon Mar 08 21:43:23 2010 +0000
+++ b/organizer_pub/calendar_interim_utils2_api/tsrc/stiff/group/CalenInterimUtils2Test_DoxyFile.txt Sun Mar 14 13:09:26 2010 +0000
@@ -2,7 +2,7 @@
# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
# All rights reserved.
# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
+# under the terms of the License "Eclipse Public License v1.0"
# which accompanies this distribution, and is available
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
#
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/organizer_pub/notepad_library_api/tsrc/.cproject Sun Mar 14 13:09:26 2010 +0000
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?fileVersion 4.0.0?>
+
+<cproject>
+<storageModule buildFromInf="true" buildingTestComps="true" cleanLevel="0" concurrentBuildJobs="4" defaultMMPChangedAction="0" infBuildComponents="" infFileLocation="group\Bld.inf" macrosFile="" manageDependencies="true" moduleId="com.nokia.carbide.cdt.builder.carbideCPPBuilder" overrideWorkspaceSettings="false" promptForMMPChangedAction="true" useConcurrentBuilding="true" useIncrementalBuilder="false" useMMPMacros="true"/>
+<storageModule moduleId="org.eclipse.cdt.core.settings">
+<cconfiguration id="Emulator Debug (WINSCW) [wk34]">
+<storageModule buildSystemId="com.nokia.carbide.cdt.builder.CarbideConfigurationDataProvider" id="Emulator Debug (WINSCW) [wk34]" moduleId="org.eclipse.cdt.core.settings" name="Emulator Debug (WINSCW) [wk34]">
+<externalSettings/>
+<extensions>
+<extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/>
+<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+<extension id="com.nokia.cdt.debug.cw.symbian.SymbianE32" point="org.eclipse.cdt.core.BinaryParser"/>
+<extension id="com.nokia.carbide.cdt.builder.MakeDefErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.MWLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.CarbideMakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.RCOMPErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.MakmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+</extensions>
+</storageModule>
+<storageModule moduleId="CarbideConfigurationDataProvider">
+<ENV_VAR_DATA_ID/>
+<ARGUMENTS_DATA_ID ABLDFREEZEARGSSTORAGE="-r"/>
+</storageModule>
+<storageModule filesCache="R:\s60\app\organizer\organizer_sdk\notepad_library_api\tsrc\group\TestNpdApi.mmp;R:\s60\app\organizer\organizer_sdk\notepad_library_api\tsrc\group\Bld.inf;R:\epoc32\include\domain\osextensions\platform_paths.hrh;" includesCache="R:/s60/app/organizer/organizer_sdk/notepad_library_api/tsrc/inc[LOCAL];r:/epoc32/include;r:/epoc32/include/oem;r:/epoc32/include/osextensions;r:/epoc32/include/domain/osextensions;r:/epoc32/include/domain/osextensions/loc;r:/epoc32/include/domain/osextensions/loc/sc;r:/epoc32/include/applications;R:/epoc32/include/oem;" macrosCache="__WINSCW__;__SUPPORT_CPP_EXCEPTIONS__;__SYMBIAN32__;_UNICODE;__SERIES60_5x__;_DEBUG;__DLL__;__WINS__;__CW32__;__SERIES60_50__;" moduleId="configDataCache" sourcesCache="/TestNpdApi/inc;/TestNpdApi/src;" timestampCache="1220696835953" useMmpMacrosCache="true"/>
+<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+</cconfiguration>
+</storageModule>
+</cproject>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/organizer_pub/notepad_library_api/tsrc/.project Sun Mar 14 13:09:26 2010 +0000
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>TestNpdApi</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>com.nokia.carbide.cdt.builder.carbideCPPBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>com.nokia.carbide.cdt.rombuilder.carbideRomBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>com.nokia.s60tools.pclint.pclintAuditor</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.cdt.core.cnature</nature>
+ <nature>org.eclipse.cdt.core.ccnature</nature>
+ <nature>com.nokia.carbide.cdt.builder.carbideCPPBuilderNature</nature>
+ <nature>com.nokia.carbide.cdt.rombuilder.carbideRomBuildNature</nature>
+ <nature>com.nokia.s60tools.pclint.pclintNature</nature>
+ </natures>
+</projectDescription>
--- a/organizer_pub/notepad_library_api/tsrc/cproject Mon Mar 08 21:43:23 2010 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?fileVersion 4.0.0?>
-
-<cproject>
-<storageModule buildFromInf="true" buildingTestComps="true" cleanLevel="0" concurrentBuildJobs="4" defaultMMPChangedAction="0" infBuildComponents="" infFileLocation="group\Bld.inf" macrosFile="" manageDependencies="true" moduleId="com.nokia.carbide.cdt.builder.carbideCPPBuilder" overrideWorkspaceSettings="false" promptForMMPChangedAction="true" useConcurrentBuilding="true" useIncrementalBuilder="false" useMMPMacros="true"/>
-<storageModule moduleId="org.eclipse.cdt.core.settings">
-<cconfiguration id="Emulator Debug (WINSCW) [wk34]">
-<storageModule buildSystemId="com.nokia.carbide.cdt.builder.CarbideConfigurationDataProvider" id="Emulator Debug (WINSCW) [wk34]" moduleId="org.eclipse.cdt.core.settings" name="Emulator Debug (WINSCW) [wk34]">
-<externalSettings/>
-<extensions>
-<extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/>
-<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
-<extension id="com.nokia.cdt.debug.cw.symbian.SymbianE32" point="org.eclipse.cdt.core.BinaryParser"/>
-<extension id="com.nokia.carbide.cdt.builder.MakeDefErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-<extension id="com.nokia.carbide.cdt.builder.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-<extension id="com.nokia.carbide.cdt.builder.MWLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-<extension id="com.nokia.carbide.cdt.builder.CarbideMakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-<extension id="com.nokia.carbide.cdt.builder.RCOMPErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-<extension id="com.nokia.carbide.cdt.builder.MakmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-</extensions>
-</storageModule>
-<storageModule moduleId="CarbideConfigurationDataProvider">
-<ENV_VAR_DATA_ID/>
-<ARGUMENTS_DATA_ID ABLDFREEZEARGSSTORAGE="-r"/>
-</storageModule>
-<storageModule filesCache="R:\s60\app\organizer\organizer_sdk\notepad_library_api\tsrc\group\TestNpdApi.mmp;R:\s60\app\organizer\organizer_sdk\notepad_library_api\tsrc\group\Bld.inf;R:\epoc32\include\domain\osextensions\platform_paths.hrh;" includesCache="R:/s60/app/organizer/organizer_sdk/notepad_library_api/tsrc/inc[LOCAL];r:/epoc32/include;r:/epoc32/include/oem;r:/epoc32/include/osextensions;r:/epoc32/include/domain/osextensions;r:/epoc32/include/domain/osextensions/loc;r:/epoc32/include/domain/osextensions/loc/sc;r:/epoc32/include/applications;R:/epoc32/include/oem;" macrosCache="__WINSCW__;__SUPPORT_CPP_EXCEPTIONS__;__SYMBIAN32__;_UNICODE;__SERIES60_5x__;_DEBUG;__DLL__;__WINS__;__CW32__;__SERIES60_50__;" moduleId="configDataCache" sourcesCache="/TestNpdApi/inc;/TestNpdApi/src;" timestampCache="1220696835953" useMmpMacrosCache="true"/>
-<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
-</cconfiguration>
-</storageModule>
-</cproject>
--- a/organizer_pub/notepad_library_api/tsrc/project Mon Mar 08 21:43:23 2010 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>TestNpdApi</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>com.nokia.carbide.cdt.builder.carbideCPPBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>com.nokia.carbide.cdt.rombuilder.carbideRomBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>com.nokia.s60tools.pclint.pclintAuditor</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.cdt.core.cnature</nature>
- <nature>org.eclipse.cdt.core.ccnature</nature>
- <nature>com.nokia.carbide.cdt.builder.carbideCPPBuilderNature</nature>
- <nature>com.nokia.carbide.cdt.rombuilder.carbideRomBuildNature</nature>
- <nature>com.nokia.s60tools.pclint.pclintNature</nature>
- </natures>
-</projectDescription>
--- a/searchfw/coresearchfw/server/src/searchserversession.cpp Mon Mar 08 21:43:23 2010 +0000
+++ b/searchfw/coresearchfw/server/src/searchserversession.cpp Sun Mar 14 13:09:26 2010 +0000
@@ -855,13 +855,20 @@
CleanupClosePushL( readStream );
readStream.Open( searchContentDesPtr );
CSearchDocumentId* documentId = CSearchDocumentId::NewL(readStream);
- TPtr8 launchInfoPtr = iSearchManager->GetLaunchInfoL( *documentId )->Des();
- aMessage.WriteL( 1, launchInfoPtr );
HBufC8* launchInfo = iSearchManager->GetLaunchInfoL( *documentId );
- delete launchInfo ;
- launchInfo = NULL;
- delete documentId;
- documentId = NULL;
+ if( launchInfo )
+ {
+ TPtr8 launchInfoPtr=launchInfo->Des();
+ aMessage.WriteL( 1, launchInfoPtr );
+
+ delete launchInfo ;
+ launchInfo = NULL;
+ }
+ if( documentId )
+ {
+ delete documentId;
+ documentId = NULL;
+ }
CleanupStack::PopAndDestroy( &readStream );
CleanupStack::PopAndDestroy( searchContentDes );
}
--- a/searchfw/plugins/contactsplugin/group/contactsplugin.mmp Mon Mar 08 21:43:23 2010 +0000
+++ b/searchfw/plugins/contactsplugin/group/contactsplugin.mmp Sun Mar 14 13:09:26 2010 +0000
@@ -68,4 +68,4 @@
LIBRARY eikctl.lib
LIBRARY flogger.lib
LIBRARY featmgr.lib
-
+LIBRARY Pbk2Presentation.lib
--- a/searchfw/plugins/contactsplugin/src/contactssearcher.cpp Mon Mar 08 21:43:23 2010 +0000
+++ b/searchfw/plugins/contactsplugin/src/contactssearcher.cpp Sun Mar 14 13:09:26 2010 +0000
@@ -51,6 +51,7 @@
#include <CVPbkContactViewDefinition.h>
#include <CVPbkSortOrder.h>
#include <MVPbkContactViewFiltering.h>
+#include <CPbk2SortOrderManager.h>
#include <barsc.h>
#include <barsread.h>
#include <contactssearchresource.rsg>
@@ -391,7 +392,7 @@
else
{
- User::Leave( KErrNotFound );
+ return NULL;
}
}
@@ -750,8 +751,8 @@
// in the contact store. Once we get the links, we extract data from them
// to be searched, and then pass the same to the text searcher
- CVPbkSortOrder* sortOrder = CVPbkSortOrder::NewL( iContactManager->FieldTypes() );
- CleanupStack::PushL( sortOrder );
+ CPbk2SortOrderManager* sortOrderManager = CPbk2SortOrderManager::NewL( iContactManager->FieldTypes() );
+ CleanupStack::PushL( sortOrderManager );
CVPbkContactViewDefinition* viewDef = CVPbkContactViewDefinition::NewL();
CleanupStack::PushL( viewDef );
@@ -781,11 +782,11 @@
SetActive();
}
iContactViewBase = iContactManager->CreateContactViewLC(
- *this, *viewDef, *sortOrder );
+ *this, *viewDef, sortOrderManager->SortOrder() );
CleanupStack::Pop(); // CreateContactViewLC
CleanupStack::PopAndDestroy( viewDef );
- CleanupStack::PopAndDestroy( sortOrder );
+ CleanupStack::PopAndDestroy( sortOrderManager );
}
--- a/searchfw/plugins/filesplugin/src/filessearcher.cpp Mon Mar 08 21:43:23 2010 +0000
+++ b/searchfw/plugins/filesplugin/src/filessearcher.cpp Sun Mar 14 13:09:26 2010 +0000
@@ -340,7 +340,7 @@
//Set the content class Id as KSearchCClassFilenamesUid
searchResult->SetContentClassId( KSearchCClassFilenamesUid );
//If file is found from memory card
- _LIT( KMemCard, "E:" );
+ _LIT( KMemCard, "F:" );
TInt found = path->Find( KMemCard );
if ( !found )
{
--- a/searchui/searchapp/plugins/resultviewerplugin/src/srchuiresultview.cpp Mon Mar 08 21:43:23 2010 +0000
+++ b/searchui/searchapp/plugins/resultviewerplugin/src/srchuiresultview.cpp Sun Mar 14 13:09:26 2010 +0000
@@ -823,7 +823,10 @@
//
void CSrchUiResultView::LaunchContactApplicationL( const TDesC8& aLaunchInfo )
{
-
+ if( aLaunchInfo.Length() <= 0 )
+ {
+ return ;
+ }
MCCAParameter* parameter = TCCAFactory::NewParameterL();
CleanupClosePushL( *parameter );