Revision: 201001 PDK_3.0.f
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Mon, 18 Jan 2010 20:08:41 +0200
changeset 3 c2b8a5ae6ed5
parent 2 19dc812fb587
child 4 e6e896426eac
Revision: 201001 Kit: 201003
omads/omadsextensions/adapters/agenda/src/nsmlagendadatastore.cpp
omads/omadsextensions/adapters/bookmark/inc/bookmarkdatastore.h
omads/omadsextensions/adapters/bookmark/inc/conversionutil.h
omads/omadsextensions/adapters/bookmark/inc/omadsfolderobject.h
omads/omadsextensions/adapters/bookmark/src/bookmarkdatastore.cpp
omads/omadsextensions/adapters/bookmark/src/conversionutil.cpp
omads/omadsextensions/adapters/bookmark/src/omadsfolderobject.cpp
omads/omadsextensions/adapters/bookmark/src/vbookmarkconverter.cpp
--- a/omads/omadsextensions/adapters/agenda/src/nsmlagendadatastore.cpp	Thu Jan 07 12:38:46 2010 +0200
+++ b/omads/omadsextensions/adapters/agenda/src/nsmlagendadatastore.cpp	Mon Jan 18 20:08:41 2010 +0200
@@ -2241,9 +2241,9 @@
         }
     else
         {
+        CleanupStack::PopAndDestroy( 2 ); // rdArray, readStream
         delete agendautil;
         delete calfilename; 
-        CleanupStack::PopAndDestroy( 2 ); // rdArray, readStream
         FLOG(_L("CNSmlAgendaDataStore::DoCommitCreateCalItemL - \
                    KErrNotSupported: END"));
         User::Leave( KErrNotSupported );
@@ -2253,9 +2253,9 @@
     // Multiple items are not supported
     if ( rdArray.Count() != 1 )
         {
+        CleanupStack::PopAndDestroy( 2 ); // rdArray, readStream
         delete agendautil;
         delete calfilename; 
-        CleanupStack::PopAndDestroy( 2 ); // rdArray, readStream
         FLOG(_L("CNSmlAgendaDataStore::DoCommitCreateCalItemL - \
                    Multiple items are not supported: END"));
         User::Leave( KErrNotSupported );
@@ -2267,9 +2267,9 @@
     FLOG(_L("CNSmlAgendaDataStore::DoCommitCreateCalItemL: after StoreL '%d'"), err );
     if ( err )
         {
+        CleanupStack::PopAndDestroy( 2 ); // rdArray, readStream
         delete agendautil;
         delete calfilename; 
-        CleanupStack::PopAndDestroy( 2 ); // rdArray, readStream
         FLOG(_L("CNSmlAgendaDataStore::DoCommitCreateCalItemL - \
                    Error at storing item to database: END"));
         User::Leave( KErrGeneral );
@@ -2312,9 +2312,10 @@
             }
         CleanupStack::PopAndDestroy();// newEntry,
         }
+	CleanupStack::PopAndDestroy( 2 ); //  rdArray, readStream 
     delete agendautil;
-    delete calfilename;     	
-    CleanupStack::PopAndDestroy( 2 ); //  rdArray, readStream   
+	delete calfilename;     	
+      
     FLOG(_L("CNSmlAgendaDataStore::DoCommitCreateCalItemL: END"));
     }
     
@@ -2365,9 +2366,9 @@
     if ( err || !agendautil )
         {
         FLOG(_L("CNSmlAgendaDataStore::DoCommitReplaceCalItemL: entry is not valid"));
+        CleanupStack::PopAndDestroy( 2 ); // olditem, writeStream
         delete agendautil;
         delete calfilename;
-        CleanupStack::PopAndDestroy( 2 ); // olditem, writeStream
         User::Leave( KErrGeneral );
         }  
         
