150 |
150 |
151 */ |
151 */ |
152 void MpGlobalPopupHandler::handleScanFinished( int error, int itemsAdded ) |
152 void MpGlobalPopupHandler::handleScanFinished( int error, int itemsAdded ) |
153 { |
153 { |
154 TX_ENTRY_ARGS("error: " << error << " Items added: " << itemsAdded ) |
154 TX_ENTRY_ARGS("error: " << error << " Items added: " << itemsAdded ) |
155 Q_UNUSED( itemsAdded ); |
155 |
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 ); |
165 launchScanFinishedDialog( true , itemsAdded ); |
166 break; |
166 break; |
167 case MpSongScanner::ScanGeneralError : |
167 case MpSongScanner::ScanGeneralError : |
168 launchScanFinishedDialog( false ); |
168 launchScanFinishedDialog( false, itemsAdded ); |
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 : |
278 |
278 |
279 /*! |
279 /*! |
280 \internal |
280 \internal |
281 Launches Scan Finished Notification. |
281 Launches Scan Finished Notification. |
282 */ |
282 */ |
283 void MpGlobalPopupHandler::launchScanFinishedDialog( bool ok ) |
283 void MpGlobalPopupHandler::launchScanFinishedDialog( bool ok , int itemsAdded ) |
284 { |
284 { |
285 HbNotificationDialog *finishedDialog = new HbNotificationDialog(); |
285 HbNotificationDialog *finishedDialog = new HbNotificationDialog(); |
286 finishedDialog->setModal(true); |
286 finishedDialog->setModal(true); |
287 finishedDialog->setAttribute( Qt::WA_DeleteOnClose ); |
287 finishedDialog->setAttribute( Qt::WA_DeleteOnClose ); |
288 finishedDialog->setObjectName( KScanFinished ); |
288 finishedDialog->setObjectName( KScanFinished ); |
289 // Connect aboutToClose with outstandingPopupClosing() first, and then with launchMTPInfoDialog |
289 // Connect aboutToClose with outstandingPopupClosing() first, and then with launchMTPInfoDialog |
290 // in order to get finishDialog cleared before MtpInfoDialog is launched. |
290 // in order to get finishDialog cleared before MtpInfoDialog is launched. |
291 setOutstandingPopup( finishedDialog ); |
291 setOutstandingPopup( finishedDialog ); |
292 |
292 |
|
293 // Educating user (of MTP information) dialog is displayed |
|
294 // only when the following conditions are met: |
|
295 // 1. A "manual" refresh operation completes successfully |
|
296 // 2. Refresh operation finds at least one new item |
|
297 |
293 if( ok ) { |
298 if( ok ) { |
294 finishedDialog->setIcon( HbIcon( QString("qtg_large_ok") ) ); |
299 finishedDialog->setIcon( HbIcon( QString("qtg_large_ok") ) ); |
295 finishedDialog->setTitle( hbTrId( "txt_mus_dpophead_refresh_complete" ) ); |
300 finishedDialog->setTitle( hbTrId( "txt_mus_dpophead_refresh_complete" ) ); |
296 if ( MpSettingsManager::showMtpInfo() && !mMpSongScanner->isAutomaticScan() ) { |
301 if ( MpSettingsManager::showMtpInfo() && !mMpSongScanner->isAutomaticScan() && itemsAdded ) { |
297 connect( finishedDialog, SIGNAL( aboutToClose() ), this, SLOT( launchMTPInfoDialog() ) ); |
302 connect( finishedDialog, SIGNAL( aboutToClose() ), this, SLOT( launchMTPInfoDialog() ) ); |
298 } |
303 } |
299 } |
304 } |
300 else { |
305 else { |
301 finishedDialog->setIcon( HbIcon( QString("qtg_small_fail") ) ); |
306 finishedDialog->setIcon( HbIcon( QString("qtg_small_fail") ) ); |