29 #include "irqenums.h" |
29 #include "irqenums.h" |
30 #include "irqstatisticsreporter.h" |
30 #include "irqstatisticsreporter.h" |
31 #include "irqsettings.h" |
31 #include "irqsettings.h" |
32 #include "iruidefines.h" |
32 #include "iruidefines.h" |
33 |
33 |
34 |
34 const QString KActionSearchInMusicStoreName("SearchInMusicStore"); |
|
35 const QString KActionDeleteName("Delete"); |
35 |
36 |
36 // public functions |
37 // public functions |
37 |
38 |
38 /* |
39 /* |
39 * Description : constructor |
40 * Description : constructor |
49 iModel = new IRSongHistoryModel(this); |
50 iModel = new IRSongHistoryModel(this); |
50 iModel->setOrientation(getViewManager()->orientation()); |
51 iModel->setOrientation(getViewManager()->orientation()); |
51 iListView->setModel(iModel); |
52 iListView->setModel(iModel); |
52 iListView->setCurrentIndex(iModel->index(0)); |
53 iListView->setCurrentIndex(iModel->index(0)); |
53 |
54 |
54 iClearSongHistoryAction = new HbAction(hbTrId("txt_irad_opt_clear_song_history"), this); |
55 iClearSongHistoryAction = new HbAction(hbTrId("txt_irad_menu_clear_list"), this); |
55 iStatisticsReporter = IRQStatisticsReporter::openInstance(); |
56 iStatisticsReporter = IRQStatisticsReporter::openInstance(); |
56 |
57 |
57 |
|
58 iShowPrompt = iSettings->getSongHistoryShow(); |
58 iShowPrompt = iSettings->getSongHistoryShow(); |
59 if( iShowPrompt ) |
59 if( iShowPrompt ) |
60 { |
60 { |
61 iSettings->setSongHistoryShow(0); |
61 iSettings->setSongHistoryShow(0); |
62 } |
62 } |
63 |
63 |
64 connect(iClearSongHistoryAction, SIGNAL(triggered()), this, SLOT(clearHisotrySongDB())); |
64 connect(iClearSongHistoryAction, SIGNAL(triggered()), this, SLOT(clearList())); |
65 connect(iModel, SIGNAL(modelChanged()), this, SLOT(modelChanged())); |
65 connect(iModel, SIGNAL(modelChanged()), this, SLOT(modelChanged())); |
66 } |
66 } |
67 |
67 |
68 /* |
68 /* |
69 * Description : destructor |
69 * Description : destructor |
89 TIRHandleResult ret = IrAbstractListViewBase::handleCommand(aCommand, aReason); |
89 TIRHandleResult ret = IrAbstractListViewBase::handleCommand(aCommand, aReason); |
90 |
90 |
91 |
91 |
92 switch (aCommand) |
92 switch (aCommand) |
93 { |
93 { |
|
94 case EIR_ViewCommand_TOBEACTIVATED: |
|
95 showSongHistory(); |
|
96 ret = EIR_NoDefault; |
|
97 break; |
|
98 |
94 case EIR_ViewCommand_ACTIVATED: |
99 case EIR_ViewCommand_ACTIVATED: |
95 connect(iPlayController, SIGNAL(metaDataAvailable(IRQMetaData*)), this, SLOT(newMetadataAdded(IRQMetaData*))); |
100 connect(iPlayController, SIGNAL(metaDataAvailable(IRQMetaData*)), this, SLOT(newMetadataAdded(IRQMetaData*))); |
96 showSongHistory(); |
|
97 |
|
98 if( iShowPrompt ) |
101 if( iShowPrompt ) |
99 { |
102 { |
100 QTimer::singleShot(5, this, SLOT(showPrompt())); |
103 QTimer::singleShot(5, this, SLOT(showPrompt())); |
101 iShowPrompt = false; |
104 iShowPrompt = false; |
102 } |
105 } |
198 void IRSongHistoryView::itemAboutToBeSelected(bool& needNetwork) |
201 void IRSongHistoryView::itemAboutToBeSelected(bool& needNetwork) |
199 { |
202 { |
200 /* for in song history view, the data will retrived from the web browser*/ |
203 /* for in song history view, the data will retrived from the web browser*/ |
201 needNetwork = false; |
204 needNetwork = false; |
202 } |
205 } |
203 |
206 |
|
207 void IRSongHistoryView::listViewLongPressed(HbAbstractViewItem *aItem, const QPointF& aCoords) |
|
208 { |
|
209 Q_UNUSED(aItem); |
|
210 Q_UNUSED(aCoords); |
|
211 |
|
212 HbAction *action = NULL; |
|
213 HbMenu *contextMenu = new HbMenu; |
|
214 contextMenu->setAttribute(Qt::WA_DeleteOnClose); |
|
215 connect(contextMenu, SIGNAL(triggered(HbAction*)), this, SLOT(actionClicked(HbAction*))); |
|
216 |
|
217 action = contextMenu->addAction(hbTrId("txt_irad_menu_search_in_music_store")); |
|
218 action->setObjectName(KActionSearchInMusicStoreName); |
|
219 action = contextMenu->addAction(hbTrId("txt_common_menu_delete")); |
|
220 action->setObjectName(KActionDeleteName); |
|
221 |
|
222 contextMenu->open(); |
|
223 } |
|
224 |
|
225 void IRSongHistoryView::searchInMusicStoreContextAction() |
|
226 { |
|
227 // Need to log the find song in NMS event, iStatisticsReporter->logNmsEvent(IRQStatisticsReporter::EIRFind,channelId); |
|
228 popupNote(hbTrId("txt_irad_info_music_store_not_available"), HbMessageBox::MessageTypeInformation); |
|
229 } |
|
230 void IRSongHistoryView::deleteContextAction() |
|
231 { |
|
232 int current = iListView->currentIndex().row(); |
|
233 bool ret = iModel->deleteOneItem(current); |
|
234 if( !ret ) |
|
235 { |
|
236 popupNote(hbTrId("txt_irad_info_operation_failed"), HbMessageBox::MessageTypeWarning); |
|
237 } |
|
238 } |
|
239 |
204 void IRSongHistoryView::gotoStationHistory() |
240 void IRSongHistoryView::gotoStationHistory() |
205 { |
241 { |
206 getViewManager()->activateView(EIRView_HistoryView); |
242 getViewManager()->activateView(EIRView_HistoryView); |
207 } |
243 } |
208 |
244 |
210 { |
246 { |
211 IrAbstractListViewBase::handleOrientationChanged(aOrientation); |
247 IrAbstractListViewBase::handleOrientationChanged(aOrientation); |
212 iModel->setOrientation(aOrientation); |
248 iModel->setOrientation(aOrientation); |
213 iListView->reset(); |
249 iListView->reset(); |
214 } |
250 } |
|
251 |
|
252 void IRSongHistoryView::actionClicked(HbAction *aAction) |
|
253 { |
|
254 if ( aAction ) |
|
255 { |
|
256 QString objectName = aAction->objectName(); |
|
257 if ( objectName == KActionSearchInMusicStoreName ) |
|
258 { |
|
259 searchInMusicStoreContextAction(); |
|
260 } |
|
261 else if( objectName == KActionDeleteName) |
|
262 { |
|
263 deleteContextAction(); |
|
264 } |
|
265 } |
|
266 } |