|
1 /* |
|
2 * Copyright (c) 2006 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: Contains CNcdFavoriteManagerProxy class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef NCD_FAVORITE_MANAGER_PROXY_H |
|
20 #define NCD_FAVORITE_MANAGER_PROXY_H |
|
21 |
|
22 #include "ncdinterfacebaseproxy.h" |
|
23 #include "ncdfavoritemanager.h" |
|
24 |
|
25 class CNcdNodeManagerProxy; |
|
26 class CNcdNodeIdentifier; |
|
27 class CNcdNodeDisclaimerProxy; |
|
28 class CNcdNodeProxy; |
|
29 |
|
30 /** |
|
31 * Proxy side object of favorite manager. Implements the MNcdFavoriteManager |
|
32 * interface used by UI. The class contains a list of all the favorite nodes. |
|
33 */ |
|
34 class CNcdFavoriteManagerProxy: public CNcdInterfaceBaseProxy, |
|
35 public MNcdFavoriteManager |
|
36 { |
|
37 public: |
|
38 /** |
|
39 * NewL |
|
40 * |
|
41 * @param aSession The session between the client proxy and the |
|
42 * corresponding server object. |
|
43 * @param aHandle The handle which identifies the server object |
|
44 * that this proxy uses. |
|
45 * @param aParent Parent whose reference count AddRef of this |
|
46 * object increments. |
|
47 * @param aNodeManager This class uses node manager to get the nodes. |
|
48 * @return CNcdFavoriteManagerProxy* Pointer to the created object |
|
49 * of this class. |
|
50 */ |
|
51 static CNcdFavoriteManagerProxy* NewL( |
|
52 MCatalogsClientServer& aSession, |
|
53 TInt aHandle, |
|
54 CCatalogsInterfaceBase* aParent, |
|
55 CNcdNodeManagerProxy& aNodeManager ); |
|
56 |
|
57 /** |
|
58 * NewLC |
|
59 * |
|
60 * @param aSession The session between the client proxy and the |
|
61 * corresponding server object. |
|
62 * @param aHandle The handle which identifies the server object |
|
63 * that this proxy uses. |
|
64 * @param aParent Parent whose reference count AddRef of this |
|
65 * object increments. |
|
66 * @param aNodeManager This class uses node manager to get the nodes. |
|
67 * @return CNcdFavoriteManagerProxy* Pointer to the created object |
|
68 * of this class. |
|
69 */ |
|
70 static CNcdFavoriteManagerProxy* NewLC( |
|
71 MCatalogsClientServer& aSession, |
|
72 TInt aHandle, |
|
73 CCatalogsInterfaceBase* aParent, |
|
74 CNcdNodeManagerProxy& aNodeManager ); |
|
75 |
|
76 /** |
|
77 * Destructor. |
|
78 */ |
|
79 virtual ~CNcdFavoriteManagerProxy(); |
|
80 |
|
81 /** |
|
82 * Tells whether the given node is a favorite node. The node is |
|
83 * favorite if its metadata is favorite. |
|
84 * |
|
85 * @param aNodeIdentifier The identifier. |
|
86 * @return ETrue if favorite, otherwise EFalse. |
|
87 */ |
|
88 TBool IsFavoriteL( const CNcdNodeIdentifier& aNodeIdentifier ) const; |
|
89 |
|
90 /** |
|
91 * Adds the given identifier to favorite list. |
|
92 * |
|
93 * @param aNodeIdentifier The identifier. |
|
94 * @param aRemoveOnDisconnect If true, the node is removed from favorites when |
|
95 * the client-server session is closed. |
|
96 */ |
|
97 void AddToFavoritesL( |
|
98 const CNcdNodeIdentifier& aNodeIdentifier, TBool aRemoveOnDisconnect ); |
|
99 |
|
100 /** |
|
101 * Removes the given identifier from favorites list. |
|
102 * |
|
103 * @param aNodeIdentifier The identifier. |
|
104 */ |
|
105 void RemoveFromFavoritesL( const CNcdNodeIdentifier& aNodeIdentifier ); |
|
106 |
|
107 /** |
|
108 * Sets or removes the disclaimer of the favorite node. |
|
109 * |
|
110 * @param aNodeIdentifier The favorite node identifier. |
|
111 * @param aDisclaimerOwner The owner of the disclaimer, to unset disclaimer, give NULL. |
|
112 * Ownership is not transferred. |
|
113 * @exception Leave KErrArgument If the node is not a favorite node. |
|
114 */ |
|
115 void SetNodeDisclaimerL( |
|
116 const CNcdNodeIdentifier& aNodeIdentifier, |
|
117 MNcdNode* aDisclaimerOwner ); |
|
118 |
|
119 /** |
|
120 * Returns the disclaimer of the favorite node or NULL if the node |
|
121 * has not a disclaimer. |
|
122 * |
|
123 * @param aNodeIdentifier The node. |
|
124 * @return The disclaimer. |
|
125 * @exception Leave KErrArgument If the node is not a favorite node. |
|
126 */ |
|
127 CNcdNodeDisclaimerProxy* NodeDisclaimerL( |
|
128 const CNcdNodeIdentifier& aNodeIdentifier ); |
|
129 |
|
130 /** |
|
131 * Returns the favorite node which has the given metadata or NULL |
|
132 * if there is no such favorite node. |
|
133 * |
|
134 * @param aMetaDataIdentifier The metadata identifier. |
|
135 * @return The node or NULL. Ownership is NOT transferred. |
|
136 */ |
|
137 CNcdNodeProxy* FavoriteNodeByMetaDataL( |
|
138 const CNcdNodeIdentifier& aMetaDataIdentifier ) const; |
|
139 |
|
140 |
|
141 /** |
|
142 * Internalizes the favorite list from server side favorite manager. |
|
143 */ |
|
144 void InternalizeL(); |
|
145 |
|
146 |
|
147 public: // From MNcdFavoriteManager |
|
148 |
|
149 /** |
|
150 * @see MNcdFavoriteManager::FavoriteNodeCount |
|
151 */ |
|
152 virtual TInt FavoriteNodeCount() const; |
|
153 |
|
154 /** |
|
155 * @see MNcdFavoriteManager::FavoriteNodeL |
|
156 */ |
|
157 virtual MNcdNode* FavoriteNodeL( TInt aIndex ) const; |
|
158 |
|
159 /** |
|
160 * @see MNcdFavoriteManager::FavoriteIndexL |
|
161 */ |
|
162 virtual TInt FavoriteIndexL( |
|
163 const TDesC& aNamespace, const TDesC& aId ) const; |
|
164 |
|
165 /** |
|
166 * @see MNcdFavoriteManager::ClearFavoritesL |
|
167 */ |
|
168 virtual void ClearFavoritesL(); |
|
169 |
|
170 protected: |
|
171 |
|
172 /** |
|
173 * Constructor. |
|
174 * @param aSession The session between the client proxy and the |
|
175 * corresponding server object. |
|
176 * @param aHandle The handle which identifies the server object |
|
177 * that this proxy uses. |
|
178 * @param aParent Parent whose reference count AddRef of this |
|
179 * object increments. |
|
180 * @param aNodeManager This class uses node manager to get the nodes. |
|
181 */ |
|
182 CNcdFavoriteManagerProxy( |
|
183 MCatalogsClientServer& aSession, |
|
184 TInt aHandle, |
|
185 CCatalogsInterfaceBase* aParent, |
|
186 CNcdNodeManagerProxy& aNodeManager ); |
|
187 |
|
188 /** |
|
189 * ConstructL. |
|
190 */ |
|
191 void ConstructL(); |
|
192 |
|
193 |
|
194 /** |
|
195 * Internalizes the favorite list from the given stream. |
|
196 * |
|
197 * @param aStream The stream. |
|
198 */ |
|
199 void InternalizeDataL( RReadStream& aStream ); |
|
200 |
|
201 /** |
|
202 * Returns the actual favorite node identifier, which has the same |
|
203 * metadata id as the given node. Returns NULL if there is no such |
|
204 * favorite node. |
|
205 * |
|
206 * @param aNodeIdentifier The node identifier. |
|
207 * @return The actual favorite node identifier, or NULL. Ownership is NOT |
|
208 * transferred. |
|
209 */ |
|
210 CNcdNodeIdentifier* ActualFavoriteIdentifierL( |
|
211 const CNcdNodeIdentifier& aNodeIdentifier ) const; |
|
212 |
|
213 /** |
|
214 * Returns the favorite node identifier which has the given metadata identifier. |
|
215 * If there is no such favorite node, return NULL. |
|
216 * |
|
217 * @param aMetaDataIdentifier The metadata identifier. |
|
218 * @return The favorite node identifier, or NULL. Ownership is not |
|
219 * transferred. |
|
220 */ |
|
221 CNcdNodeIdentifier* FavoriteIdentifierByMetaDataL( |
|
222 const CNcdNodeIdentifier& aMetaDataIdentifier ) const; |
|
223 |
|
224 private: |
|
225 // Node manager. |
|
226 CNcdNodeManagerProxy& iNodeManager; |
|
227 |
|
228 // Favorite nodes. |
|
229 RPointerArray<CNcdNodeIdentifier> iFavoriteNodes; |
|
230 }; |
|
231 |
|
232 |
|
233 #endif |