--- a/connectivitymodules/SeCon/group/bld.inf Fri Apr 16 14:53:26 2010 +0300
+++ b/connectivitymodules/SeCon/group/bld.inf Mon May 03 12:24:28 2010 +0300
@@ -32,9 +32,9 @@
PRJ_EXPORTS
// Export stub files
-stubs/secon_stub.SIS /epoc32/data/z/system/install/secon_stub.SIS
-stubs/sconpcconnplugin_stub.SIS /epoc32/data/z/system/install/sconpcconnplugin_stub.SIS
-stubs/sconftpplugin_stub.SIS /epoc32/data/z/system/install/sconftpplugin_stub.SIS
+stubs/secon_stub.sis /epoc32/data/z/system/install/secon_stub.sis
+stubs/sconpcconnplugin_stub.sis /epoc32/data/z/system/install/sconpcconnplugin_stub.sis
+stubs/sconftpplugin_stub.sis /epoc32/data/z/system/install/sconftpplugin_stub.sis
../rom/sconpcd.iby CORE_MW_LAYER_IBY_EXPORT_PATH(sconpcd.iby)
../rom/sconpcconnplugin.iby CORE_MW_LAYER_IBY_EXPORT_PATH(sconpcconnplugin.iby)
--- a/connectivitymodules/SeCon/services/csc/bld/bld.inf Fri Apr 16 14:53:26 2010 +0300
+++ b/connectivitymodules/SeCon/services/csc/bld/bld.inf Mon May 03 12:24:28 2010 +0300
@@ -22,13 +22,13 @@
DEFAULT
PRJ_EXPORTS
-./101F9698.xml /epoc32/data/Z/private/101F99F6/capability/101F9698.xml
-./fwdcomp.xml /epoc32/data/Z/private/101F99F6/capability/fwdcomp.xml
-./101F99F6.xml /epoc32/data/Z/private/101F99F6/capability/101F99F6.xml
+./101f9698.xml /epoc32/data/z/private/101f99f6/capability/101f9698.xml
+./fwdcomp.xml /epoc32/data/z/private/101f99f6/capability/fwdcomp.xml
+./101f99f6.xml /epoc32/data/z/private/101f99f6/capability/101f99f6.xml
-./101F9698.xml /epoc32/RELEASE/winscw/udeb/Z/private/101F99F6/capability/101F9698.xml
-./fwdcomp.xml /epoc32/RELEASE/winscw/udeb/Z/private/101F99F6/capability/fwdcomp.xml
-./101F99F6.xml /epoc32/RELEASE/winscw/udeb/Z/private/101F99F6/capability/101F99F6.xml
+./101f9698.xml /epoc32/release/winscw/udeb/z/private/101f99f6/capability/101f9698.xml
+./fwdcomp.xml /epoc32/release/winscw/udeb/z/private/101f99f6/capability/fwdcomp.xml
+./101f99f6.xml /epoc32/release/winscw/udeb/z/private/101f99f6/capability/101f99f6.xml
PRJ_MMPFILES
--- a/connectivitymodules/SeCon/services/csc/bld/sconcsc.mmp Fri Apr 16 14:53:26 2010 +0300
+++ b/connectivitymodules/SeCon/services/csc/bld/sconcsc.mmp Mon May 03 12:24:28 2010 +0300
@@ -70,8 +70,8 @@
LIBRARY apgrfx.lib
LIBRARY apparc.lib
LIBRARY sisregistryclient.lib
-LIBRARY SyncMLClientAPI.lib
+LIBRARY syncmlclientapi.lib
LIBRARY javaregistryclient.lib
LIBRARY sysversioninfo.lib
-LIBRARY Etel3rdParty.lib
+LIBRARY etel3rdparty.lib
LIBRARY platformver.lib
--- a/connectivitymodules/SeCon/services/ftp/bld/sconftp.mmp Fri Apr 16 14:53:26 2010 +0300
+++ b/connectivitymodules/SeCon/services/ftp/bld/sconftp.mmp Mon May 03 12:24:28 2010 +0300
@@ -45,7 +45,7 @@
USERINCLUDE ../../../inc
USERINCLUDE ../inc
-USERINCLUDE ../../../cntParser/inc
+USERINCLUDE ../../../cntparser/inc
// Default system include paths.
APP_LAYER_SYSTEMINCLUDE
@@ -60,14 +60,14 @@
LIBRARY efsrv.lib // For File server
LIBRARY euser.lib // Base library
-LIBRARY IrObex.lib // For Object exchange
+LIBRARY irobex.lib // For Object exchange
LIBRARY obexutils.lib
LIBRARY msgs.lib // For Inbox entry
LIBRARY charconv.lib // For Unicode conversion
LIBRARY bafl.lib // Basic Application Framework Library
LIBRARY commonengine.lib // For resource reader
LIBRARY platformenv.lib // For pathinfo
-LIBRARY CntParserServer.lib // for contacts
+LIBRARY cntparserserver.lib // for contacts
LIBRARY directorylocalizer.lib // For localizing directories
LIBRARY sysutil.lib
LIBRARY centralrepository.lib
--- a/connectivitymodules/SeCon/services/ftp/src/sconfshandler.cpp Fri Apr 16 14:53:26 2010 +0300
+++ b/connectivitymodules/SeCon/services/ftp/src/sconfshandler.cpp Mon May 03 12:24:28 2010 +0300
@@ -28,9 +28,9 @@
#include "sconfshandler.h"
#include "sconconsts.h"
-#include "IrMCConsts.h"
+#include "irmcconsts.h"
#include "cntparserclient.h"
-#include "CntParserInfoLog.h"
+#include "cntparserinfolog.h"
#include "debug.h"
// cntparser related constants
--- a/connectivitymodules/SeCon/services/pcd/bld/bld.inf Fri Apr 16 14:53:26 2010 +0300
+++ b/connectivitymodules/SeCon/services/pcd/bld/bld.inf Mon May 03 12:24:28 2010 +0300
@@ -23,7 +23,7 @@
DEFAULT
PRJ_EXPORTS
-./sbeconfig.xml /epoc32/data/Z/private/10202D56/sbeconfig.xml
+./sbeconfig.xml /epoc32/data/z/private/10202d56/sbeconfig.xml
PRJ_MMPFILES
sconpcd.mmp
--- a/connectivitymodules/SeCon/services/pcd/bld/sconpcd.mmp Fri Apr 16 14:53:26 2010 +0300
+++ b/connectivitymodules/SeCon/services/pcd/bld/sconpcd.mmp Mon May 03 12:24:28 2010 +0300
@@ -73,16 +73,16 @@
LIBRARY efsrv.lib
LIBRARY sysutil.lib
LIBRARY commonengine.lib // For resource reader
-LIBRARY WidgetRegistryClient.lib
+LIBRARY widgetregistryclient.lib
LIBRARY metadatautility.lib
LIBRARY exiflib.lib
LIBRARY charconv.lib
LIBRARY caf.lib // for Content Access
-LIBRARY MediaClientVideo.lib // for CVideoPlayerUtility
+LIBRARY mediaclientvideo.lib // for CVideoPlayerUtility
LIBRARY ws32.lib // for RWsSession
-LIBRARY TNEEngine.lib // for CTNEVideoClipInfo
-LIBRARY ImageConversion.lib // for CImageEncoder
-LIBRARY MMFControllerFramework.lib // for CMMFMetaDataEntry
+LIBRARY tneengine.lib // for CTNEVideoClipInfo
+LIBRARY imageconversion.lib // for CImageEncoder
+LIBRARY mmfcontrollerframework.lib // for CMMFMetaDataEntry
LIBRARY bafl.lib // for BaflUtils
DEBUGLIBRARY flogger.lib
// End of file
--- a/omads/group/bld.inf Fri Apr 16 14:53:26 2010 +0300
+++ b/omads/group/bld.inf Mon May 03 12:24:28 2010 +0300
@@ -18,6 +18,9 @@
#include <platform_paths.hrh>
PRJ_EXPORTS
+
+//for IAD support
+omads_stub.sis /epoc32/data/z/system/install/omads_stub.sis
../rom/omads.iby CORE_APP_LAYER_IBY_EXPORT_PATH(omads.iby)
#include "../omadsextensions/group/bld.inf"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/omads/group/omads_stub.pkg Mon May 03 12:24:28 2010 +0300
@@ -0,0 +1,56 @@
+;
+; Copyright (c) 2006-2008 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"
+; which accompanies this distribution, and is available
+; at the URL "http://www.eclipse.org/legal/epl-v10.html".
+;
+; Initial Contributors:
+; Nokia Corporation - initial contribution.
+;
+; Contributors:
+;
+; Description: Stub Package file for omadsextensions
+;
+
+; Languages
+&EN
+
+; Header
+; Name, UID for installation, Maj.Ver., Min.Ver., Variant, FLAG TO SPECIFY UNICODE, System component
+#{"Omads"}, (0x2002E6D9), 1, 0, 0, TYPE=SA
+
+; Localised Vendor name
+%{"Nokia"}
+
+; Unique Vendor name
+:"Nokia"
+
+; DLLs
+
+; from omadsextensions/dsutils
+""-"z:\sys\bin\nsmlcontactsdatastoreextension.dll"
+""-"z:\sys\bin\nsmlCGIScriptParser.dll"
+
+; from omadsextensions
+""-"z:\sys\bin\nsmldatamod.dll"
+
+; Ecom plugin
+; from ds
+""-"z:\sys\bin\nsmlcontactsdataprovider.dll"
+""-"z:\resource\plugin\nsmlcontactsdataprovider.r*"
+
+""-"z:\sys\bin\nsmlagendadataprovider.dll"
+""-"z:\resource\plugin\nsmlagendadataprovider.r*"
+
+""-"z:\sys\bin\nsmlnotepaddataprovider.dll"
+""-"z:\resource\plugin\nsmlnotepaddataprovider.r*"
+
+
+;Resource files
+""-"z:\resource\NSmlContactsDataStoreFormat_1_1_2.r*"
+""-"z:\resource\NSmlContactsDataStoreFormat_1_2.r*"
+""-"z:\resource\NSmlAgendaDataStore_1_1_2.r*"
+""-"z:\resource\NSmlAgendaDataStore_1_2.r*"
+""-"z:\resource\NSmlNotepadDataStoreFormat.r*"
Binary file omads/group/omads_stub.sis has changed
--- a/omads/omadsextensions/adapters/agenda/src/nsmlagendadatastore.cpp Fri Apr 16 14:53:26 2010 +0300
+++ b/omads/omadsextensions/adapters/agenda/src/nsmlagendadatastore.cpp Mon May 03 12:24:28 2010 +0300
@@ -975,13 +975,13 @@
iEntryView->DeleteL( uidArray, aNumSuccessfulDeleted );
CleanupStack::PopAndDestroy( &uidArray ); // uidArray
+ iSnapshotRegistered = EFalse;
// Update changefinder
if ( iChangeFinder )
{
iChangeFinder->ResetL();
+ RegisterSnapshotL();
}
- iSnapshotRegistered = EFalse;
- RegisterSnapshotL();
User::RequestComplete( iCallerStatus, KErrNone );
--- a/omads/omadsextensions/adapters/bld/bld.inf Fri Apr 16 14:53:26 2010 +0300
+++ b/omads/omadsextensions/adapters/bld/bld.inf Mon May 03 12:24:28 2010 +0300
@@ -26,4 +26,7 @@
#include "../agenda/bld/bld.inf"
#endif
+#ifdef __SYNCML_DS_NOTEPAD
+#include "../notes/group/bld.inf"
+#endif
--- a/omads/omadsextensions/adapters/contacts/sis/cnt_adapter.pkg Fri Apr 16 14:53:26 2010 +0300
+++ b/omads/omadsextensions/adapters/contacts/sis/cnt_adapter.pkg Mon May 03 12:24:28 2010 +0300
@@ -17,15 +17,12 @@
&EN
; Package header
-#{"DataSync Contact Adapter"}, (0x101F6DDD), 1, 2, 0, TYPE=SA,RU
+#{"DataSync Contact Adapter"}, (0x2002E6D9), 1, 2, 0, TYPE=SP
; Vendor names
%{"Nokia"}
:"Nokia"
-"\epoc32\release\armv5\urel\nsmlsosserver.exe"-"c:\sys\bin\nsmlsosserver.exe"
-"\epoc32\release\armv5\urel\nsmldshostserver.dll"-"c:\sys\bin\nsmldshostserver.dll"
-
"\epoc32\release\armv5\urel\nsmlcontactsdataprovider.dll"-"c:\sys\bin\nsmlcontactsdataprovider.dll"
"\epoc32\data\z\resource\plugins\nsmlcontactsdataprovider.rsc"-"c:\resource\plugins\nsmlcontactsdataprovider.rsc"
"\epoc32\data\z\resource\NSmlContactsDataStoreFormat_1_1_2.rsc"-"c:\resource\NSmlContactsDataStoreFormat_1_1_2.rsc"
--- a/omads/omadsextensions/adapters/contacts/src/NSmlContactsDataProvider.cpp Fri Apr 16 14:53:26 2010 +0300
+++ b/omads/omadsextensions/adapters/contacts/src/NSmlContactsDataProvider.cpp Mon May 03 12:24:28 2010 +0300
@@ -164,10 +164,14 @@
TFileName resourceFileName;
resourceFileName.Copy( TParsePtrC( dllFileName ).Drive() );
+
+ resourceFileName.Append( GetStoreFormatResourceFileL() );
- parse.Set( GetStoreFormatResourceFileL(), &KDC_RESOURCE_FILES_DIR, NULL );
+ parse.Set( resourceFileName, &KDC_RESOURCE_FILES_DIR, NULL );
fileName = parse.FullName();
+
+ DBG_ARGS(_S("CNSmlContactsDataProvider::SetOwnStoreFormatL(): '%S'"), &parse.FullName());
RResourceFile resourceFile;
BaflUtils::NearestLanguageFile( iRfs, fileName );
@@ -301,12 +305,12 @@
value );
if ( error == KErrNone && value == EDataSyncRunning )
{
- _DBG_FILE("CNSmlContactsDataProvider::GetStoreFormatResourceFileL(): END");
+ _DBG_FILE("CNSmlContactsDataProvider::GetStoreFormatResourceFileL() 1.1.2 : END");
return KNSmlContactsStoreFormatRsc_1_1_2;
}
else // error or protocol version 1.2
{
- _DBG_FILE("CNSmlContactsDataProvider::GetStoreFormatResourceFileL(): END");
+ _DBG_FILE("CNSmlContactsDataProvider::GetStoreFormatResourceFileL() 1.2 : END");
return KNSmlContactsStoreFormatRsc_1_2;
}
}
--- a/omads/omadsextensions/adapters/contacts/src/NSmlContactsDataStore.cpp Fri Apr 16 14:53:26 2010 +0300
+++ b/omads/omadsextensions/adapters/contacts/src/NSmlContactsDataStore.cpp Mon May 03 12:24:28 2010 +0300
@@ -508,10 +508,21 @@
{
TFileName fileName;
TParse parse;
+
+ // Locate the resource file
+ TFileName dllFileName;
+ Dll::FileName( dllFileName );
+
+ TFileName resourceFileName;
+ resourceFileName.Copy( TParsePtrC( dllFileName ).Drive() );
+
+ resourceFileName.Append( GetStoreFormatResourceFileL() );
- parse.Set( GetStoreFormatResourceFileL(), &KDC_RESOURCE_FILES_DIR, NULL );
+ parse.Set( resourceFileName, &KDC_RESOURCE_FILES_DIR, NULL );
fileName = parse.FullName();
+
+ DBG_ARGS(_S("CNSmlContactsDataStore::SetOwnStoreFormatL(): '%S'"), &parse.FullName());
RResourceFile resourceFile;
BaflUtils::NearestLanguageFile( iRfs, fileName );
@@ -652,8 +663,8 @@
if ( iState != ENSmlOpenAndWaiting )
{
+ _DBG_FILE("CNSmlContactsDataStore::DoCreateItemL - KErrNotReady: END");
User::RequestComplete( iCallerStatus, KErrNotReady );
- _DBG_FILE("CNSmlContactsDataStore::DoCreateItemL - KErrNotReady: END");
return;
}
@@ -685,8 +696,8 @@
// Allow using custom MIME type defined in store format resource file
( aMimeType.MatchF( iUsedMimeType ) < 0 ) )
{
+ _DBG_FILE("CNSmlContactsDataStore::DoCreateItemL - KErrNotSupported: END");
User::RequestComplete( iCallerStatus, KErrNotSupported );
- _DBG_FILE("CNSmlContactsDataStore::DoCreateItemL - KErrNotSupported: END");
return;
}
@@ -1242,18 +1253,16 @@
_DBG_FILE("CNSmlContactsDataStore::DoResetChangeInfoL(): begin");
iCallerStatus = &aStatus;
*iCallerStatus = KRequestPending;
- TInt error(KErrNone);
+
+ iSnapshotRegistered = EFalse;
if( iChangeFinder )
{
iChangeFinder->ResetL();
+ FetchModificationsL();
}
-
- iSnapshotRegistered = EFalse;
- error = FetchModificationsL();
-
- User::RequestComplete( iCallerStatus, error );
+ User::RequestComplete( iCallerStatus, KErrNone );
_DBG_FILE("CNSmlContactsDataStore::DoResetChangeInfoL(): end");
}
@@ -1526,11 +1535,31 @@
*hItemBuf = bItem->Ptr(0);
CleanupStack::PopAndDestroy(); // bItem
CleanupStack::PushL( hItemBuf );
- //StripPropertyL( hItemBuf, KVersitTokenUID() );
+ StripPropertyL( hItemBuf, KVersitTokenUID() );
+
TPtr8 hItemPtr( hItemBuf->Des() );
+ HBufC8* endPropBuf = HBufC8::NewLC( KVersitTokenEND().Length() + KVersitTokenCRLF().Length() + KVersitTokenColon().Length() );
+ TPtr8 endPropPtr( endPropBuf->Des() );
+ endPropPtr.Append( KVersitTokenCRLF() );
+ endPropPtr.Append( KVersitTokenEND() );
+ endPropPtr.Append( KVersitTokenColon() );
+ TInt endPos = hItemPtr.Find( endPropPtr );
+ if( endPos == KErrNotFound )
+ {
+ User::Leave( KErrNotSupported );
+ }
+ hItemPtr.Insert( endPos, KVersitTokenCRLF() );
+ endPos += KVersitTokenCRLF().Length();
+ hItemPtr.Insert( endPos, KVersitTokenUID() );
+ endPos += KVersitTokenUID().Length();
+ hItemPtr.Insert( endPos, KVersitTokenColon() );
+ endPos += KVersitTokenColon().Length();
+ hItemPtr.Insert( endPos, *contactitem->iGuid );
DBG_DUMP((void*)hItemPtr.Ptr(), hItemPtr.Length(),
_S8("CNSmlContactsDataStore::LdoUpdateItemL(): MergedItem:"));
+
+ CleanupStack::PopAndDestroy( endPropBuf );
// TODO: Get it reviewed
CArrayFixFlat<TUid>* entryArray = NULL;
@@ -1740,12 +1769,12 @@
value );
if ( error == KErrNone && value == EDataSyncRunning )
{
- _DBG_FILE("CNSmlContactsDataStore::GetStoreFormatResourceFileL(): END");
+ _DBG_FILE("CNSmlContactsDataStore::GetStoreFormatResourceFileL() 1.1.2: END");
return KNSmlContactsStoreFormatRsc_1_1_2;
}
else // error or protocol version 1.2
{
- _DBG_FILE("CNSmlContactsDataStore::GetStoreFormatResourceFileL(): END");
+ _DBG_FILE("CNSmlContactsDataStore::GetStoreFormatResourceFileL() 1.2: END");
return KNSmlContactsStoreFormatRsc_1_2;
}
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/omads/omadsextensions/adapters/notes/group/bld.inf Mon May 03 12:24:28 2010 +0300
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2002 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"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: build info file for Notepad DS adapter
+*
+*/
+
+#include <platform_paths.hrh>
+PRJ_EXPORTS
+../loc/101F85F8.loc APP_LAYER_LOC_EXPORT_PATH(101F85F8.loc)
+
+PRJ_MMPFILES
+nsmldsnotepaddataprovider.mmp
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/omads/omadsextensions/adapters/notes/group/def/bwinscwnotepaddataprovideru.def Mon May 03 12:24:28 2010 +0300
@@ -0,0 +1,3 @@
+EXPORTS
+ ?ImplementationGroupProxy@@YAPBUTImplementationProxy@@AAH@Z @ 1 NONAME ; struct TImplementationProxy const * ImplementationGroupProxy(int &)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/omads/omadsextensions/adapters/notes/group/def/eabinotepaddataprovideru.def Mon May 03 12:24:28 2010 +0300
@@ -0,0 +1,11 @@
+EXPORTS
+ _Z24ImplementationGroupProxyRi @ 1 NONAME
+ _ZTI20CNSmlNotepadDatabase @ 2 NONAME
+ _ZTI21CNSmlNotepadDataStore @ 3 NONAME
+ _ZTI24CNSmlNotepadDataProvider @ 4 NONAME
+ _ZTI8CNpdItem @ 5 NONAME
+ _ZTV20CNSmlNotepadDatabase @ 6 NONAME
+ _ZTV21CNSmlNotepadDataStore @ 7 NONAME
+ _ZTV24CNSmlNotepadDataProvider @ 8 NONAME
+ _ZTV8CNpdItem @ 9 NONAME
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/omads/omadsextensions/adapters/notes/group/nsmldsnotepaddataprovider.mmp Mon May 03 12:24:28 2010 +0300
@@ -0,0 +1,70 @@
+/*
+* Copyright (c) 2005 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"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: mmp file for Notepad DS adapter
+*
+*/
+
+
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+
+CAPABILITY CAP_ECOM_PLUGIN
+
+TARGET nsmlnotepaddataprovider.dll
+TARGETPATH PLUGINS_1_DIR
+TARGETTYPE PLUGIN
+UID 0x10009D8D 0x101F8612
+VENDORID VID_DEFAULT
+
+#if defined(ARMCC)
+DEFFILE ./def/eabinotepaddataprovider
+#elif defined(WINSCW)
+DEFFILE ./def/bwinscwnotepaddataprovider
+#endif
+
+//MACRO _DEBUG_
+
+SOURCEPATH ../src
+SOURCE NSmlNotepadDataProvider.cpp
+SOURCE NSmlNotepadDataStore.cpp
+SOURCE nsmlnotepadDatabase.cpp
+
+APP_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE /epoc32/include/ecom
+SYSTEMINCLUDE /epoc32/include/syncml
+
+MW_LAYER_SYSTEMINCLUDE
+
+USERINCLUDE ../inc
+
+START RESOURCE nsmlnotepaddataprovider.rss
+HEADER
+TARGET nsmlnotepaddataprovider.rsc
+TARGETPATH ECOM_RESOURCE_DIR
+END
+
+START RESOURCE NSmlNotepadDataStoreFormat.rss
+HEADER
+TARGET nsmlnotepaddatastoreformat.rsc
+TARGETPATH RESOURCE_FILES_DIR
+END
+
+
+LIBRARY ecom.lib bafl.lib euser.lib efsrv.lib estor.lib sysutil.lib
+LIBRARY nsmlchangefinder.lib etext.lib wbxmllib.lib
+LIBRARY smlstoreformat.lib smldataprovider.lib
+LIBRARY nsmldshostclient.lib
+LIBRARY calinterimapi.lib caleninterimutils2.lib
+LIBRARY nsmldebug.lib
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/omads/omadsextensions/adapters/notes/inc/NSmlNotepadDataProvider.h Mon May 03 12:24:28 2010 +0300
@@ -0,0 +1,170 @@
+/*
+* Copyright (c) 2005 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"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: DS notepad dataprovider.
+*
+*/
+
+
+#ifndef __NSMLNOTEPADDATAPROVIDER_H__
+#define __NSMLNOTEPADDATAPROVIDER_H__
+
+
+//FORWARD DECLARATION
+class CNSmlNotepadDataStore;
+
+
+// CLASS DECLARATION
+
+// ------------------------------------------------------------------------------------------------
+// CNSmlNotepadDataProvider
+//
+// @lib nsmlnotepaddataprovider.lib
+// ------------------------------------------------------------------------------------------------
+class CNSmlNotepadDataProvider : public CSmlDataProvider
+ {
+ public:
+ /**
+ * Two-phased constructor.
+ */
+ static CNSmlNotepadDataProvider* NewL();
+
+ /**
+ * Destructor.
+ */
+ virtual ~CNSmlNotepadDataProvider();
+
+ private:
+ /**
+ * Two-phased constructor.
+ */
+ static CNSmlNotepadDataProvider* NewLC();
+
+ /**
+ * C++ constructor.
+ */
+ CNSmlNotepadDataProvider();
+
+ /**
+ * 2nd phase constructor.
+ */
+ void ConstructL();
+
+ /**
+ * This method handles framework events.
+ * @param Frameworks event.
+ * @param aParam1 First parameter.
+ * @param aParam2 Second parameter.
+ */
+ void DoOnFrameworkEvent(TSmlFrameworkEvent,
+ TInt aParam1,
+ TInt aParam2);
+
+ /**
+ * Check if operation is supported by dataprovider.
+ * @param aOpId Operations type.
+ * @return ETrue if the operation is supported.
+ */
+ TBool DoSupportsOperation(TUid aOpId) const;
+
+ /**
+ * Gets dataproviders own StoreFormat.
+ */
+ const CSmlDataStoreFormat& DoStoreFormatL();
+
+ /**
+ * Lists all notepad databases on client.
+ * @return List of notepad databases.
+ */
+ CDesCArray* DoListStoresLC();
+
+ /**
+ * Gets default storename on client.
+ * @return Default storename.
+ */
+ const TDesC& DoDefaultStoreL();
+
+ /**
+ * Constructs new instance of datastore.
+ * @return Newly created instance.
+ */
+ CSmlDataStore* DoNewStoreInstanceLC();
+
+ /**
+ This method returns the set of filters that can be used to send to the SyncML server.
+ * @return New filters.
+ */
+ const RPointerArray<CSyncMLFilter>& DoSupportedServerFiltersL();
+
+ /**
+ This method checks what filters are supported by server.
+ @param aServerDataStoreFormat The store format of server
+ @param aFilters The array that includes filters
+ @param aChangeInfo The change information about changes that data provider did
+ */
+ void DoCheckSupportedServerFiltersL(const CSmlDataStoreFormat& aServerDataStoreFormat,
+ RPointerArray<CSyncMLFilter>& aFilters,
+ TSyncMLFilterChangeInfo& aChangeInfo);
+
+ /**
+ This method updates dynamic filters up-to-date.
+ @param aFilters The array that includes filters
+ @param aChangeInfo The change information about changes that data provider did
+ */
+ void DoCheckServerFiltersL(RPointerArray<CSyncMLFilter>& aFilters,
+ TSyncMLFilterChangeInfo& aChangeInfo);
+
+ /**
+ This method generates a record filter query to be sent to the SyncML server for the provided filters.
+ @param aFilters The filters to be used for the query generation
+ @param aMatch The filter match type to be used
+ @param aFilterMimeType The mime type of the returned filter query
+ @param TSyncMLFilterType The filter type of the returned filter query
+ @param aStoreName The name of used store
+ @return The record filter query to be sent to the SyncML server - empty if no record filter involved
+ for this specific filter
+ */
+ HBufC* DoGenerateRecordFilterQueryLC(const RPointerArray<CSyncMLFilter>& aFilters,
+ TSyncMLFilterMatchType aMatch,
+ TDes& aFilterMimeType,
+ TSyncMLFilterType& aFilterType,
+ TDesC& aStoreName);
+
+ /**
+ This method generates a field filter query to be sent to the SyncML server for the provided filters.
+ @param aFilters The filters to be used for the query generation
+ @param aFilterMimeType The mime type of the returned filter query
+ @param aProperties The field filter query to be sent to the SyncML server - empty if no field filter involved
+ for this specific filter
+ @param aStoreName The name of used store
+ */
+ void DoGenerateFieldFilterQueryL(const RPointerArray<CSyncMLFilter>& aFilters,
+ TDes& aFilterMimeType,
+ RPointerArray<CSmlDataProperty>& aProperties,
+ TDesC& aStoreName);
+
+
+
+ private: // data
+ CNSmlNotepadDataStore* iNotepadDataStore;
+ RPointerArray<CSyncMLFilter> iFilterArray;
+ RFs iRfs;
+ RStringPool iStringPool;
+ CSmlDataStoreFormat* iStoreFormat;
+
+
+ };
+
+#endif // __NSMLNOTEPADDATAPROVIDER_H__
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/omads/omadsextensions/adapters/notes/inc/NSmlNotepadDatastore.h Mon May 03 12:24:28 2010 +0300
@@ -0,0 +1,454 @@
+/*
+* Copyright (c) 2005 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"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: DS notepad datastore.
+*
+*/
+
+
+#ifndef __NSMLNOTEPADDATASTORE_H__
+#define __NSMLNOTEPADDATASTORE_H__
+
+//CONSTANTS
+const TInt KNSmlCompactAfterChanges = 16;
+const TInt KNSmlDataStoreMaxSize = 102400; // 100 k
+const TInt KNSmlDefaultStoreNameMaxSize = 256;
+const TInt KNSmlItemDataExpandSize = 1024;
+const TInt KUTF8Lenght = 4;
+const TInt KNullCharLen = 1;
+const TInt KUnicodeSize = 2;
+const TInt KSnapshotGranularity = 8;
+
+
+_LIT(KNSmlNotepadStoreFormatRsc,"NSmlNotepadDataStoreFormat.rsc");
+_LIT( KNSmlDriveC, "C" );
+_LIT8( KMimePlainText, "text/plain" );
+_LIT8( KMimePlainTextVersion, "1.0" );
+
+// FORWARD DECLARATIONS
+class CNSmlChangeFinder;
+class CNSmlNotepadDatabase;
+class CNpdItem;
+class CNSmlDataItemUidSet;
+class TNSmlSnapshotItem;
+
+// CLASS DECLARATION
+
+// ------------------------------------------------------------------------------------------------
+// CNSmlNotepadDataStore
+//
+// @lib nsmlnotepaddataprovider.lib
+// ------------------------------------------------------------------------------------------------
+class CNSmlNotepadDataStore : public CSmlDataStore
+ {
+ public:
+ /**
+ * Two-phased constructor.
+ */
+ static CNSmlNotepadDataStore* NewL();
+
+ /**
+ * Destructor.
+ */
+ virtual ~CNSmlNotepadDataStore();
+
+ private:
+
+ /**
+ * Default constructor.
+ */
+ CNSmlNotepadDataStore();
+
+ /**
+ * 2nd phase constructor.
+ */
+ void ConstructL();
+
+
+
+ public:
+ /**
+ * Default store name of client.
+ * @return Default store name.
+ */
+ const TDesC& DefaultStoreNameL() const;
+
+ /**
+ * Gets a list of all notepad databases on client.
+ * @return List of databases.
+ */
+ CDesCArray* DoListStoresLC();
+
+
+ /**
+ * DoOpenL() opens the data store specified by aStoreName asynchronously.
+ * @param aStoreName The name of the data store to open.
+ * @param aContext Identifies the specific synchronisation relationship to use for the synchronisation.
+ * @param aStatus On completion of the open, contains the result code.
+ */
+
+ void DoOpenL(const TDesC& aStoreName, MSmlSyncRelationship& aContext, TRequestStatus& aStatus);
+
+ /**
+ * DoCancelRequest() cancels the current asynchronous request, including open. Only one asynchronous request may be outstanding at any one time.
+ */
+ void DoCancelRequest();
+
+ /**
+ * DoStoreName() returns the name of the open data store.
+ * @return The name of the currently opened data store.
+ */
+ const TDesC& DoStoreName() const;
+
+ /**
+ * DoBeginTransactionL() starts the transaction mode. During this mode calls to CreateItemL, ReplaceItemL,
+ * WriteItemL, CommitItemL, MoveItemL, DeleteItemL and SoftDeleteItemL will be part of this transaction.
+ * Their RequestStatus must be completed, even if the change is not yet really executed in the Data Store.
+ * If a RequestStatus is completed with an error code, the transaction has failed and a rollback must be
+ * done. In this case RevertTransaction will be called.
+ */
+ void DoBeginTransactionL();
+
+ /**
+ * DoCommitTransactionL() will be called at the end of a successful transaction. At this point in time the
+ * operations within the transaction are applied to the Data Store in an atomic way. If all operations
+ * succeed, the RequestStatus must be completed with KErrNone. If an operation fails, a rollback must be
+ * done and the RequestStatus must be completed with an appropriate error code.
+ */
+ void DoCommitTransactionL(TRequestStatus& aStatus);
+
+ /**
+ * DoRevertTransaction() will be called to abort an ongoing transaction. None of the operations already
+ * submitted may be applied to the Data Store. The RequestStatus must be completed with KErrNone as a revert
+ * cannot fail.
+ */
+ void DoRevertTransaction(TRequestStatus& aStatus);
+
+ /**
+ * DoBeginBatchL() starts the batch mode. During this mode calls to CreateItemL, ReplaceItemL,
+ * WriteItemL, CommitItemL, MoveItemL, DeleteItemL and SoftDeleteItemL will be part of this batch.
+ * Their RequestStatus must be completed with KErrNone, which only signals acceptance of the operation
+ * for batch processing.
+ */
+ void DoBeginBatchL();
+
+ /**
+ * DoCommitBatchL() will be called at the end of the batch mode. This tells the Data Store to
+ * process the batched operations (in the order they were submitted), and to append the error code
+ * for each operation to aResultArray.
+ * The error codes in aResultArray are only valid if the RequestStatus is completed with KErrNone.
+ * If the RequestStatus is completed with an error code none of the operations in the batch mode
+ * were applied to the Data Store.
+ */
+ void DoCommitBatchL(RArray<TInt>& aResultArray,
+ TRequestStatus& aStatus);
+
+ /**
+ * DoCancelBatch() will be called to abort an ongoing batch mode. None of the operations already
+ * submitted may be applied to the Data Store.
+ */
+ void DoCancelBatch();
+
+ /**
+ * DoSetRemoteStoreFormatL() sets the SyncML server Data Format - this may optionally be used by the Data
+ * Provider to filter out properties that the server does not support, and should be used to avoid deleting
+ * these properties in case the server sends a changed item to the Data Provider
+ */
+ void DoSetRemoteStoreFormatL(const CSmlDataStoreFormat& aServerDataStoreFormat);
+
+ /**
+ * DoSetRemoteMaxObjectSize() sets the SyncML server maximum object size - this may optionally be used by the
+ * Data Provider to not send items to the server exceeding its maximum size. 0 means there is no limit.
+ */
+ void DoSetRemoteMaxObjectSize(TInt aServerMaxObjectSize);
+
+ /**
+ * DoMaxObjectSize() gets the Data Store maximum object size which is reported to the SyncML server. 0 means
+ * there is no limit.
+ * @return The maximum object size.
+ */
+ TInt DoMaxObjectSize() const;
+
+ /**
+ * DoOpenItemL() opens the data item specified by aUid asynchronously for reading.
+ * @param aUid Item UID which going to be read.
+ * @param aFieldChange Accept field changes.
+ * @param aParent Parent of the item.
+ * @param aSize Size of the item data.
+ * @param aMimeType MIME type of the item.
+ * @param aMimeVer MIME version used on item.
+ * @param aStatus On completion of the opening of item, contains the result code.
+ */
+ void DoOpenItemL(TSmlDbItemUid aUid,
+ TBool& aFieldChange,
+ TInt& aSize,
+ TSmlDbItemUid& aParent,
+ TDes8& aMimeType,
+ TDes8& aMimeVer,
+ TRequestStatus& aStatus);
+
+ /**
+ * DoCreateItemL() sets the item properties and reference to aUid which will be created.
+ * @param aUid Reference to item UID which going to be created.
+ * @param aSize Size of the item to be created.
+ * @param aParent Parent of the item.
+ * @param aMimeType MIME type of the item.
+ * @param aMimeVer MIME version used on item.
+ * @param aStatus On completion of the creating an item, contains the result code.
+ */
+ void DoCreateItemL(TSmlDbItemUid& aUid,
+ TInt aSize,
+ TSmlDbItemUid aParent,
+ const TDesC8& aMimeType,
+ const TDesC8& aMimeVer,
+ TRequestStatus& aStatus);
+
+ /**
+ * DoReplaceItemL() opens the data item specified by aUid asynchronously to be updated.
+ * @param aUid Item UID which going to be updated.
+ * @param aSize Size of the item data.
+ * @param aParent Parent of the item.
+ * @param aFieldChange Accept field changes.
+ * @param aStatus On completion of the updating of item, contains the result code.
+ */
+ void DoReplaceItemL(TSmlDbItemUid aUid,
+ TInt aSize,
+ TSmlDbItemUid aParent,
+ TBool aFieldChange,
+ TRequestStatus& aStatus);
+
+ /**
+ * DoReadItemL() reads data(or size of aBuffer) of an item opened in DoOpenItemL() to given aBuffer.
+ * @param aBuffer Buffer to item data.
+ */
+ void DoReadItemL(TDes8& aBuffer);
+
+ /**
+ * DoWriteItemL() writes aData of an item opened in DoCreateItemL() or DoReplaceItemL() to be saved on database.
+ * @param aData Item data (or part of data).
+ */
+ void DoWriteItemL(const TDesC8& aData);
+
+ /**
+ * DoCommitItemL() completes an item operation started in DoCreateItemL() or DoReplaceItemL().
+ * @param aStatus On completion of the operation, contains the result code.
+ */
+ void DoCommitItemL(TRequestStatus& aStatus);
+
+ /**
+ * DoCloseItem() completes an item operation started in DoOpenItemL().
+ */
+ void DoCloseItem();
+
+ /**
+ * DoMoveItemL() moves item specified by aUid asynchronously.
+ * @param aUid Item UID which going to be moved.
+ * @param aNewParent A new parent of the item.
+ * @param aStatus On completion of the moving an item, contains the result code.
+ */
+ void DoMoveItemL(TSmlDbItemUid aUid,
+ TSmlDbItemUid aNewParent,
+ TRequestStatus& aStatus);
+
+ /**
+ * DoDeleteItemL() deletes item specified by aUid asynchronously.
+ * @param aUid Item UID which going to be deleted.
+ * @param aStatus On completion of the deleting an item, contains the result code.
+ */
+ void DoDeleteItemL(TSmlDbItemUid aUid,
+ TRequestStatus& aStatus);
+
+ /**
+ * DoSoftDeleteItemL() soft deletes item specified by aUid asynchronously.
+ * @param aUid Item UID which going to be softdeleted.
+ * @param aStatus On completion of the softdeleting an item, contains the result code.
+ */
+ void DoSoftDeleteItemL(TSmlDbItemUid aUid,
+ TRequestStatus& aStatus);
+
+ /**
+ * DoDeleteAllItemsL() deletes all items from opened database asynchronously.
+ * @param aStatus On completion of delete, contains the result code.
+ */
+ void DoDeleteAllItemsL(TRequestStatus& aStatus);
+
+ /**
+ * DoHasSyncHistory() checks if previous sync with opened server and context.
+ * @return ETrue if there is synchonization history.
+ */
+ TBool DoHasSyncHistory() const;
+
+ /**
+ * DoAddedItems() gets all added items on client since previous synchronization.
+ * @return Added items.
+ */
+ const MSmlDataItemUidSet& DoAddedItems() const;
+
+ /**
+ * DoDeletedItems() gets all deleted items on client since previous synchronization.
+ * @return Deleted items.
+ */
+ const MSmlDataItemUidSet& DoDeletedItems() const;
+
+ /**
+ * DoSoftDeletedItems() gets all softdeleted items on client since previous synchronization.
+ * @return Soft deleted items.
+ */
+ const MSmlDataItemUidSet& DoSoftDeletedItems() const;
+
+ /**
+ * DoModifiedItems() gets all modified items on client since previous synchronization.
+ * @return Modified items.
+ */
+ const MSmlDataItemUidSet& DoModifiedItems() const;
+
+ /**
+ * DoMovedItems() gets all moved items on client since previous synchronization.
+ * @return Moved items.
+ */
+ const MSmlDataItemUidSet& DoMovedItems() const;
+
+ /**
+ * DoResetChangeInfoL() resets client synchronization data => next time will be slow sync.
+ * @param aStatus On completion of reset, contains the result code.
+ */
+ void DoResetChangeInfoL(TRequestStatus& aStatus);
+
+ /**
+ * DoCommitChangeInfoL() commits client synchronization changes for given aItems list.
+ * @param aStatus On completion of given items, contains the result code.
+ * @param aItems Item ids to be commited.
+ */
+ void DoCommitChangeInfoL(TRequestStatus& aStatus,
+ const MSmlDataItemUidSet& aItems);
+
+ /**
+ * DoCommitChangeInfoL() commits all client synchronization changes.
+ * @param aStatus On completion of all items, contains the result code.
+ */
+ void DoCommitChangeInfoL(TRequestStatus& aStatus);
+
+
+ private:
+ /**
+ * DoOwnStoreFormatL() gets the data storeformat from resource file.
+ * @return CSmlDataStoreFormat object
+ */
+ CSmlDataStoreFormat* DoOwnStoreFormatL();
+ /**
+ * OpenItemL() opens the the specified item from notepad database.
+ * @param aUid, uid of the memo.
+ * @param aItem, content of the memo.
+ * @return KErrNone on success, system wide error on failure
+ */
+ TInt OpenItemL(TSmlDbItemUid& aUid,CBufBase& aItem);
+ /**
+ * ConvertSyncItemToNoteL() converst teh sync item(text) to notepad memo item(CNpdItem).
+ * @param aSyncItem, descriptor that represents content of the memo
+ * @param aNote, content of the memo.
+ * @returns KErrNone on success, system wide error on failure.
+ */
+ TInt ConvertSyncItemToNoteL(const TDesC8& aSyncItem, CNpdItem& aNote);
+
+ /**
+ * ConvertNoteToSyncItemL() converst the notepad memo item(CNpdItem) to descriptor item(TDesC)
+ * @param aNote, content of the memo.
+ * @returns descriptor of that represents content of the memo.
+ */
+ HBufC8* ConvertNoteToSyncItemL(CNpdItem& aNote);
+ /**
+ * DoAddItemToDataBaseL() add the the item to the notepad database
+ * @param aItem, represents content of the notepad memo
+ * @returns id the of memo.
+ */
+ TInt DoAddItemToDataBaseL(CBufBase& aItem,TInt& aUid);
+
+ /**
+ * DoReplaceItemAtDataBaseL() replaces the tem in notepad database for given uid
+ * @param aItem, represents content of the notepad memo
+ * @param aUid, uid of the memo.
+ */
+ TInt DoReplaceItemAtDataBaseL(CBufBase& aItem, TInt& aUid);
+ /**
+ * DriveBelowCriticalLevelL() checks the available size of the drive C
+ * @param aSize, size to be check
+ * @returns ETrue if size available else EFalse.
+ */
+ TBool DriveBelowCriticalLevelL( TInt aSize );
+
+ /**
+ * FetchModificationsL() constucts the snapshot
+ * @returns system wide error
+ */
+ TInt FetchModificationsL();
+
+ private: // data
+
+ // MODULE DATA STRUCTURES
+ enum TNSmlDataStoreStatus // DataStore status
+ {
+ ENSmlClosed = 1,
+ ENSmlOpenAndWaiting,
+ ENSmlItemOverflow,
+ ENSmlItemOpen,
+ ENSmlItemCreating,
+ ENSmlItemUpdating
+ };
+
+ CNSmlNotepadDatabase* iNpdDb;
+ CNSmlChangeFinder* iChangeFinder;
+
+ TRequestStatus* iCallerStatus;
+
+ TPtrC8 iMimeTypeItem;
+ TPtrC8 iMimeVersionItem;
+
+ TPtrC8 iUsedMimeType;
+ TPtrC8 iUsedMimeVersion;
+
+ RStringF iServerMimeType;
+ RStringF iServerMimeVersion;
+
+
+ TInt iServerMaxObjectSize;
+ TBool iSnapshotRegistered;
+ TBool iSyncHistory;
+ HBufC* iOpenedStoreName;
+ HBufC* iDefaultStoreName;
+ TInt64 iOpenedStoreId;
+ TInt iReaderPosition;
+ TInt iWriterPosition;
+ TInt* iAddItemId;
+ TInt iReplaceItemId;
+ CBufBase* iItemData;
+ TInt iItemSize;
+ TInt iUid;
+ TKeyArrayFix iKey;
+ CSmlDataStoreFormat* iOwnStoreFormat;
+ TInt iModificationCount;
+ TInt iDrive;
+ RFs iRfs;
+ RStringPool iStringPool;
+ CNSmlDataItemUidSet* iNewUids;
+ CNSmlDataItemUidSet* iDeletedUids;
+ CNSmlDataItemUidSet* iSoftDeletedUids;
+ CNSmlDataItemUidSet* iReplacedUids;
+ CNSmlDataItemUidSet* iMovedUids;
+ TNSmlDataStoreStatus iState;
+ CArrayFixSeg<TNSmlSnapshotItem>* iSnapshot;
+ TBool iDataBaseOpened;
+ };
+
+#endif // __NSMLNOTEPADDATASTORE_H__
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/omads/omadsextensions/adapters/notes/inc/nsmlnotepadDatabase.h Mon May 03 12:24:28 2010 +0300
@@ -0,0 +1,236 @@
+/*
+* Copyright (c) 2003 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"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: calss which directly deal with notepad database.
+*
+*/
+
+
+#ifndef NSMLNOTEPADDATABASE_H
+#define NSMLNOTEPADDATABASE_H
+
+
+//INCLUDES
+#include <d32dbms.h>
+#include <badesca.h>
+
+//CLASS Forward declarations
+class CNpdItem;
+class CCalSession;
+class CCalInstanceView;
+class CCalEntryView;
+
+const TInt KMaxFileLength(255);
+
+//Class declarations
+
+// ------------------------------------------------------------------------------------------------
+// CNSmlNotepadDatabase
+// ------------------------------------------------------------------------------------------------
+
+class CNSmlNotepadDatabase : public CBase
+ {
+ public:
+ /**
+ * Creates new instance of CNpdSmlDbModel based class.
+ * @return CNpdSmlDbModel* Newly created instance.
+ */
+ static CNSmlNotepadDatabase* NewL();
+
+ virtual ~CNSmlNotepadDatabase();
+
+ private:
+ // Constructor
+ CNSmlNotepadDatabase();
+
+ /**
+ * 2-phase constructor
+ */
+ void ConstructL();
+
+ public:
+
+ /**
+ * Opens notepad database file. If file does not exist, or is corrupted,
+ * a new, empty file is created.
+ * @param aStoreName, name of the notepad database file name
+ */
+ void OpenL(const TDesC& aStoreName);
+
+ /**
+ * Adds a note to the database.
+ * @param aNote the note to be added.
+ * @param aKey database index of the newly added note.
+ */
+ void AddNoteL(CNpdItem& aNote, TInt &aKey);
+
+ /**
+ * Deletes a note from the database.
+ * @param aKey database index of the note to be deleted.
+ */
+ void DeleteNoteL(const TInt aKey);
+
+
+ /**
+ * Closes the database.
+ */
+ void Close();
+
+ /**
+ * Reads a note from the database.
+ * @param aKey database index of the desired note.
+ * @param aNote reference to note object, used to return note data.
+ */
+ void GetNoteL(const TInt aKey, CNpdItem& aNote);
+
+ /**
+ * Updates a note in the database.
+ * @param aKey database index of the note to be updated.
+ * @param aItem note data. This data overrides existing note.
+ */
+ void UpdateNoteL(const TInt aKey, CNpdItem& aItem);
+
+
+ /**
+ * Empties the database. All notes are deleted.
+ * @return KErrNone if successful, a system wide error code otherwise.
+ */
+ TInt ResetL();
+
+ /**
+ * Checks if the database has been succesfully openend
+ * @return ETrue if database has been succesfully opened, EFalse otherwise
+ */
+ TBool IsOpen();
+
+ /**
+ * gets teh default database storename of the notepad database
+ * @Param aStoreName holds the default notepad database's file name.
+ */
+ void GetDefaultDatastoreName(TDes& aStoreName);
+
+ /**
+ * lists the notepad database file names
+ * @returns available notepad database file names.
+ */
+ CDesCArray* ListDatabasesL();
+
+ /**
+ * Fetch all the note items if aKey is not present. Else item with the aKey.
+ * @returns array of NpdItem.
+ */
+ CArrayPtr<CNpdItem>* FetchItemsLC(TBool aIncludeText = EFalse, TInt* aKey = 0);
+
+ /**
+ * Close all the CalSession related sessions
+ * viz., instance view, entry view and calsession itself
+ */
+ void CloseAgendaSessions();
+
+ private: // Data
+
+ // Flag for whether database has been opened
+ TBool iOpened;
+ HBufC* iDataFile;
+ CCalSession* iSession;
+ CCalInstanceView* iInstanceView;
+ CCalEntryView* iEntryView;
+
+ enum TNotepadColumnType
+ {
+ ENotepadKey = 1, // this must be 1 (DBMS/SQL restriction)
+ ENotepadUpdateTime,
+ ENotepadMemo
+ };
+ };
+
+class CNpdItem : public CBase
+ {
+ public:
+ // Destructor
+ virtual ~CNpdItem();
+
+ /**
+ * Creates new instance of CNpdItem based class.
+ * @return CNpdItem* Newly created instance.
+ */
+ static CNpdItem* NewLC();
+
+ /**
+ * Creates new instance of CNpdItem based class.
+ * @param aKey database index key
+ * @param aLastModified timestamp
+ * @param aContent content (text) of the note
+ * @return CNpdItem* Newly created instance.
+ */
+ static CNpdItem* NewLC(TInt aKey, const TTime& aLastModified, HBufC* aContent);
+
+ private:
+ // Constructor
+ CNpdItem();
+
+ //Overloaded Constructor
+ CNpdItem(TInt aKey, const TTime& aLastModified, HBufC *content);
+
+ public:
+ /**
+ * Returns database key.
+ * @return key value.
+ */
+ TInt Key() const;
+
+ /**
+ * Returns the time stamp of the note.
+ * @return when note was last modified.
+ */
+ TTime LastModified() const;
+
+ /**
+ * Returns content of the note
+ * @return text of the note.
+ */
+ HBufC* Content();
+
+ /**
+ * Set note data.
+ * @param aKey database index
+ * @param aModTime time note was last modified
+ * @param aContent content of the note
+ */
+ void Set(TInt aKey, const TTime& aModTime, HBufC* aContent);
+
+ /**
+ * Set key of the note
+ * @param aKey key of the note.
+ */
+ void SetKey(TInt aKey);
+
+ /**
+ * Set content of the note
+ * @param aContent text of the note.
+ */
+ void SetContent(HBufC* aContent);
+
+ /**
+ * Returns timestamp of the note
+ * @param aLastModified time note was last modified.
+ */
+ void SetModified(const TTime& aLastModified);
+
+ private:
+ TInt iKey;
+ TTime iLastModified;
+ HBufC* iContent; // owned
+ };
+
+#endif // NSMLNOTEPADDATABASE_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/omads/omadsextensions/adapters/notes/inc/nsmlnotepaddefs.h Mon May 03 12:24:28 2010 +0300
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2002 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"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: DS notepad definitions.
+*
+*/
+
+
+#ifndef __NSMLNOTEPADDEFS_H__
+#define __NSMLNOTEPADDEFS_H__
+
+#include <e32std.h>
+
+static const TUint KNSmlNotepadAdapterImplUid = 0x101F8612;
+
+#endif // __NSMLNOTEPADDEFS_H__
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/omads/omadsextensions/adapters/notes/inc/nsmlnotepadlogging.h Mon May 03 12:24:28 2010 +0300
@@ -0,0 +1,32 @@
+/*
+* Copyright (c) 2003 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"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: calss which directly deal with notepad database.
+*
+*/
+
+
+#ifndef __NSMLNOTEPADLOGGING_H__
+#define __NSMLNOTEPADLOGGING_H__
+
+#define _NOTEPAD_DBG_FILE(p)
+
+#ifdef _DEBUG_
+#include "nsmldebug.h"
+
+#define _NOTEPAD_DBG_FILE(p) _DBG_FILE(p)
+
+#endif
+
+
+#endif //__NSMLNOTEPADLOGGING_H__
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/omads/omadsextensions/adapters/notes/loc/101F85F8.loc Mon May 03 12:24:28 2010 +0300
@@ -0,0 +1,23 @@
+/*
+* Copyright (c) 2002 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"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+* Registery info for Notepad sync
+*
+*/
+
+
+//d:Display name for registry info
+//l:list_setting_pane_t1
+//
+#define qtn_nsml_npd_display_name "Notes"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/omads/omadsextensions/adapters/notes/src/NSmlNotepadDataProvider.cpp Mon May 03 12:24:28 2010 +0300
@@ -0,0 +1,314 @@
+/*
+* Copyright (c) 2005 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"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: DS notepad dataprovider
+*
+*/
+
+
+// INCLUDE FILES
+
+#include <barsc.h>
+#include <bautils.h>
+#include <SmlDataProvider.h>
+#include <implementationproxy.h>
+#include <nsmlnotepaddatastoreformat.rsg>
+#include <data_caging_path_literals.hrh>
+#include "NSmlNotepadDataProvider.h"
+#include "NSmlNotepadDatastore.h"
+#include "nsmlnotepaddefs.h"
+
+#include "nsmlnotepadlogging.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CNSmlNotepadDataProvider::NewL
+// -----------------------------------------------------------------------------
+//
+CNSmlNotepadDataProvider* CNSmlNotepadDataProvider::NewL()
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataProvider::NewL(): begin");
+ CNSmlNotepadDataProvider* self = NewLC();
+ CleanupStack::Pop(self);
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataProvider::NewL(): end");
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CNSmlNotepadDataProvider::NewLC
+// -----------------------------------------------------------------------------
+//
+CNSmlNotepadDataProvider* CNSmlNotepadDataProvider::NewLC()
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataProvider::NewLC(): begin");
+ CNSmlNotepadDataProvider* self = new (ELeave) CNSmlNotepadDataProvider();
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataProvider::NewLC(): end");
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CNSmlNotepadDataProvider::CNSmlNotepadDataProvider
+// -----------------------------------------------------------------------------
+//
+CNSmlNotepadDataProvider::CNSmlNotepadDataProvider()
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataProvider::CNSmlNotepadDataProvider(): begin");
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataProvider::CNSmlNotepadDataProvider(): end");
+ }
+
+// -----------------------------------------------------------------------------
+// CNSmlNotepadDataProvider::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CNSmlNotepadDataProvider::ConstructL()
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataProvider::ConstructL(): begin");
+ User::LeaveIfError( iRfs.Connect() );
+ iNotepadDataStore = CNSmlNotepadDataStore::NewL();
+ iStringPool.OpenL();
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataProvider::ConstructL(): end");
+ }
+
+// -----------------------------------------------------------------------------
+// CNSmlNotepadDataProvider::CNSmlNotepadDataProvider
+// -----------------------------------------------------------------------------
+//
+CNSmlNotepadDataProvider::~CNSmlNotepadDataProvider()
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataProvider::~CNSmlNotepadDataProvider(): begin");
+ iRfs.Close();
+ if(iNotepadDataStore)
+ {
+ delete iNotepadDataStore;
+ iNotepadDataStore = NULL;
+ }
+ if(iStoreFormat)
+ {
+ delete iStoreFormat;
+ iStoreFormat = NULL;
+ }
+ iFilterArray.ResetAndDestroy();
+ iFilterArray.Close();
+ iStringPool.Close();
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataProvider::~CNSmlNotepadDataProvider(): end");
+ }
+
+// -----------------------------------------------------------------------------
+// CNSmlNotepadDataProvider::DoOnFrameworkEvent
+// -----------------------------------------------------------------------------
+//
+void CNSmlNotepadDataProvider::DoOnFrameworkEvent( TSmlFrameworkEvent /*aFrameworkEvent*/,
+ TInt /*aParam1*/,
+ TInt /*aParam2*/ )
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataProvider::DoOnFrameworkEvent(): begin");
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataProvider::DoOnFrameworkEvent(): end");
+ }
+
+// -----------------------------------------------------------------------------
+// CNSmlNotepadDataProvider::DoSupportsOperation
+// -----------------------------------------------------------------------------
+//
+TBool CNSmlNotepadDataProvider::DoSupportsOperation( TUid aOpId ) const
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataProvider::DoSupportsOperation(): begin");
+ if ( aOpId == KUidSmlSupportMultipleStores )
+ {
+ _NOTEPAD_DBG_FILE("CNSmlAgendaDataProvider::DoSupportsOperation: true end");
+ return ETrue;
+ }
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataProvider::DoSupportsOperation(): end");
+ return EFalse; // KUidSmlSupportTransaction ,KUidSmlSupportSuspendResume, KUidSmlSupportUserSelectableMatchType
+ }
+
+// -----------------------------------------------------------------------------
+// CNSmlNotepadDataProvider::DoStoreFormatL
+// -----------------------------------------------------------------------------
+//
+ const CSmlDataStoreFormat& CNSmlNotepadDataProvider::DoStoreFormatL()
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataProvider::DoStoreFormatL(): begin");
+ if( !iStoreFormat )
+ {
+ TFileName fileName;
+ TParse parse;
+
+ // Locate the resource file
+ TFileName dllFileName;
+ Dll::FileName( dllFileName );
+
+ TFileName resourceFileName;
+ resourceFileName.Copy( TParsePtrC( dllFileName ).Drive() );
+ resourceFileName.Append(KNSmlNotepadStoreFormatRsc);
+
+ parse.Set( resourceFileName, &KDC_RESOURCE_FILES_DIR, NULL );
+ fileName = parse.FullName();
+ RResourceFile resourceFile;
+ BaflUtils::NearestLanguageFile( iRfs, fileName );
+ resourceFile.OpenL( iRfs,fileName );
+ CleanupClosePushL( resourceFile );
+ HBufC8* notepadDataFormat = resourceFile.AllocReadLC( NSML_NOTEPAD_DATA_STORE_FORMAT );
+ TResourceReader reader;
+ reader.SetBuffer( notepadDataFormat );
+ iStoreFormat = CSmlDataStoreFormat::NewLC( iStringPool, reader );
+ CleanupStack::Pop(iStoreFormat); // iStoreFormat
+ CleanupStack::PopAndDestroy( 2 ); // notepadDataFormat,resourceFile
+ }
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataProvider::DoStoreFormatL(): end");
+ return *iStoreFormat;
+ }
+
+// -----------------------------------------------------------------------------
+// CNSmlNotepadDataProvider::DoListStoresLC
+// -----------------------------------------------------------------------------
+//
+
+CDesCArray* CNSmlNotepadDataProvider::DoListStoresLC()
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataProvider::DoListStoresLC(): begin");
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataProvider::DoListStoresLC(): end");
+ return iNotepadDataStore->DoListStoresLC();
+ }
+
+// -----------------------------------------------------------------------------
+// CNSmlNotepadDataProvider::DoDefaultStoreL
+// -----------------------------------------------------------------------------
+//
+const TDesC& CNSmlNotepadDataProvider::DoDefaultStoreL()
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataProvider::DoDefaultStoreL(): begin");
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataProvider::DoDefaultStoreL(): end");
+ return iNotepadDataStore->DefaultStoreNameL();
+ }
+
+// -----------------------------------------------------------------------------
+// CNSmlNotepadDataProvider::DoNewStoreInstanceLC
+// -----------------------------------------------------------------------------
+//
+CSmlDataStore* CNSmlNotepadDataProvider::DoNewStoreInstanceLC()
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataProvider::DoNewStoreInstanceLC(): begin");
+ CNSmlNotepadDataStore* newDataStore = CNSmlNotepadDataStore::NewL();
+ CleanupStack::PushL( newDataStore );
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataProvider::DoNewStoreInstanceLC(): end");
+ return newDataStore;
+ }
+
+// ------------------------------------------------------------------------------------------------
+// CNSmlNotepadDataProvider::DoSupportedServerFiltersL
+//
+// ------------------------------------------------------------------------------------------------
+const RPointerArray<CSyncMLFilter>& CNSmlNotepadDataProvider::DoSupportedServerFiltersL()
+ {
+ // This method returns empty array. It means that this Data Provider does not support filtering
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataProvider::DoSupportedServerFiltersL(): BEGIN");
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataProvider::DoSupportedServerFiltersL(): END");
+ return iFilterArray;
+ }
+
+// ------------------------------------------------------------------------------------------------
+// CNSmlNotepadDataProvider::DoCheckSupportedServerFiltersL
+//
+// ------------------------------------------------------------------------------------------------
+void CNSmlNotepadDataProvider::DoCheckSupportedServerFiltersL( const CSmlDataStoreFormat& /*aServerDataStoreFormat*/,
+ RPointerArray<CSyncMLFilter>& /*aFilters*/,
+ TSyncMLFilterChangeInfo& /*aChangeInfo*/ )
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataProvider::DoCheckSupportedServerFiltersL(): BEGIN");
+ User::Leave( KErrNotSupported );
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataProvider::DoCheckSupportedServerFiltersL(): END");
+ }
+
+// ------------------------------------------------------------------------------------------------
+// CNSmlNotepadDataProvider::CheckServerFiltersL
+//
+// ------------------------------------------------------------------------------------------------
+void CNSmlNotepadDataProvider::DoCheckServerFiltersL( RPointerArray<CSyncMLFilter>& /*aFilters*/,
+ TSyncMLFilterChangeInfo& /*aChangeInfo*/ )
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataProvider::DoCheckServerFiltersL(): BEGIN");
+ User::Leave( KErrNotSupported );
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataProvider::DoCheckServerFiltersL(): END");
+ }
+
+// ------------------------------------------------------------------------------------------------
+// CNSmlNotepadDataProvider::DoGenerateRecordFilterQueryLC
+//
+// ------------------------------------------------------------------------------------------------
+HBufC* CNSmlNotepadDataProvider::DoGenerateRecordFilterQueryLC( const RPointerArray<CSyncMLFilter>& /*aFilters*/,
+ TSyncMLFilterMatchType /*aMatch*/,
+ TDes& /*aFilterMimeType*/,
+ TSyncMLFilterType& /*aFilterType*/,
+ TDesC& /*aStoreName*/ )
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataProvider::DoGenerateRecordFilterQueryLC(): BEGIN");
+ User::Leave( KErrNotSupported );
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataProvider::DoGenerateRecordFilterQueryLC(): END");
+ return NULL;
+ }
+
+// ------------------------------------------------------------------------------------------------
+// CNSmlNotepadDataProvider::DoGenerateFieldFilterQueryL
+//
+// ------------------------------------------------------------------------------------------------
+void CNSmlNotepadDataProvider::DoGenerateFieldFilterQueryL( const RPointerArray<CSyncMLFilter>& /*aFilters*/,
+ TDes& /*aFilterMimeType*/,
+ RPointerArray<CSmlDataProperty>& /*aProperties*/,
+ TDesC& /*aStoreName*/ )
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataProvider::DoGenerateFieldFilterQueryL(): BEGIN");
+ User::Leave( KErrNotSupported );
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataProvider::DoGenerateFieldFilterQueryL(): END");
+ }
+
+// -----------------------------------------------------------------------------
+// ImplementationGroupProxy array
+// -----------------------------------------------------------------------------
+//
+#ifndef IMPLEMENTATION_PROXY_ENTRY
+#define IMPLEMENTATION_PROXY_ENTRY( aUid, aFuncPtr ) {{aUid},(aFuncPtr)}
+#endif
+
+const TImplementationProxy ImplementationTable[] =
+ {
+ IMPLEMENTATION_PROXY_ENTRY( KNSmlNotepadAdapterImplUid, CNSmlNotepadDataProvider::NewL )
+ };
+
+// -----------------------------------------------------------------------------
+// ImplementationGroupProxy
+// -----------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount )
+ {
+ _NOTEPAD_DBG_FILE("ImplementationGroupProxy() for CNSmlNotepadDataProvider: begin");
+ aTableCount = sizeof( ImplementationTable ) / sizeof( TImplementationProxy );
+ _NOTEPAD_DBG_FILE("ImplementationGroupProxy() for CNSmlNotepadDataProvider: end");
+ return ImplementationTable;
+ }
+
+// -----------------------------------------------------------------------------
+// E32Dll
+// DLL entry point.
+// -----------------------------------------------------------------------------
+//
+#ifndef EKA2
+GLDEF_C TInt E32Dll( TDllReason /*aReason*/ )
+ {
+ return KErrNone;
+ }
+#endif
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/omads/omadsextensions/adapters/notes/src/NSmlNotepadDataStore.cpp Mon May 03 12:24:28 2010 +0300
@@ -0,0 +1,1353 @@
+/*
+* Copyright (c) 2005 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"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: DS notepad data store
+*
+*/
+
+
+// INCLUDE FILES
+#include <barsc.h>
+#include <bautils.h>
+#include <s32mem.h>
+#include <sysutil.h>
+#include <nsmlnotepaddatastoreformat.rsg>
+#include <data_caging_path_literals.hrh>
+#include <SmlDataProvider.h>
+#include <txtetext.h>
+#include <charconv.h>
+#include <nsmlchangefinder.h>
+
+#include "NSmlNotepadDatastore.h"
+#include "nsmlnotepaddefs.h"
+#include "nsmlnotepadDatabase.h"
+#include "nsmlsnapshotitem.h"
+#include "nsmlnotepadlogging.h"
+
+// ----------------------------------------------------------------------------
+// CNSmlNotepadDataStore::NewL
+// ----------------------------------------------------------------------------
+CNSmlNotepadDataStore* CNSmlNotepadDataStore::NewL()
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::NewL: BEGIN");
+ CNSmlNotepadDataStore* self = new ( ELeave ) CNSmlNotepadDataStore();
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop(self); // self
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::NewL: END");
+ return self;
+ }
+
+// ----------------------------------------------------------------------------
+// CNSmlNotepadDataStore::~CNSmlNotepadDataStore()
+// ----------------------------------------------------------------------------
+CNSmlNotepadDataStore::~CNSmlNotepadDataStore()
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::~CNSmlNotepadDataStore(): begin");
+ if(iOwnStoreFormat)
+ {
+ delete iOwnStoreFormat;
+ iOwnStoreFormat = NULL;
+ }
+ if(iDefaultStoreName)
+ {
+ delete iDefaultStoreName;
+ iDefaultStoreName = NULL;
+ }
+ if(iNpdDb)
+ {
+ delete iNpdDb;
+ iNpdDb = NULL;
+ }
+ if(iReplacedUids)
+ {
+ delete iReplacedUids;
+ iReplacedUids = NULL;
+ }
+ if(iMovedUids)
+ {
+ delete iMovedUids;
+ iMovedUids = NULL;
+ }
+ if(iSoftDeletedUids)
+ {
+ delete iSoftDeletedUids;
+ iSoftDeletedUids = NULL;
+ }
+ if(iDeletedUids)
+ {
+ delete iDeletedUids;
+ iDeletedUids = NULL;
+ }
+ if(iNewUids)
+ {
+ delete iNewUids;
+ iNewUids = NULL;
+ }
+ iRfs.Close();
+ iStringPool.Close();
+ if(iOpenedStoreName)
+ {
+ delete iOpenedStoreName;
+ iOpenedStoreName = NULL;
+ }
+ if(iItemData)
+ {
+ delete iItemData;
+ iItemData = NULL;
+ }
+ if ( iChangeFinder )
+ {
+ TRAP_IGNORE( iChangeFinder->CloseL() );
+ delete iChangeFinder;
+ iChangeFinder = NULL;
+ }
+
+ if( iSnapshot )
+ {
+ delete iSnapshot;
+ iSnapshot = NULL;
+ }
+
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::~CNSmlNotepadDataStore(): end");
+ }
+
+
+// ----------------------------------------------------------------------------
+// CNSmlNotepadDataStore::CNSmlNotepadDataStore()
+// ----------------------------------------------------------------------------
+CNSmlNotepadDataStore::CNSmlNotepadDataStore() : iOpenedStoreId(KNSmlNotepadAdapterImplUid),iKey( TKeyArrayFix( _FOFF( TNSmlSnapshotItem,ItemId() ),ECmpTInt ))
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::CNSmlNotepadDataStore(): begin");
+ iSyncHistory = EFalse;
+ iDataBaseOpened = EFalse;
+ iReaderPosition = -1;
+ iWriterPosition = -1;
+ iModificationCount = KNSmlCompactAfterChanges;
+ iState = ENSmlClosed;
+ iSnapshotRegistered = EFalse;
+ iDrive = -1;
+ iReplaceItemId = -1;
+ iServerMaxObjectSize = 0; // Maximum size default value
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::CNSmlNotepadDataStore(): end");
+ }
+
+// ----------------------------------------------------------------------------
+// CNSmlNotepadDataStore::ConstructL()
+// ----------------------------------------------------------------------------
+void CNSmlNotepadDataStore::ConstructL()
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::ConstructL(): begin");
+ User::LeaveIfError(iRfs.Connect());
+ iStringPool.OpenL();
+ iUsedMimeType.Set( KMimePlainText() );
+ iUsedMimeVersion.Set( KMimePlainTextVersion() );
+ // Uid Sets
+ if(iNewUids)
+ {
+ delete iNewUids;
+ iNewUids = NULL;
+ }
+ iNewUids = new (ELeave) CNSmlDataItemUidSet();
+ if(iDeletedUids)
+ {
+ delete iDeletedUids;
+ iDeletedUids = NULL;
+ }
+ iDeletedUids = new (ELeave) CNSmlDataItemUidSet();
+ if(iSoftDeletedUids)
+ {
+ delete iSoftDeletedUids;
+ iSoftDeletedUids = NULL;
+ }
+ iSoftDeletedUids = new (ELeave) CNSmlDataItemUidSet();
+ if(iMovedUids)
+ {
+ delete iMovedUids;
+ iMovedUids = NULL;
+ }
+ iMovedUids = new (ELeave) CNSmlDataItemUidSet();
+ if(iReplacedUids)
+ {
+ delete iReplacedUids;
+ iReplacedUids = NULL;
+ }
+ iReplacedUids = new (ELeave) CNSmlDataItemUidSet();
+ if(iNpdDb)
+ {
+ delete iNpdDb;
+ iNpdDb = NULL;
+ }
+ iNpdDb = CNSmlNotepadDatabase::NewL();
+ if(iDefaultStoreName)
+ {
+ delete iDefaultStoreName;
+ iDefaultStoreName = NULL;
+ }
+ iDefaultStoreName = HBufC::NewL( KNSmlDefaultStoreNameMaxSize );
+ TInt len = iDefaultStoreName->Length();
+ TPtr obptr = iDefaultStoreName->Des();
+ iNpdDb->GetDefaultDatastoreName(obptr);
+ if(iOwnStoreFormat)
+ {
+ delete iOwnStoreFormat;
+ iOwnStoreFormat = NULL;
+ }
+ iOwnStoreFormat = DoOwnStoreFormatL();
+
+ iSnapshot = new (ELeave) CArrayFixSeg<TNSmlSnapshotItem>(KSnapshotGranularity);
+
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::ConstructL(): end");
+ }
+
+
+// ----------------------------------------------------------------------------
+// void CNSmlNotepadDataStore::DefaultStoreNameL()
+// ----------------------------------------------------------------------------
+const TDesC& CNSmlNotepadDataStore::DefaultStoreNameL() const
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DefaultStoreNameL(): begin");
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DefaultStoreNameL(): end");
+ if ( iDefaultStoreName )
+ {
+ return *iDefaultStoreName;
+ }
+ return KNullDesC;
+ }
+
+
+// ----------------------------------------------------------------------------
+// CDesCArray* CNSmlNotepadDataStore::DoListStoresLC();
+// ----------------------------------------------------------------------------
+CDesCArray* CNSmlNotepadDataStore::DoListStoresLC()
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoListStoresLC(): begin");
+ CDesCArray* npdStores = iNpdDb->ListDatabasesL();
+ CleanupStack::PushL( npdStores );
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoListStoresLC(): end");
+ return npdStores;
+ }
+
+// ----------------------------------------------------------------------------
+// void CNSmlNotepadDataStore::DoOpenL(const TDesC& aStoreName,
+// MSmlSyncRelationship& aContext,
+// TRequestStatus& aStatus)
+// ----------------------------------------------------------------------------
+void CNSmlNotepadDataStore::DoOpenL( const TDesC& aStoreName,
+ MSmlSyncRelationship& aContext,
+ TRequestStatus& aStatus )
+ {
+ iCallerStatus = &aStatus;
+ *iCallerStatus = KRequestPending;
+ if( iState != ENSmlClosed || iDataBaseOpened )
+ {
+ User::RequestComplete( iCallerStatus, KErrInUse );
+ return;
+ }
+ if(aStoreName.Length()>0)
+ {
+ if( RFs::CharToDrive(aStoreName[0], iDrive) != KErrNone )
+ {
+ RFs::CharToDrive( KNSmlDriveC()[0], iDrive );
+ }
+ }
+
+ // Open the Database
+ TInt err( KErrNone );
+ TRAP(err,iNpdDb->OpenL( aStoreName ));
+ if ( err )
+ {
+ User::RequestComplete( iCallerStatus, err );
+ return;
+ }
+
+ if ( iOpenedStoreName )
+ {
+ delete iOpenedStoreName;
+ iOpenedStoreName = NULL;
+ }
+ iOpenedStoreName = aStoreName.Alloc();
+
+ iDataBaseOpened = ETrue;
+
+ if ( iChangeFinder )
+ {
+ iChangeFinder->CloseL();
+ delete iChangeFinder;
+ iChangeFinder = NULL;
+ }
+ iChangeFinder = CNSmlChangeFinder::NewL( aContext, iKey, iSyncHistory, KNSmlNotepadAdapterImplUid );
+
+ err = FetchModificationsL();
+
+ iState = ENSmlOpenAndWaiting;
+ User::RequestComplete( iCallerStatus, err );
+
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoOpenL(): end");
+}
+
+// ----------------------------------------------------------------------------
+// void CNSmlNotepadDataStore::DoCancelRequest()
+// ----------------------------------------------------------------------------
+void CNSmlNotepadDataStore::DoCancelRequest()
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoCancelRequest(): begin");
+ if ( iState == ENSmlOpenAndWaiting )
+ {
+ iState = ENSmlClosed;
+ }
+ else
+ {
+ iState = ENSmlOpenAndWaiting;
+ }
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoCancelRequest(): NOT NEEDED end");
+ }
+
+// ----------------------------------------------------------------------------
+// void CNSmlNotepadDataStore::DoStoreName()
+// ----------------------------------------------------------------------------
+const TDesC& CNSmlNotepadDataStore::DoStoreName() const
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoStoreName(): begin");
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoStoreName(): end");
+ if ( iOpenedStoreName )
+ {
+ return *iOpenedStoreName;
+ }
+ return KNullDesC;
+ }
+
+// ----------------------------------------------------------------------------
+// void CNSmlNotepadDataStore::DoBeginTransactionL()
+// ----------------------------------------------------------------------------
+void CNSmlNotepadDataStore::DoBeginTransactionL()
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoBeginTransactionL(): begin");
+ User::Leave( KErrNotSupported );
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoBeginTransactionL(): end");
+ }
+
+// ----------------------------------------------------------------------------
+// void CNSmlNotepadDataStore::DoCommitTransactionL()
+// ----------------------------------------------------------------------------
+void CNSmlNotepadDataStore::DoCommitTransactionL(TRequestStatus& aStatus)
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoCommitTransactionL(): begin");
+ iCallerStatus = &aStatus;
+ *iCallerStatus = KRequestPending;
+ User::RequestComplete( iCallerStatus, KErrNotSupported );
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoCommitTransactionL(): end");
+ }
+
+// ----------------------------------------------------------------------------
+// void CNSmlNotepadDataStore::DoRevertTransaction()
+// ----------------------------------------------------------------------------
+void CNSmlNotepadDataStore::DoRevertTransaction(TRequestStatus& aStatus)
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoRevertTransaction(): begin");
+ iCallerStatus = &aStatus;
+ *iCallerStatus = KRequestPending;
+ User::RequestComplete( iCallerStatus, KErrNotSupported );
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoRevertTransaction(): end");
+ }
+
+// ----------------------------------------------------------------------------
+// void CNSmlNotepadDataStore::DoBeginBatchL()
+// ----------------------------------------------------------------------------
+void CNSmlNotepadDataStore::DoBeginBatchL()
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoBeginBatchL(): begin");
+ User::Leave( KErrNotSupported );
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoBeginBatchL(): end");
+ }
+
+// ----------------------------------------------------------------------------
+// void CNSmlNotepadDataStore::DoCommitBatchL()
+// ----------------------------------------------------------------------------
+void CNSmlNotepadDataStore::DoCommitBatchL( RArray<TInt>& /*aResultArray*/, TRequestStatus& aStatus )
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoCommitBatchL(): begin");
+ iCallerStatus = &aStatus;
+ *iCallerStatus = KRequestPending;
+ User::RequestComplete( iCallerStatus, KErrNotSupported );
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoCommitBatchL(): end");
+ }
+// ----------------------------------------------------------------------------
+// void CNSmlNotepadDataStore::DoCancelBatch()
+// ----------------------------------------------------------------------------
+void CNSmlNotepadDataStore::DoCancelBatch()
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoCancelBatch(): begin");
+ // Nothing to do
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoCancelBatch(): end");
+ }
+// ----------------------------------------------------------------------------
+// void CNSmlNotepadDataStore::DoSetRemoteStoreFormatL()
+// ----------------------------------------------------------------------------
+void CNSmlNotepadDataStore::DoSetRemoteStoreFormatL( const CSmlDataStoreFormat& aServerDataStoreFormat )
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoSetRemoteStoreFormatL(): begin");
+ TBool foundMime = EFalse;
+ // KErrNotSupported is returned if server does not support same mime type
+ // and same mime type version as Data Provider.
+ TInt i=0;
+ while( i< aServerDataStoreFormat.MimeFormatCount() && !foundMime )
+ {
+ if( iUsedMimeType.MatchF(aServerDataStoreFormat.MimeFormat(i).MimeType().DesC()) ==0 &&
+ iUsedMimeVersion.MatchF(aServerDataStoreFormat.MimeFormat(i).MimeVersion().DesC())==0 )
+ {
+ foundMime = ETrue;
+ iServerMimeType = aServerDataStoreFormat.MimeFormat(i).MimeType();
+ iServerMimeVersion = aServerDataStoreFormat.MimeFormat(i).MimeVersion();
+ }
+ i++;
+ }
+ if( !foundMime )
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoSetRemoteStoreFormatL(): SERVER MIMETYPE NOTSUPPORTED end");
+
+ User::Leave( KErrNotSupported );
+ }
+ if( !iOwnStoreFormat )
+ {
+ iOwnStoreFormat = DoOwnStoreFormatL();
+ }
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoSetRemoteStoreFormatL(): end");
+ return;
+ }
+
+// ----------------------------------------------------------------------------
+// void CNSmlNotepadDataStore::DoSetRemoteMaxObjectSize()
+// ----------------------------------------------------------------------------
+void CNSmlNotepadDataStore::DoSetRemoteMaxObjectSize( TInt aServerMaxObjectSize )
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoSetRemoteMaxObjectSize(): begin");
+ iServerMaxObjectSize = aServerMaxObjectSize;
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoSetRemoteMaxObjectSize(): end");
+ }
+// ----------------------------------------------------------------------------
+// void CNSmlNotepadDataStore::DoMaxObjectSize()
+// ----------------------------------------------------------------------------
+TInt CNSmlNotepadDataStore::DoMaxObjectSize() const
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoMaxObjectSize(): begin");
+ if ( iOwnStoreFormat )
+ {
+ if ( iOwnStoreFormat->HasMaxSize() )
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoMaxObjectSize - From resource: END");
+
+ return iOwnStoreFormat->MaxSize();
+ }
+ }
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoMaxObjectSize() 100 k: end");
+ return KNSmlDataStoreMaxSize; // 100 k
+ }
+
+
+// ----------------------------------------------------------------------------
+// void CNSmlNotepadDataStore::DoOpenItemL()
+// ----------------------------------------------------------------------------
+void CNSmlNotepadDataStore::DoOpenItemL( TSmlDbItemUid aUid,
+ TBool& aFieldChange,
+ TInt& aSize,
+ TSmlDbItemUid& aParent,
+ TDes8& aMimeType,
+ TDes8& aMimeVer,
+ TRequestStatus& aStatus )
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoOpenItemL(): begin");
+ iCallerStatus = &aStatus;
+ *iCallerStatus = KRequestPending;
+ if ( iState != ENSmlOpenAndWaiting )
+ {
+ User::RequestComplete( iCallerStatus, KErrNotReady );
+ return;
+ }
+ aFieldChange = EFalse; // Whole item sent NOT SUPPORT ON FIELDCHANGE
+ aMimeType = iOwnStoreFormat->MimeFormat( 0 ).MimeType().DesC();
+ aMimeVer = iOwnStoreFormat->MimeFormat( 0 ).MimeVersion().DesC();
+ aParent = KNullDataItemId;
+ if( !iItemData )
+ {
+ iItemData= CBufFlat::NewL( KNSmlItemDataExpandSize );
+ }
+ else
+ {
+ iItemData->Reset();
+ }
+ TInt err = OpenItemL( aUid, *iItemData );
+ if( !err )
+ {
+
+ iItemData->Compress();
+ iReaderPosition = 0;
+ aSize = iItemData->Size();
+ iState = ENSmlItemOpen;
+ if ( iServerMaxObjectSize == 0 || aSize <= iServerMaxObjectSize )
+ {
+ User::RequestComplete( iCallerStatus, KErrNone );
+ }
+ else
+ {
+ User::RequestComplete( iCallerStatus, KErrTooBig );
+ }
+ }
+ else
+ {
+ User::RequestComplete( iCallerStatus, err );
+ }
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoOpenItemL(): end");
+ }
+
+// ----------------------------------------------------------------------------
+// void CNSmlNotepadDataStore::DoCreateItemL()
+// ----------------------------------------------------------------------------
+void CNSmlNotepadDataStore::DoCreateItemL( TSmlDbItemUid& aUid,
+ TInt aSize,
+ TSmlDbItemUid /*aParent*/,
+ const TDesC8& aMimeType,
+ const TDesC8& aMimeVer,
+ TRequestStatus& aStatus )
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoCreateItemL(): begin");
+ TBuf8<255> lMimeType;
+ lMimeType.Copy(aMimeType);
+ TBuf8<255> lMimeVer;
+ lMimeVer.Copy(aMimeVer);
+ iCallerStatus = &aStatus;
+ *iCallerStatus = KRequestPending;
+ iAddItemId = &aUid;
+ if ( iState != ENSmlOpenAndWaiting )
+ {
+ User::RequestComplete( iCallerStatus, KErrNotReady );
+ return;
+ }
+ if ( iOwnStoreFormat->HasMaxSize() )
+ {
+ if ( iOwnStoreFormat->MaxSize() < aSize )
+ {
+ User::RequestComplete( iCallerStatus, KErrTooBig );
+ return;
+ }
+ }
+ if( SysUtil::DiskSpaceBelowCriticalLevelL( &iRfs, aSize, iDrive ) )
+ {
+ User::RequestComplete( iCallerStatus, KErrDiskFull );
+ return;
+ }
+ TBuf8<255> lOwnMimeType;
+ lOwnMimeType.Copy(iOwnStoreFormat->MimeFormat( 0 ).MimeType().DesC());
+ TBuf8<255> lOwnMimeVer;
+ lOwnMimeVer.Copy(iOwnStoreFormat->MimeFormat( 0 ).MimeVersion().DesC());
+ if ( (iOwnStoreFormat->MimeFormat( 0 ).MimeType().DesC().Compare( aMimeType ) != 0 ) )
+ {
+ User::RequestComplete( iCallerStatus, KErrNotSupported );
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoCreateItemL - KErrNotSupported: END");
+ return;
+ }
+ if ( iItemData )
+ {
+ delete iItemData;
+ iItemData = NULL;
+ }
+ iItemData = CBufFlat::NewL( KNSmlItemDataExpandSize );
+ iWriterPosition = 0;
+ iItemSize = aSize; // Size sent from server
+ iState = ENSmlItemCreating;
+ User::RequestComplete( iCallerStatus, KErrNone );
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoCreateItemL(): end");
+ }
+
+// ----------------------------------------------------------------------------
+// void CNSmlNotepadDataStore::DoReplaceItemL()
+// ----------------------------------------------------------------------------
+void CNSmlNotepadDataStore::DoReplaceItemL( TSmlDbItemUid aUid,
+ TInt aSize,
+ TSmlDbItemUid /*aParent*/,
+ TBool aFieldChange,
+ TRequestStatus& aStatus )
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoReplaceItemL(): begin");
+ iCallerStatus = &aStatus;
+ *iCallerStatus = KRequestPending;
+ if ( iState != ENSmlOpenAndWaiting )
+ {
+ User::RequestComplete( iCallerStatus, KErrNotReady );
+ return;
+ }
+ if ( iOwnStoreFormat->HasMaxSize() )
+ {
+ if ( iOwnStoreFormat->MaxSize() < aSize )
+ {
+ User::RequestComplete( iCallerStatus, KErrTooBig );
+ return;
+ }
+ }
+ if( aFieldChange )
+ {
+ User::RequestComplete( iCallerStatus, KErrNotSupported );
+ return;
+ }
+ if( SysUtil::DiskSpaceBelowCriticalLevelL( &iRfs, aSize, iDrive ) )
+ {
+ User::RequestComplete(iCallerStatus, KErrDiskFull);
+ return;
+ }
+ TInt err = KErrNone;
+ iUid = aUid;
+ iItemSize = aSize;
+ iWriterPosition = 0;
+ if ( iItemData )
+ {
+ delete iItemData;
+ iItemData = NULL;
+ }
+ iItemData = CBufFlat::NewL( KNSmlItemDataExpandSize );
+ CNpdItem *note;
+ note = CNpdItem::NewLC();
+ TInt itemFound;
+ TRAP(itemFound,iNpdDb->GetNoteL(aUid, *note));
+ CleanupStack::PopAndDestroy(note);//for note
+ if ( itemFound != KErrNone)
+ {
+ delete iItemData;
+ iItemData = NULL;
+
+ User::RequestComplete( iCallerStatus, KErrNotFound );
+ return;
+ }
+ iReplaceItemId = aUid;
+ iState = ENSmlItemUpdating;
+ User::RequestComplete( iCallerStatus, err );
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoReplaceItemL(): end");
+ }
+// ----------------------------------------------------------------------------
+// void CNSmlNotepadDataStore::DoReadItemL()
+// ----------------------------------------------------------------------------
+void CNSmlNotepadDataStore::DoReadItemL( TDes8& aBuffer )
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoReadItemL(): begin");
+ if ( iState != ENSmlItemOpen || !iItemData )
+ {
+ iReaderPosition = -1;
+ User::Leave( KErrNotReady );
+ }
+ if ( iReaderPosition == -1 )
+ {
+ User::Leave( KErrEof );
+ }
+
+ if ( aBuffer.MaxSize() <= iItemData->Size() )
+ {
+ //iItemData->Read( 0, aBuffer );
+ //iReaderPosition = -1;
+ if (iReaderPosition < (iItemData->Size() - iReaderPosition))
+ {
+ iItemData->Read( iReaderPosition , aBuffer);
+ iReaderPosition = iReaderPosition + aBuffer.Size();
+ }
+ else
+ {
+ if (aBuffer.MaxLength() <= (iItemData->Size() - iReaderPosition))
+ {
+ iItemData->Read( iReaderPosition , aBuffer, aBuffer.MaxLength() );
+ }
+ else
+ {
+ iItemData->Read( iReaderPosition , aBuffer, (iItemData->Size() - iReaderPosition) );
+ }
+ iReaderPosition = -1;
+ }
+ }
+ else
+ {
+ TInt length = iItemData->Size() - iReaderPosition;
+ if ( aBuffer.Size() <= length )
+ {
+ iItemData->Read( iReaderPosition , aBuffer );
+ iReaderPosition = -1;
+ }
+ else
+ {
+ iItemData->Read( iReaderPosition , aBuffer, aBuffer.Size() );
+ iReaderPosition = iReaderPosition + aBuffer.Size();
+ }
+ }
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoReadItemL(): end");
+ }
+
+// ----------------------------------------------------------------------------
+// void CNSmlNotepadDataStore::DoWriteItemL()
+// ----------------------------------------------------------------------------
+void CNSmlNotepadDataStore::DoWriteItemL( const TDesC8& aData )
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoWriteItemL(): begin");
+ if ( iState == ENSmlItemCreating || iState == ENSmlItemUpdating )
+ {
+ TInt totalSize = aData.Size() + iItemData->Size();
+ if( SysUtil::DiskSpaceBelowCriticalLevelL( &iRfs, totalSize, iDrive ) )
+ {
+ User::RequestComplete(iCallerStatus, KErrDiskFull);
+ return;
+ }
+ if ( iItemData )
+ {
+ if ( iWriterPosition == -1 )
+ {
+ User::Leave( KErrEof );
+ }
+ iItemData->InsertL( iWriterPosition , aData );
+ iWriterPosition = aData.Size();
+ return;
+ }
+ }
+ User::Leave( KErrNotReady );
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoWriteItemL(): end");
+ }
+
+// ----------------------------------------------------------------------------
+// void CNSmlNotepadDataStore::DoCommitItemL()
+// ----------------------------------------------------------------------------
+void CNSmlNotepadDataStore::DoCommitItemL( TRequestStatus& aStatus )
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoCommitItemL(): begin");
+ iCallerStatus = &aStatus;
+ *iCallerStatus = KRequestPending;
+ if ( iState == ENSmlItemCreating || iState == ENSmlItemUpdating )
+ {
+ if ( !iItemData )
+ {
+ User::RequestComplete( iCallerStatus, KErrNotReady );
+ return;
+ }
+ }
+ else
+ {
+ User::RequestComplete(iCallerStatus, KErrNotReady );
+ return;
+ }
+ iItemData->Compress();
+ TInt err(KErrNone);
+ if ( iState == ENSmlItemCreating )
+ {
+ iState = ENSmlClosed;
+ TSmlDbItemUid newUid;
+ err = DoAddItemToDataBaseL( *iItemData,newUid);
+ *iAddItemId = newUid;
+ }
+ else // ENSmlItemUpdating
+ {
+ iState = ENSmlClosed;
+ err = DoReplaceItemAtDataBaseL( *iItemData, iReplaceItemId );
+ }
+ iReplaceItemId = -1;
+ iWriterPosition = -1;
+ iState = ENSmlOpenAndWaiting;
+ if ( iItemData )
+ {
+ delete iItemData;
+ iItemData = NULL;
+ }
+ User::RequestComplete( iCallerStatus, err);
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoCommitItemL(): end");
+ }
+
+// ----------------------------------------------------------------------------
+// void CNSmlNotepadDataStore::DoCloseItem()
+// ----------------------------------------------------------------------------
+void CNSmlNotepadDataStore::DoCloseItem()
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoCloseItem(): begin");
+ if ( iState == ENSmlItemOpen )
+ {
+ iReaderPosition = -1;
+ if ( iItemData )
+ {
+ delete iItemData;
+ iItemData = NULL;
+ }
+ iState = ENSmlOpenAndWaiting;
+ }
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoCloseItem(): end");
+ }
+
+
+// ----------------------------------------------------------------------------
+// void CNSmlNotepadDataStore::DoMoveItemL()
+// ----------------------------------------------------------------------------
+void CNSmlNotepadDataStore::DoMoveItemL( TSmlDbItemUid /*aUid*/,
+ TSmlDbItemUid /*aNewParent*/,
+ TRequestStatus& aStatus )
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoMoveItemL(): begin");
+ iCallerStatus = &aStatus;
+ *iCallerStatus = KRequestPending;
+ if ( iState != ENSmlOpenAndWaiting )
+ {
+ User::RequestComplete( iCallerStatus, KErrNotReady );
+ return;
+ }
+ User::RequestComplete( iCallerStatus, KErrNotSupported );
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoMoveItemL(): end");
+ }
+
+// ----------------------------------------------------------------------------
+// void CNSmlNotepadDataStore::DoDeleteItemL()
+// ----------------------------------------------------------------------------
+void CNSmlNotepadDataStore::DoDeleteItemL( TSmlDbItemUid aUid, TRequestStatus& aStatus )
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoDeleteItemL(): begin");
+ iCallerStatus = &aStatus;
+ *iCallerStatus = KRequestPending;
+ if ( iState != ENSmlOpenAndWaiting )
+ {
+ // Items cannot be deleted if some of them is opened
+ User::RequestComplete( iCallerStatus, KErrNotReady );
+ return;
+ }
+ iItemData = CBufFlat::NewL( KNSmlItemDataExpandSize );
+ CNpdItem *note;
+ note = CNpdItem::NewLC();
+ TInt itemFound;
+ TRAP(itemFound,iNpdDb->GetNoteL(aUid, *note));
+ CleanupStack::PopAndDestroy(note); // for note
+ if( itemFound != KErrNone)
+ {
+ delete iItemData;
+ iItemData = NULL;
+
+ User::RequestComplete( iCallerStatus, KErrNotFound );
+ return;
+ }
+ TRAPD( err, iNpdDb->DeleteNoteL( aUid ) );
+ if( err == KErrNone )
+ {
+ if(iChangeFinder)
+ {
+ iChangeFinder->ItemDeleted( TNSmlSnapshotItem( aUid ) );
+ }
+ }
+ User::RequestComplete(iCallerStatus, err);
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoDeleteItemL(): end");
+ }
+
+// ----------------------------------------------------------------------------
+// void CNSmlNotepadDataStore::DoSoftDeleteItemL()
+// ----------------------------------------------------------------------------
+void CNSmlNotepadDataStore::DoSoftDeleteItemL( TSmlDbItemUid aUid, TRequestStatus& aStatus )
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoSoftDeleteItemL(): begin");
+ DoDeleteItemL( aUid,aStatus );
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoSoftDeleteItemL(): end");
+ }
+
+// ----------------------------------------------------------------------------
+// void CNSmlNotepadDataStore::DoDeleteAllItemsL()
+// ----------------------------------------------------------------------------
+void CNSmlNotepadDataStore::DoDeleteAllItemsL( TRequestStatus& aStatus )
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoDeleteAllItemsL(): begin");
+ iCallerStatus = &aStatus;
+ *iCallerStatus = KRequestPending;
+ if ( iState != ENSmlOpenAndWaiting )
+ {
+ // Items cannot be deleted if they are opened.
+ User::RequestComplete(iCallerStatus, KErrNotReady);
+ return;
+ }
+ iNpdDb->ResetL();
+ if( iChangeFinder )
+ {
+ iChangeFinder->ResetL();
+ }
+ iSnapshotRegistered = EFalse;
+ User::RequestComplete(iCallerStatus, KErrNone);
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoDeleteAllItemsL(): end");
+ }
+
+// ----------------------------------------------------------------------------
+// TBool CNSmlNotepadDataStore::DoHasSyncHistory()
+// ----------------------------------------------------------------------------
+TBool CNSmlNotepadDataStore::DoHasSyncHistory() const
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoHasSyncHistory(): begin");
+ TBool doHasSyncHistory = EFalse;
+ if( !iDataBaseOpened )
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoHasSyncHistory(): NOT OPEN end");
+ return doHasSyncHistory;
+ }
+
+ if( iSyncHistory )
+ {
+ if ( iOpenedStoreId != iChangeFinder->DataStoreUid() )
+ {
+ iChangeFinder->SetDataStoreUid( iOpenedStoreId );
+ doHasSyncHistory = EFalse;
+ }
+ else
+ {
+ doHasSyncHistory = ETrue;
+ }
+ }
+ else
+ {
+ iChangeFinder->SetDataStoreUid( iOpenedStoreId );
+ }
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoHasSyncHistory(): end");
+ return doHasSyncHistory;
+ }
+
+// ----------------------------------------------------------------------------
+// void CNSmlNotepadDataStore::DoAddedItems()
+// ----------------------------------------------------------------------------
+const MSmlDataItemUidSet& CNSmlNotepadDataStore::DoAddedItems() const
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoAddedItems(): begin");
+ if ( iState == ENSmlOpenAndWaiting )
+ {
+ iNewUids->Reset();
+ if( iChangeFinder )
+ {
+ TRAPD( err,iChangeFinder->FindNewItemsL( *iNewUids ) );
+ if( err != KErrNone )
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoAddedItems(): LEAVE end");
+ }
+ }
+ }
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoAddedItems(): end");
+ return *iNewUids;
+ }
+
+// ----------------------------------------------------------------------------
+// void CNSmlNotepadDataStore::DoDeletedItems()
+// ----------------------------------------------------------------------------
+const MSmlDataItemUidSet& CNSmlNotepadDataStore::DoDeletedItems() const
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoDeletedItems(): begin");
+ if ( iState == ENSmlOpenAndWaiting )
+ {
+ iDeletedUids->Reset();
+ if( iChangeFinder )
+ {
+ TRAPD(err,iChangeFinder->FindDeletedItemsL( *iDeletedUids ) );
+ if( err != KErrNone )
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoDeletedItems(): LEAVE end");
+ }
+ }
+ }
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoDeletedItems(): end");
+ return *iDeletedUids;
+ }
+
+// ----------------------------------------------------------------------------
+// void CNSmlNotepadDataStore::DoSoftDeletedItems()
+// ----------------------------------------------------------------------------
+const MSmlDataItemUidSet& CNSmlNotepadDataStore::DoSoftDeletedItems() const
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoSoftDeletedItems(): begin");
+ if ( iState == ENSmlOpenAndWaiting )
+ {
+ iSoftDeletedUids->Reset();
+ if( iChangeFinder )
+ {
+ TRAPD( err, iChangeFinder->FindSoftDeletedItemsL( *iSoftDeletedUids ) );
+ if( err != KErrNone )
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoSoftDeletedItems(): LEAVE end");
+ }
+ }
+ }
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoSoftDeletedItems: END");
+ return *iSoftDeletedUids;
+ }
+
+// ----------------------------------------------------------------------------
+// void CNSmlNotepadDataStore::DoModifiedItems()
+// ----------------------------------------------------------------------------
+const MSmlDataItemUidSet& CNSmlNotepadDataStore::DoModifiedItems() const
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoModifiedItems(): begin");
+ if ( iState == ENSmlOpenAndWaiting )
+ {
+ iReplacedUids->Reset();
+ if( iChangeFinder )
+ {
+ TRAPD( err, iChangeFinder->FindChangedItemsL( *iReplacedUids ) );
+ if( err != KErrNone )
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoModifiedItems(): LEAVE end");
+ }
+ }
+ }
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoModifiedItems: END");
+ return *iReplacedUids;
+ }
+
+// ----------------------------------------------------------------------------
+// void CNSmlNotepadDataStore::DoMovedItems()
+// ----------------------------------------------------------------------------
+const MSmlDataItemUidSet& CNSmlNotepadDataStore::DoMovedItems() const
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoMovedItems(): begin");
+ if ( iState == ENSmlOpenAndWaiting )
+ {
+ iMovedUids->Reset();
+ if( iChangeFinder )
+ {
+ TRAPD( err, iChangeFinder->FindMovedItemsL( *iMovedUids ) );
+ if( err != KErrNone )
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoMovedItems(): LEAVE end");
+ }
+ }
+ }
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoMovedItems: END");
+ return *iMovedUids;
+ }
+
+// ----------------------------------------------------------------------------
+// void CNSmlNotepadDataStore::DoResetChangeInfoL()
+// ----------------------------------------------------------------------------
+void CNSmlNotepadDataStore::DoResetChangeInfoL( TRequestStatus& aStatus )
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoResetChangeInfoL(): begin");
+ iCallerStatus = &aStatus;
+ *iCallerStatus = KRequestPending;
+ if( iChangeFinder )
+ {
+ iChangeFinder->ResetL();
+ }
+ iSnapshotRegistered = EFalse;
+ TInt err = FetchModificationsL();
+ User::RequestComplete( iCallerStatus, err );
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoResetChangeInfoL(): end");
+ }
+
+// ----------------------------------------------------------------------------
+// void CNSmlNotepadDataStore::DoCommitChangeInfoL()
+// ----------------------------------------------------------------------------
+void CNSmlNotepadDataStore::DoCommitChangeInfoL( TRequestStatus& aStatus,
+ const MSmlDataItemUidSet& aItems )
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoCommitChangeInfoL(aItems): begin");
+ iCallerStatus = &aStatus;
+ *iCallerStatus = KRequestPending;
+ if( iChangeFinder )
+ {
+ iChangeFinder->CommitChangesL( aItems );
+ User::RequestComplete( iCallerStatus, KErrNone );
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoCommitChangeInfoL(aItems):success end");
+ return;
+ }
+ User::RequestComplete( iCallerStatus, KErrNotReady );
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoCommitChangeInfoL(aItems): end");
+ }
+
+// ----------------------------------------------------------------------------
+// void CNSmlNotepadDataStore::DoCommitChangeInfoL()
+// ----------------------------------------------------------------------------
+void CNSmlNotepadDataStore::DoCommitChangeInfoL( TRequestStatus& aStatus )
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoCommitChangeInfoL(): begin");
+ iCallerStatus = &aStatus;
+ *iCallerStatus = KRequestPending;
+ if( iChangeFinder )
+ {
+ iChangeFinder->CommitChangesL();
+ User::RequestComplete( iCallerStatus, KErrNone );
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoCommitChangeInfoL(): success end");
+ return;
+ }
+ User::RequestComplete( iCallerStatus, KErrNotReady );
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoCommitChangeInfoL(): end");
+ }
+
+// ----------------------------------------------------------------------------
+// CSmlDataStoreFormat* CNSmlNotepadDataStore::DoOwnStoreFormatL()
+// ----------------------------------------------------------------------------
+CSmlDataStoreFormat* CNSmlNotepadDataStore::DoOwnStoreFormatL()
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoOwnStoreFormatL(): begin");
+ TFileName fileName;
+ TParse parse;
+
+ // Locate the resource file
+ TFileName dllFileName;
+ Dll::FileName( dllFileName );
+
+ TFileName resourceFileName;
+ resourceFileName.Copy( TParsePtrC( dllFileName ).Drive() );
+ resourceFileName.Append(KNSmlNotepadStoreFormatRsc);
+
+ parse.Set( resourceFileName, &KDC_RESOURCE_FILES_DIR, NULL );
+ fileName = parse.FullName();
+ RResourceFile resourceFile;
+ BaflUtils::NearestLanguageFile( iRfs, fileName );
+ resourceFile.OpenL( iRfs, fileName );
+ CleanupClosePushL( resourceFile );
+ HBufC8* notepadDataFormat = resourceFile.AllocReadLC( NSML_NOTEPAD_DATA_STORE_FORMAT );
+ TResourceReader reader;
+ reader.SetBuffer( notepadDataFormat );
+ CSmlDataStoreFormat* lDsFormat = CSmlDataStoreFormat::NewLC( iStringPool, reader );
+ CleanupStack::Pop(lDsFormat); // lDsFormat
+ CleanupStack::PopAndDestroy(notepadDataFormat); // notepadDataFormat
+ CleanupStack::PopAndDestroy();// resourceFile
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoOwnStoreFormatL(): end");
+ return lDsFormat;
+ }
+
+// ----------------------------------------------------------------------------
+// TInt CNSmlNotepadDataStore::OpenItemL(TSmlDbItemUid& aUid,CBufBase& aItem)
+// ----------------------------------------------------------------------------
+TInt CNSmlNotepadDataStore::OpenItemL(TSmlDbItemUid& aUid,CBufBase& aItem)
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::OpenItemL(): begin");
+ TInt err = KErrNone;
+ if(iNpdDb->IsOpen())
+ {
+ CNpdItem *note;
+ note = CNpdItem::NewLC();
+ TRAP(err,iNpdDb->GetNoteL(aUid, *note));
+ if(err == KErrNone)
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore:: FetchItemL(): begin");
+
+ HBufC8* buf = ConvertNoteToSyncItemL(*note);
+ CleanupStack::PushL(buf);
+ aItem.Reset();
+ // Write the buffer to the passed writeStream (aItem)
+ TBufBuf bufBuf;
+ bufBuf.Set(aItem, 0, TBufBuf::EWrite);
+ RWriteStream writeStream( &bufBuf);
+ writeStream.PushL();
+ writeStream.WriteL(buf->Des().Ptr(), buf->Des().Length());
+ writeStream.CommitL();
+ CleanupStack::PopAndDestroy(1);//writeStream
+ CleanupStack::PopAndDestroy(buf);//buf
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::FetchItemL(): end");
+ }
+ CleanupStack::PopAndDestroy(note); // note
+ }
+ else
+ {
+ err = KErrNotReady;
+ }
+
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::OpenItemL(): end");
+ return err;
+}
+
+// ----------------------------------------------------------------------------
+// TInt CNSmlNotepadDataStore::ConvertSyncItemToNoteL(const TDesC8& aSyncItem, CNpdItem& aNote)
+// ----------------------------------------------------------------------------
+TInt CNSmlNotepadDataStore::ConvertSyncItemToNoteL(const TDesC8& aSyncItem, CNpdItem& aNote)
+ {
+ TInt err(KErrNone);
+ TTime gmt;
+ gmt.UniversalTime();
+ gmt.RoundUpToNextMinute();
+ gmt -= TTimeIntervalMinutes(1);
+ HBufC *note = NULL;
+ if(&aSyncItem)
+ {
+ RDesReadStream stream(aSyncItem);
+ CPlainText *text;
+ text = CPlainText::NewL();
+ CleanupStack::PushL(text);
+ CPlainText::TImportExportParam param;
+ param.iForeignEncoding = KCharacterSetIdentifierUtf8;
+ param.iOrganisation = CPlainText::EOrganiseByParagraph;
+ param.iGuessForeignEncoding = EFalse;
+ CPlainText::TImportExportResult result;
+ text->ImportTextL(0,stream,param,result);
+ stream.Close();
+ note = HBufC::NewL(result.iOutputChars);
+ CleanupStack::PushL(note);
+ TPtr tmpdes = note->Des();
+ text->Extract(tmpdes,0);
+ CleanupStack::Pop(note);
+ CleanupStack::PopAndDestroy(text);
+ }
+ aNote.SetContent(note);
+ aNote.SetModified(gmt);
+ return err;
+ }
+
+// ----------------------------------------------------------------------------
+// HBufC8* CNSmlNotepadDataStore::ConvertNoteToSyncItemL(CNpdItem& aNote)
+// ----------------------------------------------------------------------------
+HBufC8* CNSmlNotepadDataStore::ConvertNoteToSyncItemL(CNpdItem& aNote)
+ {
+ if (!aNote.Content())
+ {
+ HBufC8* tempHBuf = HBufC8::NewL(KNullCharLen);//room for null character
+ return tempHBuf;
+ }
+ // Note: a single unicode character can be 4 bytes long in UTF8 format,
+ // hence the long length for 8-bit buffer.
+ TInt length = (aNote.Content()->Length()) * KUTF8Lenght;
+ HBufC8* tempHBuf = HBufC8::NewLC(length + KNullCharLen);
+ CPlainText *text = CPlainText::NewL();
+ CleanupStack::PushL(text);
+ text->InsertL(0,aNote.Content()->Des());
+ CPlainText::TImportExportResult result;
+ CPlainText::TImportExportParam param;
+ param.iForeignEncoding = KCharacterSetIdentifierUtf8;
+ param.iOrganisation = CPlainText::EOrganiseByParagraph;
+ param.iGuessForeignEncoding = EFalse;
+ param.iMaxOutputChars = length;
+ TPtr8 ptr = tempHBuf->Des();
+ RDesWriteStream stream(ptr);
+ text->ExportTextL(0,stream,param,result);
+ stream.Close();
+ CleanupStack::PopAndDestroy(text);
+ CleanupStack::Pop(tempHBuf);//pop the HBufC8 temp
+ return (tempHBuf);
+ }
+
+// ----------------------------------------------------------------------------
+// TInt CNSmlNotepadDataStore::DoAddItemToDataBaseL(CBufBase& aItem)
+// ----------------------------------------------------------------------------
+TInt CNSmlNotepadDataStore::DoAddItemToDataBaseL(CBufBase& aItem,TInt& aUid)
+{
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoAddItemToDataBaseL: begin");
+ TInt lKey = -1;
+ TInt length = aItem.Size();
+ HBufC8* buf = HBufC8::NewLC(length*KUnicodeSize + KNullCharLen);
+ buf->Des().Copy(aItem.Ptr(0));
+ TPtr8 lPtr(buf->Des());
+ CNpdItem *note;
+ note = CNpdItem::NewLC();
+ TInt err(KErrNone);
+ err = ConvertSyncItemToNoteL(*buf, *note);
+ if(err != KErrNone)
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoAddItemToDataBaseL: conversion error");
+ }
+ else
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoAddItemToDataBaseL: before adding to notepad db");
+ TRAP(err,iNpdDb->AddNoteL(*note,lKey));
+ if(err!=KErrNone)
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoAddItemToDataBaseL: Addnote error");
+ }
+ else
+ {
+ TNSmlSnapshotItem item( lKey );
+ TTime lLastModified = note->LastModified();
+ item.SetLastChangedDate(lLastModified);
+ item.SetSoftDelete( EFalse );
+ iChangeFinder->ItemAddedL( item );
+ }
+ }
+ aUid = lKey;
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoAddItemToDataBaseL: after adding to notepad db");
+ CleanupStack::PopAndDestroy(note);//note
+ CleanupStack::PopAndDestroy(buf);//buf
+ return err;
+}
+// ----------------------------------------------------------------------------
+// void CNSmlNotepadDataStore::DoReplaceItemAtDataBaseL(CBufBase& aItem, TInt& aUid)
+// ----------------------------------------------------------------------------
+TInt CNSmlNotepadDataStore::DoReplaceItemAtDataBaseL(CBufBase& aItem, TInt& aUid)
+{
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoReplaceItemAtDataBaseL: begin");
+ TInt length = aItem.Size();
+ HBufC8* buf = HBufC8::NewLC(length*KUnicodeSize + KNullCharLen);
+ buf->Des().Copy(aItem.Ptr(0));
+ TPtr8 lPtr(buf->Des());
+ CNpdItem *note;
+ note = CNpdItem::NewLC();
+ TInt err(KErrNone);
+ err = ConvertSyncItemToNoteL(*buf, *note);
+ if(err != KErrNone)
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoReplaceItemAtDataBaseL: conversion error");
+ }
+ else
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoReplaceItemAtDataBaseL: before updating into notepad db");
+ TRAP(err,iNpdDb->UpdateNoteL(aUid,*note));
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoReplaceItemAtDataBaseL: after updating into notepad db");
+ if(err!=KErrNone)
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoReplaceItemAtDataBaseL: updating error");
+ }
+ else
+ {
+ TNSmlSnapshotItem item( aUid );
+ item.SetLastChangedDate( note->LastModified() );
+ item.SetSoftDelete( EFalse );
+ iChangeFinder->ItemUpdatedL( item );
+ }
+ }
+ CleanupStack::PopAndDestroy(note);//note
+ CleanupStack::PopAndDestroy(buf); //buf
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoReplaceItemAtDataBaseL: end");
+ return err;
+}
+
+// ------------------------------------------------------------------------------------------------
+// CNSmlNotepadDataStore::DriveBelowCriticalLevelL()
+// ------------------------------------------------------------------------------------------------
+TBool CNSmlNotepadDataStore::DriveBelowCriticalLevelL( TInt aSize )
+ {
+ return SysUtil::DiskSpaceBelowCriticalLevelL( &iRfs, aSize, iDrive );
+ }
+
+// ----------------------------------------------------------------------------
+// TInt CNSmlNotepadDataStore::FetchModificationsL()
+// ----------------------------------------------------------------------------
+TInt CNSmlNotepadDataStore::FetchModificationsL()
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::FetchModificationsL: begin");
+ TInt err( KErrNone );
+ CArrayPtr<CNpdItem>* arrNpdItem = NULL;
+ arrNpdItem = iNpdDb->FetchItemsLC();
+
+ if( !iSnapshot )
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::FetchModificationsL: inside if(!isnapshot)");
+ iSnapshot = new (ELeave) CArrayFixSeg<TNSmlSnapshotItem>( 8 );
+ }
+
+ if( !iSnapshotRegistered )
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::FetchModificationsL: inside if(!iSnapshotRegistered)");
+ for( TInt count = 0; count < arrNpdItem->Count(); count++ )
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::FetchModificationsL: inside for before snap");
+ TNSmlSnapshotItem snap( arrNpdItem->At( count )->Key() );
+ snap.SetLastChangedDate( arrNpdItem->At( count )->LastModified() );
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::FetchModificationsL: inside for before insertisql");
+ iSnapshot->InsertIsqL( snap, iKey );
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::FetchModificationsL: inside for after insertisql");
+ }
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::FetchModificationsL: for loop ends");
+ iSnapshot->Compress();
+ iChangeFinder->SetNewSnapshot( iSnapshot ); // changefinder takes ownership
+ iSnapshot = NULL;
+ iSnapshotRegistered = ETrue;
+ }
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::FetchModificationsL: before popanddestroy arrnpditem");
+ CleanupStack::PopAndDestroy(arrNpdItem);
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::FetchModificationsL: end");
+ return err;
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/omads/omadsextensions/adapters/notes/src/NSmlNotepadDataStoreFormat.rss Mon May 03 12:24:28 2010 +0300
@@ -0,0 +1,55 @@
+CHARACTER_SET UTF8/*
+* Copyright (c) 2005 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"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Resource data for notepadDataProvider
+*
+*/
+
+#include <eikon.rh>
+#include <avkon.rh>
+#include "SmlDataFormat.rh"
+#include "SmlDataFormat.hrh"
+#include <data_caging_paths_strings.hrh>
+
+
+
+RESOURCE TBUF r_notepad_datafile_name
+ {
+ buf = NOTEPAD_DATABASE;
+ }
+
+RESOURCE SML_DATA_STORE_FORMAT NSML_NOTEPAD_DATA_STORE_FORMAT
+ {
+ version=1;
+ display_name="Notes";
+ sync_types=KSmlSyncType_TwoWay+KSmlSyncType_OneWayFromSvr+KSmlSyncType_OneWayFromClnt+KSmlSyncType_RefreshFromSvr+KSmlSyncType_RefreshFromClnt+KSmlSyncType_SlowSync;
+ mime_format=
+ {
+ SML_MIME_FORMAT
+ {
+ version=1;
+ mime_type="text/plain";
+ mime_ver="1.0";
+ field_level=0;
+ }
+ };
+ mime_format_tx_pref=0; // Preferred index for tx
+ mime_format_rx_pref=0; // Preferred index for rx
+ folder_properties={};
+ filter_capabilities={};
+ max_size=0; // no limit
+ max_items=0; // no limit
+ flags=0;
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/omads/omadsextensions/adapters/notes/src/nsmlnotepadDatabase.cpp Mon May 03 12:24:28 2010 +0300
@@ -0,0 +1,646 @@
+/*
+* Copyright (c) 2003 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"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: notepad database
+*
+*/
+
+
+#include <sysutil.h>
+
+#include <txtetext.h>
+#include "nsmlnotepadDatabase.h"
+#include <nsmlnotepaddatastoreformat.rsg>
+#include <nsmlconstants.h>
+
+#include <calentryview.h>
+#include <calentry.h>
+#include <calinstance.h>
+#include <calinstanceview.h>
+#include <calsession.h>
+#include <CalenInterimUtils2.h>
+
+#include "nsmlnotepadlogging.h"
+
+
+// -----------------------------------------------------------------------------
+// CNSmlNotepadDatabase::NewL
+// -----------------------------------------------------------------------------
+//
+CNSmlNotepadDatabase* CNSmlNotepadDatabase::NewL()
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::NewL(): begin");
+
+ CNSmlNotepadDatabase *instance = new(ELeave) CNSmlNotepadDatabase();
+ CleanupStack::PushL(instance);
+ instance->ConstructL();
+ CleanupStack::Pop(instance);
+
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::NewL(): end");
+ return instance;
+ }
+
+// -----------------------------------------------------------------------------
+// CNSmlNotepadDatabase::~CNSmlNotepadDatabase()
+// -----------------------------------------------------------------------------
+//
+CNSmlNotepadDatabase::~CNSmlNotepadDatabase()
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::~CNSmlNotepadDatabase(): begin");
+
+ if(iDataFile)
+ {
+ delete iDataFile;
+ iDataFile = NULL;
+ }
+ CloseAgendaSessions();
+
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::~CNSmlNotepadDatabase(): end");
+ }
+
+// -----------------------------------------------------------------------------
+// CNSmlNotepadDatabase::CNSmlNotepadDatabase()
+// -----------------------------------------------------------------------------
+//
+CNSmlNotepadDatabase::CNSmlNotepadDatabase()
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::CNSmlNotepadDatabase(): begin");
+
+ iOpened = EFalse;
+
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::CNSmlNotepadDatabase(): end");
+ }
+
+// -----------------------------------------------------------------------------
+// CNSmlNotepadDatabase::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CNSmlNotepadDatabase::ConstructL()
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::ConstructL: begin");
+
+ // Instantiate the Session variable
+ iSession = CCalSession::NewL();
+
+ iDataFile = HBufC::NewL(KMaxFileLength);
+ TPtr obptr = iDataFile->Des();
+ obptr = iSession->DefaultFileNameL();
+
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::ConstructL: end");
+ }
+
+// -----------------------------------------------------------------------------
+// TInt CNSmlNotepadDatabase::OpenL(const TDesC& aStoreName)
+// -----------------------------------------------------------------------------
+//
+void CNSmlNotepadDatabase::OpenL(const TDesC& aStoreName)
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::OpenL(): begin");
+ CloseAgendaSessions();
+
+ TInt err = KErrNone;
+ iSession = CCalSession::NewL();
+
+ TRAP( err,iSession->OpenL(iSession->DefaultFileNameL()) );
+ if(err == KErrNotFound)
+ {
+ iSession->CreateCalFileL( iSession->DefaultFileNameL() );
+ iSession->OpenL(iSession->DefaultFileNameL());
+ }
+ else if( err != KErrNone )
+ {
+ CloseAgendaSessions();
+ User::Leave(err);
+ }
+
+ iEntryView = CCalEntryView::NewL(*iSession);
+ iInstanceView = CCalInstanceView::NewL(*iSession);
+
+ if(iEntryView && iInstanceView)
+ {
+ iOpened = ETrue;
+ }
+ else
+ {
+ CloseAgendaSessions();
+ User::LeaveIfError(KErrNotFound);
+ }
+
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::OpenL(): end");
+ }
+
+// -----------------------------------------------------------------------------
+// CNSmlNotepadDatabase::AddNoteL
+// -----------------------------------------------------------------------------
+//
+void CNSmlNotepadDatabase::AddNoteL(CNpdItem& aNote, TInt &aKey)
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::AddNoteL(): begin");
+
+ TInt successCount = 0;
+
+ CCalenInterimUtils2* interimUtils = CCalenInterimUtils2::NewL();
+ CleanupStack::PushL(interimUtils);
+
+ HBufC8* guid = interimUtils->GlobalUidL();
+ CleanupStack::PopAndDestroy(interimUtils);
+
+ CleanupStack::PushL(guid);
+ CCalEntry* entry = CCalEntry::NewL(CCalEntry::ENote, guid,
+ CCalEntry::EMethodNone, 0);
+ CleanupStack::Pop(guid);
+
+ CleanupStack::PushL(entry);
+
+ // set the description
+ TDesC* noteContent(aNote.Content());
+ entry->SetDescriptionL(*noteContent);
+
+ // store the entry in to calendar file
+ RPointerArray<CCalEntry> array;
+ CleanupRPtrArrayPushL(array);
+
+ array.AppendL(entry);
+ CleanupStack::Pop(entry);
+ iEntryView->StoreL(array, successCount);
+
+ if(successCount)
+ {
+ HBufC* content = HBufC::NewL(entry->DescriptionL().Length());
+ content->Des().Copy(entry->DescriptionL());
+ aNote.Set(entry->LocalUidL(),entry->LastModifiedDateL().TimeUtcL(), content);
+ aKey = entry->LocalUidL();
+ CleanupStack::PopAndDestroy(&array);
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::AddNoteL(): inside if(successCount) after array");
+ }
+ else
+ {
+ User::Leave(KErrGeneral);
+ }
+
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::AddNoteL(): end");
+
+ User::Leave(KErrNone);
+ }
+
+// -----------------------------------------------------------------------------
+// CNSmlNotepadDatabase::DeleteNoteL
+// -----------------------------------------------------------------------------
+//
+void CNSmlNotepadDatabase::DeleteNoteL(const TInt aKey)
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::DeleteNoteL(): begin");
+
+ CCalEntry* entryTobeDeleted(NULL);
+ entryTobeDeleted = iEntryView->FetchL(aKey);
+ if(entryTobeDeleted)
+ {
+ CleanupStack::PushL(entryTobeDeleted);
+ iEntryView->DeleteL(*entryTobeDeleted);
+ CleanupStack::Pop(entryTobeDeleted);
+ }
+
+ delete entryTobeDeleted;
+ entryTobeDeleted = NULL;
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::DeleteNoteL(): end");
+ }
+
+// -----------------------------------------------------------------------------
+// CNSmlNotepadDatabase::Close
+// -----------------------------------------------------------------------------
+//
+void CNSmlNotepadDatabase::Close() // can be deprecated ????
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::Close(): begin");
+ iOpened = EFalse;
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::Close(): end");
+ }
+
+// -----------------------------------------------------------------------------
+// CNSmlNotepadDatabase::GetNoteL
+// -----------------------------------------------------------------------------
+//
+void CNSmlNotepadDatabase::GetNoteL(const TInt aKey, CNpdItem& aItem)
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::GetNoteL(): begin");
+ TInt err(KErrNone);
+ if(!iOpened)
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::GetNoteL(): not opened");
+ User::Leave(KErrNotReady);
+ }
+
+ if(aKey)
+ {
+ CCalEntry* entryTobeFetched(NULL);
+ entryTobeFetched = iEntryView->FetchL(aKey);
+ if(entryTobeFetched)
+ {
+ CleanupStack::PushL(entryTobeFetched);
+ HBufC* content = HBufC::NewL(entryTobeFetched->DescriptionL().Length());
+ content->Des().Copy(entryTobeFetched->DescriptionL());
+
+ aItem.Set(aKey, entryTobeFetched->LastModifiedDateL().TimeUtcL(), content);
+
+ //CleanupStack::Pop(aItem);
+ CleanupStack::PopAndDestroy(entryTobeFetched);
+ }
+ else
+ {
+ delete entryTobeFetched;
+ entryTobeFetched = NULL;
+ }
+ }
+
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::GetNoteL(): end");
+ User::Leave(err);
+ }
+
+// -----------------------------------------------------------------------------
+// CNSmlNotepadDatabase::UpdateNoteL
+// -----------------------------------------------------------------------------
+//
+void CNSmlNotepadDatabase::UpdateNoteL(const TInt aKey, CNpdItem& aItem)
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::UpdateNoteL(): begin");
+
+ if(!iOpened)
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::UpdateNoteL(): not ready");
+ User::Leave(KErrNotReady);
+ }
+
+ RPointerArray<CCalEntry> array;
+ CleanupRPtrArrayPushL(array);
+
+ // fetch the created note using the localuid
+ CCalEntry* entryTobeUpdated(NULL);
+ entryTobeUpdated = iEntryView->FetchL(aKey);
+ if(entryTobeUpdated)
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::UpdateNoteL(): entry found");
+ }
+ else
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::UpdateNoteL(): entry not found");
+ User::Leave(KErrNotFound);
+ }
+ CleanupStack::PushL(entryTobeUpdated);
+
+ // update the description
+ HBufC* content = HBufC::NewL(aItem.Content()->Length());
+ content = aItem.Content();
+
+ entryTobeUpdated->SetDescriptionL(*content);
+
+ array.AppendL(entryTobeUpdated);
+ CleanupStack::Pop(entryTobeUpdated);
+ TBool success(EFalse);
+ // update the entry
+ iEntryView->UpdateL(array, success);
+
+ if(success)
+ {
+ aItem.SetModified(entryTobeUpdated->LastModifiedDateL().TimeUtcL());
+ CleanupStack::PopAndDestroy(&array);
+ }
+ else
+ {
+ User::Leave(KErrGeneral);
+ }
+
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::UpdateNoteL(): end");
+ }
+
+// -----------------------------------------------------------------------------
+// CNSmlNotepadDatabase::ResetL
+// -----------------------------------------------------------------------------
+//
+TInt CNSmlNotepadDatabase::ResetL()
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::ResetL(): begin");
+
+ TInt err(KErrNone);
+ CArrayPtr<CNpdItem>* arrNpdItem = NULL;
+
+ // Fetch all the available notes from the db
+ arrNpdItem = FetchItemsLC();
+
+ // Delete the Notes
+ for( TInt count = 0; count < arrNpdItem->Count(); count++ )
+ {
+ CCalEntry* entryTobeDeleted(NULL);
+ entryTobeDeleted = iEntryView->FetchL( arrNpdItem->At(count)->Key() );
+ if(entryTobeDeleted)
+ {
+ CleanupStack::PushL(entryTobeDeleted);
+ iEntryView->DeleteL(*entryTobeDeleted);
+ CleanupStack::Pop(entryTobeDeleted);
+ }
+ delete entryTobeDeleted;
+ entryTobeDeleted = NULL;
+ }
+ CleanupStack::PopAndDestroy(arrNpdItem);
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::ResetL(): begin");
+ return err;
+ }
+
+// -----------------------------------------------------------------------------
+// CNSmlNotepadDatabase::IsOpen
+// -----------------------------------------------------------------------------
+//
+TBool CNSmlNotepadDatabase::IsOpen()
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::IsOpen(): begin");
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::IsOpen(): end");
+ return iOpened;
+ }
+
+// -----------------------------------------------------------------------------
+// void CNSmlNotepadDatabase::GetDefaultDatastoreName(TDes& aStoreName)
+// -----------------------------------------------------------------------------
+//
+void CNSmlNotepadDatabase::GetDefaultDatastoreName(TDes& aStoreName)
+ {
+ _NOTEPAD_DBG_FILE("CCNSmlNotepadDatabase::GetDefaultDatastoreName(): begin");
+
+ aStoreName.Copy(*iDataFile);
+
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::GetDefaultDatastoreName(): end");
+ }
+
+// -----------------------------------------------------------------------------
+// CDesCArray* CNSmlNotepadDatabase::ListDatabasesL()
+// -----------------------------------------------------------------------------
+//
+CDesCArray* CNSmlNotepadDatabase::ListDatabasesL()
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::ListDatabasesL(): begin");
+
+ CDesCArrayFlat *arr = new (ELeave)CDesCArrayFlat(1);
+ CleanupStack::PushL(arr);
+ arr->AppendL(*iDataFile);
+ CleanupStack::Pop(arr);
+
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::ListDatabasesL(): end");
+
+ return arr;
+ }
+
+// ------------------------------------------------------------------------------------------------
+// CArrayPtr<CNpdItem>* CNSmlNotepadDatabase::FetchItemsLC(TBool aIncludeText,
+// ------------------------------------------------------------------------------------------------
+CArrayPtr<CNpdItem>* CNSmlNotepadDatabase::FetchItemsLC(TBool aIncludeText,
+ TInt* aKey)
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::FetchItemsLC(): begin") ;
+
+ CArrayPtr<CNpdItem>* res = new (ELeave) CArrayPtrFlat<CNpdItem> (8);
+ CleanupPtrArrayPushL(res);
+
+ if(!aKey)
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::FetchItemsLC(): In aKey case");
+ RPointerArray<CCalInstance> array;
+ CleanupRPtrArrayPushL(array);
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::FetchItemsLC(): After cleaupstack");
+
+ TCalTime startDate;
+ startDate.SetTimeLocalL(TDateTime(1900, EJanuary, 1, 0, 0, 0, 0));
+ TCalTime endDate;
+ endDate.SetTimeLocalL(TDateTime(2100, EJanuary, 30, 0, 0, 0, 0));
+ CalCommon::TCalTimeRange timeRange(startDate, endDate);
+
+ iInstanceView->FindInstanceL(array,CalCommon::EIncludeNotes, timeRange);
+ CNpdItem* entry = NULL;
+ TInt i = 0;
+
+ while (i < array.Count())
+ {
+ entry = CNpdItem::NewLC();
+ entry->SetKey( array[i]->Entry().LocalUidL() );
+ entry->SetModified( array[i]->Entry().LastModifiedDateL().TimeUtcL());
+ if(aIncludeText)
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::FetchItemsLC(): aIncludeText true");
+ HBufC* content = HBufC::NewL( array[i]->Entry().DescriptionL().Length() );
+ content->Des().Copy( array[i]->Entry().DescriptionL() );
+ entry->SetContent( content );
+ }
+ res->AppendL(entry);
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::FetchItemsLC(): After res->AppendL(entry)");
+ CleanupStack::Pop(entry);
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::FetchItemsLC(): After popping (entry)");
+ i++;
+ }
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::FetchItemsLC(): before pop and destroy");
+ CleanupStack::PopAndDestroy(&array);
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::FetchItemsLC(): After While Loop");
+ }
+ else
+ {
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::FetchItemsLC(): In else case");
+ CCalEntry* entryTobeFetched(NULL);
+ entryTobeFetched = iEntryView->FetchL(*aKey);
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::FetchItemsLC(): After Fetching entry");
+ if(entryTobeFetched)
+ {
+ CleanupStack::PushL(entryTobeFetched);
+ CNpdItem* entry = CNpdItem::NewLC();
+ entry->SetKey( entryTobeFetched->LocalUidL() );
+ entry->SetModified( entryTobeFetched->LastModifiedDateL().TimeUtcL() );
+ if(aIncludeText)
+ {
+ HBufC* content = HBufC::NewL( entryTobeFetched->DescriptionL().Length() );
+ content->Des().Copy( entryTobeFetched->DescriptionL() );
+ entry->SetContent( content );
+ }
+ res->AppendL(entry);
+ CleanupStack::Pop(entry);
+ CleanupStack::PopAndDestroy(entryTobeFetched);
+ }
+ }
+ _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::FetchItemLC(): end");
+ return res;
+ }
+
+// -----------------------------------------------------------------------------
+// CNSmlNotepadDatabase::CloseAgendaSessions
+// -----------------------------------------------------------------------------
+//
+void CNSmlNotepadDatabase::CloseAgendaSessions()
+ {
+ if(iInstanceView)
+ {
+ delete iInstanceView;
+ iInstanceView = NULL;
+ }
+ if(iEntryView)
+ {
+ delete iEntryView;
+ iEntryView = NULL;
+ }
+ if(iSession)
+ {
+ delete iSession;
+ iSession = NULL;
+ }
+ }
+
+
+
+// -----------------------------------------------------------------------------
+// CNpdItem class implementations
+// -----------------------------------------------------------------------------
+
+
+// -----------------------------------------------------------------------------
+// CNpdItem::~CNpdItem
+// -----------------------------------------------------------------------------
+//
+CNpdItem::~CNpdItem()
+ {
+ _NOTEPAD_DBG_FILE("CNpdItem::~CNpdItem: begin");
+ delete iContent;
+ _NOTEPAD_DBG_FILE("CNpdItem::~CNpdItem: end");
+ }
+// -----------------------------------------------------------------------------
+// CNpdItem::NewL
+// -----------------------------------------------------------------------------
+//
+CNpdItem* CNpdItem::NewLC()
+ {
+ _NOTEPAD_DBG_FILE("CNpdItem::NewLC: begin");
+ CNpdItem* tmp = new (ELeave) CNpdItem();
+ CleanupStack::PushL(tmp);
+ //tmp->ConstructL(0, TTime(), NULL);
+ _NOTEPAD_DBG_FILE("CNpdItem::NewLC: end");
+ return tmp;
+ }
+
+// -----------------------------------------------------------------------------
+// CNpdItem::NewL
+// -----------------------------------------------------------------------------
+//
+CNpdItem* CNpdItem::NewLC(TInt aKey, const TTime& aLastModified, HBufC *aContent)
+ {
+ _NOTEPAD_DBG_FILE("CNpdItem::NewLC(TInt aKey, const TTime& aLastModified, HBufC *aContent): begin");
+ CNpdItem* tmp = new (ELeave) CNpdItem(aKey,aLastModified,aContent);
+ CleanupStack::PushL(tmp);
+ //tmp->ConstructL(aKey, aLastModified, aContent);
+ _NOTEPAD_DBG_FILE("CNpdItem::NewLC(TInt aKey, const TTime& aLastModified, HBufC *aContent): end");
+ return tmp;
+ }
+
+// -----------------------------------------------------------------------------
+// CNpdItem::CNpdItem()
+// -----------------------------------------------------------------------------
+//
+CNpdItem::CNpdItem() : iKey(0), iLastModified(Time::MinTTime()), iContent(NULL)
+ {
+ _NOTEPAD_DBG_FILE("NpdItem::CNpdItem(): begin");
+ _NOTEPAD_DBG_FILE("NpdItem::CNpdItem(): end");
+ }
+
+// -----------------------------------------------------------------------------
+// CNpdItem::CNpdItem(TInt aKey,const TTime& aLastModified, HBufC *aContent)
+// -----------------------------------------------------------------------------
+//
+CNpdItem::CNpdItem(TInt aKey,
+ const TTime& aLastModified,
+ HBufC *aContent) : iKey(aKey),
+ iLastModified(aLastModified),
+ iContent(aContent)
+ {
+ _NOTEPAD_DBG_FILE("NpdItem::CNpdItem(): begin");
+ _NOTEPAD_DBG_FILE("NpdItem::CNpdItem(): end");
+ }
+
+
+// -----------------------------------------------------------------------------
+// CNpdItem::Key
+// -----------------------------------------------------------------------------
+//
+TInt CNpdItem::Key() const
+ {
+ _NOTEPAD_DBG_FILE("CNpdItem::Key(): begin");
+ _NOTEPAD_DBG_FILE("CNpdItem::Key(): end");
+ return iKey;
+ }
+// -----------------------------------------------------------------------------
+// CNpdItem::LastModified
+// -----------------------------------------------------------------------------
+//
+TTime CNpdItem::LastModified() const
+ {
+ _NOTEPAD_DBG_FILE("CNpdItem::LastModified(): begin");
+ _NOTEPAD_DBG_FILE("CNpdItem::LastModified(): end");
+ return iLastModified;
+ }
+// -----------------------------------------------------------------------------
+// CNpdItem::Content
+// -----------------------------------------------------------------------------
+//
+HBufC* CNpdItem::Content()
+ {
+ _NOTEPAD_DBG_FILE("NpdItem::Content(): begin");
+ _NOTEPAD_DBG_FILE("NpdItem::Content(): end");
+ return iContent;
+ }
+// -----------------------------------------------------------------------------
+// CNpdItem::Set
+// -----------------------------------------------------------------------------
+//
+void CNpdItem::Set(TInt aKey, const TTime& aLastModified, HBufC *aContent)
+ {
+ _NOTEPAD_DBG_FILE("CNpdItem::Set(): begin");
+ iKey = aKey;
+ iLastModified = aLastModified;
+ SetContent(aContent);
+ _NOTEPAD_DBG_FILE("CNpdItem::Set(): end");
+ }
+
+// -----------------------------------------------------------------------------
+// CNpdItem::Set
+// -----------------------------------------------------------------------------
+//
+void CNpdItem::SetKey(TInt aKey)
+ {
+ _NOTEPAD_DBG_FILE("CNpdItem::SetKey(): begin");
+ iKey = aKey;
+ _NOTEPAD_DBG_FILE("CNpdItem::SetKey(): end");
+ }
+
+// -----------------------------------------------------------------------------
+// CNpdItem::SetContent
+// -----------------------------------------------------------------------------
+//
+void CNpdItem::SetContent(HBufC *aContent)
+ {
+ _NOTEPAD_DBG_FILE("CNpdItem::SetContent(): begin");
+ iContent = aContent;
+ _NOTEPAD_DBG_FILE("CNpdItem::SetContent(): end");
+ }
+
+// -----------------------------------------------------------------------------
+// CNpdItem::SetModified
+// -----------------------------------------------------------------------------
+//
+void CNpdItem::SetModified(const TTime& aLastModified)
+ {
+ _NOTEPAD_DBG_FILE("CNpdItem::SetModified(): begin");
+ iLastModified = aLastModified;
+ _NOTEPAD_DBG_FILE("CNpdItem::SetModified(): end");
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/omads/omadsextensions/adapters/notes/src/nsmlnotepaddataprovider.rss Mon May 03 12:24:28 2010 +0300
@@ -0,0 +1,48 @@
+/*
+* Copyright (c) 2005 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"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Registery info for DS notepad
+*
+*/
+
+
+
+#include <101F85F8.loc>
+#include <registryinfo.rh>
+
+#define KNSMLDSINTERFACEUID 0x101F4D3A
+
+RESOURCE REGISTRY_INFO theRegistryInfo
+ {
+ //dll_uid = 0x101F85F8; // DS interface implementation UID
+ dll_uid = 0x101F8612;
+ interfaces =
+ {
+ INTERFACE_INFO
+ {
+ interface_uid = KNSMLDSINTERFACEUID; //DS interface UID
+ implementations =
+ {
+ IMPLEMENTATION_INFO
+ {
+ //implementation_uid = 0x101F85F8; // DS interface implementation UID
+ implementation_uid = 0x101F8612;
+ version_no = 1;
+ display_name = qtn_nsml_npd_display_name;
+ default_data = "";
+ opaque_data = "";
+ }
+ };
+ }
+ };
+ }
--- a/omads/omadsextensions/dsutils/contactsdatastoreextension/sis/contactsdatastoreextension.pkg Fri Apr 16 14:53:26 2010 +0300
+++ b/omads/omadsextensions/dsutils/contactsdatastoreextension/sis/contactsdatastoreextension.pkg Mon May 03 12:24:28 2010 +0300
@@ -17,7 +17,8 @@
&EN
; SIS header: name, uid, version
-#{"contactsdatastoreextension"},(0x2002DC83),1,0,0
+#{"contactsdatastoreextension"},(0x2002E6D9),1,0,0, TYPE=SP
+
; Localised Vendor name
%{"Vendor"}
--- a/omads/omadsextensions/dsutils/contactsdatastoreextension/src/nsmlcontactsdatastoreextension_p.cpp Fri Apr 16 14:53:26 2010 +0300
+++ b/omads/omadsextensions/dsutils/contactsdatastoreextension/src/nsmlcontactsdatastoreextension_p.cpp Mon May 03 12:24:28 2010 +0300
@@ -137,25 +137,32 @@
DBG_ARGS(_S("CNsmlContactsDataStoreExtensionPrivate::ExportContactsL: BEGIN: UID: %d"), uid);
TInt error(KErrNone);
+ QList<QContact> contacts;
QBuffer contactsbuf;
contactsbuf.open(QBuffer::ReadWrite);
- mWriter->setDevice( &contactsbuf );
- QVersitDocument::VersitType versitType(QVersitDocument::VCard21);
-
+ mWriter->setDevice( &contactsbuf );
QContact contact = mContactManager->contact( uid.iUid );
- /*error = mContactManager->error();
+ error = mContactManager->error();
if( error != QContactManager::NoError )
{
DBG_ARGS(_S("CNsmlContactsDataStoreExtensionPrivate::ExportContactsL:Error %d"), error );
return error;
- }*/
+ }
+ contacts.append( contact );
- QVersitDocument document = mExporter->exportContact( contact,versitType );
- mWriter->setVersitDocument( document );
- bool status = mWriter->writeAll();
- DBG_ARGS(_S("CNsmlContactsDataStoreExtensionPrivate::ExportContactsL:status %d"), status);
- contactbufbase.InsertL( contactbufbase.Size(), *XQConversions::qStringToS60Desc8( contactsbuf.data() ) );
-
+ if( mExporter->exportContacts( contacts, QVersitDocument::VCard21Type ) )
+ {
+ QList<QVersitDocument> documents = mExporter->documents();
+ mWriter->startWriting( documents );
+ bool status = mWriter->waitForFinished();
+ DBG_ARGS(_S("CNsmlContactsDataStoreExtensionPrivate::ExportContactsL:status %d"), status);
+ contactbufbase.InsertL( contactbufbase.Size(), *XQConversions::qStringToS60Desc8( contactsbuf.data() ) );
+ }
+ else
+ {
+ error = KErrGeneral;
+ DBG_ARGS(_S("CNsmlContactsDataStoreExtensionPrivate::ExportContactsL:Error in exporting %d"), error );
+ }
TPtr8 ptrbuf(contactbufbase.Ptr(0));
DBG_DUMP( (void*)ptrbuf.Ptr(), ptrbuf.Length(),
@@ -176,7 +183,7 @@
DBG_DUMP((void*)contactbufbase.Ptr(), contactbufbase.Length(),
_S8("CNsmlContactsDataStoreExtensionPrivate::ImportContactsL: To DB :"));
- TInt error(KErrNone);
+ TBool ret( ETrue );
CArrayFixFlat<TUid>* contactItems = new(ELeave) CArrayFixFlat<TUid>(4);
QBuffer contactsbuf;
contactsbuf.open(QBuffer::ReadWrite);
@@ -186,27 +193,33 @@
contactsbuf.seek(0);
mReader->setDevice(&contactsbuf);
- mReader->readAll();
-
- foreach (QVersitDocument document, mReader->result())
- {
- QContact contact = mImporter->importContact(document);
- mContactManager->saveContact(&contact);
- error = mContactManager->error();
- DBG_ARGS(_S("CNsmlContactsDataStoreExtensionPrivate::ImportContactsL:Error %d"), error );
- if( error == QContactManager::NoError )
+ if (mReader->startReading() && mReader->waitForFinished())
{
- TUint contactid = contact.id().localId();
- contactItems->AppendL( TUid::Uid( contactid ) );
- DBG_ARGS(_S("CNsmlContactsDataStoreExtensionPrivate::ImportContactsL:UID %d"), contactid );
+ DBG_ARGS(_S("CNsmlContactsDataStoreExtensionPrivate::Buffer Count: %d"), mReader->results().count() );
+
+ QList<QContact> contacts = mImporter->importContacts(mReader->results());
+ QMap<int, QContactManager::Error> errorMap;
+ ret = mContactManager->saveContacts( &contacts, &errorMap );
+ DBG_ARGS(_S("CNsmlContactsDataStoreExtensionPrivate::Import Status: %d"), ret );
+ if( ret )
+ {
+ foreach (QContact contact, contacts )
+ {
+ TUint contactid = contact.id().localId();
+
+ DBG_ARGS(_S("CNsmlContactsDataStoreExtensionPrivate::Contact ID: %d"), contactid );
+
+ contactItems->AppendL( TUid::Uid( contactid ) );
+ }
+ }
+
+ if( contactItems->Count() <= 0 )
+ {
+ delete contactItems;
+ contactItems = NULL;
+ }
}
- }
- DBG_ARGS(_S("CNsmlContactsDataStoreExtensionPrivate::ImportContactsL:Count %d"), contactItems->Count() );
- if( contactItems->Count() <= 0 )
- {
- delete contactItems;
- contactItems = NULL;
- }
+
_DBG_FILE("CNsmlContactsDataStoreExtensionPrivate::ImportContactsL: END");
return contactItems;
@@ -222,12 +235,12 @@
TInt error(KErrNone);
QContact contact = mContactManager->contact( uid.iUid );
- /*error = mContactManager->error();
+ error = mContactManager->error();
if( error != QContactManager::NoError )
{
DBG_ARGS(_S("CNsmlContactsDataStoreExtensionPrivate::ReadContactL:Error %d"), error );
return error;
- }*/
+ }
// Fetch the contact details
QContactTimestamp timestamp = contact.detail( QContactTimestamp::DefinitionName );
@@ -280,16 +293,15 @@
{
_DBG_FILE("CNsmlContactsDataStoreExtensionPrivate::DeleteContactsL: BEGIN");
- TBool ret = ETrue;
+ QList<QContactLocalId> contacts;
for( TInt count = 0; count < arrDelete->Count(); count++ )
- {
- ret = mContactManager->removeContact( arrDelete->At( count ).iUid );
- if( EFalse == ret )
{
- DBG_ARGS(_S("CNsmlContactsDataStoreExtensionPrivate::DeleteContactsL:ERROR : %d"), ret );
- return ret;
+ contacts.append( arrDelete->At( count ).iUid );
}
- }
+
+ QMap<int, QContactManager::Error> errorMap;
+ TBool ret = mContactManager->removeContacts( &contacts, &errorMap );
+
_DBG_FILE("CNsmlContactsDataStoreExtensionPrivate::DeleteContactsL: END");
return ret;
@@ -302,22 +314,14 @@
{
_DBG_FILE("CNsmlContactsDataStoreExtensionPrivate::DeleteAllContactsL: BEGIN");
- QList<QContactManager::Error> err;
- TBool ret = ETrue;
QContactLocalId selfcontactid = mContactManager->selfContactId();
- QList<QContactLocalId> contactIds = mContactManager->contacts();
- int index = contactIds.indexOf( selfcontactid );
+ QList<QContactLocalId> contactIds = mContactManager->contactIds();
+ int index = contactIds.indexOf( selfcontactid );
contactIds.removeAt( index );
- err = mContactManager->removeContacts( &contactIds );
- foreach ( const QContactManager::Error error, err )
- {
- if( error != QContactManager::NoError )
- {
- ret = EFalse;
- break;
- }
- }
+ QMap<int, QContactManager::Error> errorMap;
+ TBool ret = mContactManager->removeContacts( &contactIds, &errorMap );
+
_DBG_FILE("CNsmlContactsDataStoreExtensionPrivate::DeleteAllContactsL: END");
return ret;
@@ -347,10 +351,13 @@
{
_DBG_FILE("CNsmlContactsDataStoreExtensionPrivate::MachineIdL: BEGIN");
- TInt64 machineid = DefaultHash::Des16( *XQConversions::qStringToS60Desc(
- mContactManager->managerUri() ) );
+ DBG_ARGS(_S("CNsmlContactsDataStoreExtensionPrivate::manageruri: %S"), XQConversions::qStringToS60Desc(
+ mContactManager->managerUri() ) );
- DBG_ARGS(_S("CNsmlContactsDataStoreExtensionPrivate::MachineIdL: %d"), machineid );
+ TInt64 machineid = DefaultHash::Des16( XQConversions::qStringToS60Desc(
+ mContactManager->managerUri() )->Des() );
+
+ DBG_ARGS(_S("CNsmlContactsDataStoreExtensionPrivate::MachineIdL: %ld"), machineid );
return machineid;
}
@@ -362,7 +369,7 @@
{
_DBG_FILE("CNsmlContactsDataStoreExtensionPrivate::ListContactsL: BEGIN");
- QList<QContactLocalId> contactIds = mContactManager->contacts();
+ QList<QContactLocalId> contactIds = mContactManager->contactIds();
foreach (QContactLocalId id, contactIds )
{
--- a/omads/rom/omads.iby Fri Apr 16 14:53:26 2010 +0300
+++ b/omads/rom/omads.iby Mon May 03 12:24:28 2010 +0300
@@ -19,6 +19,9 @@
#ifndef __OMADS_IBY__
#define __OMADS_IBY__
+REM stub sis file
+data=ZSYSTEM\install\omads_stub.sis System\Install\omads_stub.sis
+
REM SyncML Data Synchronisation plug-in adapters
#ifdef __SYNCML_DS_CAL // SyncML data synchronization calendar plug-in
@@ -27,6 +30,11 @@
data=DATAZ_\RESOURCE_FILES_DIR\NSmlAgendaDataStore_1_2.rsc RESOURCE_FILES_DIR\NSmlAgendaDataStore_1_2.rsc
#endif // __SYNCML_DS_CAL
+#ifdef __SYNCML_DS_NOTEPAD
+ECOM_PLUGIN(nsmlnotepaddataprovider.dll,nsmlnotepaddataprovider.rsc)
+data=DATAZ_\RESOURCE_FILES_DIR\nsmlnotepaddatastoreformat.rsc RESOURCE_FILES_DIR\nsmlnotepaddatastoreformat.rsc
+#endif
+
#ifdef __SYNCML_DS_CON // SyncML data synchronization contacts plug-in
ECOM_PLUGIN(nsmlcontactsdataprovider.dll,nsmlcontactsdataprovider.rsc)
data=DATAZ_\RESOURCE_FILES_DIR\NSmlContactsDataStoreFormat_1_1_2.rsc RESOURCE_FILES_DIR\NSmlContactsDataStoreFormat_1_1_2.rsc