56 |
57 |
57 iModel = new IRHistoryModel(this); |
58 iModel = new IRHistoryModel(this); |
58 iListView->setModel(iModel); |
59 iListView->setModel(iModel); |
59 iListView->setCurrentIndex(iModel->index(0)); |
60 iListView->setCurrentIndex(iModel->index(0)); |
60 |
61 |
61 iClearHistoryAction = new HbAction(hbTrId("txt_irad_opt_clear_station_history"), menu()); |
62 iClearHistoryAction = new HbAction(hbTrId("txt_irad_menu_clear_list"), menu()); |
62 |
63 |
63 |
64 |
64 iConvertTimer = new QTimer(this); |
65 iConvertTimer = new QTimer(this); |
65 iConvertTimer->setInterval(10); |
66 iConvertTimer->setInterval(10); |
66 |
67 |
98 TIRHandleResult ret = IrAbstractListViewBase::handleCommand(aCommand, aReason); |
99 TIRHandleResult ret = IrAbstractListViewBase::handleCommand(aCommand, aReason); |
99 int leftCount = 0; |
100 int leftCount = 0; |
100 |
101 |
101 switch (aCommand) |
102 switch (aCommand) |
102 { |
103 { |
|
104 |
|
105 case EIR_ViewCommand_TOBEACTIVATED: |
|
106 showHistory(); |
|
107 ret = EIR_NoDefault; |
|
108 break; |
|
109 |
103 case EIR_ViewCommand_ACTIVATED: |
110 case EIR_ViewCommand_ACTIVATED: |
104 connect(iIsdsClient, SIGNAL(presetResponse(IRQPreset *)), |
111 connect(iIsdsClient, SIGNAL(presetResponse(IRQPreset *)), |
105 this, SLOT(presetResponse(IRQPreset *))); |
112 this, SLOT(presetResponse(IRQPreset *))); |
106 connect(iIsdsClient, SIGNAL(operationException(IRQError)), |
113 connect(iIsdsClient, SIGNAL(operationException(IRQError)), |
107 this, SLOT(operationException(IRQError))); |
114 this, SLOT(operationException(IRQError))); |
108 connect(iIsdsClient, SIGNAL(presetLogoDownloaded(IRQPreset* )), |
115 connect(iIsdsClient, SIGNAL(presetLogoDownloaded(IRQPreset* )), |
109 this, SLOT(presetLogoDownload(IRQPreset* ))); |
116 this, SLOT(presetLogoDownload(IRQPreset* ))); |
110 connect(iIsdsClient, SIGNAL(presetLogoDownloadError()), |
117 connect(iIsdsClient, SIGNAL(presetLogoDownloadError()), |
111 this, SLOT(presetLogoDownloadError())); |
118 this, SLOT(presetLogoDownloadError())); |
112 |
119 |
113 showHistory(); |
|
114 leftCount = iIconIndexArray.count(); |
120 leftCount = iIconIndexArray.count(); |
115 if( leftCount > 0 ) |
121 if( leftCount > 0 ) |
116 { |
122 { |
117 iConvertTimer->start(); |
123 iConvertTimer->start(); |
118 } |
124 } |
164 } |
170 } |
165 |
171 |
166 if (hisInfo->getChannelType()) |
172 if (hisInfo->getChannelType()) |
167 { |
173 { |
168 // channel from isds server, get this preset |
174 // channel from isds server, get this preset |
169 iPlayController->createBufferingDialog(this, SLOT(cancelRequest())); |
175 iApplication->createLoadingDialog(this, SLOT(cancelRequest())); |
170 iIsdsClient->isdsListenRequest(hisInfo->getChannelId(), true); |
176 iIsdsClient->isdsListenRequest(hisInfo->getChannelId(), true); |
171 } |
177 } |
172 else |
178 else |
173 { |
179 { |
174 // user defined channel |
180 // user defined channel |
179 IRQPreset preset; |
185 IRQPreset preset; |
180 preset.insertChannelServer(server); |
186 preset.insertChannelServer(server); |
181 preset.name = hisInfo->getChannelName(); |
187 preset.name = hisInfo->getChannelName(); |
182 preset.description = hisInfo->getChannelDesc(); |
188 preset.description = hisInfo->getChannelDesc(); |
183 preset.shortDesc = hisInfo->getChannelDesc(); |
189 preset.shortDesc = hisInfo->getChannelDesc(); |
|
190 preset.genreName = hisInfo->getGenreName(); |
|
191 preset.countryName = hisInfo->getCountryName(); |
|
192 preset.languageName = hisInfo->getLanguageName(); |
184 preset.type = 0; |
193 preset.type = 0; |
185 preset.uniqID = 0; |
194 preset.uniqID = 0; |
186 preset.presetId = 0; |
195 preset.presetId = 0; |
187 |
196 |
188 iPlayController->connectToChannel(&preset,EIRQHistoryAdhoc); |
197 iPlayController->connectToChannel(&preset,EIRQHistoryAdhoc); |
199 } |
208 } |
200 |
209 |
201 void IRHistoryView::operationException(IRQError aError) |
210 void IRHistoryView::operationException(IRQError aError) |
202 { |
211 { |
203 Q_UNUSED(aError); |
212 Q_UNUSED(aError); |
204 iPlayController->closeBufferingDialog(); |
213 iApplication->closeLoadingDialog(); |
205 |
214 |
206 popupNote(hbTrId("txt_irad_info_failed_to_connect"), HbMessageBox::MessageTypeWarning); |
215 popupNote(hbTrId("txt_irad_info_failed_to_connect"), HbMessageBox::MessageTypeWarning); |
207 } |
216 } |
208 |
217 |
209 void IRHistoryView::networkRequestNotified(IRQNetworkEvent aEvent) |
218 void IRHistoryView::networkRequestNotified(IRQNetworkEvent aEvent) |
214 } |
223 } |
215 |
224 |
216 switch (aEvent) |
225 switch (aEvent) |
217 { |
226 { |
218 case EIRQNetworkConnectionEstablished: |
227 case EIRQNetworkConnectionEstablished: |
219 iApplication->closeConnectingDialog(); |
|
220 |
|
221 if (EIR_UseNetwork_SelectItem == getUseNetworkReason()) |
228 if (EIR_UseNetwork_SelectItem == getUseNetworkReason()) |
222 { |
229 { |
223 handleItemSelected(); |
230 handleItemSelected(); |
224 } |
231 } |
225 |
|
226 setUseNetworkReason(EIR_UseNetwork_NoReason); |
|
227 break; |
232 break; |
228 |
233 |
229 default: |
234 default: |
230 setCheckedAction(); |
235 setCheckedAction(); |
231 break; |
236 break; |
232 } |
237 } |
|
238 |
|
239 setUseNetworkReason(EIR_UseNetwork_NoReason); |
233 } |
240 } |
234 |
241 |
235 void IRHistoryView::cancelRequest() |
242 void IRHistoryView::cancelRequest() |
236 { |
243 { |
237 iIsdsClient->isdsCancelRequest(); |
244 iIsdsClient->isdsCancelRequest(); |
394 IRQSongHistoryInfo * currentInfo = iModel->getHistoryInfo(current.row()); |
401 IRQSongHistoryInfo * currentInfo = iModel->getHistoryInfo(current.row()); |
395 IRQPreset preset; |
402 IRQPreset preset; |
396 convertStationHistory2Preset(*currentInfo, preset); |
403 convertStationHistory2Preset(*currentInfo, preset); |
397 int retValue = iFavorites->addPreset(preset); |
404 int retValue = iFavorites->addPreset(preset); |
398 |
405 |
|
406 HbNotificationDialog *add2FavNote = new HbNotificationDialog(); |
|
407 add2FavNote->setModal(true); |
|
408 add2FavNote->setAttribute(Qt::WA_DeleteOnClose); |
|
409 |
399 switch (retValue) |
410 switch (retValue) |
400 { |
411 { |
401 case EIRQErrorNone: |
412 case EIRQErrorNone: |
402 popupNote(hbTrId("txt_irad_menu_add_to_favorite"), HbMessageBox::MessageTypeInformation); |
413 add2FavNote->setTitle(hbTrId("txt_irad_info_added_to_favorites")); |
403 |
414 //add2FavNote->setIcon(HbIcon( QString("qtg_large_ok"))); |
|
415 add2FavNote->show(); |
404 break; |
416 break; |
405 |
417 |
406 case EIRQErrorOutOfMemory: |
418 case EIRQErrorOutOfMemory: |
407 popupNote(hbTrId("txt_irad_info_can_not_add_more"), HbMessageBox::MessageTypeInformation); |
419 add2FavNote->setTitle(hbTrId("txt_irad_info_can_not_add_more")); |
408 break; |
420 //add2FavNote->setIcon(HbIcon( QString("qtg_large_ok"))); |
|
421 add2FavNote->show(); |
|
422 break; |
409 |
423 |
410 case EIRQErrorAlreadyExist: |
424 case EIRQErrorAlreadyExist: |
411 popupNote(hbTrId("txt_irad_info_favorite_updated"), HbMessageBox::MessageTypeInformation); |
425 add2FavNote->setTitle(hbTrId("txt_irad_info_favorite_updated")); |
412 break; |
426 //add2FavNote->setIcon(HbIcon( QString("qtg_large_ok"))); |
413 |
427 add2FavNote->show(); |
414 default: |
428 break; |
415 break; |
429 |
|
430 default: |
|
431 Q_ASSERT(false); |
|
432 break; |
416 } |
433 } |
417 } |
434 } |
418 |
435 |
419 void IRHistoryView::deleteContextAction() |
436 void IRHistoryView::deleteContextAction() |
420 { |
437 { |
423 if( !ret ) |
440 if( !ret ) |
424 { |
441 { |
425 popupNote(hbTrId("txt_irad_info_operation_failed"), HbMessageBox::MessageTypeWarning); |
442 popupNote(hbTrId("txt_irad_info_operation_failed"), HbMessageBox::MessageTypeWarning); |
426 } |
443 } |
427 } |
444 } |
428 void IRHistoryView::detailContextAction() |
445 void IRHistoryView::detailsContextAction() |
429 { |
446 { |
430 getViewManager()->activateView(EIRView_StationDetailsView); |
|
431 IRStationDetailsView *channelHistoryView = static_cast<IRStationDetailsView*>(getViewManager()->getView(EIRView_StationDetailsView)); |
|
432 int selectedItemIndex = iListView->currentIndex().row(); |
447 int selectedItemIndex = iListView->currentIndex().row(); |
433 IRQSongHistoryInfo *channelDetailInfo = iModel->getHistoryInfo(selectedItemIndex); |
448 IRQSongHistoryInfo *channelDetailInfo = iModel->getHistoryInfo(selectedItemIndex); |
434 channelHistoryView->setDetails(channelDetailInfo); |
449 |
|
450 IRQPreset channelPreset; |
|
451 convertStationHistory2Preset(*channelDetailInfo, channelPreset); |
|
452 |
|
453 IRStationDetailsView *stationDetailsView = static_cast<IRStationDetailsView*>(getViewManager()->getView(EIRView_StationDetailsView, true)); |
|
454 stationDetailsView->setDetails(&channelPreset); |
|
455 |
|
456 getViewManager()->activateView(EIRView_StationDetailsView); |
435 } |
457 } |
436 |
458 |
437 void IRHistoryView::listViewLongPressed(HbAbstractViewItem *aItem, const QPointF& aCoords) |
459 void IRHistoryView::listViewLongPressed(HbAbstractViewItem *aItem, const QPointF& aCoords) |
438 { |
460 { |
439 Q_UNUSED(aItem); |
461 Q_UNUSED(aItem); |
463 aPreset.insertChannelServer(url); |
485 aPreset.insertChannelServer(url); |
464 aPreset.type = aHistoryInfo.getChannelType(); |
486 aPreset.type = aHistoryInfo.getChannelType(); |
465 aPreset.presetId = aHistoryInfo.getChannelId(); |
487 aPreset.presetId = aHistoryInfo.getChannelId(); |
466 aPreset.shortDesc = aHistoryInfo.getChannelDesc(); |
488 aPreset.shortDesc = aHistoryInfo.getChannelDesc(); |
467 aPreset.imgUrl = aHistoryInfo.getImageUrl(); |
489 aPreset.imgUrl = aHistoryInfo.getImageUrl(); |
|
490 aPreset.genreName = aHistoryInfo.getGenreName(); |
|
491 aPreset.countryName = aHistoryInfo.getCountryName(); |
|
492 aPreset.languageName = aHistoryInfo.getLanguageName(); |
468 aPreset.description = aHistoryInfo.getChannelDesc(); |
493 aPreset.description = aHistoryInfo.getChannelDesc(); |
469 aPreset.musicStoreStatus = aHistoryInfo.getMusicStoreStatus(); |
494 aPreset.musicStoreStatus = aHistoryInfo.getMusicStoreStatus(); |
470 } |
495 } |
471 |
496 |
472 |
497 |