williamr@2: // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). williamr@2: // All rights reserved. williamr@2: // This component and the accompanying materials are made available williamr@2: // under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members williamr@2: // which accompanies this distribution, and is available williamr@2: // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". williamr@2: // williamr@2: // Initial Contributors: williamr@2: // Nokia Corporation - initial contribution. williamr@2: // williamr@2: // Contributors: williamr@2: // williamr@2: // Description: williamr@2: // CommDb Template Record View williamr@2: // williamr@2: // williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: @file williamr@2: @deprecated since v9.1. Functionality is replaced with commsdat. williamr@2: */ williamr@2: williamr@2: #ifndef CDBTEMP_H williamr@2: #define CDBTEMP_H williamr@2: williamr@2: #include williamr@2: williamr@2: class CCommsDatabaseBase; williamr@2: class CCommsDbTableView; williamr@2: williamr@2: // Template view class. Uses a supplied `CCommsDatabase` and a williamr@2: // `CCommsDbTableView` to read and write template records. Created from williamr@2: // `CCommsDbTableView::ConstructL()` the recursion is stopped because the williamr@2: // template view NewL is called with aUseTemplate set to false. williamr@2: // internal "This class is poorly named it should be something like: williamr@2: // CCommDbTemplateView" williamr@2: class CCommsDbTemplateRecord : public CBase williamr@2: /** The view on a template record of a specific table. williamr@2: williamr@2: The view contains only the template record and therefore, unlike the more williamr@2: general CCommsDbTableView class, does not contain any navigation functions. williamr@2: williamr@2: This class does, however, contain the necessary member functions for reading williamr@2: and writing to columns. williamr@2: @publishedAll williamr@2: @released */ williamr@2: { williamr@2: public: williamr@2: /** Creates a new template view on the database and table specified. */ williamr@2: IMPORT_C static CCommsDbTemplateRecord* NewL(CCommsDatabaseBase* aDb,const TDesC& aTableName); williamr@2: IMPORT_C ~CCommsDbTemplateRecord(); williamr@2: williamr@2: /** Modifies the existing template record if there is no template create one. williamr@2: StoreModifications() is called to complete the transaction. */ williamr@2: IMPORT_C TInt Modify(); williamr@2: /** Removes the template from the table. */ williamr@2: IMPORT_C TInt Delete(); williamr@2: /** Stores an new or updated template back to the database. */ williamr@2: IMPORT_C TInt StoreModifications(); williamr@2: /** Cancels pending changes since `Modify()`. */ williamr@2: IMPORT_C void CancelModifications(); williamr@2: williamr@2: // Access data from the template williamr@2: IMPORT_C void ReadTextL(const TDesC& aColumn, TDes8& aValue); williamr@2: IMPORT_C void ReadTextL(const TDesC& aColumn, TDes16& aValue); williamr@2: IMPORT_C HBufC* ReadLongTextLC(const TDesC& aColumn); williamr@2: IMPORT_C void ReadUintL(const TDesC& aColumn, TUint32& aValue); williamr@2: IMPORT_C void ReadBoolL(const TDesC& aColumn, TBool& aValue); williamr@2: IMPORT_C void ReadTypeAttribL(const TDesC& aColumn, TDbColType& aColType, TUint32& aAttrib); williamr@2: IMPORT_C void ReadColumnLengthL(const TDesC& aColumn, TInt& aLength); williamr@2: williamr@2: // Modify a new or modified template. Must call `StoreModifications()` williamr@2: // to store the changes. williamr@2: IMPORT_C void WriteTextL(const TDesC& aColumn, const TDesC8& aValue); williamr@2: IMPORT_C void WriteTextL(const TDesC& aColumn, const TDesC16& aValue); williamr@2: IMPORT_C void WriteLongTextL(const TDesC& aColumn, const TDesC& aValue); williamr@2: IMPORT_C void WriteUintL(const TDesC& aColumn, const TUint32& aValue); williamr@2: IMPORT_C void WriteBoolL(const TDesC& aColumn, const TBool& aValue); williamr@2: williamr@2: /** The name of the table that this template belongs to. */ williamr@2: IMPORT_C void GetTableName(TDes& aTableName) const; williamr@2: williamr@2: /** True if a template exists. */ williamr@2: IMPORT_C TBool TemplateRecordExists(); williamr@2: williamr@2: // Create a new record based on the contents of the template record williamr@2: IMPORT_C TInt InsertCopy(TUint32& aId); williamr@2: private: williamr@2: CCommsDbTemplateRecord(); williamr@2: void ConstructL(CCommsDatabaseBase* aDb, const TDesC& aTableName); williamr@2: TInt Reposition(); williamr@2: williamr@2: // Enabling and Desabling client view on template record williamr@2: TBool SetHiddenMask(); williamr@2: void ClearHiddenMask(TBool aClearHiddenMask); williamr@2: private: williamr@2: CCommsDbTableView* iView; williamr@2: TBool iRecordExists; williamr@2: }; williamr@2: williamr@2: #endif