@@ -2386,9 +2387,9 @@
 #endif // __NSML_USE_ICAL_FEATURE
     else
         {
+        CleanupStack::PopAndDestroy( 2 ); // olditem, writeStream
         delete agendautil;
         delete calfilename;
-        CleanupStack::PopAndDestroy( 2 ); // olditem, writeStream
         FLOG(_L("CNSmlAgendaDataStore::DoCommitReplaceCalItemL - \
                    KErrNotSupported: END"));
         User::Leave( KErrNotSupported );
@@ -2429,10 +2430,11 @@
         }
     else
         {
+        CleanupStack::PopAndDestroy( 5 ); // xRecurrenceId, recurrenceId,
+                                              // uid, oldItem, geoId
         delete agendautil;
         delete calfilename;
-        CleanupStack::PopAndDestroy( 5 ); // xRecurrenceId, recurrenceId,
-                                          // uid, oldItem, geoId
+        
         User::Leave( KErrNotSupported );
         }
     if ( recurrenceId )
@@ -2482,9 +2484,9 @@
 #endif // __NSML_USE_ICAL_FEATURE
     else
         {
+        CleanupStack::PopAndDestroy( 2 ); // rdArray, readStream
         delete agendautil;
         delete calfilename;
-        CleanupStack::PopAndDestroy( 2 ); // rdArray, readStream
         FLOG(_L("CNSmlAgendaDataStore::DoCommitReplaceItemL - \
                    KErrNotSupported: END"));
         User::Leave( KErrNotSupported );
@@ -2495,9 +2497,9 @@
     if ( rdArray.Count() != 1 )
         {
         FLOG(_L("CNSmlAgendaDataStore::DoCommitReplaceCalItemL: Multiple items are not supported "));
+        CleanupStack::PopAndDestroy( 2 ); // rdArray, readStream
         delete agendautil;
         delete calfilename;
-        CleanupStack::PopAndDestroy( 2 ); // rdArray, readStream
         FLOG(_L("CNSmlAgendaDataStore::DoCommitReplaceItemL - \
                    Multiple items are not supported: END"));
         User::Leave( KErrNotSupported );
@@ -2507,12 +2509,13 @@
 
     FLOG(_L("CNSmlAgendaDataStore::DoCommitReplaceCalItemL: before StoreL"));
     TRAP( err, iInterimUtils->StoreL( *agendautil->iEntryView, *rdArray[0], ETrue ) );
-    FLOG(_L("CNSmlAgendaDataStore::DoCommitCreateItemL: after StoreL '%d'"), err );
+    FLOG(_L("CNSmlAgendaDataStore::DoCommitReplaceCalItemL: after StoreL '%d'"), err );
+    
     if ( err )
         {
+        CleanupStack::PopAndDestroy( 2 ); // rdArray, readStream
         delete agendautil;
         delete calfilename;
-        CleanupStack::PopAndDestroy( 2 ); // rdArray, readStream
         FLOG(_L("CNSmlAgendaDataStore::DoCommitReplaceCalItemL - \
                    Error at storing item to database: END"));
         User::Leave( KErrGeneral );
@@ -2548,11 +2551,9 @@
     CleanupStack::PopAndDestroy(); // replacedEntry
     }
     
+	CleanupStack::PopAndDestroy( 2 ); // rdArray, readStream
     delete agendautil;
-    delete calfilename;
-	
-    CleanupStack::PopAndDestroy( 2 ); // rdArray, readStream
-    
+	delete calfilename;	
 	FLOG(_L("CNSmlAgendaDataStore::DoCommitReplaceCalItemL: END"));
     }
 
@@ -3051,29 +3052,58 @@
     FLOG(_L("CNSmlAgendaDataStore::OpenStoreL BEGIN"));
 
     TInt profileid = NULL;
+    TBuf<KBuffLength> serverid;
     TBuf<KBuffLength> profilename;
+	TBool isHandlerAvailable( EFalse );
     
-    // Get the ProfileId and ProfileName from the cenrep
+    // Get the ServerId, ProfileId and ProfileName from the cenrep
     CRepository* rep = CRepository::NewLC( KNsmlDsSessionInfoKey );
     TInt err = rep->Get( EDSSessionProfileId, profileid );
     err = rep->Get( EDSSessionProfileName, profilename );
+    err = rep->Get(EDSSessionServerId, serverid );
     User::LeaveIfError(err);
     CleanupStack::PopAndDestroy(rep);
     
+    // Reintialize the StoreName
+    if ( iOpenedStoreName )
+        {
+        delete iOpenedStoreName;
+        iOpenedStoreName = NULL;
+        }
+    
     // Find the CalendarFile having the given ProfileID
     CDesCArray* calfilearr = new (ELeave) CDesCArrayFlat(1);
     CleanupStack::PushL(calfilearr);
-    if ( IsCalFileAvailableL( profileid, calfilearr ) )
+    FLOG(_L("CNSmlAgendaDataStore:::OpenStoreL():Profilename '%S'"), &profilename );
+    FLOG(_L("CNSmlAgendaDataStore:::OpenStoreL():serverid '%S'"), &serverid );
+	
+	if( 0 != serverid.Length() )
+        {   
+		HBufC8* opaquedata = HBufC8::NewL( serverid.Length() );
+        TPtr8 name( opaquedata->Des() );
+        CnvUtfConverter::ConvertFromUnicodeToUtf8(name , serverid );
+		
+		for( TInt adaptercount = 0; adaptercount < iAgendaPluginAdapters.Count(); adaptercount++ )
+	        {
+	        if( 0 == opaquedata->Compare(iAgendaPluginAdapters[adaptercount]->iOpaqueData->Des()) )
+	            {
+	            FLOG(_L("CNSmlAgendaDataStore::Handler available"));			
+				isHandlerAvailable = ETrue;
+	            break;
+	            }        
+	        }
+			delete opaquedata;
+        }	
+    
+	if( isHandlerAvailable )
+		{
+		iOpenedStoreName = iDefaultStoreFileName->AllocL();
+		}	
+    else if( IsCalFileAvailableL( profileid, calfilearr ) )
         {
         FLOG(_L("CNSmlAgendaDataStore::OpenStoreL Found the assoicated calfile"));
         
         // TODO: Yet to get clarification for enable/disable the notification
-       
-        if ( iOpenedStoreName )
-            {
-            delete iOpenedStoreName;
-            iOpenedStoreName = NULL;
-            }
         iOpenedStoreName = calfilearr->MdcaPoint(0).AllocL();
         }
     else
@@ -3084,12 +3114,6 @@
         HBufC* name = profilename.AllocL();
         HBufC* calfilename = CreateCalFileL( name, profileid );
         delete name;
-        
-        if ( iOpenedStoreName )
-            {
-            delete iOpenedStoreName;
-            iOpenedStoreName = NULL;
-            }
         iOpenedStoreName = calfilename;
         }
         
