phonebookengines/contactsmodel/cntplsql/inc/clplcontactproperties.h
changeset 0 e686773b3f54
equal deleted inserted replaced
-1:000000000000 0:e686773b3f54
       
     1 /**
       
     2 * Copyright (c) 2007-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 
       
    27 #ifndef __CLPLCONTACTPROPERTIES_H__
       
    28 #define __CLPLCONTACTPROPERTIES_H__
       
    29 
       
    30 #include "pltables.h"
       
    31 
       
    32 class CPplContactItemManager;
       
    33 class CPplPreferencesPersistor;
       
    34 
       
    35 /**
       
    36 This class derives from the phonebook synchroniser plugin interface, but
       
    37 contains no implementation.  It is used to avoid the deadlock situation which
       
    38 occurs when the phonebook synchroniser server, using the Contacts Model, tries
       
    39 to call itself.
       
    40 
       
    41 The contacts server analyses the SID of the server process and replaces the
       
    42 real plugin with this class.  As a result the check is only required in one
       
    43 place where the plugin reference is requested and the algorithms using the
       
    44 plugin are unaware of the replacement.
       
    45 */
       
    46 class NONSHARED CDummySynchroniser : public CBase, public MContactSynchroniser
       
    47 	{
       
    48 public:
       
    49 	// From MContactSynchroniser
       
    50 	TInt ValidateContact(TValidateOperation aOp, TContactItemId aId);
       
    51 	TInt ValidateWriteContact(CContactICCEntry& aContactItem);
       
    52 	TInt DeleteContact(TContactItemId aId);
       
    53 	void Release();
       
    54 	void UpdatePostWriteL(const CContactICCEntry& aContactItem);
       
    55 	TContactItemId ICCTemplateIdL(TUid aPhonebookUid);
       
    56 	TContactItemId GroupIdL(TUid aPhonebookUid);
       
    57 	void NotifySyncStateChange(TRequestStatus& aStatus, TUid aPhonebookUid);
       
    58 	void CancelNotifyRequest(TUid aPhonebookUid);
       
    59 	TBool IsSynchronisedL(TUid aPhonebookUid);
       
    60 	TInt PhonebookList(RArray<TUid>& aPhonebookList);
       
    61 	};
       
    62 
       
    63 /**
       
    64 The CSystemTemplateManager class is a helper class for managing the System
       
    65 template.
       
    66 
       
    67 The System template is the special contact item that contains detailed 
       
    68 information about every possible field in the contact card.
       
    69 
       
    70 The System template is used when contact cards are read from the database.
       
    71 
       
    72 When a new database is created the System template is built from the resource
       
    73 file.
       
    74 */
       
    75 class NONSHARED CSystemTemplateManager : CBase
       
    76 	{
       
    77 public:
       
    78 	static CSystemTemplateManager* NewL(CPplContactItemManager& aContactItemManager, RFs& aFileSession);
       
    79 	~CSystemTemplateManager();
       
    80 	
       
    81 	const CContactTemplate& TemplateL();
       
    82 	void DeleteTemplate();
       
    83 	void RecreateSystemTemplateL();
       
    84 	CContactTemplate* SystemTemplateFromResourceL(const TDesC& aResouceFileName);
       
    85 	
       
    86 	RArray<TUid>& CustomFilterableFieldsL();
       
    87 
       
    88 private:
       
    89 	CSystemTemplateManager(CPplContactItemManager& aContactItemManager, RFs& aFileSession);
       
    90 
       
    91 private:
       
    92 	CContactTemplate* iSystemTemplate;
       
    93 	CPplContactItemManager& iContactItemManager;
       
    94 	RFs& iFileSession;
       
    95 	RArray<TUid> iCustFiltFields;		   
       
    96 	};
       
    97 
       
    98 /**
       
    99 The CLplContactProperties class:
       
   100 	
       
   101 - Provides the interface to the settings stored in the Preferences table.
       
   102 - It loads and owns the ECOM plugins used in the Persistence Layer, making sure
       
   103 that only one instance is reused by several users.
       
   104 - Manages the System template.
       
   105 */
       
   106 class NONSHARED CLplContactProperties : public CBase, public MLplContactProperties
       
   107 	{
       
   108 public:
       
   109 	CLplContactProperties(RFs& aFs);
       
   110 	~CLplContactProperties();
       
   111 
       
   112 	void SetContactItemManagerL(CPplContactItemManager& aContactItemManager);
       
   113 	
       
   114 	CContactPhoneParser& ContactPhoneParserL();
       
   115 	MContactSynchroniser& ContactSynchroniserL(TUint aSessionId);
       
   116 	void DisableSynchroniser(TUint aSessionId);
       
   117 
       
   118 	void SessionDeleted(TUint aSessionId);
       
   119 
       
   120 	TInt CardTemplatePrefIdL() const;
       
   121 	void SetCardTemplatePrefIdL(TInt aCardTemplatePrefId);
       
   122 
       
   123 	CContactIdArray& CardTemplateIdsL();
       
   124 	CContactIdArray& GroupIdListL();
       
   125 	
       
   126 	TInt64 MachineIdL() const;
       
   127 	void SetMachineIdL(TInt64 aMachineId);
       
   128 	TPtrC UniqueIdL(); 
       
   129 
       
   130 	const RArray<TUid>& CustomFilterableFieldsL();
       
   131 
       
   132 	void SetDbViewContactType(TUid aDbViewContactType);
       
   133 	TUid GetDbViewContactType() const;
       
   134 	
       
   135 	// Public for other Persistence Layer classes.
       
   136 	TBool CheckType(TUid aUid) const;
       
   137 
       
   138 	// System template methods.
       
   139 	CContactTemplate* SystemTemplateFromResourceL(const TDesC& aResouceFileName) const;
       
   140 	void RecreateSystemTemplateL();
       
   141 	CSystemTemplateManager& SystemTemplateManager() const;
       
   142 	const CContactTemplate& SystemTemplateL() const;
       
   143 	
       
   144 	TContactItemId OwnCardIdL();
       
   145 	void SetOwnCardIdL(TContactItemId aId);	
       
   146 
       
   147 	TContactItemId ICCTemplateIdL(TUid aPhonebookUid, TUint aSessionId);
       
   148 	TContactItemId PhonebookGroupIdL(TUint aSessionId);
       
   149 	
       
   150 	// Preferences methods
       
   151 	const CArrayFix<CContactDatabase::TSortPref>& SortPrefsL();	
       
   152 	void SetSortPrefsL(CArrayFix<CContactDatabase::TSortPref>* aPrefs);		
       
   153 	
       
   154 private:
       
   155 	RFs& iFs;
       
   156 	CPplContactItemManager* iContactItemManager;
       
   157 	CContactPhoneParser* iPhoneParser;
       
   158 
       
   159 	CContactSynchroniser* iSyncPlugin;
       
   160 	CDummySynchroniser*	iSyncDummy; 
       
   161 	CSystemTemplateManager* iSystemTemplate;
       
   162 	TUint iDisabledPhonebookSessionId;
       
   163 
       
   164 	TBuf<40> iUidString;
       
   165 	TUid iDbViewContactType;
       
   166 	CContactIdArray* iGroupIdList;
       
   167 	};
       
   168 
       
   169 #endif //__CLPLCONTACTPROPERTIES_H__