williamr@2
|
1 |
// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
|
williamr@2
|
2 |
// All rights reserved.
|
williamr@2
|
3 |
// This component and the accompanying materials are made available
|
williamr@4
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
williamr@2
|
5 |
// which accompanies this distribution, and is available
|
williamr@4
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
williamr@2
|
7 |
//
|
williamr@2
|
8 |
// Initial Contributors:
|
williamr@2
|
9 |
// Nokia Corporation - initial contribution.
|
williamr@2
|
10 |
//
|
williamr@2
|
11 |
// Contributors:
|
williamr@2
|
12 |
//
|
williamr@2
|
13 |
// Description:
|
williamr@2
|
14 |
//
|
williamr@2
|
15 |
|
williamr@2
|
16 |
#if !defined(__CNTDBOBS_H__)
|
williamr@2
|
17 |
#define __CNTDBOBS_H__
|
williamr@2
|
18 |
|
williamr@2
|
19 |
#if !defined(__E32DEF_H__)
|
williamr@2
|
20 |
#include <e32def.h>
|
williamr@2
|
21 |
#endif
|
williamr@2
|
22 |
|
williamr@4
|
23 |
#if !( defined __SYMBIAN_CNTMODEL_HIDE_DBMS__ ) && !defined __D32DBMS_H__
|
williamr@2
|
24 |
#include <d32dbms.h>
|
williamr@2
|
25 |
#else
|
williamr@2
|
26 |
#include <s32std.h>
|
williamr@2
|
27 |
#include <f32file.h>
|
williamr@2
|
28 |
#endif
|
williamr@2
|
29 |
|
williamr@2
|
30 |
#include <cntdef.h> //for tcontactitemid
|
williamr@2
|
31 |
|
williamr@2
|
32 |
/** Change event type. For events which update, delete or add a contact item, the
|
williamr@2
|
33 |
ID of the item affected is provided in the TContactDbObserverEvent struct.
|
williamr@2
|
34 |
@publishedAll
|
williamr@2
|
35 |
@released
|
williamr@2
|
36 |
*/
|
williamr@2
|
37 |
enum TContactDbObserverEventType
|
williamr@2
|
38 |
{
|
williamr@2
|
39 |
/** Null event type. */
|
williamr@2
|
40 |
EContactDbObserverEventNull,
|
williamr@2
|
41 |
/** Not currently used. */
|
williamr@2
|
42 |
EContactDbObserverEventUnused,
|
williamr@2
|
43 |
/** A contact item (not a template, group or own card) has been changed. */
|
williamr@2
|
44 |
EContactDbObserverEventContactChanged,
|
williamr@2
|
45 |
/** A contact item (not a template, group or own card) has been deleted. */
|
williamr@2
|
46 |
EContactDbObserverEventContactDeleted,
|
williamr@2
|
47 |
/** A contact item (not a template or group) has been added. */
|
williamr@2
|
48 |
EContactDbObserverEventContactAdded,
|
williamr@2
|
49 |
/** Unknown change event type. */
|
williamr@2
|
50 |
EContactDbObserverEventUnknownChanges,
|
williamr@2
|
51 |
/** Recover from a damaged database. */
|
williamr@2
|
52 |
EContactDbObserverEventRecover,
|
williamr@2
|
53 |
/** Rollback from a change to the database. */
|
williamr@2
|
54 |
EContactDbObserverEventRollback,
|
williamr@2
|
55 |
/** Database tables closed. */
|
williamr@2
|
56 |
EContactDbObserverEventTablesClosed,
|
williamr@2
|
57 |
/** Database tables opened. */
|
williamr@2
|
58 |
EContactDbObserverEventTablesOpened,
|
williamr@2
|
59 |
/** A contact card template has changed. */
|
williamr@2
|
60 |
EContactDbObserverEventTemplateChanged,
|
williamr@2
|
61 |
/** A contact card template has been deleted. */
|
williamr@2
|
62 |
EContactDbObserverEventTemplateDeleted,
|
williamr@2
|
63 |
/** A contact card template has been added. */
|
williamr@2
|
64 |
EContactDbObserverEventTemplateAdded,
|
williamr@2
|
65 |
/** The database's current item has been deleted. */
|
williamr@2
|
66 |
EContactDbObserverEventCurrentItemDeleted,
|
williamr@2
|
67 |
/** The database's current item has changed. */
|
williamr@2
|
68 |
EContactDbObserverEventCurrentItemChanged,
|
williamr@2
|
69 |
/** The database's own card has changed. */
|
williamr@2
|
70 |
EContactDbObserverEventOwnCardChanged,
|
williamr@2
|
71 |
/** The database's preferred template has been set. (See CContactDatabase::SetPrefTemplateL()). */
|
williamr@2
|
72 |
EContactDbObserverEventPreferredTemplateChanged,
|
williamr@2
|
73 |
/** An own card has been deleted from the database. */
|
williamr@2
|
74 |
EContactDbObserverEventOwnCardDeleted,
|
williamr@2
|
75 |
/** A contact item group has been added. */
|
williamr@2
|
76 |
EContactDbObserverEventGroupAdded,
|
williamr@2
|
77 |
/** A contact item group has been updated. */
|
williamr@2
|
78 |
EContactDbObserverEventGroupChanged,
|
williamr@2
|
79 |
/** A contact item group has been deleted from the database. */
|
williamr@2
|
80 |
EContactDbObserverEventGroupDeleted,
|
williamr@2
|
81 |
/** The current database has changed. */
|
williamr@2
|
82 |
EContactDbObserverEventCurrentDatabaseChanged,
|
williamr@2
|
83 |
/** The phone number assigned to one of the speed dial positions
|
williamr@2
|
84 |
has been replaced, removed or modified.*/
|
williamr@2
|
85 |
EContactDbObserverEventSpeedDialsChanged,
|
williamr@2
|
86 |
/** Not currently used. */
|
williamr@2
|
87 |
EContactDbObserverEventSortOrderChanged,
|
williamr@2
|
88 |
/** Contacts DB about to be backed up */
|
williamr@2
|
89 |
EContactDbObserverEventBackupBeginning,
|
williamr@2
|
90 |
/** Contacts DB about to be restored */
|
williamr@2
|
91 |
EContactDbObserverEventRestoreBeginning,
|
williamr@2
|
92 |
/** The backup/restore operation has completed. */
|
williamr@2
|
93 |
EContactDbObserverEventBackupRestoreCompleted,
|
williamr@2
|
94 |
/** The restore operation has completed but the database could not be opened. */
|
williamr@2
|
95 |
EContactDbObserverEventRestoreBadDatabase,
|
williamr@2
|
96 |
/** Database has been compressed. */
|
williamr@2
|
97 |
EContactDbObserverEventCompress
|
williamr@2
|
98 |
};
|
williamr@2
|
99 |
|
williamr@2
|
100 |
struct TContactDbObserverEvent
|
williamr@2
|
101 |
/** Contact database change event details. These include the type of change event
|
williamr@2
|
102 |
and the ID of the contact item affected by the change, if relevant.
|
williamr@2
|
103 |
|
williamr@2
|
104 |
An object of this type is passed to a contact database's change observer,
|
williamr@2
|
105 |
see MContactDbObserver::HandleDatabaseEventL().
|
williamr@2
|
106 |
@publishedAll
|
williamr@2
|
107 |
@released
|
williamr@2
|
108 |
*/
|
williamr@2
|
109 |
{
|
williamr@2
|
110 |
/** The change event type. */
|
williamr@2
|
111 |
TContactDbObserverEventType iType;
|
williamr@2
|
112 |
/** The ID of the contact item affected. */
|
williamr@2
|
113 |
TContactItemId iContactId;
|
williamr@2
|
114 |
/** Identifies which connection to the contacts server generated the event. Use
|
williamr@2
|
115 |
CContactDatabase::ConnectionId() to get the ID of the current connection.
|
williamr@2
|
116 |
|
williamr@2
|
117 |
Set to zero if the event has no meaningful connection ID. */
|
williamr@2
|
118 |
TUint iConnectionId;
|
williamr@2
|
119 |
};
|
williamr@2
|
120 |
|
williamr@2
|
121 |
class MContactDbObserver
|
williamr@2
|
122 |
/** The interface for an observer that handles changes to a contact database.
|
williamr@2
|
123 |
|
williamr@2
|
124 |
It specifies a single pure virtual function which should be implemented by
|
williamr@2
|
125 |
the observer class to test the type of the change event (see the TContactDbObserverEventType
|
williamr@2
|
126 |
enum) and handle it.
|
williamr@2
|
127 |
|
williamr@2
|
128 |
There is no need for the observer class to explicitly test for all possible
|
williamr@2
|
129 |
event types - the event is for information only and event types which are of no interest
|
williamr@2
|
130 |
to the observer class can safely be ignored.
|
williamr@2
|
131 |
|
williamr@2
|
132 |
The change event type (TContactDbObserverEventType) may be augmented
|
williamr@2
|
133 |
in future releases with additional values.
|
williamr@2
|
134 |
|
williamr@2
|
135 |
A contact database observer pointer is passed to the NewL() function for the
|
williamr@2
|
136 |
CContactChangeNotifier class.
|
williamr@2
|
137 |
@publishedAll
|
williamr@2
|
138 |
@released
|
williamr@2
|
139 |
*/
|
williamr@2
|
140 |
{
|
williamr@2
|
141 |
public:
|
williamr@2
|
142 |
/** Tests the contact database observer event type and handles it. The ID of a
|
williamr@2
|
143 |
contact affected by the change event, if relevant, can be retrieved via TContactDbObserverEvent::iContactId.
|
williamr@2
|
144 |
|
williamr@2
|
145 |
@param aEvent Provides information about the change event. */
|
williamr@2
|
146 |
virtual void HandleDatabaseEventL(TContactDbObserverEvent aEvent)=0;
|
williamr@2
|
147 |
};
|
williamr@2
|
148 |
|
williamr@2
|
149 |
|
williamr@2
|
150 |
#endif
|