commsconfig/commsdatabaseshim/commdbshim/ProtectedDB/ProtectDB.h
changeset 0 dfb7c4ff071f
equal deleted inserted replaced
-1:000000000000 0:dfb7c4ff071f
       
     1 // Copyright (c) 2006-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 // Protected tables/records functionality
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file ProtectDB.h
       
    20  @deprecated since v9.1. Functionality is replaced with commsdat.
       
    21 */
       
    22 
       
    23 #ifndef PROTECTDB_H
       
    24 #define	PROTECTDB_H
       
    25 
       
    26 #include <commdb.h>
       
    27 #include <metadatabase.h>
       
    28 #include <badesca.h>
       
    29 
       
    30 using namespace CommsDat;
       
    31 
       
    32 class CCommsDatabaseProtect : public CCommsDatabase
       
    33 /**
       
    34 @internalTechnology
       
    35 */
       
    36 	{
       
    37 public:
       
    38 	/** Creates a `CCommsDatabase`. If the database filestore does not exist
       
    39 		the default filestore is duplicated. If no default filestore exists an
       
    40 		empty database is created. */
       
    41 	IMPORT_C static CCommsDatabaseProtect* NewL();
       
    42 	/** Creates a `CCommsDatabase`. If the database filestore exists and
       
    43 		`aUseDefaultDb` is True the default filestore is duplicated. Otherwise
       
    44 		an empty database is created. */
       
    45 	IMPORT_C static CCommsDatabaseProtect* NewL(TBool aUseDefaultDb);
       
    46 	/** Creates a `CCommsDatabase` as with `NewL()`. The method of opening:
       
    47 		(Created, CopiedDefault or Opened) is returned in `aOpeningMethod`. */
       
    48 	IMPORT_C static CCommsDatabaseProtect* NewL(TCommDbOpeningMethod &aOpeningMethod);
       
    49 
       
    50 	IMPORT_C ~CCommsDatabaseProtect();
       
    51 
       
    52 	/**Sets the access right field in the ACCESS_TYPE_TABLE for the table specified
       
    53 	in aTableName to RDbRowSet::EReadOnly*/
       
    54 	IMPORT_C TInt ProtectTable(const TDesC& aTableName);
       
    55 	/**Sets the access right field in the ACCESS_TYPE_TABLE for the table specified
       
    56 	in aTableName to RDbRowSet::EUpdatable*/
       
    57 	IMPORT_C TInt UnProtectTable(const TDesC& aTableName);
       
    58 
       
    59 	/** returns the access rights for aTableName from the ACCESS_TYPE_TABLE*/
       
    60 	IMPORT_C RDbRowSet::TAccess GetTableAccessL(const TDesC& aTableName);
       
    61 
       
    62 	/**Sets the access right fields in the ACCESS_TYPE_TABLE for the tables specified
       
    63 	in aTableList to RDbRowSet::EReadOnly*/
       
    64 	IMPORT_C TInt ProtectTables(CPtrCArray& aTableList);
       
    65 	/**Sets the access right fields in the ACCESS_TYPE_TABLE for the tables specified
       
    66 	in aTableList to RDbRowSet::EUpdatable*/
       
    67 	IMPORT_C TInt UnprotectTables(CPtrCArray& aTableList);
       
    68 	
       
    69 
       
    70 private:
       
    71 	CCommsDatabaseProtect();
       
    72 	void ConstructL();
       
    73 
       
    74 	void DoTableProtectionL(CMDBRecordSetBase* aElement, TBool aProtect);
       
    75 	void DoTablesProtectionL(CPtrCArray& aTableList, TBool aProtect);
       
    76 	
       
    77 private:
       
    78 	CCommDbTableExtension* iTableExt;
       
    79 	};
       
    80 
       
    81 class CCommsDbProtectTableView : public CCommsDbTableView
       
    82 /**
       
    83 @internalTechnology
       
    84 */
       
    85 	{
       
    86 public:
       
    87 	static CCommsDbProtectTableView* NewL(CCommsDatabaseBase& aDb,const TDesC& aTableName,const TDbQuery& aQuery,TBool aUseTemplate);
       
    88 	IMPORT_C ~CCommsDbProtectTableView();
       
    89 	//Protection of settings
       
    90 	IMPORT_C TInt ProtectTable();
       
    91 	IMPORT_C TInt UnprotectTable();
       
    92 	IMPORT_C TInt ProtectRecord();
       
    93 	IMPORT_C TInt UnprotectRecord();
       
    94 	IMPORT_C TInt GetTableAccess(RDbRowSet::TAccess& aAccessType);
       
    95 	IMPORT_C TInt GetRecordAccess(TInt& aAccess);
       
    96 	
       
    97 private:
       
    98 	CCommsDbProtectTableView(CCommsDatabaseBase& aDb, const TDesC& aTableName);
       
    99 	void ConstructL(const TDbQuery& aQuery,TBool aUseTemplate);
       
   100 	void DoProtectionL(CMDBSession* aSession, CMDBElement* aElement, TBool aProtect);
       
   101 	};
       
   102 
       
   103 #endif