# HG changeset patch # User hgs # Date 1278972115 -19800 # Node ID 1bb40c16ad337e5f04537d0cb05b3e8e6f9f75db # Parent 74081e1a0272b845714a37b5d03e9a69cddc3f6e 201021 diff -r 74081e1a0272 -r 1bb40c16ad33 omads/omadsextensions/adapters/agenda/inc/nsmlagendadatastore.h --- a/omads/omadsextensions/adapters/agenda/inc/nsmlagendadatastore.h Tue Jul 13 03:28:47 2010 +0530 +++ b/omads/omadsextensions/adapters/agenda/inc/nsmlagendadatastore.h Tue Jul 13 03:31:55 2010 +0530 @@ -36,6 +36,7 @@ #include #include #include +#include #include #include @@ -567,6 +568,9 @@ // Exporter CCalenExporter* iExporter; + //Instance View + CCalInstanceView* iInstanceView; + // Entry view CCalEntryView* iEntryView; CVersitTlsData *iVersitTlsData; // for better performance diff -r 74081e1a0272 -r 1bb40c16ad33 omads/omadsextensions/adapters/agenda/src/nsmlagendadatastore.cpp --- a/omads/omadsextensions/adapters/agenda/src/nsmlagendadatastore.cpp Tue Jul 13 03:28:47 2010 +0530 +++ b/omads/omadsextensions/adapters/agenda/src/nsmlagendadatastore.cpp Tue Jul 13 03:31:55 2010 +0530 @@ -177,7 +177,7 @@ delete iImporter; delete iExporter; - + delete iInstanceView; delete iEntryView; delete iVCalSession; delete iInterimUtils; @@ -219,9 +219,14 @@ err = KErrNone; TRAP( err, iVCalSession->CreateCalFileL( aStoreName )); DBG_ARGS(_S("CNSmlAgendaDataStore::DoOpenL: creating the new calfile '%d'"), err ); + if( err == KErrNone ) + { + TRAP( err, iVCalSession->OpenL( aStoreName )); + } } if ( err ) { + DBG_ARGS(_S("CNSmlAgendaDataStore::DoOpenL: end with error '%d'"), err ); User::RequestComplete( iCallerStatus, err ); return; } @@ -245,7 +250,12 @@ // Progress view iAgendaProgressview = CNSmlAgendaProgressview::NewL(); + // Entry View iEntryView = CCalEntryView::NewL( *iVCalSession, *iAgendaProgressview ); + + // Instance View + iInstanceView = CCalInstanceView::NewL(*iVCalSession); + CActiveScheduler::Start(); TInt completedStatus = iAgendaProgressview->GetCompletedStatus(); if ( completedStatus != KErrNone ) @@ -1181,23 +1191,35 @@ CleanupStack::PushL( snapshot ); // First find all entries ... - RArray uidArray; - CleanupClosePushL( uidArray ); - TCalTime zeroTime; - zeroTime.SetTimeUtcL( Time::NullTTime() ); - iEntryView->GetIdsModifiedSinceDateL( zeroTime, uidArray ); - - // ... and then create snapshot items - for ( TInt i = 0; i < uidArray.Count(); i++ ) - { - TNSmlSnapshotItem newItem = CreateSnapshotItemL( uidArray[i] ); - if ( newItem.ItemId() != 0 ) - { - snapshot->InsertIsqL( newItem, iKey ); - } - } - - CleanupStack::PopAndDestroy( &uidArray ); + RPointerArray array; + CleanupRPtrArrayPushL(array); + + 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::EIncludeAppts| + CalCommon::EIncludeReminder| + CalCommon::EIncludeEvents| + CalCommon::EIncludeAnnivs| + CalCommon::EIncludeCompletedTodos| + CalCommon::EIncludeIncompletedTodos, + timeRange); + TInt i = 0; + + while (i < array.Count()) + { + TNSmlSnapshotItem newItem = CreateSnapshotItemL( array[i]->Entry().LocalUidL() ); + if ( newItem.ItemId() != 0 ) + { + snapshot->InsertIsqL( newItem, iKey ); + } + i++; + } + CleanupStack::PopAndDestroy(&array); iChangeFinder->SetNewSnapshot( snapshot ); diff -r 74081e1a0272 -r 1bb40c16ad33 omads/omadsextensions/adapters/notes/inc/NSmlNotepadDatastore.h --- a/omads/omadsextensions/adapters/notes/inc/NSmlNotepadDatastore.h Tue Jul 13 03:28:47 2010 +0530 +++ b/omads/omadsextensions/adapters/notes/inc/NSmlNotepadDatastore.h Tue Jul 13 03:31:55 2010 +0530 @@ -31,6 +31,8 @@ _LIT(KNSmlNotepadStoreFormatRsc,"NSmlNotepadDataStoreFormat.rsc"); +_LIT(KNSmlNotepadStoreName, "C:Note" ); +_LIT(KNSmlNotepadDefaultStoreName, "C:Calendar" ); _LIT( KNSmlDriveC, "C" ); _LIT8( KMimePlainText, "text/plain" ); _LIT8( KMimePlainTextVersion, "1.0" ); diff -r 74081e1a0272 -r 1bb40c16ad33 omads/omadsextensions/adapters/notes/inc/nsmlnotepadDatabase.h --- a/omads/omadsextensions/adapters/notes/inc/nsmlnotepadDatabase.h Tue Jul 13 03:28:47 2010 +0530 +++ b/omads/omadsextensions/adapters/notes/inc/nsmlnotepadDatabase.h Tue Jul 13 03:31:55 2010 +0530 @@ -113,18 +113,7 @@ */ 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. @@ -140,8 +129,7 @@ private: // Data // Flag for whether database has been opened - TBool iOpened; - HBufC* iDataFile; + TBool iOpened; CCalSession* iSession; CCalInstanceView* iInstanceView; CCalEntryView* iEntryView; diff -r 74081e1a0272 -r 1bb40c16ad33 omads/omadsextensions/adapters/notes/src/NSmlNotepadDataStore.cpp --- a/omads/omadsextensions/adapters/notes/src/NSmlNotepadDataStore.cpp Tue Jul 13 03:28:47 2010 +0530 +++ b/omads/omadsextensions/adapters/notes/src/NSmlNotepadDataStore.cpp Tue Jul 13 03:31:55 2010 +0530 @@ -195,9 +195,8 @@ iDefaultStoreName = NULL; } iDefaultStoreName = HBufC::NewL( KNSmlDefaultStoreNameMaxSize ); - TInt len = iDefaultStoreName->Length(); - TPtr obptr = iDefaultStoreName->Des(); - iNpdDb->GetDefaultDatastoreName(obptr); + *iDefaultStoreName = KNSmlNotepadStoreName; + if(iOwnStoreFormat) { delete iOwnStoreFormat; @@ -232,9 +231,10 @@ CDesCArray* CNSmlNotepadDataStore::DoListStoresLC() { _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoListStoresLC(): begin"); - CDesCArray* npdStores = iNpdDb->ListDatabasesL(); - CleanupStack::PushL( npdStores ); - _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoListStoresLC(): end"); + CDesCArrayFlat *npdStores = new (ELeave)CDesCArrayFlat(1); + CleanupStack::PushL(npdStores); + npdStores->AppendL(KNSmlNotepadStoreName); + _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoListStoresLC(): end"); return npdStores; } @@ -247,10 +247,12 @@ MSmlSyncRelationship& aContext, TRequestStatus& aStatus ) { - iCallerStatus = &aStatus; + _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoOpenL(): begin"); + iCallerStatus = &aStatus; *iCallerStatus = KRequestPending; if( iState != ENSmlClosed || iDataBaseOpened ) { + User::RequestComplete( iCallerStatus, KErrInUse ); return; } @@ -264,7 +266,7 @@ // Open the Database TInt err( KErrNone ); - TRAP(err,iNpdDb->OpenL( aStoreName )); + TRAP(err,iNpdDb->OpenL( KNSmlNotepadDefaultStoreName )); if ( err ) { User::RequestComplete( iCallerStatus, err ); @@ -276,7 +278,8 @@ delete iOpenedStoreName; iOpenedStoreName = NULL; } - iOpenedStoreName = aStoreName.Alloc(); + iOpenedStoreName = HBufC::NewL( KNSmlDefaultStoreNameMaxSize ); + *iOpenedStoreName = KNSmlNotepadStoreName; iDataBaseOpened = ETrue; @@ -290,6 +293,7 @@ err = FetchModificationsL(); + iState = ENSmlOpenAndWaiting; User::RequestComplete( iCallerStatus, err ); diff -r 74081e1a0272 -r 1bb40c16ad33 omads/omadsextensions/adapters/notes/src/nsmlnotepadDatabase.cpp --- a/omads/omadsextensions/adapters/notes/src/nsmlnotepadDatabase.cpp Tue Jul 13 03:28:47 2010 +0530 +++ b/omads/omadsextensions/adapters/notes/src/nsmlnotepadDatabase.cpp Tue Jul 13 03:31:55 2010 +0530 @@ -32,7 +32,6 @@ #include "nsmlnotepadlogging.h" - // ----------------------------------------------------------------------------- // CNSmlNotepadDatabase::NewL // ----------------------------------------------------------------------------- @@ -58,11 +57,6 @@ { _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::~CNSmlNotepadDatabase(): begin"); - if(iDataFile) - { - delete iDataFile; - iDataFile = NULL; - } CloseAgendaSessions(); _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::~CNSmlNotepadDatabase(): end"); @@ -92,10 +86,6 @@ // Instantiate the Session variable iSession = CCalSession::NewL(); - iDataFile = HBufC::NewL(KMaxFileLength); - TPtr obptr = iDataFile->Des(); - obptr = iSession->DefaultFileNameL(); - _NOTEPAD_DBG_FILE("CNSmlNotepadDatabase::ConstructL: end"); } @@ -111,11 +101,11 @@ TInt err = KErrNone; iSession = CCalSession::NewL(); - TRAP( err,iSession->OpenL(iSession->DefaultFileNameL()) ); + TRAP( err,iSession->OpenL( aStoreName ) ); if(err == KErrNotFound) { - iSession->CreateCalFileL( iSession->DefaultFileNameL() ); - iSession->OpenL(iSession->DefaultFileNameL()); + iSession->CreateCalFileL( aStoreName ); + iSession->OpenL( aStoreName ); } else if( err != KErrNone ) { @@ -366,36 +356,6 @@ 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* CNSmlNotepadDatabase::FetchItemsLC(TBool aIncludeText, diff -r 74081e1a0272 -r 1bb40c16ad33 omads/omadsextensions/dsutils/contactsdatastoreextension/src/nsmlcontactsdatastoreextension_p.cpp --- a/omads/omadsextensions/dsutils/contactsdatastoreextension/src/nsmlcontactsdatastoreextension_p.cpp Tue Jul 13 03:28:47 2010 +0530 +++ b/omads/omadsextensions/dsutils/contactsdatastoreextension/src/nsmlcontactsdatastoreextension_p.cpp Tue Jul 13 03:31:55 2010 +0530 @@ -197,10 +197,14 @@ { DBG_ARGS(_S("CNsmlContactsDataStoreExtensionPrivate::Buffer Count: %d"), mReader->results().count() ); - QList contacts = mImporter->importContacts(mReader->results()); - QMap errorMap; - ret = mContactManager->saveContacts( &contacts, &errorMap ); - DBG_ARGS(_S("CNsmlContactsDataStoreExtensionPrivate::Import Status: %d"), ret ); + QList contacts; + if ( mImporter->importDocuments( mReader->results() ) ) + { + contacts = mImporter->contacts(); + QMap errorMap; + ret = mContactManager->saveContacts( &contacts, &errorMap ); + DBG_ARGS(_S("CNsmlContactsDataStoreExtensionPrivate::Import Status: %d"), ret ); + } if( ret ) { foreach (QContact contact, contacts ) @@ -300,7 +304,7 @@ } QMap errorMap; - TBool ret = mContactManager->removeContacts( &contacts, &errorMap ); + TBool ret = mContactManager->removeContacts( contacts, &errorMap ); _DBG_FILE("CNsmlContactsDataStoreExtensionPrivate::DeleteContactsL: END"); @@ -320,7 +324,7 @@ contactIds.removeAt( index ); QMap errorMap; - TBool ret = mContactManager->removeContacts( &contactIds, &errorMap ); + TBool ret = mContactManager->removeContacts( contactIds, &errorMap ); _DBG_FILE("CNsmlContactsDataStoreExtensionPrivate::DeleteAllContactsL: END"); diff -r 74081e1a0272 -r 1bb40c16ad33 omads/omadsextensions/group/bld.inf --- a/omads/omadsextensions/group/bld.inf Tue Jul 13 03:28:47 2010 +0530 +++ b/omads/omadsextensions/group/bld.inf Tue Jul 13 03:31:55 2010 +0530 @@ -18,8 +18,6 @@ #include "../dsutils/cgiscriptutils/bld/bld.inf" -#include "../dsutils/contactsdatastoreextension/bld.inf" - #include "../datamod/bld/bld.inf" #include "../adapters/bld/bld.inf"