--- a/omads/omadsextensions/adapters/bookmark/inc/bookmarkdatastore.h	Thu Jan 07 12:38:46 2010 +0200
+++ b/omads/omadsextensions/adapters/bookmark/inc/bookmarkdatastore.h	Mon Jan 18 20:08:41 2010 +0200
@@ -20,11 +20,11 @@
 #define __BOOKMARKDATASTORE_H__
 
 #include <SmlDataProvider.h>
-#include <FavouritesDb.h>
+#include <favouritesdb.h>
 #include <nsmlchangefinder.h>
 
 #include <FeedsServerClient.h>
-#include <FeedsServerFolderItem.h>
+#include <feedsserverfolderitem.h>
 
 class CNSmlDataItemUidSet;
 class CFavouritesItem;
--- a/omads/omadsextensions/adapters/bookmark/inc/conversionutil.h	Thu Jan 07 12:38:46 2010 +0200
+++ b/omads/omadsextensions/adapters/bookmark/inc/conversionutil.h	Mon Jan 18 20:08:41 2010 +0200
@@ -19,7 +19,7 @@
 #ifndef _CONVERSIONUTIL_H_
 #define _CONVERSIONUTIL_H_
 
-#include <FavouritesItem.h>
+#include <favouritesitem.h>
 
 class COMADSFolderObject;
 class CVBookmarkConverter;
