63 mMpEngine = MpEngineFactory::sharedEngine(); |
63 mMpEngine = MpEngineFactory::sharedEngine(); |
64 connect( mMpEngine, SIGNAL( libraryAboutToUpdate() ), this, SLOT( handleLibraryAboutToUpdate() ) ); |
64 connect( mMpEngine, SIGNAL( libraryAboutToUpdate() ), this, SLOT( handleLibraryAboutToUpdate() ) ); |
65 connect( mMpEngine, SIGNAL( unableToCotinueDueUSB() ), this, SLOT( launchUnableToCotinueDueUsb() ) ); |
65 connect( mMpEngine, SIGNAL( unableToCotinueDueUSB() ), this, SLOT( launchUnableToCotinueDueUsb() ) ); |
66 connect( mMpEngine, SIGNAL( usbSynchronizationStarted() ), this, SLOT( launchUsbBlockingNote() ) ); |
66 connect( mMpEngine, SIGNAL( usbSynchronizationStarted() ), this, SLOT( launchUsbBlockingNote() ) ); |
67 connect( mMpEngine, SIGNAL( usbSynchronizationFinished() ), this, SLOT( closeUsbBlockingNote() ) ); |
67 connect( mMpEngine, SIGNAL( usbSynchronizationFinished() ), this, SLOT( closeUsbBlockingNote() ) ); |
68 connect( mMpEngine, SIGNAL( libraryRefreshNeeded() ), this, SLOT( launchRefreshLibraryRequest() ) ); |
|
69 TX_EXIT |
68 TX_EXIT |
70 } |
69 } |
71 |
70 |
72 /*! |
71 /*! |
73 Destructs the collection popup handler. |
72 Destructs the collection popup handler. |
115 { |
114 { |
116 TX_ENTRY |
115 TX_ENTRY |
117 HbProgressDialog* scanProgressDialog = new HbProgressDialog( HbProgressDialog::WaitDialog ); |
116 HbProgressDialog* scanProgressDialog = new HbProgressDialog( HbProgressDialog::WaitDialog ); |
118 connect( scanProgressDialog, SIGNAL( cancelled() ), mMpSongScanner, SLOT( cancelScan() ) ); |
117 connect( scanProgressDialog, SIGNAL( cancelled() ), mMpSongScanner, SLOT( cancelScan() ) ); |
119 scanProgressDialog->setModal( true ); |
118 scanProgressDialog->setModal( true ); |
120 HbLabel *title = new HbLabel( hbTrId( "txt_mus_title_refreshing" ) ); |
119 HbLabel *title = new HbLabel( hbTrId( "txt_mus_info_refreshingnln_songs_added" ) ); |
121 title->setFontSpec(HbFontSpec(HbFontSpec::Primary)); |
120 title->setFontSpec(HbFontSpec(HbFontSpec::Primary)); |
122 |
121 |
123 scanProgressDialog->setHeadingWidget( title ); |
122 scanProgressDialog->setHeadingWidget( title ); |
124 scanProgressDialog->setText( QString("") ); |
123 scanProgressDialog->setText( QString("") ); |
125 scanProgressDialog->setAttribute( Qt::WA_DeleteOnClose ); |
124 scanProgressDialog->setAttribute( Qt::WA_DeleteOnClose ); |
137 { |
136 { |
138 TX_ENTRY_ARGS("count " << count ) |
137 TX_ENTRY_ARGS("count " << count ) |
139 if ( mOutstandingPopup && ( mOutstandingPopup->objectName() == KScanProgressDialog ) ) { |
138 if ( mOutstandingPopup && ( mOutstandingPopup->objectName() == KScanProgressDialog ) ) { |
140 HbProgressDialog *dialog = qobject_cast<HbProgressDialog *>( mOutstandingPopup ); |
139 HbProgressDialog *dialog = qobject_cast<HbProgressDialog *>( mOutstandingPopup ); |
141 QString added; |
140 QString added; |
142 added = hbTrId( "txt_mus_info_ln_songs_added" , count ); |
141 added = hbTrId( "txt_mus_info_ln_songs_found" , count ); |
143 dialog->setText( added ); |
142 dialog->setText( added ); |
144 } |
143 } |
145 TX_EXIT |
144 TX_EXIT |
146 } |
145 } |
147 |
146 |
151 |
150 |
152 */ |
151 */ |
153 void MpGlobalPopupHandler::handleScanFinished( int error, int itemsAdded ) |
152 void MpGlobalPopupHandler::handleScanFinished( int error, int itemsAdded ) |
154 { |
153 { |
155 TX_ENTRY_ARGS("error: " << error << " Items added: " << itemsAdded ) |
154 TX_ENTRY_ARGS("error: " << error << " Items added: " << itemsAdded ) |
|
155 Q_UNUSED( itemsAdded ); |
156 if ( mOutstandingPopup && ( mOutstandingPopup->objectName() == KScanProgressDialog ) ) { |
156 if ( mOutstandingPopup && ( mOutstandingPopup->objectName() == KScanProgressDialog ) ) { |
157 HbProgressDialog *dialog = qobject_cast<HbProgressDialog *>( mOutstandingPopup ); |
157 HbProgressDialog *dialog = qobject_cast<HbProgressDialog *>( mOutstandingPopup ); |
158 disconnect( dialog, SIGNAL( aboutToClose() ), this, SLOT( outstandingPopupClosing() ) ); |
158 disconnect( dialog, SIGNAL( aboutToClose() ), this, SLOT( outstandingPopupClosing() ) ); |
159 mOutstandingPopup = 0; |
159 mOutstandingPopup = 0; |
160 dialog->close(); |
160 dialog->close(); |
161 } |
161 } |
162 |
162 |
163 switch( error ) { |
163 switch( error ) { |
164 case MpSongScanner::ScanErrorNone : |
164 case MpSongScanner::ScanErrorNone : |
165 launchScanFinishedDialog( true, itemsAdded ); |
165 launchScanFinishedDialog( true ); |
166 break; |
166 break; |
167 case MpSongScanner::ScanGeneralError : |
167 case MpSongScanner::ScanGeneralError : |
168 launchScanFinishedDialog( false, itemsAdded ); |
168 launchScanFinishedDialog( false ); |
169 break; |
169 break; |
170 case MpSongScanner::ScanErrorDiskFull : |
170 case MpSongScanner::ScanErrorDiskFull : |
171 launchDiskFullDialog(); |
171 launchDiskFullDialog(); |
172 break; |
172 break; |
173 case MpSongScanner::ScanInterrupted : |
173 case MpSongScanner::ScanInterrupted : |
221 dialog->cancel(); |
221 dialog->cancel(); |
222 } |
222 } |
223 } |
223 } |
224 |
224 |
225 /*! |
225 /*! |
226 Slot called when MpEngine emits libraryRefreshNeeded() signal |
|
227 */ |
|
228 void MpGlobalPopupHandler::launchRefreshLibraryRequest() |
|
229 { |
|
230 HbAction *action; |
|
231 HbMessageBox *promptRefresh = new HbMessageBox( HbMessageBox::MessageTypeQuestion ); |
|
232 promptRefresh->setText( hbTrId( "txt_mus_info_music_may_need_to_be_refreshed" ) ); |
|
233 promptRefresh->setTimeout( HbPopup::NoTimeout ); |
|
234 promptRefresh->setModal( true ); |
|
235 promptRefresh->clearActions(); |
|
236 action = new HbAction( hbTrId( "txt_common_button_yes" ) ); |
|
237 action->setObjectName( KYes ); |
|
238 connect( action, SIGNAL( triggered() ), mMpEngine, SLOT( refreshLibrary() ) ); |
|
239 promptRefresh->addAction( action ); |
|
240 action = new HbAction( hbTrId( "txt_common_button_no" ) ); |
|
241 action->setObjectName( KNo ); |
|
242 promptRefresh->addAction( action ); |
|
243 promptRefresh->setAttribute( Qt::WA_DeleteOnClose ); |
|
244 promptRefresh->setObjectName( KPromptRefresh ); |
|
245 setOutstandingPopup( promptRefresh ); |
|
246 promptRefresh->show(); |
|
247 } |
|
248 |
|
249 /*! |
|
250 Slot to launch the MTP educating info dialog |
226 Slot to launch the MTP educating info dialog |
|
227 This dialog would be displayed after any manual refresh (from options menu), |
|
228 or after a refreshing originated by USBMassStorage disconnection. |
251 */ |
229 */ |
252 void MpGlobalPopupHandler::launchMTPInfoDialog() |
230 void MpGlobalPopupHandler::launchMTPInfoDialog() |
253 { |
231 { |
254 TX_ENTRY |
232 TX_ENTRY |
255 HbDialog *dialog = new HbDialog(); |
233 HbDialog *dialog = new HbDialog(); |
300 |
278 |
301 /*! |
279 /*! |
302 \internal |
280 \internal |
303 Launches Scan Finished Notification. |
281 Launches Scan Finished Notification. |
304 */ |
282 */ |
305 void MpGlobalPopupHandler::launchScanFinishedDialog( bool ok, int itemsAdded ) |
283 void MpGlobalPopupHandler::launchScanFinishedDialog( bool ok ) |
306 { |
284 { |
307 QString added; |
|
308 HbNotificationDialog *finishedDialog = new HbNotificationDialog(); |
285 HbNotificationDialog *finishedDialog = new HbNotificationDialog(); |
309 finishedDialog->setModal(true); |
286 finishedDialog->setModal(true); |
310 added = hbTrId( "txt_mus_dpopinfo_ln_songs_added", itemsAdded ); |
|
311 finishedDialog->setText( added ); |
|
312 finishedDialog->setAttribute( Qt::WA_DeleteOnClose ); |
287 finishedDialog->setAttribute( Qt::WA_DeleteOnClose ); |
313 finishedDialog->setObjectName( KScanFinished ); |
288 finishedDialog->setObjectName( KScanFinished ); |
314 // Connect aboutToClose with outstandingPopupClosing() first, and then with launchMTPInfoDialog |
289 // Connect aboutToClose with outstandingPopupClosing() first, and then with launchMTPInfoDialog |
315 // in order to get finishDialog cleared before MtpInfoDialog is launched. |
290 // in order to get finishDialog cleared before MtpInfoDialog is launched. |
316 setOutstandingPopup( finishedDialog ); |
291 setOutstandingPopup( finishedDialog ); |