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