diff -r 000000000000 -r e686773b3f54 phonebookengines/contactsmodel/cntsrv/inc/CntSpeedDials.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/phonebookengines/contactsmodel/cntsrv/inc/CntSpeedDials.h Tue Feb 02 10:12:17 2010 +0200 @@ -0,0 +1,92 @@ +// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#ifndef __CNTSERVERSPEEDDIALS_H__ +#define __CNTSERVERSPEEDDIALS_H__ + +#include +#include + +const TUid KUidCntSpeedDialStream = { 0x10009EF7 }; + +class CDictionaryFileStore; +class CCntServerSpeedDialTable; + +/** Manages a collection of speed-dial tables. */ +class CCntServerSpeedDialManager : public CBase + { +public: + CCntServerSpeedDialManager(); + ~CCntServerSpeedDialManager(); + CCntServerSpeedDialTable& TableL(const TDesC& aDatabase); + TBool DeleteTable(const TDesC& aDatabase); + + void StoreL(CDictionaryFileStore& aStore) const; + void RestoreL(CDictionaryFileStore& aStore); + static TUid SpeedDialFieldUidFromSpeedDialPosition(TInt aSpeedDialPosition); +private: + RPointerArray iSpeedDials; + }; + + +/** A speed-dial table. */ +class CCntServerSpeedDialTable : public CBase + { +public: + static CCntServerSpeedDialTable* NewL(const TDesC& aDatabase); + ~CCntServerSpeedDialTable(); + inline const TDesC& Database() const; + TContactItemId SpeedDialContactItem(TInt aIndex, TDes& aPhoneNumber) const; + CArrayFix* SpeedDialIndicesForContactIdLC(TContactItemId aContactId); + void SetSpeedDialL(TInt aIndex, TContactItemId aContactId, const TSpeedDialPhoneNumber& aPhoneNumber); + + void InternalizeL(RReadStream& aStream); + void ExternalizeL(RWriteStream& aStream) const; +private: + CCntServerSpeedDialTable(); + void ConstructL(const TDesC& aDatabase); +private: + /** An individual speed-dial entry. */ + class CSpeedDial : public CBase + { + public: + CSpeedDial(); + static CSpeedDial* NewL(TContactItemId aContactId, const TSpeedDialPhoneNumber& aPhoneNumber); + ~CSpeedDial(); + inline TContactItemId ContactId() const; + void PhoneNumber(TSpeedDialPhoneNumber& aSpeedNumber) const; + void InternalizeL(RReadStream& aStream); + void ExternalizeL(RWriteStream& aStream) const; + void Reset(); + void SetL(TContactItemId aContactId, const TSpeedDialPhoneNumber& aPhoneNumber); + private: + CSpeedDial(TContactItemId aContactId, const TSpeedDialPhoneNumber& aPhoneNumber); + void ConstructL(); + private: + TContactItemId iContactId; + HBufC* iPhoneNumber; + }; +private: + TFixedArray iSpeedDialTable; + HBufC* iDatabaseFile; + }; + + +inline const TDesC& CCntServerSpeedDialTable::Database() const { return *iDatabaseFile; } +inline TContactItemId CCntServerSpeedDialTable::CSpeedDial::ContactId() const { return iContactId; } + + + +#endif