|
1 /* |
|
2 * Copyright (c) 2008-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: Implementation of collection manager API for external use |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 #ifndef __C_GLXCOLLECTIONMANAGERIMPL_H__ |
|
22 #define __C_GLXCOLLECTIONMANAGERIMPL_H__ |
|
23 |
|
24 #include <e32base.h> |
|
25 #include <e32std.h> |
|
26 #include <mpxcollectionobserver.h> |
|
27 |
|
28 #include "glxcollectionmanager.h" |
|
29 |
|
30 class CGlxCollectionInfo; |
|
31 class MMPXCollectionUtility; |
|
32 class CMPXCollectionPath; |
|
33 |
|
34 /** |
|
35 * Collection manager internal implementation. |
|
36 * |
|
37 * @lib glxuiutilities.lib |
|
38 */ |
|
39 NONSHARABLE_CLASS( CGlxCollectionManagerImpl ) |
|
40 : public CBase, public MMPXCollectionObserver |
|
41 { |
|
42 public: |
|
43 /** |
|
44 * Constructor |
|
45 */ |
|
46 CGlxCollectionManagerImpl(); |
|
47 |
|
48 /** |
|
49 * Destructor |
|
50 */ |
|
51 ~CGlxCollectionManagerImpl(); |
|
52 |
|
53 /** |
|
54 * Adds a file to container asynchronously. |
|
55 * @param aUri URI of file to be added to the container. |
|
56 * @param aContainer Container to which item should be added. |
|
57 * @param aRequestStatus Request status that will be signalled when |
|
58 * request is complete or fails due to an error. aRequestStatus must |
|
59 * be an iStatus member variable of an active object. Using |
|
60 * User::WaitForRequest() will not work. |
|
61 */ |
|
62 void AddToContainerL(const TDesC& aUri, |
|
63 CGlxCollectionManager::TCollection aContainer, TRequestStatus& aRequestStatus); |
|
64 |
|
65 /** |
|
66 * Adds a file to container asynchronously. |
|
67 * @param aUri URI of file to be added to the container. |
|
68 * @param aConatinerId MDS ID of container (album, tag, etc.) |
|
69 * @param aRequestStatus Request status that will be signalled when |
|
70 * request is complete or fails due to an error. aRequestStatus must |
|
71 * be an iStatus member variable of an active object. Using |
|
72 * User::WaitForRequest() will not work. |
|
73 */ |
|
74 void AddToContainerL(const TDesC& aUri, |
|
75 TUint32 aContainerId, TRequestStatus& aRequestStatus); |
|
76 |
|
77 /** |
|
78 * Retrieves collection info |
|
79 * @param aRequestStatus Request status that will be signalled when |
|
80 * request is complete or fails due asynchronous error |
|
81 * @param aInfo Contain the collection information upon return |
|
82 * Must contain the collection info when called |
|
83 */ |
|
84 void CollectionInfoL(CGlxCollectionInfo& aInfo, |
|
85 TRequestStatus& aRequestStatus); |
|
86 |
|
87 /** |
|
88 * Cancel an outstanding request |
|
89 */ |
|
90 void Cancel(); |
|
91 |
|
92 public: // from MMPXCollectionObserver |
|
93 /** |
|
94 * See @ref MMPXCollectionObserver::HandleCollectionMessageL |
|
95 */ |
|
96 void HandleCollectionMessageL(const TMPXCollectionMessage& aMessage); |
|
97 |
|
98 /** |
|
99 * See @ref MMPXCollectionObserver::HandleCollectionMessageL |
|
100 */ |
|
101 void HandleCollectionMessageL(const CMPXMessage& aMsg); |
|
102 |
|
103 /** |
|
104 * See @ref MMPXCollectionObserver::HandleOpenL |
|
105 */ |
|
106 void HandleOpenL(const CMPXMedia& aEntries, |
|
107 TInt aIndex,TBool aComplete,TInt aError); |
|
108 /** |
|
109 * See @ref MMPXCollectionObserver::HandleOpenL |
|
110 */ |
|
111 void HandleOpenL(const CMPXCollectionPlaylist& aPlaylist ,TInt aError); |
|
112 |
|
113 /** |
|
114 * See @ref MMPXCollectionObserver::HandleCollectionMediaL |
|
115 */ |
|
116 void HandleCollectionMediaL(const CMPXMedia& aMedia, |
|
117 TInt aError); |
|
118 |
|
119 /** |
|
120 * See @ref MMPXCollectionObserver::HandleCommandComplete |
|
121 */ |
|
122 void HandleCommandComplete(CMPXCommand* aCommandResult, TInt aError); |
|
123 |
|
124 private: |
|
125 |
|
126 /** |
|
127 * Initialise the request. |
|
128 * Stores a pointer to aRequestStatus and sets aRequestStatus to KRequestPending. |
|
129 * @param aRequestStatus request to be signaled when asynchronous |
|
130 * operation completes. |
|
131 */ |
|
132 void InitializeRequest(TRequestStatus& aRequestStatus); |
|
133 |
|
134 /** |
|
135 * Completes the request. |
|
136 * Calls User::RequestComplete() on the request set by InitializeRequest(). |
|
137 * @aError error message passed to User::RequestComplete() |
|
138 */ |
|
139 void CompleteRequest(TInt aError); |
|
140 |
|
141 /** |
|
142 * Creates and opens an MPX collection utility. |
|
143 */ |
|
144 void OpenCollectionL(); |
|
145 |
|
146 /** |
|
147 * Closes the MPX collection utitlity. |
|
148 */ |
|
149 void CloseCollection(); |
|
150 |
|
151 /** |
|
152 * Performs the addition of an item to a container. |
|
153 * Assumes that the collection is open. |
|
154 */ |
|
155 void DoAddToContainerL(); |
|
156 |
|
157 /** |
|
158 * Helper method that is called by the two public AddToContainerL overloads |
|
159 * and in turn calls DoAddToContainer. |
|
160 * @param aUri URI of file to be added to the container. |
|
161 * @param aRequestStatus Request status that will be signalled when |
|
162 * request is complete or fails due to an error. aRequestStatus must |
|
163 * be an iStatus member variable of an active object. Using |
|
164 * User::WaitForRequest() will not work. |
|
165 */ |
|
166 void AddToContainerL(const TDesC& aUri, TRequestStatus& aRequestStatus); |
|
167 |
|
168 /* |
|
169 * Retrieves collection info |
|
170 * Assumes that the collection is open. |
|
171 */ |
|
172 void DoCollectionInfoL(); |
|
173 |
|
174 private: |
|
175 /** |
|
176 * Collection utitility (onwed) |
|
177 */ |
|
178 MMPXCollectionUtility* iCollectionUtility; |
|
179 |
|
180 /** |
|
181 * Collection UID. |
|
182 */ |
|
183 TUid iCollectionId; |
|
184 |
|
185 /** |
|
186 * Container id |
|
187 */ |
|
188 TMPXItemId iContainerId; |
|
189 |
|
190 /** |
|
191 * Uri (owned) |
|
192 */ |
|
193 HBufC* iUri; |
|
194 |
|
195 /** |
|
196 * Collection info (not owned) |
|
197 */ |
|
198 CGlxCollectionInfo* iCollectionInfo; |
|
199 |
|
200 /** |
|
201 * Request status (not owned) |
|
202 */ |
|
203 TRequestStatus* iRequestStatus; |
|
204 |
|
205 enum TState |
|
206 { |
|
207 EClosed, |
|
208 EOpeningForAdd, |
|
209 EOpeningForCollectionInfo, |
|
210 EOpening, |
|
211 EOpen, |
|
212 EAdding, |
|
213 ERequestingMedia |
|
214 }; |
|
215 |
|
216 /** |
|
217 * In the following states an asynchronous request is outstanding: |
|
218 * |
|
219 * EOpeningForAdd, |
|
220 * EOpeningForCollectionInfo |
|
221 * EOpening |
|
222 * EAdding |
|
223 * ERequestingMedia |
|
224 * |
|
225 */ |
|
226 TState iState; |
|
227 }; |
|
228 |
|
229 #endif // __C_GLXCOLLECTIONMANAGERIMPL_H__ |