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: mpxcollectionutility stub for testing mpmpxframeworkwrapper |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <mpxmedia.h> |
|
20 #include <mpxmessage.h> |
|
21 #include <mpxmessagegeneraldefs.h> |
|
22 #include <mpxcollectionmessage.h> |
|
23 #include <mpxcollectionmessagedefs.h> |
|
24 #include <mpxmediageneraldefs.h> |
|
25 #include <mpxmediacollectiondetaildefs.h> |
|
26 #include <mpxcollectionplugin.hrh> |
|
27 #include <mpxcollectionpath.h> |
|
28 #include "mptrace.h" |
|
29 #include <e32debug.h> |
|
30 |
|
31 #include "stub/inc/mpxcollectionutility.h" |
|
32 const TInt KMPXAllSongsViewIndex = 0; |
|
33 const TInt KMPXPlaylistViewIndex = 1; |
|
34 |
|
35 /*! |
|
36 Stub function. |
|
37 */ |
|
38 MMPXCollectionUtility::MMPXCollectionUtility():iBack(EFalse), |
|
39 iOpen(EFalse), |
|
40 iIndex(0), |
|
41 iOpenCount(0), |
|
42 iCountPath(0), |
|
43 iPlaylists(0), |
|
44 iAlbumSongs(0) |
|
45 { |
|
46 |
|
47 } |
|
48 |
|
49 /*! |
|
50 Stub function. |
|
51 */ |
|
52 MMPXCollectionUtility::~MMPXCollectionUtility() |
|
53 { |
|
54 if (iAlbumSongs) |
|
55 { |
|
56 delete iAlbumSongs; |
|
57 } |
|
58 if (iPlaylists) |
|
59 { |
|
60 delete iPlaylists; |
|
61 } |
|
62 } |
|
63 |
|
64 /*! |
|
65 Stub function. |
|
66 */ |
|
67 MMPXCollectionUtility* MMPXCollectionUtility::NewL(MMPXCollectionObserver* aObs, const TUid& aModeId) |
|
68 { |
|
69 Q_UNUSED(aObs); |
|
70 Q_UNUSED(aModeId); |
|
71 MMPXCollectionUtility* temp = new MMPXCollectionUtility(); |
|
72 return temp; |
|
73 } |
|
74 |
|
75 /*! |
|
76 Stub function. |
|
77 */ |
|
78 MMPXCollection& MMPXCollectionUtility::Collection() |
|
79 { |
|
80 return *this; |
|
81 } |
|
82 |
|
83 /*! |
|
84 Stub function. |
|
85 */ |
|
86 void MMPXCollectionUtility::Close() |
|
87 { |
|
88 delete this; |
|
89 } |
|
90 |
|
91 /*! |
|
92 Stub function. |
|
93 */ |
|
94 CMPXMedia* MMPXCollectionUtility::FindAllL(const CMPXSearchCriteria& aCriteria, |
|
95 const TArray<TMPXAttribute>& aAttrs) |
|
96 { |
|
97 Q_UNUSED(aAttrs); |
|
98 |
|
99 // Find Playlists |
|
100 if(aCriteria.IsSupported(KMPXMediaGeneralType) && EMPXGroup == aCriteria.ValueTObjectL<TMPXGeneralType>(KMPXMediaGeneralType) && |
|
101 aCriteria.IsSupported(KMPXMediaGeneralCategory) && EMPXPlaylist == aCriteria.ValueTObjectL<TMPXGeneralCategory>(KMPXMediaGeneralCategory)) |
|
102 { |
|
103 return CMPXMedia::NewL(*iPlaylists); |
|
104 } |
|
105 // Find Album with ID |
|
106 else if (aCriteria.IsSupported(KMPXMediaGeneralType) && EMPXGroup == aCriteria.ValueTObjectL<TMPXGeneralType>(KMPXMediaGeneralType) && |
|
107 aCriteria.IsSupported(KMPXMediaGeneralCategory) && EMPXSong == aCriteria.ValueTObjectL<TMPXGeneralCategory>(KMPXMediaGeneralCategory) && |
|
108 aCriteria.IsSupported(KMPXMediaGeneralId) && iAlbumSongs && |
|
109 //it is assumed that album ID matches index on the media array, just to make test logic more simple. |
|
110 TUint32(aCriteria.ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId)) >= 0 && TUint32(aCriteria.ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId)) < iAlbumSongs->Count()) |
|
111 { |
|
112 return CMPXMedia::NewL(*iAlbumSongs->AtL(aCriteria.ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId))); |
|
113 } |
|
114 else |
|
115 { |
|
116 return NULL; |
|
117 } |
|
118 |
|
119 } |
|
120 |
|
121 /*! |
|
122 Stub function. |
|
123 */ |
|
124 void MMPXCollectionUtility::CancelRequest() |
|
125 { |
|
126 } |
|
127 |
|
128 /*! |
|
129 Stub function. |
|
130 */ |
|
131 void MMPXCollectionUtility::BackL() |
|
132 { |
|
133 iBack = ETrue; |
|
134 } |
|
135 |
|
136 /*! |
|
137 Stub function. |
|
138 */ |
|
139 CMPXCollectionPath* MMPXCollectionUtility::PathL() |
|
140 { |
|
141 CMPXCollectionPath* path = CMPXCollectionPath::NewL(); |
|
142 CleanupStack::PushL( path ); |
|
143 path->AppendL( TUid::Uid(EMPXCollectionPluginMusic).iUid ); |
|
144 path->AppendL( KMPXPlaylistViewIndex ); |
|
145 //Fake some elements for the path |
|
146 for(TInt i = 0; i < 10; i++){ |
|
147 path->InsertL(TUid::Uid(EMPXCollectionPluginMusic).iUid,0); |
|
148 } |
|
149 CleanupStack::Pop( path ); |
|
150 |
|
151 return path; |
|
152 } |
|
153 |
|
154 /*! |
|
155 Stub function. |
|
156 */ |
|
157 TUid MMPXCollectionUtility::CollectionIDL(const TArray<TUid>& aUids) |
|
158 { |
|
159 Q_UNUSED(aUids); |
|
160 return TUid::Uid(EMPXCollectionPluginMusic); |
|
161 } |
|
162 |
|
163 /*! |
|
164 Stub function. |
|
165 */ |
|
166 void MMPXCollectionUtility::OpenL(TMPXOpenMode aMode) |
|
167 { |
|
168 Q_UNUSED(aMode); |
|
169 iOpen = ETrue; |
|
170 } |
|
171 |
|
172 /*! |
|
173 Stub function. |
|
174 */ |
|
175 void MMPXCollectionUtility::OpenL(TInt aIndex,TMPXOpenMode aMode) |
|
176 { |
|
177 Q_UNUSED(aMode); |
|
178 iIndex = aIndex; |
|
179 iOpen = ETrue; |
|
180 } |
|
181 |
|
182 /*! |
|
183 Stub function. |
|
184 */ |
|
185 void MMPXCollectionUtility::OpenL(const CMPXCollectionPath& aPath, TMPXOpenMode aMode) |
|
186 { |
|
187 Q_UNUSED(aMode); |
|
188 iCountPath = aPath.Count(); |
|
189 iOpen = ETrue; |
|
190 iOpenCount++; |
|
191 } |
|
192 |
|
193 /*! |
|
194 Stub function. |
|
195 */ |
|
196 void MMPXCollectionUtility::setPlaylists( const CMPXMedia& entries ) |
|
197 { |
|
198 delete iPlaylists; |
|
199 iPlaylists = 0; |
|
200 iPlaylists = CMPXMedia::NewL(entries); |
|
201 } |
|
202 |
|
203 //end of file |
|