Revision: 201021
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Fri, 11 Jun 2010 13:29:32 +0300
changeset 30 04643625ed38
parent 26 fdc38da86094
child 35 0ca79e3612d9
Revision: 201021 Kit: 2010123
contentcontrol.pro
omads/omads.pro
omads/omadsextensions/adapters/agenda/inc/nsmlagendadatastore.h
omads/omadsextensions/adapters/agenda/src/nsmlagendadatastore.cpp
omads/omadsextensions/adapters/notes/inc/NSmlNotepadDatastore.h
omads/omadsextensions/adapters/notes/inc/nsmlnotepadDatabase.h
omads/omadsextensions/adapters/notes/src/NSmlNotepadDataStore.cpp
omads/omadsextensions/adapters/notes/src/nsmlnotepadDatabase.cpp
omads/omadsextensions/dsutils/contactsdatastoreextension/contactsdatastoreextension.pro
omads/omadsextensions/dsutils/contactsdatastoreextension/src/nsmlcontactsdatastoreextension_p.cpp
omads/omadsextensions/dsutils/dsutils.pro
omads/omadsextensions/group/bld.inf
omads/omadsextensions/omadsextensions.pro
--- a/contentcontrol.pro	Thu May 27 12:45:29 2010 +0300
+++ b/contentcontrol.pro	Fri Jun 11 13:29:32 2010 +0300
@@ -1,17 +1,17 @@
 #
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#   Name        : contentcontrol.pro
+#   Part of     : contentcontrol  
+#   Description : This is the project specification file for the contentcontrol project.
+#   Version     : 1
 #
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description:  This is the project specification file for the contentcontrol project.
+#   Copyright © 2009 Nokia.  All rights reserved.
+#   This material, including documentation and any related computer
+#   programs, is protected by copyright controlled by Nokia.  All
+#   rights are reserved.  Copying, including reproducing, storing,
+#   adapting or translating, any or all of this material requires the
+#   prior written consent of Nokia.  This material also contains
+#   confidential information which may not be disclosed to others
+#   without the prior written consent of Nokia.
 #
 
 TEMPLATE = subdirs
--- a/omads/omads.pro	Thu May 27 12:45:29 2010 +0300
+++ b/omads/omads.pro	Fri Jun 11 13:29:32 2010 +0300
@@ -1,17 +1,17 @@
 #
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#   Name        : omads.pro
+#   Part of     : contentcontrol  
+#   Description : This is the project specification file for the contentcontrol project.
+#   Version     : 1
 #
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description:  This is the project specification file for the contentcontrol project.
+#   Copyright © 2009 Nokia.  All rights reserved.
+#   This material, including documentation and any related computer
+#   programs, is protected by copyright controlled by Nokia.  All
+#   rights are reserved.  Copying, including reproducing, storing,
+#   adapting or translating, any or all of this material requires the
+#   prior written consent of Nokia.  This material also contains
+#   confidential information which may not be disclosed to others
+#   without the prior written consent of Nokia.
 #
 
 TEMPLATE = subdirs
--- a/omads/omadsextensions/adapters/agenda/inc/nsmlagendadatastore.h	Thu May 27 12:45:29 2010 +0300
+++ b/omads/omadsextensions/adapters/agenda/inc/nsmlagendadatastore.h	Fri Jun 11 13:29:32 2010 +0300
@@ -36,6 +36,7 @@
 #include <msvapi.h>
 #include <CalenImporter.h>
 #include <CalenExporter.h>
+#include <calinstanceview.h>
 #include <CalenInterimUtils2.h>
 #include <versittls.h>
 
@@ -567,6 +568,9 @@
 	    // Exporter
 	    CCalenExporter* iExporter;
 	    
+	    //Instance View
+	    CCalInstanceView*   iInstanceView;
+	    
 	    // Entry view
         CCalEntryView* iEntryView;
         CVersitTlsData *iVersitTlsData; // for better performance
--- a/omads/omadsextensions/adapters/agenda/src/nsmlagendadatastore.cpp	Thu May 27 12:45:29 2010 +0300
+++ b/omads/omadsextensions/adapters/agenda/src/nsmlagendadatastore.cpp	Fri Jun 11 13:29:32 2010 +0300
@@ -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<TCalLocalUid> 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<CCalInstance> 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 );
 	
--- a/omads/omadsextensions/adapters/notes/inc/NSmlNotepadDatastore.h	Thu May 27 12:45:29 2010 +0300
+++ b/omads/omadsextensions/adapters/notes/inc/NSmlNotepadDatastore.h	Fri Jun 11 13:29:32 2010 +0300
@@ -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" );
--- a/omads/omadsextensions/adapters/notes/inc/nsmlnotepadDatabase.h	Thu May 27 12:45:29 2010 +0300
+++ b/omads/omadsextensions/adapters/notes/inc/nsmlnotepadDatabase.h	Fri Jun 11 13:29:32 2010 +0300
@@ -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;
--- a/omads/omadsextensions/adapters/notes/src/NSmlNotepadDataStore.cpp	Thu May 27 12:45:29 2010 +0300
+++ b/omads/omadsextensions/adapters/notes/src/NSmlNotepadDataStore.cpp	Fri Jun 11 13:29:32 2010 +0300
@@ -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 );
 	