--- a/omads/omadsextensions/adapters/bookmark/inc/omadsfolderobject.h	Thu Jan 07 12:38:46 2010 +0200
+++ b/omads/omadsextensions/adapters/bookmark/inc/omadsfolderobject.h	Mon Jan 18 20:08:41 2010 +0200
@@ -21,7 +21,7 @@
 
 #include <f32file.h>
 #include <MSenContentHandlerClient.h>
-#include <FavouritesItem.h>
+#include <favouritesitem.h>
 
 
 const TInt KMaxFolderNameLength = KFavouritesMaxName;
--- a/omads/omadsextensions/adapters/bookmark/src/bookmarkdatastore.cpp	Thu Jan 07 12:38:46 2010 +0200
+++ b/omads/omadsextensions/adapters/bookmark/src/bookmarkdatastore.cpp	Mon Jan 18 20:08:41 2010 +0200
@@ -17,12 +17,12 @@
 
 
 #include <sysutil.h> 
-#include <FavouritesItem.h>
+#include <favouritesitem.h>
 #include <FavouritesItemList.h> 
 
 #include <FeedsServerClient.h>
 #include <FeedsServerFeed.h>
-#include <FeedsServerFolderItem.h>
+#include <feedsserverfolderitem.h>
 
 #include "bookmarkdatastore.h"
 #include "vbookmarkconverter.h"
--- a/omads/omadsextensions/adapters/bookmark/src/conversionutil.cpp	Thu Jan 07 12:38:46 2010 +0200
+++ b/omads/omadsextensions/adapters/bookmark/src/conversionutil.cpp	Mon Jan 18 20:08:41 2010 +0200
@@ -15,7 +15,7 @@
 *
 */
 
-#include <FeedsServerFolderItem.h>
+#include <feedsserverfolderitem.h>
 #include "conversionutil.h"
 #include "omadsfolderobject.h"
 #include "vbookmarkconverter.h"
--- a/omads/omadsextensions/adapters/bookmark/src/omadsfolderobject.cpp	Thu Jan 07 12:38:46 2010 +0200
+++ b/omads/omadsextensions/adapters/bookmark/src/omadsfolderobject.cpp	Mon Jan 18 20:08:41 2010 +0200
@@ -17,12 +17,12 @@
 
 #include <SenXmlUtils.h>
 #include <SenXmlReader.h>
-#include <FavouritesLimits.h>   // Localized names for folders
+#include <favouriteslimits.h>   // Localized names for folders
 #include <bookmarkdsa.rsg>
 #include <stringresourcereader.h>
 #include <bautils.h>
 #include <utf.h>
-#include <FeedsServerFolderItem.h>
+#include <feedsserverfolderitem.h>
 
 #include "bookmarkdataproviderdefs.h"
 #include "omadsfolderobject.h"
--- a/omads/omadsextensions/adapters/bookmark/src/vbookmarkconverter.cpp	Thu Jan 07 12:38:46 2010 +0200
+++ b/omads/omadsextensions/adapters/bookmark/src/vbookmarkconverter.cpp	Mon Jan 18 20:08:41 2010 +0200
@@ -18,8 +18,8 @@
 
 // INCLUDES
 #include <utf.h>
-#include <FavouritesItem.h>
-#include <FeedsServerFolderItem.h>
+#include <favouritesitem.h>
+#include <feedsserverfolderitem.h>
 #include "vbookmarkconverter.h"
 #include "logger.h"