85
|
1 |
/*
|
|
2 |
* Copyright (c) 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 |
#ifndef CACLIENTNOTIFIERPROXY_H
|
|
19 |
#define CACLIENTNOTIFIERPROXY_H
|
|
20 |
|
|
21 |
#include <QObject>
|
|
22 |
#include <QMutex>
|
|
23 |
|
|
24 |
#include "caclient_global.h"
|
|
25 |
#include "cadefs.h"
|
|
26 |
#include "canotifier_p.h"
|
|
27 |
|
|
28 |
class CaEntry;
|
|
29 |
class CaNotifierFilter;
|
|
30 |
|
|
31 |
/**
|
|
32 |
* IDataObserver
|
|
33 |
*
|
|
34 |
*/
|
|
35 |
class IDataObserver
|
|
36 |
{
|
|
37 |
public:
|
|
38 |
/**
|
|
39 |
* Method invoked when entry is changed.
|
|
40 |
* @param entryId entry id.
|
|
41 |
* @param changeType change type.
|
|
42 |
*/
|
|
43 |
virtual void entryChanged(int entryId,
|
87
|
44 |
ChangeType changeType) const = 0;
|
85
|
45 |
|
|
46 |
/**
|
|
47 |
* Method invoked when entry is changed.
|
|
48 |
* @param entry entry.
|
|
49 |
* @param changeType change type.
|
|
50 |
*/
|
|
51 |
virtual void entryChanged(const CaEntry &entry,
|
87
|
52 |
ChangeType changeType) const = 0;
|
85
|
53 |
|
|
54 |
/**
|
|
55 |
* Method invoked when entry was changed.
|
|
56 |
* @param entryId entry id.
|
|
57 |
*/
|
|
58 |
virtual void entryTouched(int id) const = 0;
|
|
59 |
|
|
60 |
/**
|
|
61 |
* Method invoked when entry was changed.
|
|
62 |
* @param groupId group id.
|
|
63 |
*/
|
|
64 |
virtual void groupContentChanged(int groupId) const = 0;
|
|
65 |
};
|
|
66 |
|
|
67 |
|
|
68 |
class CACLIENT_EXPORT CaClientNotifierProxy: public QObject
|
|
69 |
{
|
87
|
70 |
Q_OBJECT
|
85
|
71 |
|
|
72 |
public:
|
|
73 |
|
|
74 |
/**
|
|
75 |
* Constructor.
|
|
76 |
* @param parent pointer to parent. Defaults to NULL.
|
|
77 |
*/
|
|
78 |
explicit CaClientNotifierProxy(QObject *parent = 0);
|
|
79 |
|
|
80 |
/**
|
|
81 |
* Destructor.
|
|
82 |
*/
|
|
83 |
~CaClientNotifierProxy();
|
|
84 |
|
|
85 |
/**
|
|
86 |
* Method invoked when entry is changed.
|
|
87 |
* @param entryId entry id.
|
|
88 |
* @param changeType change type.
|
|
89 |
*/
|
|
90 |
virtual void entryChanged(int entryId, ChangeType changeType) const;
|
|
91 |
|
|
92 |
/**
|
|
93 |
* Method invoked when entry is changed.
|
|
94 |
* @param entry entry.
|
|
95 |
* @param changeType change type.
|
|
96 |
*/
|
|
97 |
virtual void entryChanged(const CaEntry &entry,
|
87
|
98 |
ChangeType changeType) const;
|
85
|
99 |
|
|
100 |
/**
|
|
101 |
* Method invoked when entry was changed.
|
|
102 |
* @param entryId entry id.
|
|
103 |
*/
|
|
104 |
virtual void entryTouched(int id) const;
|
|
105 |
|
|
106 |
/**
|
|
107 |
* Method invoked when entry was changed.
|
|
108 |
* @param groupId group id.
|
|
109 |
*/
|
|
110 |
virtual void groupContentChanged(int groupId) const;
|
|
111 |
|
|
112 |
/**
|
|
113 |
* Method for registering notifier
|
|
114 |
*
|
|
115 |
* @param notifierFilter notifierFilter used to register notifier.
|
|
116 |
* @param notifierType type of notifier
|
|
117 |
* @return error code
|
|
118 |
*/
|
|
119 |
int registerNotifier(
|
|
120 |
const CaNotifierFilter *notifierFilter,
|
|
121 |
CaNotifierPrivate::NotifierType notifierType,
|
|
122 |
const CaClientNotifierProxy *notifierProxy);
|
|
123 |
|
|
124 |
/**
|
|
125 |
* Method for unregistering notifier.
|
|
126 |
*
|
|
127 |
* @param notifierFilter notifierFilter used to unregister notifier.
|
|
128 |
* @param notifierType type of notifier
|
|
129 |
*/
|
|
130 |
void unregisterNotifier(
|
|
131 |
const CaNotifierFilter ¬ifierFilter,
|
|
132 |
CaNotifierPrivate::NotifierType notifierType);
|
|
133 |
|
|
134 |
signals:
|
|
135 |
|
|
136 |
void signalEntryChanged(int entryId, ChangeType changeType) const;
|
|
137 |
void signalEntryChanged(const CaEntry &entry,
|
87
|
138 |
ChangeType changeType) const;
|
85
|
139 |
void signalEntryTouched(int id) const;
|
|
140 |
void signalGroupContentChanged(int groupId) const;
|
|
141 |
|
|
142 |
private:
|
|
143 |
|
|
144 |
// Mutex to serialize registering/unregistering for notifications.
|
|
145 |
QMutex mMutex;
|
|
146 |
|
|
147 |
Q_DISABLE_COPY(CaClientNotifierProxy)
|
|
148 |
};
|
|
149 |
|
|
150 |
#endif //_CACLIENTNOTIFIERPROXY_H
|