equal
deleted
inserted
replaced
28 #include <hbstyleloader.h> |
28 #include <hbstyleloader.h> |
29 #include <hbdataformmodel.h> |
29 #include <hbdataformmodel.h> |
30 #include <hbdataformmodelitem.h> |
30 #include <hbdataformmodelitem.h> |
31 #include <hbdataform.h> |
31 #include <hbdataform.h> |
32 #include <cpsettingformentryitemdata.h> |
32 #include <cpsettingformentryitemdata.h> |
|
33 #include <QDesktopServices> |
|
34 //ovi ringtong address. |
|
35 const QString oviUrl("http://lr.ovi.mobi/store/ringtones"); |
33 |
36 |
34 CpRingToneView::CpRingToneView( QGraphicsItem *parent ): |
37 CpRingToneView::CpRingToneView( QGraphicsItem *parent ): |
35 CpBaseSettingView(0, parent), |
38 CpBaseSettingView(0, parent), |
36 mToneTypeList( new HbListWidget(this) ), |
39 mToneTypeList( new HbListWidget(this) ), |
37 mReq(0), mProcessing(false) |
40 mReq(0), mProcessing(false) |
72 //avoid responding to the second or later consecutive click |
75 //avoid responding to the second or later consecutive click |
73 if (mProcessing) { |
76 if (mProcessing) { |
74 return; |
77 return; |
75 } |
78 } |
76 mProcessing = true; |
79 mProcessing = true; |
77 int nRow = index.row(); |
80 int nRow = index.row(); |
78 |
|
79 switch(nRow) { |
81 switch(nRow) { |
80 case 0: //no tone, set default no sound |
82 case 0: //no tone, set default no sound |
81 emit selOK(QString("")); |
83 emit selOK(QString("")); |
82 emit aboutToClose(); |
84 emit aboutToClose(); |
83 break; |
85 break; |
84 case 1: //tone |
86 case 1: { //tone |
85 launchMediaFetcher( "com.nokia.symbian.IToneFetch", "fetch()" ); |
87 launchMediaFetcher( "com.nokia.symbian.IToneFetch", "fetch()" ); |
86 break; |
88 break; |
87 case 2: //music |
89 } |
88 launchMediaFetcher("com.nokia.symbian.IMusicFetch", "fetch()" ); |
90 case 2: { //music |
89 break; |
91 XQRequestInfo requestInfo; |
90 case 3: //get more tones |
92 requestInfo.setInfo("WindowTitle", QVariant(hbTrId("txt_cp_title_control_panel"))); |
91 default: |
93 launchMediaFetcher("com.nokia.symbian.IMusicFetch", "fetch()", QList<QVariant>(), requestInfo ); |
92 break; |
94 break; |
|
95 } |
|
96 case 3: { //get more tones |
|
97 // Launch the URL in the browser and |
|
98 QDesktopServices::openUrl(QUrl(oviUrl, QUrl::TolerantMode)); |
|
99 break; |
|
100 } |
|
101 default: |
|
102 break; |
93 } |
103 } |
94 } |
104 } |
95 void CpRingToneView::handleOk(const QVariant &result) |
105 void CpRingToneView::handleOk(const QVariant &result) |
96 { |
106 { |
97 mProcessing = false; |
107 mProcessing = false; |
104 emit selOK( result.value<QString>() ); |
114 emit selOK( result.value<QString>() ); |
105 emit aboutToClose(); |
115 emit aboutToClose(); |
106 } |
116 } |
107 |
117 |
108 |
118 |
109 void CpRingToneView::handleError(int errorCode, const QString& errorMessage) |
119 void CpRingToneView::handleError(int errorCode, const QString &errorMessage) |
110 { |
120 { |
111 mProcessing = false; |
121 mProcessing = false; |
112 emit(selError( errorCode, errorMessage )); |
122 emit(selError( errorCode, errorMessage )); |
113 } |
123 } |
114 |
124 |
115 void CpRingToneView::launchMediaFetcher( const QString &strService, const QString &strItface ) |
125 /*! |
|
126 Launch media fetcher service. |
|
127 \a strService, the service interface name. |
|
128 \a srItface, the service operation name. |
|
129 \a arguments, the request arguments, preserved. |
|
130 \a info, the request info. |
|
131 */ |
|
132 void CpRingToneView::launchMediaFetcher( const QString &strService, const QString &strItface,\ |
|
133 const QList<QVariant> &arguments, const XQRequestInfo &info ) |
116 { |
134 { |
117 CPFW_LOG("CpRingToneView::launchMediaFetcher, START"); |
135 CPFW_LOG("CpRingToneView::launchMediaFetcher, START"); |
118 if(mReq) |
136 if(mReq) |
119 { |
137 { |
120 delete mReq; |
138 delete mReq; |
131 else |
149 else |
132 { //use QueuedConnection so that requestError will not be emitted when selecting one tone |
150 { //use QueuedConnection so that requestError will not be emitted when selecting one tone |
133 connect(mReq, SIGNAL(requestOk(QVariant)), SLOT( handleOk(QVariant)), Qt::QueuedConnection); |
151 connect(mReq, SIGNAL(requestOk(QVariant)), SLOT( handleOk(QVariant)), Qt::QueuedConnection); |
134 connect(mReq, SIGNAL(requestError(int, QString)), SLOT(handleError(int, QString))); |
152 connect(mReq, SIGNAL(requestError(int, QString)), SLOT(handleError(int, QString))); |
135 } |
153 } |
136 |
154 if (!arguments.isEmpty()) { |
137 QList<QVariant> args; |
155 mReq->setArguments(arguments); |
138 args << QVariant(QString("<app_name>")); |
156 } |
139 mReq->setArguments(args); |
157 if (info.isValid()) { |
|
158 mReq->setInfo(info); |
|
159 } |
140 // Make the request |
160 // Make the request |
141 if (!mReq->send()) |
161 if (!mReq->send()) |
142 { |
162 { |
143 CPFW_LOG("CpRingToneView::launchMediaFetcher, Mediafetcher calling failed"); |
163 CPFW_LOG("CpRingToneView::launchMediaFetcher, Mediafetcher calling failed"); |
144 } |
164 } |