phonebookengines_old/contactsmodel/cntsrv/inc/CCntDbManagerController.h
changeset 40 b46a585f6909
equal deleted inserted replaced
37:fd64c38c277d 40:b46a585f6909
       
     1 /**
       
     2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 /**
       
    21  @file
       
    22  @internalComponent
       
    23  @released
       
    24 */
       
    25 
       
    26 #ifndef CCNTDBMANAGERCONTROLLER_H
       
    27 #define CCNTDBMANAGERCONTROLLER_H
       
    28 
       
    29 #include <e32base.h>
       
    30 #include <f32file.h> // For TDriveUnit.
       
    31 #include "CCntServer.h" // For TCntServerType.
       
    32 #include "CCntDbManager.h" // For TCntFileMode.
       
    33 #include "CIniFileManager.h" // For TSaveType.
       
    34 
       
    35 
       
    36 class CCntDbManager;
       
    37 class CPersistenceLayer;
       
    38 class CReqAsyncOpen;
       
    39 class CCntServerSpeedDialManager;
       
    40 class CCntBackupRestoreAgent;
       
    41 class CCntPermanentData;
       
    42 		
       
    43 
       
    44 /**
       
    45 The CCntDbManagerController instantiates and controls all CCntDbManager
       
    46 instances.
       
    47 
       
    48 There is one CCntDbManagerController class per CCntServer instance.
       
    49 */
       
    50 class CCntDbManagerController : public CBase
       
    51 	{
       
    52 public:
       
    53 	static CCntDbManagerController* NewLC(TCntServerType aServerType);
       
    54 	virtual ~CCntDbManagerController();
       
    55 
       
    56 	CCntDbManager* GetDbManagerL(TDes& aCntFile, TCntFileMode aMode);
       
    57 	CCntDbManager* DbManagerL(const TDesC& aCntFile) const;
       
    58 
       
    59 	// Database management methods.
       
    60 	void DeleteDatabaseL(TDes& aCntFile) const;
       
    61 	void DefaultDatabaseL(TDes& aCntFile) const;
       
    62 	void DatabaseDrive(TDriveUnit& aDrive) const;	
       
    63 	void SetDatabaseDriveL(TDriveUnit aDrive,TBool aCopy);
       
    64 	void RestoreDatabaseDrive(TDriveUnit& aDrive);
       
    65 	TBool DatabaseExistsL(const TDesC& aCntFile) const;
       
    66 	void ListDatabasesL(CBufFlat*& aList,TDriveUnit* aDriveUnit = NULL) const;
       
    67 	void CloseDatabase(CCntDbManager& aManager);
       
    68 	void SetCurrentDbL(const TDesC& aNewCurrentDb, TUint aSessionId);
       
    69 	const TDesC& CurrentDb() const;
       
    70 	
       
    71 	void HandleBackupRestoreEventL(TContactDbObserverEvent aEvent);
       
    72 	
       
    73 	void ScheduleSaveIniFileSettings(TInt aSaveFlags, TBool aReplace=EFalse);
       
    74 		
       
    75 	// Access methods.
       
    76 	CCntBackupRestoreAgent& BackupRestoreAgent() const;
       
    77 	CIniFileManager& IniFileManager() const;
       
    78 
       
    79 private:
       
    80 	CCntDbManagerController();
       
    81 	void ConstructL(TCntServerType aServerType);
       
    82 	
       
    83 	TInt FindExistingFileManager(const TDesC& aCntFile) const;
       
    84 
       
    85 	void NotifyDbManagersL(TContactDbObserverEvent aEvent);
       
    86 		
       
    87 private:
       
    88 	RPointerArray<CCntDbManager>	iManagers;
       
    89 	CPersistenceLayer*				iPersistenceLayer;
       
    90 	TDriveUnit						iDefaultDriveUnit;
       
    91 
       
    92 	CCntBackupRestoreAgent*			iBackupRestoreAgent;
       
    93 	CIniFileManager*				iIniFileManager;
       
    94 	CCntPermanentData*				iPermanentData;
       
    95 
       
    96 	RFs iFs;
       
    97 	};
       
    98 
       
    99 #endif