summaryrefslogtreecommitdiffstats
path: root/plugins/contacts/symbian/contactsmodel/cntplsql/inc/clplanalyserproxy.h
blob: 6c6a0ab667f4700d40fe70c9b52d15efadd1f96d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/*
* Copyright (c) 2005-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: 
*
*/




/**
 @file
 @internalComponent
 @released
*/


#ifndef __CLPLANALYSERPROXY_H__
#define __CLPLANALYSERPROXY_H__

#include <e32base.h>
#include "persistencelayer.h"
#include "clplgenericproxy.h"


class MIniFileManager;


/**
The CLplAnalyserProxy proxy class sits between the State Machine and the
Persistence Layer.

This proxy has several functions.  It provides contacts server speed dial 
and initialisation file managers with dynamic information on the changes in the
database.

It also creates database event notification messages on the changes and sends
them to the CCntDbManager owning this object which in turn queues the events for
consumption by the client-side of the Contacts Model.
*/
class NONSHARED CLplAnalyserProxy : public CLplGenericProxy
	{
public:
	CLplAnalyserProxy(MIniFileManager& aIniManager,MContactDbObserverV2& aCntDbObserver, MLplPersistenceBroker& aBroker, MLplTransactionManager& aTranMan, MLplContactProperties& aProperties);

	/** Store a new Contact. */
	TContactItemId CreateL(CContactItem& aItem, TUint aSessionId);
	/** Update an existing Contact (or parts of it as specified by the view
	definition). */
	void UpdateL(CContactItem& aItem, TUint aSessionId, TBool aSpeeDailUpdate = EFalse);
	/** Delete a Contact. */
	CContactItem* DeleteLC(TContactItemId  aItemId, TUint aSessionId, TCntSendEventAction aEventType);
	/** Change the type of an existing Contact. */	
	void ChangeTypeL(TContactItemId aItemId, TUid aNewType);

	void SetConnectionId(TInt aConnectionId);

	void RollbackCurrentTransactionL(TUint aSessionId);

private:
	TUid SpeedDialFieldUidFromSpeedDialPosition(TInt aSpeedDialPosition);
	TBool CheckSpeedDialUpdatesL(CContactItem& aItem);
	TBool CheckSpeedDialDeletesL(TContactItemId aItemId);

	void CheckPrefTemplateDeleteL(TContactItemId aItemId);

	void NotifyObserverL(const TContactDbObserverEventType aType,
                         const TContactItemId aContactId,
                         const TUint aConnectionId = 0,
                         const TContactDbObserverEventTypeV2 aTypeV2 = EContactDbObserverEventV2Null,
                         const CContactIdArray* aAdditoinalContactIds = 0);

	MContactDbObserverV2& iCntDbObserver;
	MIniFileManager& iIniManager;
	MLplContactProperties& iProperties;

	TInt iConnectionId;
	};


#endif // __CLPLANALYSERPROXY_H__