50 iModel = new IRSongHistoryModel(this); |
50 iModel = new IRSongHistoryModel(this); |
51 iModel->setOrientation(getViewManager()->orientation()); |
51 iModel->setOrientation(getViewManager()->orientation()); |
52 iListView->setModel(iModel); |
52 iListView->setModel(iModel); |
53 iListView->setCurrentIndex(iModel->index(0)); |
53 iListView->setCurrentIndex(iModel->index(0)); |
54 |
54 |
55 iClearSongHistoryAction = new HbAction(hbTrId("txt_irad_menu_clear_list"), this); |
55 #ifdef SUBTITLE_STR_BY_LOCID |
|
56 iClearSongHistoryAction = new HbAction(hbTrId("txt_irad_opt_clear_list"), this); |
|
57 #else |
|
58 iClearSongHistoryAction = new HbAction(hbTrId("Clear list"), this); |
|
59 #endif |
56 iStatisticsReporter = IRQStatisticsReporter::openInstance(); |
60 iStatisticsReporter = IRQStatisticsReporter::openInstance(); |
57 |
61 |
58 iShowPrompt = iSettings->getSongHistoryShow(); |
62 iShowPrompt = iSettings->getSongHistoryShow(); |
59 if( iShowPrompt ) |
63 if( iShowPrompt ) |
60 { |
64 { |
61 iSettings->setSongHistoryShow(0); |
65 iSettings->setSongHistoryShow(0); |
62 } |
66 } |
63 |
67 |
64 connect(iClearSongHistoryAction, SIGNAL(triggered()), this, SLOT(clearList())); |
68 connect(iClearSongHistoryAction, SIGNAL(triggered()), this, SLOT(popupClearHistoryConfirmMessageBox())); |
65 connect(iModel, SIGNAL(modelChanged()), this, SLOT(modelChanged())); |
69 connect(iModel, SIGNAL(modelChanged()), this, SLOT(modelChanged())); |
66 } |
70 } |
67 |
71 |
68 /* |
72 /* |
69 * Description : destructor |
73 * Description : destructor |
140 return; |
144 return; |
141 } |
145 } |
142 |
146 |
143 // TODO : Add the report in future. Add the channel id in the song info db |
147 // TODO : Add the report in future. Add the channel id in the song info db |
144 // iStatisticsReporter->logNmsEvents(EIRQFind,channelId); |
148 // iStatisticsReporter->logNmsEvents(EIRQFind,channelId); |
145 popupNote(hbTrId("txt_irad_info_music_store_not_available"), HbMessageBox::MessageTypeInformation); |
149 #ifdef SUBTITLE_STR_BY_LOCID |
|
150 popupNote(hbTrId("txt_irad_info_music_store_not_available"), HbMessageBox::MessageTypeInformation); |
|
151 #else |
|
152 popupNote(hbTrId("Music store not available"), HbMessageBox::MessageTypeInformation); |
|
153 #endif |
146 } |
154 } |
147 |
155 |
148 |
156 |
149 // --------------------------------------------------------------------------- |
157 // --------------------------------------------------------------------------- |
150 // IRSongHistoryView::showSongHistory() |
158 // IRSongHistoryView::showSongHistory() |
191 Q_UNUSED(aMetadata); |
199 Q_UNUSED(aMetadata); |
192 iModel->checkSongHistoryUpdate(); |
200 iModel->checkSongHistoryUpdate(); |
193 |
201 |
194 } |
202 } |
195 |
203 |
196 void IRSongHistoryView::clearList() |
204 void IRSongHistoryView::popupClearHistoryConfirmMessageBox() |
197 { |
205 { |
198 iModel->clearList(); |
206 #ifdef SUBTITLE_STR_BY_LOCID |
|
207 HbMessageBox::question(hbTrId("txt_irad_info_clear_song_list"), this, SLOT(clearList(HbAction*)), hbTrId("txt_common_button_ok"), hbTrId("txt_common_button_cancel")); |
|
208 #else |
|
209 HbMessageBox::question(hbTrId("Clear song list?"), this, SLOT(clearList(HbAction*)), hbTrId("Ok"), hbTrId("Cancel")); |
|
210 #endif |
|
211 } |
|
212 void IRSongHistoryView::clearList(HbAction *aAction) |
|
213 { |
|
214 HbMessageBox *dialog = static_cast<HbMessageBox*>(sender()); |
|
215 if (dialog) |
|
216 { |
|
217 if (aAction == dialog->actions().at(0)) |
|
218 { |
|
219 iModel->clearList(); |
|
220 } |
|
221 } |
199 } |
222 } |
200 |
223 |
201 void IRSongHistoryView::showPrompt() |
224 void IRSongHistoryView::showPrompt() |
202 { |
225 { |
|
226 #ifdef SUBTITLE_STR_BY_LOCID |
203 QString str = hbTrId("txt_irad_info_click_the_song_and_find_it_in_nokia_music_store"); |
227 QString str = hbTrId("txt_irad_info_click_the_song_and_find_it_in_nokia_music_store"); |
|
228 #else |
|
229 QString str = hbTrId("Click the song and find it in nokia music store"); |
|
230 #endif |
204 popupNote(str, HbMessageBox::MessageTypeInformation); |
231 popupNote(str, HbMessageBox::MessageTypeInformation); |
205 } |
232 } |
206 |
233 |
207 void IRSongHistoryView::itemAboutToBeSelected(bool& needNetwork) |
234 void IRSongHistoryView::itemAboutToBeSelected(bool& needNetwork) |
208 { |
235 { |
218 HbAction *action = NULL; |
245 HbAction *action = NULL; |
219 HbMenu *contextMenu = new HbMenu; |
246 HbMenu *contextMenu = new HbMenu; |
220 contextMenu->setAttribute(Qt::WA_DeleteOnClose); |
247 contextMenu->setAttribute(Qt::WA_DeleteOnClose); |
221 connect(contextMenu, SIGNAL(triggered(HbAction*)), this, SLOT(actionClicked(HbAction*))); |
248 connect(contextMenu, SIGNAL(triggered(HbAction*)), this, SLOT(actionClicked(HbAction*))); |
222 |
249 |
|
250 #ifdef SUBTITLE_STR_BY_LOCID |
223 action = contextMenu->addAction(hbTrId("txt_irad_menu_search_in_music_store")); |
251 action = contextMenu->addAction(hbTrId("txt_irad_menu_search_in_music_store")); |
|
252 #else |
|
253 action = contextMenu->addAction(hbTrId("Search in music store")); |
|
254 #endif |
224 action->setObjectName(KActionSearchInMusicStoreName); |
255 action->setObjectName(KActionSearchInMusicStoreName); |
|
256 #ifdef SUBTITLE_STR_BY_LOCID |
225 action = contextMenu->addAction(hbTrId("txt_common_menu_delete")); |
257 action = contextMenu->addAction(hbTrId("txt_common_menu_delete")); |
|
258 #else |
|
259 action = contextMenu->addAction(hbTrId("Delete")); |
|
260 #endif |
226 action->setObjectName(KActionDeleteName); |
261 action->setObjectName(KActionDeleteName); |
227 |
262 |
228 contextMenu->open(); |
263 contextMenu->open(); |
229 } |
264 } |
230 |
265 |
231 void IRSongHistoryView::searchInMusicStoreContextAction() |
266 void IRSongHistoryView::searchInMusicStoreContextAction() |
232 { |
267 { |
233 // Need to log the find song in NMS event, iStatisticsReporter->logNmsEvent(IRQStatisticsReporter::EIRFind,channelId); |
268 // Need to log the find song in NMS event, iStatisticsReporter->logNmsEvent(IRQStatisticsReporter::EIRFind,channelId); |
|
269 #ifdef SUBTITLE_STR_BY_LOCID |
234 popupNote(hbTrId("txt_irad_info_music_store_not_available"), HbMessageBox::MessageTypeInformation); |
270 popupNote(hbTrId("txt_irad_info_music_store_not_available"), HbMessageBox::MessageTypeInformation); |
|
271 #else |
|
272 popupNote(hbTrId("Music store not available"), HbMessageBox::MessageTypeInformation); |
|
273 #endif |
235 } |
274 } |
236 void IRSongHistoryView::deleteContextAction() |
275 void IRSongHistoryView::deleteContextAction() |
237 { |
276 { |
238 int current = iListView->currentIndex().row(); |
277 int current = iListView->currentIndex().row(); |
239 bool ret = iModel->deleteOneItem(current); |
278 bool ret = iModel->deleteOneItem(current); |
240 if( !ret ) |
279 if( !ret ) |
241 { |
280 { |
|
281 #ifdef SUBTITLE_STR_BY_LOCID |
242 popupNote(hbTrId("txt_irad_info_operation_failed"), HbMessageBox::MessageTypeWarning); |
282 popupNote(hbTrId("txt_irad_info_operation_failed"), HbMessageBox::MessageTypeWarning); |
|
283 #else |
|
284 popupNote(hbTrId("Operation failed"), HbMessageBox::MessageTypeWarning); |
|
285 #endif |
243 } |
286 } |
244 } |
287 } |
245 |
288 |
246 void IRSongHistoryView::gotoStationHistory() |
289 void IRSongHistoryView::gotoStationHistory() |
247 { |
290 { |