|
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 CNcdNodeIconProxy class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_NCDNODEICONPROXY_H |
|
20 #define C_NCDNODEICONPROXY_H |
|
21 |
|
22 |
|
23 // For the streams |
|
24 #include <s32mem.h> |
|
25 |
|
26 #include "ncdinterfacebaseproxy.h" |
|
27 #include "ncdnodeicon.h" |
|
28 |
|
29 class CNcdNodeMetadataProxy; |
|
30 |
|
31 |
|
32 /** |
|
33 * This class implements the functionality for the |
|
34 * MNcdNodeIcon interfaces. The interface is provided for |
|
35 * API users. |
|
36 * |
|
37 * @since S60 v3.2 |
|
38 */ |
|
39 class CNcdNodeIconProxy : public CNcdInterfaceBaseProxy, |
|
40 public MNcdNodeIcon |
|
41 { |
|
42 |
|
43 public: |
|
44 |
|
45 /** |
|
46 * @param aSession The session between the client proxy and the |
|
47 * corresponding server object. |
|
48 * @param aHandle The handle which identifies the server object |
|
49 * that this proxy uses. |
|
50 * @param aMetadata Owns and uses the information of this proxy. |
|
51 * The metadata also keeps track of the refence counts of its objects. |
|
52 * And handles the deletion of these objects when the total reference |
|
53 * count reaches zero. |
|
54 * @return CNcdNodeIconProxy* Pointer to the created object |
|
55 * of this class. |
|
56 */ |
|
57 static CNcdNodeIconProxy* NewL( |
|
58 MCatalogsClientServer& aSession, |
|
59 TInt aHandle, |
|
60 CNcdNodeMetadataProxy& aMetadata ); |
|
61 |
|
62 /** |
|
63 * @param aSession The session between the client proxy and the |
|
64 * corresponding server object. |
|
65 * @param aHandle The handle which identifies the server object |
|
66 * that this proxy uses. |
|
67 * @param aMetadata Owns and uses the information of this proxy. |
|
68 * The metadata also keeps track of the refence counts of its objects. |
|
69 * And handles the deletion of these objects when the total reference |
|
70 * count reaches zero. |
|
71 * @return CNcdNodeIconProxy* Pointer to the created object |
|
72 * of this class. |
|
73 */ |
|
74 static CNcdNodeIconProxy* NewLC( |
|
75 MCatalogsClientServer& aSession, |
|
76 TInt aHandle, |
|
77 CNcdNodeMetadataProxy& aMetadata ); |
|
78 |
|
79 |
|
80 /** |
|
81 * Destructor. |
|
82 * The destructor is set public. So, the node that owns the icon may |
|
83 * delete it directly when the reference count of the node reaches zero |
|
84 * and the destructor of the node is called. |
|
85 */ |
|
86 virtual ~CNcdNodeIconProxy(); |
|
87 |
|
88 |
|
89 /** |
|
90 * @return CNcdNodeMetadataProxy& The metadata that owns this object. |
|
91 * @exception KNcdErrorObsolete if the object has been set as obsolete. Then, we |
|
92 * cannot be sure if the original metadata still exists because it is not the parent |
|
93 * of this class object anymore. |
|
94 */ |
|
95 CNcdNodeMetadataProxy& MetadataL() const; |
|
96 |
|
97 |
|
98 /** |
|
99 * Gets the data for descriptors from the server side. This function is |
|
100 * called to update proxy data. The function uses the protected virtual |
|
101 * internalize functions. So, the child classes may provide their own |
|
102 * implementations for internalizations of certain metadata. |
|
103 */ |
|
104 void InternalizeL(); |
|
105 |
|
106 |
|
107 public: // MNcdNodeIcon |
|
108 |
|
109 /** |
|
110 * @see MNcdNodeIcon::IconId |
|
111 */ |
|
112 const TDesC& IconId() const; |
|
113 |
|
114 /** |
|
115 * NOTE: Currently protocol does not offer mime type! |
|
116 * This function returns KNullDesC! |
|
117 * @see MNcdNodeIcon::IconMimeType |
|
118 */ |
|
119 const TDesC& IconMimeType() const; |
|
120 |
|
121 /** |
|
122 * @see MNcdNodeIcon::LoadIconL |
|
123 */ |
|
124 MNcdDownloadOperation* LoadIconL( |
|
125 MNcdDownloadOperationObserver* aObserver ); |
|
126 |
|
127 /** |
|
128 * @see MNcdNodeIcon::IconDataL |
|
129 */ |
|
130 HBufC8* IconDataL(); |
|
131 |
|
132 |
|
133 protected: |
|
134 |
|
135 /** |
|
136 * Constructor |
|
137 * |
|
138 * @param aSession The session between the client proxy and the |
|
139 * corresponding server object. |
|
140 * @param aHandle The handle which identifies the server object |
|
141 * that this proxy uses. |
|
142 * @param aMetadata Owns and uses the information of this proxy. |
|
143 * The metadata also keeps track of the refence counts of its objects. |
|
144 * And handles the deletion of these objects when the total reference |
|
145 * count reaches zero. |
|
146 * @return CNcdNodeIconProxy* Pointer to the created object |
|
147 * of this class. |
|
148 */ |
|
149 CNcdNodeIconProxy( |
|
150 MCatalogsClientServer& aSession, |
|
151 TInt aHandle, |
|
152 CNcdNodeMetadataProxy& aMetadata ); |
|
153 |
|
154 |
|
155 /** |
|
156 * ConstructL |
|
157 */ |
|
158 virtual void ConstructL(); |
|
159 |
|
160 |
|
161 /** |
|
162 * @return TBool ETrue if this object has been set as obsolete. |
|
163 */ |
|
164 TBool IsObsolete() const; |
|
165 |
|
166 /** |
|
167 * @param aObsolete ETrue if the object should be set as obsolete else EFalse. |
|
168 */ |
|
169 void SetObsolete( TBool aObsolete ); |
|
170 |
|
171 |
|
172 void InternalizeDataL( RReadStream& aStream ); |
|
173 |
|
174 |
|
175 private: |
|
176 |
|
177 // Prevent if not implemented |
|
178 CNcdNodeIconProxy( const CNcdNodeIconProxy& aObject ); |
|
179 CNcdNodeIconProxy& operator =( const CNcdNodeIconProxy& aObject ); |
|
180 |
|
181 |
|
182 private: // data |
|
183 |
|
184 CNcdNodeMetadataProxy& iMetadata; |
|
185 |
|
186 HBufC* iIconId; |
|
187 |
|
188 TBool iObsolete; |
|
189 }; |
|
190 |
|
191 |
|
192 #endif // C_NCDNODEICONPROXY_H |