phonebookengines/contactsmodel/cntsrv/src/CCntDbManagerController.cpp
changeset 0 e686773b3f54
equal deleted inserted replaced
-1:000000000000 0:e686773b3f54
       
     1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 /**
       
    17  @file
       
    18  @internalComponent
       
    19  @released
       
    20 */
       
    21 
       
    22 
       
    23 #include <e32cmn.h>
       
    24 #include <bautils.h>
       
    25 
       
    26 #include "persistencelayer.h"
       
    27 #include "CCntDbManagerController.h"
       
    28 #include "CCntRequest.h"
       
    29 #include "CCntIpcCodes.h" // For KCntMaxFilePath.
       
    30 #include "CCntBackupRestoreAgent.h"
       
    31 #include "CIniFileManager.h"
       
    32 #include "CCntPermanentData.h"
       
    33 
       
    34 _LIT(KSqLiteFilePrefix, "SQLite__");
       
    35 
       
    36 /**
       
    37 Object factory method.
       
    38 
       
    39 @param aServerType 	ETransientServer if the Server is transient,
       
    40 ENonTransientServer if the Server is not transient.
       
    41 
       
    42 @return CCntDbManagerController instance.
       
    43 */
       
    44 CCntDbManagerController* CCntDbManagerController::NewLC(TCntServerType aServerType)
       
    45 	{
       
    46 	CCntDbManagerController* ctrl = new (ELeave) CCntDbManagerController();
       
    47 	CleanupStack::PushL(ctrl);
       
    48 	ctrl->ConstructL(aServerType);
       
    49 	return ctrl;
       
    50 	}
       
    51 
       
    52 /**
       
    53 Second phase constructor.
       
    54 
       
    55 @param aServerType 	ETransientServer if the Server is transient,
       
    56 ENonTransientServer if the Server is not transient.
       
    57 */
       
    58 void CCntDbManagerController::ConstructL(TCntServerType aServerType)
       
    59 	{
       
    60 	User::LeaveIfError(iFs.Connect());
       
    61 	iBackupRestoreAgent = CCntBackupRestoreAgent::NewL(iFs, *this);
       
    62 	iIniFileManager = CIniFileManager::NewL(iFs, *this);
       
    63 	
       
    64 	// Controller requires one Persistence Layer instance.
       
    65 	iPersistenceLayer = CPersistenceLayer::NewLC(iFs);
       
    66 	CleanupStack::Pop(iPersistenceLayer);
       
    67 
       
    68 	// Create a backup registration file for the Contacts Model initialisation
       
    69 	// file.
       
    70 	TFileName iniFile;
       
    71 	iIniFileManager->GetIniFileNameL(iniFile, EFalse);
       
    72 	iBackupRestoreAgent->CreateBackupRegistrationFileL(iniFile);
       
    73 	
       
    74 	// Only now safe to start the Backup/Restore Agent since it relies on the
       
    75 	// iIniFileManager object being fully constructed in the case where, within
       
    76 	// the StartL() method, the value of the Backup/Restore property indicates
       
    77 	// either a Backup or Restore is in progress.
       
    78 	iBackupRestoreAgent->StartL();
       
    79 	
       
    80 	// Start the pre-creation of the default application data:
       
    81 	// Open the default file and create the default remote
       
    82 	// view(s) so they are ready for use by client applications.
       
    83 	if (aServerType == ENonTransientServer)
       
    84 		{
       
    85 		iPermanentData = CCntPermanentData::NewL(*this);
       
    86 		// If the permanent data creation step leaves, it should not
       
    87 		// cause the server to panic. Instead, TRAP it and ignore
       
    88 		// it - it is not fatal to normal server operation anyway.
       
    89 		TRAP_IGNORE(iPermanentData->StartDataCreationL());
       
    90 		}
       
    91 
       
    92 	// Retrieve the list of contact databases on the C: drive.
       
    93 	MLplContactsFile& contactsFile = iPersistenceLayer->ContactsFileL();
       
    94 	TDriveUnit cDrive(EDriveC);
       
    95 	CDesCArray* list(contactsFile.ListL(&cDrive)); 
       
    96 	CleanupStack::PushL(list);
       
    97 	
       
    98 	// Check that each database has a back up registration XML file.
       
    99 	// If not, create one.  
       
   100 	const TInt KListLen(list->Count());
       
   101 	for (TInt i = 0; i < KListLen; ++i)
       
   102 		{
       
   103 		TFileName dbName((*list)[i]);
       
   104 		HBufC* backupFileNameBuf = iBackupRestoreAgent->
       
   105 			CreateBackupRegistrationFileNameLC(dbName.Mid(cDrive.Name().Length()));
       
   106 		TFileName backupFileName;
       
   107 		backupFileName.Append(cDrive.Name());
       
   108 		backupFileName.Append(*backupFileNameBuf);
       
   109 		CleanupStack::PopAndDestroy(backupFileNameBuf);
       
   110 		if (!BaflUtils::FileExists(iFs, backupFileName))
       
   111 			{
       
   112 			TRAP_IGNORE(iBackupRestoreAgent->CreateBackupRegistrationFileL(dbName));
       
   113 			}
       
   114 		}
       
   115 	CleanupStack::PopAndDestroy(list);		
       
   116 	}
       
   117 
       
   118 
       
   119 CCntDbManagerController::CCntDbManagerController()
       
   120 	: iDefaultDriveUnit(EDriveC)
       
   121 	{
       
   122 	}
       
   123 
       
   124 
       
   125 CCntDbManagerController::~CCntDbManagerController()
       
   126 	{
       
   127 	delete iPermanentData;
       
   128 	iManagers.ResetAndDestroy();
       
   129 	delete iPersistenceLayer;
       
   130 	delete iIniFileManager;
       
   131 	delete iBackupRestoreAgent;
       
   132 	iFs.Close();
       
   133 	}
       
   134 
       
   135 
       
   136 /**
       
   137 Return a CCntDbManager for an existing Contacts database.  Creates a
       
   138 CCntDbManager if no session has the file open.  The Contacts database must
       
   139 exist.
       
   140 
       
   141 @param aCntFile Contacts database filename.
       
   142 @param aMode Indicates whether Contacts database is to be opened, created or
       
   143 replaced.
       
   144 
       
   145 @return CCntDbManager instance.
       
   146 */
       
   147 CCntDbManager* CCntDbManagerController::GetDbManagerL(TDes& aCntFile, TCntFileMode aMode)
       
   148  	{
       
   149 #ifdef __PROFILE__
       
   150 	TTime now;
       
   151 	now.UniversalTime();
       
   152 #endif
       
   153 
       
   154  	// If a Backup or Restore is in progress disallow creation of manager and
       
   155  	// hence any access to database.  This is replicated behaviour from Contacts
       
   156  	// Model 1.
       
   157  	if (iBackupRestoreAgent->RestoreInProgress() || iBackupRestoreAgent->BackupInProgress())
       
   158  		{
       
   159  		User::Leave(KErrLocked);
       
   160  		}
       
   161  		
       
   162 	// Deal with default Contacts database file (indicated by empty descriptor).
       
   163 	if(aCntFile.Length() == 0)
       
   164 		{
       
   165 		DefaultDatabaseL(aCntFile);
       
   166 		}
       
   167 
       
   168 	// Free it up for a replace/create operation if 
       
   169 	// permanent data is only thing holding it open.
       
   170 	if (iPermanentData && (aMode == ECntFileReplace))
       
   171 		{
       
   172 		CCntDbManager* manager = DbManagerL(aCntFile);
       
   173 		if (manager && iPermanentData->IsOnlyClientOfDbManager(manager))
       
   174 			{
       
   175 			iPermanentData->ReleaseDbManagerL(manager);
       
   176 			}
       
   177 		}
       
   178 
       
   179 	CCntDbManager* theManager = DbManagerL(aCntFile);
       
   180 	
       
   181 	if (theManager != NULL) // Existing DbManager is found.
       
   182 		{
       
   183 		// If creating the file, leave because it is already exists.
       
   184 		if (aMode == ECntFileCreate)
       
   185 			{
       
   186 			User::Leave(KErrAlreadyExists);
       
   187 			}
       
   188 		// If replacing the file, leave because it is currently in use.
       
   189 		if (aMode == ECntFileReplace)
       
   190 			{
       
   191 			User::Leave(KErrInUse);
       
   192 			}
       
   193 		}
       
   194 	else // The file is not opened and DbManager doesn't exist.
       
   195 		{
       
   196 		// Create new CCntDbManager.
       
   197 		theManager = CCntDbManager::NewLC(iFs, aCntFile, aMode, *iBackupRestoreAgent, *iIniFileManager);	
       
   198 		// Add to the list of managers.
       
   199 		iManagers.AppendL(theManager);
       
   200 		CleanupStack::Pop(theManager);
       
   201 		}
       
   202 
       
   203 	// Increase the session count.
       
   204 	theManager->AddSession();
       
   205 
       
   206 #ifdef __PROFILE__
       
   207 	TTime now2;
       
   208 	now2.UniversalTime();
       
   209 	
       
   210 	RDebug::Print(_L("[CNTMODEL] Spend %d microseconds in CCntDbManagerController::GetDbManagerL \n"), now2.MicroSecondsFrom(now).Int64());
       
   211 #endif
       
   212 
       
   213 	return theManager;
       
   214 	}
       
   215 
       
   216 	
       
   217 /**
       
   218 Find an existing manager for an opened Contacts database file.
       
   219 
       
   220 @param aCntFile Contacts database filename.
       
   221 
       
   222 @return CCntDbManager instance if the manager exists for aCntFile otherwise
       
   223 returns NULL.
       
   224 */
       
   225 CCntDbManager* CCntDbManagerController::DbManagerL(const TDesC& aCntFile) const
       
   226 	{
       
   227 	CCntDbManager* manager = NULL;
       
   228 	const TInt index = FindExistingFileManager(aCntFile);
       
   229 	if (index != KErrNotFound)
       
   230 		{
       
   231 		manager =  iManagers[index];
       
   232 		}
       
   233 	return manager;
       
   234 	}
       
   235 
       
   236 
       
   237 /**
       
   238 Delete an existing Contacts database file.
       
   239 
       
   240 @param aCntFile Contacts database filename.
       
   241 */
       
   242 void CCntDbManagerController::DeleteDatabaseL(TDes& aCntFile) const
       
   243 	{
       
   244 	// Deal with default Contacts database file (indicated by empty descriptor).
       
   245 	if(aCntFile.Length() == 0)
       
   246 		{
       
   247 		DefaultDatabaseL(aCntFile); // Get the default database name.
       
   248 		}
       
   249 		
       
   250 	// Release the internal reference to the manager if the internal
       
   251 	// permanent data is the only object holding it open.
       
   252 	if (iPermanentData)
       
   253 		{
       
   254 		CCntDbManager* manager = DbManagerL(aCntFile);
       
   255 		if (manager && iPermanentData->IsOnlyClientOfDbManager(manager))
       
   256 			{
       
   257 			iPermanentData->ReleaseDbManagerL(manager);
       
   258 			}
       
   259 		}
       
   260 	
       
   261 	// Make sure there is not an existing CCntDbManager session.
       
   262 	if(FindExistingFileManager(aCntFile) != KErrNotFound)
       
   263 		{
       
   264 		User::Leave(KErrInUse);
       
   265 		}
       
   266 	else
       
   267 		{
       
   268 		// Delete the backup registration file associated with the Contacts
       
   269 		// database file.
       
   270 		iBackupRestoreAgent->DeleteBackupRegistrationFileL(aCntFile);
       
   271 		// Call the Persistence Layer to delete the Contacts database file.
       
   272 		iPersistenceLayer->ContactsFileL().DeleteL(aCntFile);
       
   273 		}
       
   274 	}
       
   275 
       
   276 
       
   277 /**
       
   278 Return the filename of the current default Contact database file.
       
   279 
       
   280 @param aCntFile On return holds current default Contacts database filename.
       
   281 */
       
   282 void CCntDbManagerController::DefaultDatabaseL(TDes& aCntFile) const
       
   283 	{
       
   284 
       
   285 	if ((iDefaultDriveUnit.Name().Length() + KContactsBaseFilename().Length()) > aCntFile.MaxLength())
       
   286 		{
       
   287 		User::Leave(KErrOverflow);		
       
   288 		}
       
   289 	aCntFile.Copy(iDefaultDriveUnit.Name());
       
   290 	aCntFile.Append(KContactsBaseFilename);
       
   291 	}
       
   292 
       
   293 
       
   294 /**
       
   295 Return the current default Contacts database drive.
       
   296 
       
   297 @param aDrive On return holds the current default Contacts database drive.
       
   298 */
       
   299 void CCntDbManagerController::DatabaseDrive(TDriveUnit& aDrive) const
       
   300 	{
       
   301 	aDrive = iDefaultDriveUnit;
       
   302 	}
       
   303 
       
   304 
       
   305 /**
       
   306 Set the current default Contacts database drive and optionally moves the
       
   307 default Contacts database from the current default drive to the new drive.
       
   308 
       
   309 @param aDriveUnit New current default Contacts database drive.
       
   310 @param aCopy ETrue if default Contacts database should be moved to new drive.
       
   311 */
       
   312 void CCntDbManagerController::SetDatabaseDriveL(TDriveUnit aDriveUnit, TBool aCopy)
       
   313 	{
       
   314 	if (aDriveUnit == iDefaultDriveUnit) // Same drive?
       
   315 		{ 
       
   316 		aCopy = EFalse;
       
   317 		if (iIniFileManager->DatabaseDriveSet())
       
   318 			{
       
   319 			return;
       
   320 			}
       
   321 		}
       
   322 
       
   323 	// Old drive name.
       
   324 	TDriveName oldDrv = iDefaultDriveUnit.Name();
       
   325 	// New drive name.
       
   326 	TDriveName newDrv = aDriveUnit.Name();	
       
   327 	TBuf<KCntMaxFilePath> oldPath;	
       
   328 	User::LeaveIfError(iFs.PrivatePath(oldPath));
       
   329 	// Drive name goes before the path.
       
   330 	oldPath.Insert(0,oldDrv);
       
   331 	// Filename goes after the path.
       
   332 	oldPath.Append(KSqLiteFilePrefix);
       
   333 	oldPath.Append(KContactsBaseFilename);
       
   334 	
       
   335 	TBuf<KCntMaxFilePath> newPath;	
       
   336 	User::LeaveIfError(iFs.PrivatePath(newPath));
       
   337 	// Drive name goes before the path.
       
   338 	newPath.Insert(0,newDrv);
       
   339 	// Filename goes after the path.
       
   340 	newPath.Append(KSqLiteFilePrefix);
       
   341 	newPath.Append(KContactsBaseFilename);
       
   342 
       
   343 	// Move the old file to the new drive location.
       
   344 	CFileMan* fileManager = CFileMan::NewL(iFs);
       
   345 	CleanupStack::PushL(fileManager);
       
   346 	// The new file will be overwritten if it exists.  If the file or the path
       
   347 	// doesn't exist then it will be created.
       
   348 	if (aCopy)
       
   349 		{
       
   350 		User::LeaveIfError(fileManager->Copy(oldPath, newPath, CFileMan::ERecurse | CFileMan::EOverWrite ));	
       
   351 		}
       
   352 
       
   353 	// Change the default drive to the specified drive.
       
   354 	iDefaultDriveUnit = aDriveUnit;
       
   355 
       
   356 	// Save to Contacts initialisation file.
       
   357 	iIniFileManager->SetDefaultDatabaseDrive(iDefaultDriveUnit, ETrue);
       
   358 	iIniFileManager->ScheduleSaveIniFileSettings(CIniFileManager::ESaveDefaultDbDrive);
       
   359 
       
   360 	// Remove the old file.
       
   361 	if (aCopy)
       
   362 		{
       
   363 		(void)fileManager->Delete(oldPath);
       
   364 		}		
       
   365 	CleanupStack::PopAndDestroy(fileManager);
       
   366 	}
       
   367 
       
   368 /**
       
   369 Return the restored Contacts database drive.
       
   370 
       
   371 @param aDrive On return holds the Contacts database drive restored from CntModel.ini.
       
   372 */
       
   373 void CCntDbManagerController::RestoreDatabaseDrive(TDriveUnit& aDrive)
       
   374 	{
       
   375 	iDefaultDriveUnit = aDrive;
       
   376 	}
       
   377 
       
   378 /**
       
   379 Return whether or not the named or default (empty descriptor) Contacts database
       
   380 exists.
       
   381 
       
   382 @param aCntFile Contacts database filename.
       
   383 
       
   384 @return ETrue if Contacts database exists, EFalse otherwise.
       
   385 */
       
   386 TBool CCntDbManagerController::DatabaseExistsL(const TDesC& aCntFile) const
       
   387 	{
       
   388 	if(aCntFile==KNullDesC)
       
   389 		{
       
   390 		TBuf<KCntMaxFilePath> path;
       
   391 		DefaultDatabaseL(path);
       
   392 		return (iPersistenceLayer->ContactsFileL().DatabaseExistsL(path));
       
   393 		}
       
   394 	return (iPersistenceLayer->ContactsFileL().DatabaseExistsL(aCntFile));		
       
   395 	}
       
   396 
       
   397 
       
   398 /**
       
   399 Return a list of Contacts databases found on drive aDriveUnit.
       
   400 
       
   401 @param aListBuffer Client supplied flat buffer to be filled with a serialized
       
   402 CDesCArray of Contacts databases found on drive aDriveUnit.
       
   403 @param aDriveUnit Drive to list Contacts databases for.  If defaulted then a
       
   404 list of Contacts databases on all drives will be returned.
       
   405 */
       
   406 void CCntDbManagerController::ListDatabasesL(CBufFlat*& aListBuffer, TDriveUnit* aDriveUnit) const
       
   407 	{
       
   408 	const TInt KInitialBufferSize = 200;
       
   409 	aListBuffer = CBufFlat::NewL(KInitialBufferSize);
       
   410 	CleanupStack::PushL(aListBuffer);
       
   411 	
       
   412 	// Create a write stream for this buffer.
       
   413 	RBufWriteStream bufStream;
       
   414 	CleanupClosePushL(bufStream);
       
   415 	bufStream.Open(*aListBuffer);
       
   416 
       
   417 	// Use Persistence Layer to get list of Contacts databases.  Note that the
       
   418 	// ListL() method always returns a list even if empty so no NULL check for
       
   419 	// list is required.
       
   420 	MLplContactsFile& pl = iPersistenceLayer->ContactsFileL();
       
   421 	CDesCArray* list =NULL;
       
   422 	if(aDriveUnit == NULL)
       
   423 		{
       
   424 		list = pl.ListL(); // Retrieve Contacts databases on all drives.
       
   425 		}
       
   426 	else
       
   427 		{
       
   428 		list = pl.ListL(aDriveUnit); // Retrieve Contacts databases on named drive.
       
   429 		}
       
   430 
       
   431 	// Externalize the CDesCArray.
       
   432 	CleanupStack::PushL(list);
       
   433 	TInt count = list->Count();
       
   434 	bufStream.WriteUint32L(count);
       
   435 	
       
   436 	for (TInt i=0; i<count; i++)
       
   437 		{
       
   438 		TInt length=(list->MdcaPoint(i)).Length();
       
   439 		bufStream.WriteUint8L(length);
       
   440 		bufStream.WriteL(list->MdcaPoint(i),length);
       
   441 		}
       
   442 	bufStream.CommitL();
       
   443 	
       
   444 	CleanupStack::PopAndDestroy(2, &bufStream); // list
       
   445 	CleanupStack::Pop(aListBuffer);	
       
   446 	}
       
   447 
       
   448 
       
   449 /**
       
   450 Return the index of the CCntDbManager instance which has a Contacts database
       
   451 filename equal to aCntFile.  If no CCntDbManager instance has this filename then
       
   452 KErrNotFound is returned.
       
   453 
       
   454 @param aCntFile Contacts database filename.
       
   455 
       
   456 @return Index of CCntDbManager instance which has a Contacts database filename
       
   457 equal to aCntFile or KErrNotFound if no match.
       
   458 */
       
   459 TInt CCntDbManagerController::FindExistingFileManager(const TDesC& aCntFile) const
       
   460 	{
       
   461 	for(TInt i=iManagers.Count()-1; i>=0; --i)
       
   462 		{
       
   463 		if(aCntFile.CompareF(iManagers[i]->CntFile()) == 0)
       
   464 			{
       
   465 			return i;
       
   466 			}
       
   467 		}
       
   468 	return KErrNotFound;
       
   469 	}
       
   470 
       
   471 
       
   472 /**
       
   473 Close a session for the given CCntDbManager instance.  If no more session are
       
   474 open for this CCntDbManager instance (i.e. last client session for this Contacts
       
   475 database has closed) then the instance is destroyed.
       
   476 
       
   477 @param aManager CCntDbManager instance to close session on.
       
   478 */
       
   479 void CCntDbManagerController::CloseDatabase(CCntDbManager& aManager)
       
   480 	{
       
   481 	aManager.RemoveSession();
       
   482 	if(aManager.SessionCount() == 0)
       
   483 		{
       
   484 		for(TInt i=0;i<iManagers.Count();++i)
       
   485 			{
       
   486 			if(&aManager == iManagers[i])
       
   487 				{
       
   488 				iManagers.Remove(i);
       
   489 				delete &aManager;
       
   490 				break;
       
   491 				}
       
   492 			}
       
   493 		}
       
   494 	}
       
   495 
       
   496 
       
   497 /**
       
   498 Get the "system wide" current Contacts database.
       
   499 
       
   500 @return "System wide" current Contacts database.
       
   501 */
       
   502 const TDesC& CCntDbManagerController::CurrentDb() const
       
   503 	{
       
   504 	return iIniFileManager->CurrentDb();
       
   505 	}
       
   506 
       
   507 
       
   508 /**
       
   509 Set the "system wide" current Contacts database.  Also notify all CCntDbManager
       
   510 instances of the change of current Contacts database.
       
   511 
       
   512 @param aNewCurrentDb New current Contacts database.
       
   513 @param aSessionId Session ID of the client making the change.
       
   514 
       
   515 @leave KErrNoMemory Out of memory.
       
   516 @leave KErrNotFound
       
   517 @leave KErrGeneral
       
   518 */
       
   519 void CCntDbManagerController::SetCurrentDbL(const TDesC& aNewCurrentDb, TUint aSessionId)
       
   520 	{
       
   521 	iIniFileManager->SetCurrentDb(aNewCurrentDb);
       
   522 	iIniFileManager->ScheduleSaveIniFileSettings(CIniFileManager::ESaveCurrentDatabase);
       
   523 	TContactDbObserverEvent event;
       
   524 	event.iType = EContactDbObserverEventCurrentDatabaseChanged;
       
   525 	event.iContactId = KNullContactId;
       
   526 	event.iConnectionId = aSessionId;
       
   527 	NotifyDbManagersL(event);	
       
   528 	}
       
   529 	
       
   530 
       
   531 /**
       
   532 Process a Backup/Restore event generated by the Backup/Restore Agent.  Simply
       
   533 notfiy all CCntDbManager instances of the event which they will process in
       
   534 turn.
       
   535 
       
   536 @param aEvent Backup/Restore event.
       
   537 */
       
   538 void CCntDbManagerController::HandleBackupRestoreEventL(TContactDbObserverEvent aEvent)
       
   539 	{
       
   540 	TInt count = iManagers.Count();
       
   541 	for (TInt i = 0 ; i < count ; ++i)
       
   542 		{
       
   543 		iManagers[i]->HandleBackupRestoreEventL(aEvent);
       
   544 		}
       
   545 	}
       
   546 
       
   547 
       
   548 /**
       
   549 Notify all CCntDbManager instances of the database event aEvent.  The
       
   550 CCntDbManager instances will in turn notify all registered observers of the
       
   551 event.
       
   552 
       
   553 @param aEvent Database event.
       
   554 */
       
   555 void CCntDbManagerController::NotifyDbManagersL(TContactDbObserverEvent aEvent)
       
   556 	{
       
   557 	TInt count = iManagers.Count();
       
   558 	for (TInt i = 0 ; i < count ; ++i)
       
   559 		{
       
   560 		iManagers[i]->NotifyObserversL(aEvent);
       
   561 		}
       
   562 	}
       
   563 
       
   564 
       
   565 /**
       
   566 Schedule a save of the initialisation file.
       
   567 */
       
   568 void CCntDbManagerController::ScheduleSaveIniFileSettings(TInt aSaveFlags, TBool aReplace)
       
   569 	{
       
   570 	iIniFileManager->ScheduleSaveIniFileSettings(aSaveFlags, aReplace);	
       
   571 	}
       
   572 
       
   573 
       
   574 /**
       
   575 Get the Backup/Restore Agent instance owned by CCntDbManagerController.
       
   576 
       
   577 @return CCntBackupRestoreAgent instance owned by CCntDbManagerController.
       
   578 */
       
   579 CCntBackupRestoreAgent& CCntDbManagerController::BackupRestoreAgent() const
       
   580 	{
       
   581 	return *iBackupRestoreAgent;
       
   582 	}
       
   583 	
       
   584 
       
   585 /**
       
   586 Get the Initialisation File Manager instance owned by CCntDbManagerController.
       
   587 
       
   588 @return CIniFileManager instance owned by CCntDbManagerController.
       
   589 */
       
   590 CIniFileManager& CCntDbManagerController::IniFileManager() const
       
   591 	{
       
   592 	return *iIniFileManager;
       
   593 	}