phonebookengines/contactsmodel/cntplsql/src/cplcontactsfile.cpp
branchRCL_3
changeset 9 0d28c1c5b6dd
parent 0 e686773b3f54
equal deleted inserted replaced
8:5586b4d2ec3e 9:0d28c1c5b6dd
   103 CPplContactsFile::~CPplContactsFile()
   103 CPplContactsFile::~CPplContactsFile()
   104 	{
   104 	{
   105   	Close();
   105   	Close();
   106 	delete iItemManager;
   106 	delete iItemManager;
   107 	delete iConfigureStr;
   107 	delete iConfigureStr;
       
   108 	iSqlDatabaseObservers.Reset();
   108 	}
   109 	}
   109 
   110 
   110 
   111 
   111 /**
   112 /**
   112 Set the database observer for event propagation.
   113 Set the database observer for event propagation.
   338 
   339 
   339 /**
   340 /**
   340 Close the database.
   341 Close the database.
   341 */
   342 */
   342 void CPplContactsFile::Close(TBool aNotify)
   343 void CPplContactsFile::Close(TBool aNotify)
   343 	{	 		
   344 	{	 	
       
   345 	// Close the resource which depends on iDatabase before it will be closed.
       
   346     for (TInt i = 0; i < iSqlDatabaseObservers.Count(); i++ )
       
   347         {
       
   348         iSqlDatabaseObservers[i]->OnCloseL();
       
   349         }
       
   350 
   344   	iDatabase.Close(); 
   351   	iDatabase.Close(); 
   345   	iFileIsOpen = EFalse;
   352   	iFileIsOpen = EFalse;
   346   
   353   
   347   	REComSession::FinalClose(); // This line is necessary to make sure the plug-in is unloaded properly
   354   	REComSession::FinalClose(); // This line is necessary to make sure the plug-in is unloaded properly
   348   	iLocalFs.Close(); //we now use a local File Session	
   355   	iLocalFs.Close(); //we now use a local File Session	
   435 	GetPhysicalFileNameL(fileName, aFileName);
   442 	GetPhysicalFileNameL(fileName, aFileName);
   436 	LocalFsL();
   443 	LocalFsL();
   437 	return BaflUtils::FileExists(iLocalFs, fileName);
   444 	return BaflUtils::FileExists(iLocalFs, fileName);
   438 	}
   445 	}
   439 
   446 
       
   447 
       
   448 /**
       
   449  * Add an observer for monitoring RSqlDatabase.
       
   450  * 
       
   451  * @param  aSqlDatabaseObserver The observer for monitoring RSqlDatabase.
       
   452  * 
       
   453  * @return None 
       
   454  */
       
   455 void CPplContactsFile::AddSqlDBObserverL(
       
   456     MLplSqlDatabaseObserver& aSqlDatabaseObserver )
       
   457     {
       
   458     iSqlDatabaseObservers.AppendL( &aSqlDatabaseObserver );
       
   459     }
       
   460 
       
   461 
       
   462 /**
       
   463  * Remove an RSqlDatabase observer.
       
   464  * 
       
   465  * @param  aSqlDatabaseObserver The observer is to be removed.
       
   466  * 
       
   467  * @return None
       
   468  */
       
   469 void CPplContactsFile::RemoveSqlDBObserverL(
       
   470     MLplSqlDatabaseObserver& aSqlDatabaseObserver )
       
   471     {
       
   472     TInt id = iSqlDatabaseObservers.Find( &aSqlDatabaseObserver );
       
   473     if ( id != KErrNotFound )
       
   474         {
       
   475         iSqlDatabaseObservers.Remove( id );
       
   476         }
       
   477     }
       
   478 
       
   479