|
1 /* |
|
2 * Copyright (c) 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 // USER INCLUDES |
|
19 #include "msgaudiofetcherutil.h" |
|
20 #include "debugtraces.h" |
|
21 |
|
22 // INCLUDES |
|
23 #include <QStringList> |
|
24 #include <xqappmgr.h> |
|
25 #include <xqaiwrequest.h> |
|
26 |
|
27 // Constants |
|
28 |
|
29 //--------------------------------------------------------------- |
|
30 // MsgAudioFetcherUtil::MsgAudioFetcherUtil |
|
31 // @see header file |
|
32 //--------------------------------------------------------------- |
|
33 MsgAudioFetcherUtil::MsgAudioFetcherUtil(QObject* parent): |
|
34 QObject(parent), |
|
35 mRequest(NULL) |
|
36 { |
|
37 mAppMgr = new XQApplicationManager; |
|
38 } |
|
39 |
|
40 //--------------------------------------------------------------- |
|
41 // MsgAudioFetcherUtil::~MsgAudioFetcherUtil |
|
42 // @see header file |
|
43 //--------------------------------------------------------------- |
|
44 MsgAudioFetcherUtil::~MsgAudioFetcherUtil() |
|
45 { |
|
46 delete mAppMgr; |
|
47 } |
|
48 |
|
49 //--------------------------------------------------------------- |
|
50 // MsgAudioFetcherUtil::fetchAudio |
|
51 // @see header file |
|
52 //--------------------------------------------------------------- |
|
53 void MsgAudioFetcherUtil::fetchAudio() |
|
54 { |
|
55 QString service("Music Fetcher"); |
|
56 QString interface("com.nokia.services.media.Music"); |
|
57 QString operation("fetch(QString)"); |
|
58 |
|
59 mRequest = mAppMgr->create(service, interface, operation, false); |
|
60 if(!mRequest) |
|
61 { |
|
62 QDEBUG_WRITE("AIW-ERROR: NULL request"); |
|
63 return; |
|
64 } |
|
65 |
|
66 connect(mRequest, SIGNAL(requestOk(const QVariant&)), |
|
67 parent(), SIGNAL(audiosFetched(const QVariant&))); |
|
68 connect(mRequest, SIGNAL(requestError(int,const QString&)), |
|
69 this, SLOT(onRequestError(int,const QString&))); |
|
70 connect(this, SIGNAL(serviceError(const QString&)), |
|
71 parent(), SIGNAL(serviceError(const QString&))); |
|
72 |
|
73 // Make the request |
|
74 if (!mRequest->send()) |
|
75 { |
|
76 QDEBUG_WRITE_FORMAT("AIW-ERROR: Send failed ",mRequest->lastError()); |
|
77 } |
|
78 } |
|
79 |
|
80 //--------------------------------------------------------------- |
|
81 // MsgAudioFetcherUtil::onRequestError |
|
82 // @see header file |
|
83 //--------------------------------------------------------------- |
|
84 void MsgAudioFetcherUtil::onRequestError(int errorCode, |
|
85 const QString& errorMessage) |
|
86 { |
|
87 Q_UNUSED(errorCode); |
|
88 // emit utils mgr signal |
|
89 emit serviceError(errorMessage); |
|
90 } |
|
91 |
|
92 //EOF |