20
|
1 |
/*
|
|
2 |
* Copyright (c) 2008 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: Handles music store integration.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#ifndef FMRADIOMUSICSTOREHANDLER_H
|
|
20 |
#define FMRADIOMUSICSTOREHANDLER_H
|
|
21 |
|
|
22 |
#include <e32base.h>
|
|
23 |
|
|
24 |
class CEikMenuPane;
|
|
25 |
class CRepository;
|
|
26 |
|
|
27 |
/**
|
|
28 |
* Handler for Music Store.
|
|
29 |
*
|
|
30 |
* Takes care of Nokia music store and operator specific music store.
|
|
31 |
*
|
|
32 |
* Provides also a interface to open a web page.
|
|
33 |
*/
|
|
34 |
class CFMRadioMusicStoreHandler : public CBase
|
|
35 |
{
|
|
36 |
private:
|
|
37 |
/**
|
|
38 |
* Used for tracking the visibility state.
|
|
39 |
*/
|
|
40 |
enum TFMRadioMusicStoreState
|
|
41 |
{
|
|
42 |
EFMRadioMusicStoreUninitialized,
|
|
43 |
EFMRadioMusicStoreEnabled,
|
|
44 |
EFMRadioMusicStoreDisabled,
|
|
45 |
EFMRadioMusicStoreForceEnabled
|
|
46 |
};
|
|
47 |
|
|
48 |
/**
|
|
49 |
* Distinguishes between different implementation types of music store.
|
|
50 |
*/
|
|
51 |
enum TFMRadioOperatorAppType
|
|
52 |
{
|
|
53 |
EFMRadioAppNotAvailable,
|
|
54 |
EFMRadioNativeApp,
|
|
55 |
EFMRadioJavaApp,
|
|
56 |
EFMRadioWebsite
|
|
57 |
};
|
|
58 |
|
|
59 |
public:
|
|
60 |
/**
|
|
61 |
* Two-phase constructor of CMusicStoreHandler.
|
|
62 |
*
|
|
63 |
* @param aResourceId Menu pane where the music store item/items
|
|
64 |
* will be added.
|
|
65 |
*/
|
|
66 |
static CFMRadioMusicStoreHandler* NewL( TInt aResourceId );
|
|
67 |
|
|
68 |
/**
|
|
69 |
* Destructor
|
|
70 |
*/
|
|
71 |
~CFMRadioMusicStoreHandler();
|
|
72 |
|
|
73 |
/**
|
|
74 |
* Checks wether given command id is for music store functionality.
|
|
75 |
*
|
|
76 |
* @param aCommandId command id to check
|
|
77 |
* @returns ETrue for music store command ids
|
|
78 |
*/
|
|
79 |
TBool IsMusicStoreCommandId( TInt aCommandId );
|
|
80 |
|
|
81 |
/**
|
|
82 |
* This is called when dynamically initializing menu (ie, from DynInitMenuPaneL).
|
|
83 |
*
|
|
84 |
* @param aResourceId Resource id for currently processed menu part
|
|
85 |
* @param aMenuPane Menu pane which is being handled
|
|
86 |
* @returns ETrue, if menu pane was handled by this method
|
|
87 |
*/
|
|
88 |
TBool InitializeMenuL( TInt aResourceId, CEikMenuPane* aMenuPane );
|
|
89 |
|
|
90 |
/**
|
|
91 |
* The value given will be used as a guideline to wether to show or hide the item.
|
|
92 |
* If music shop feature is not supported and this is called with ETrue it will
|
|
93 |
* not show the item unless forced state is used.
|
|
94 |
*
|
|
95 |
* @param aEnable Whether enable or disable the item
|
|
96 |
* @param aForce Whether the state is forced, by default it is not
|
|
97 |
*/
|
|
98 |
void EnableMusicStore( TBool aEnable, TBool aForce = EFalse );
|
|
99 |
|
|
100 |
/**
|
|
101 |
* Launches Music store based on command id.
|
|
102 |
*
|
|
103 |
* @param aCommandId Command id for menu item
|
|
104 |
* @param aArtist Artist of the single
|
|
105 |
* @param aAlbum Album of the single
|
|
106 |
* @param aTitle Name of the single
|
|
107 |
*/
|
|
108 |
void LaunchMusicStoreL( TInt aCommandId,
|
|
109 |
const TDesC& aTitle,
|
|
110 |
const TDesC& aArtist,
|
|
111 |
const TDesC& aAlbum );
|
|
112 |
|
|
113 |
/**
|
|
114 |
* Launches web page based on given string.
|
|
115 |
*
|
|
116 |
* @param aWebpage Web site to be launched
|
|
117 |
*/
|
|
118 |
void LaunchWebPageL( const TDesC& aWebpage );
|
|
119 |
|
|
120 |
/**
|
|
121 |
* Is Nokia Music shop available
|
|
122 |
* @returns ETrue if available
|
|
123 |
*/
|
|
124 |
TBool NokiaMusicStoreAvailable();
|
|
125 |
|
|
126 |
/**
|
|
127 |
* Is Operator music store available
|
|
128 |
* @returns ETrue if available
|
|
129 |
*/
|
|
130 |
TBool OperatorMusicStoreAvailable();
|
|
131 |
|
|
132 |
/**
|
|
133 |
* Check if the music store functionality has been enabled
|
|
134 |
* @return state
|
|
135 |
*/
|
|
136 |
TBool IsMusicStoreEnabled();
|
|
137 |
|
|
138 |
/**
|
|
139 |
* returns name of the operator music store
|
|
140 |
* @return name
|
|
141 |
*/
|
|
142 |
const TDesC& OperatorMusicStoreName() const;
|
|
143 |
|
|
144 |
private:
|
|
145 |
/**
|
|
146 |
* Default C++ constuctor
|
|
147 |
*
|
|
148 |
* @param aResourceId Menu pane where the music store item/items
|
|
149 |
* will be added.
|
|
150 |
*/
|
|
151 |
CFMRadioMusicStoreHandler( TInt aResourceId );
|
|
152 |
|
|
153 |
/**
|
|
154 |
* Second-phase constructor
|
|
155 |
*/
|
|
156 |
void ConstructL();
|
|
157 |
|
|
158 |
/**
|
|
159 |
* Finds out the type of operator specific music store.
|
|
160 |
*
|
|
161 |
* @param aRepository Cenrep from which information is sought.
|
|
162 |
* @returns Application type if available, otherwise EFMRadioAppNotAvailable
|
|
163 |
*/
|
|
164 |
TFMRadioOperatorAppType CheckOperatorMusicStoreTypeL( CRepository& aRepository );
|
|
165 |
|
|
166 |
/**
|
|
167 |
* Called for application type specific initialization.
|
|
168 |
*
|
|
169 |
* @param aRepository Cenrep from which information is sought.
|
|
170 |
* @param aAppType Type of implementation to be initialized.
|
|
171 |
*/
|
|
172 |
void InitializeParametersL( CRepository& aRepository, TFMRadioOperatorAppType aAppType );
|
|
173 |
|
|
174 |
/**
|
|
175 |
* Called when native music store needs initializing.
|
|
176 |
*
|
|
177 |
* @param aMusicstoreUid P&S UID for initializing music shop
|
|
178 |
*/
|
|
179 |
void InitializeMusicStore( TUid aMusicstoreUid );
|
|
180 |
|
|
181 |
/**
|
|
182 |
* Returns the count of active music stores.
|
|
183 |
*
|
|
184 |
* @returns Active music store count
|
|
185 |
*/
|
|
186 |
TInt MusicStoreCount();
|
|
187 |
|
|
188 |
/**
|
|
189 |
* Creates the search string for Nokia Music Shop application
|
|
190 |
*
|
|
191 |
* @param aArtistName Artist of the single
|
|
192 |
* @param aAlbumName Album of the single
|
|
193 |
* @param aSongName Name of the single
|
|
194 |
* @returns search string and pushes it to cleanup stack.
|
|
195 |
*/
|
|
196 |
HBufC* NokiaMusicShopSearchL( const TDesC& aSongName,
|
|
197 |
const TDesC& aArtistName,
|
|
198 |
const TDesC& aAlbumName );
|
|
199 |
|
|
200 |
/**
|
|
201 |
* Handles calling appropriate operator music store implementation
|
|
202 |
*
|
|
203 |
* @param aSearchString string used for searching
|
|
204 |
*/
|
|
205 |
void LaunchOperatorMusicStoreL( const TDesC& aSearchString );
|
|
206 |
|
|
207 |
/**
|
|
208 |
* Launches Nokia Music shop application
|
|
209 |
*
|
|
210 |
* @param aMusicshopUid UID of the music shop
|
|
211 |
* @param aSearchString string used for searching
|
|
212 |
*/
|
|
213 |
void LaunchMusicShopL( TUid aMusicshopUid, const TDesC& aSearchString );
|
|
214 |
|
|
215 |
/**
|
|
216 |
* Converts binary data from cenrep to Uint32 presentation
|
|
217 |
* @param aBuf binary data from cenrep
|
|
218 |
* @return resolved Uint32 number
|
|
219 |
*/
|
|
220 |
TUint32 Uint32Presentation( const TDesC8& aBuf );
|
|
221 |
|
|
222 |
/**
|
|
223 |
* Checks if the application with the given uid is installed to the system
|
|
224 |
* @param aAppUid Application uid
|
|
225 |
* @return true if app is found
|
|
226 |
*/
|
|
227 |
TBool IsAppInstalledL( const TUid& aAppUid );
|
|
228 |
|
|
229 |
private: // members
|
|
230 |
/**
|
|
231 |
* Resource id to which music store option will be bound.
|
|
232 |
*/
|
|
233 |
TInt iResourceId;
|
|
234 |
|
|
235 |
/**
|
|
236 |
* This is used for with isMenuInitialized so that it is not needed
|
|
237 |
* to go through all items in case we don't find the music store item.
|
|
238 |
*/
|
|
239 |
TInt iFirstKnownResourceId;
|
|
240 |
|
|
241 |
/**
|
|
242 |
* Saves the state of Music store item
|
|
243 |
*/
|
|
244 |
TFMRadioMusicStoreState iState;
|
|
245 |
|
|
246 |
/**
|
|
247 |
* Nokia Music store UID
|
|
248 |
*/
|
|
249 |
TUint32 iMusicStoreUID;
|
|
250 |
|
|
251 |
/**
|
|
252 |
* Display name for operator music store
|
|
253 |
*/
|
|
254 |
RBuf iOperatorMusicStoreName;
|
|
255 |
|
|
256 |
/**
|
|
257 |
* UID for Operator music store (native app.)
|
|
258 |
*/
|
|
259 |
TUint32 iOperatorStoreNativeUID;
|
|
260 |
|
|
261 |
/*
|
|
262 |
* UID for operator java client app
|
|
263 |
*/
|
|
264 |
TUid iOperatorJavaMusicStoreUID;
|
|
265 |
|
|
266 |
/**
|
|
267 |
* Website where Operator music store can be found
|
|
268 |
*/
|
|
269 |
RBuf iOperatorStoreWebsite;
|
|
270 |
|
|
271 |
/**
|
|
272 |
* Control environment.
|
|
273 |
*/
|
|
274 |
CCoeEnv* iCoeEnv;
|
|
275 |
|
|
276 |
/**
|
|
277 |
* flag for music store application availability
|
|
278 |
*/
|
|
279 |
TBool iMusicStoreAppInstalled;
|
|
280 |
};
|
|
281 |
|
|
282 |
#endif /*FMRADIOMUSICSTOREHANDLER_H*/
|