--- a/omads/omadsextensions/adapters/notes/src/nsmlnotepadDatabase.cpp	Thu May 27 12:45:29 2010 +0300
+++ b/omads/omadsextensions/adapters/notes/src/nsmlnotepadDatabase.cpp	Fri Jun 11 13:29:32 2010 +0300
@@ -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<CNpdItem>* CNSmlNotepadDatabase::FetchItemsLC(TBool aIncludeText,
--- a/omads/omadsextensions/dsutils/contactsdatastoreextension/contactsdatastoreextension.pro	Thu May 27 12:45:29 2010 +0300
+++ b/omads/omadsextensions/dsutils/contactsdatastoreextension/contactsdatastoreextension.pro	Fri Jun 11 13:29:32 2010 +0300
@@ -1,18 +1,19 @@
 #
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+# ============================================================================
+#  Name        : contactsdatastoreextension.pro
+#  Part of     : contactsdatastoreextension    
+#  Description : Project file
 #
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description:  Project file
-#
+#  Copyright © 2009 Nokia.  All rights reserved.
+#  This material, including documentation and any related computer
+#  programs, is protected by copyright controlled by Nokia.  All
+#  rights are reserved.  Copying, including reproducing, storing,
+#  adapting or translating, any or all of this material requires the
+#  prior written consent of Nokia.  This material also contains
+#  confidential information which may not be disclosed to others
+#  without the prior written consent of Nokia.
+# ============================================================================
+# 
 
 
 TEMPLATE = lib
--- a/omads/omadsextensions/dsutils/contactsdatastoreextension/src/nsmlcontactsdatastoreextension_p.cpp	Thu May 27 12:45:29 2010 +0300
+++ b/omads/omadsextensions/dsutils/contactsdatastoreextension/src/nsmlcontactsdatastoreextension_p.cpp	Fri Jun 11 13:29:32 2010 +0300
@@ -197,10 +197,14 @@
         {
         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 );
+        QList<QContact> contacts;
+        if ( mImporter->importDocuments( mReader->results() ) )
+            {
+            contacts = mImporter->contacts();
+            QMap<int, QContactManager::Error> 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<int, QContactManager::Error> 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<int, QContactManager::Error> errorMap;
-    TBool ret = mContactManager->removeContacts( &contactIds, &errorMap );
+    TBool ret = mContactManager->removeContacts( contactIds, &errorMap );
     
     _DBG_FILE("CNsmlContactsDataStoreExtensionPrivate::DeleteAllContactsL: END");
     
--- a/omads/omadsextensions/dsutils/dsutils.pro	Thu May 27 12:45:29 2010 +0300
+++ b/omads/omadsextensions/dsutils/dsutils.pro	Fri Jun 11 13:29:32 2010 +0300
@@ -1,17 +1,17 @@
 #
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#   Name        : dsutils.pro
+#   Part of     : contentcontrol  
+#   Description : This is the project specification file for the contentcontrol project.
+#   Version     : 1
 #
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description:  This is the project specification file for the contentcontrol project.
+#   Copyright © 2009 Nokia.  All rights reserved.
+#   This material, including documentation and any related computer
+#   programs, is protected by copyright controlled by Nokia.  All
+#   rights are reserved.  Copying, including reproducing, storing,
+#   adapting or translating, any or all of this material requires the
+#   prior written consent of Nokia.  This material also contains
+#   confidential information which may not be disclosed to others
+#   without the prior written consent of Nokia.
 #
 
 TEMPLATE = subdirs
--- a/omads/omadsextensions/group/bld.inf	Thu May 27 12:45:29 2010 +0300
+++ b/omads/omadsextensions/group/bld.inf	Fri Jun 11 13:29:32 2010 +0300
@@ -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"
--- a/omads/omadsextensions/omadsextensions.pro	Thu May 27 12:45:29 2010 +0300
+++ b/omads/omadsextensions/omadsextensions.pro	Fri Jun 11 13:29:32 2010 +0300
@@ -1,17 +1,17 @@
 #
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#   Name        : omadsextensions.pro
+#   Part of     : contentcontrol  
+#   Description : This is the project specification file for the contentcontrol project.
+#   Version     : 1
 #
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description:  This is the project specification file for the contentcontrol project.
+#   Copyright © 2009 Nokia.  All rights reserved.
+#   This material, including documentation and any related computer
+#   programs, is protected by copyright controlled by Nokia.  All
+#   rights are reserved.  Copying, including reproducing, storing,
+#   adapting or translating, any or all of this material requires the
+#   prior written consent of Nokia.  This material also contains
+#   confidential information which may not be disclosed to others
+#   without the prior written consent of Nokia.
 #
 
 TEMPLATE = subdirs