Commit afeec678f85fd29f750acd26544151a11f78a023
fix logic in FileCollectionLocation so all files are deleted, rather than just the first one (most likely, it was calling slotRemoveOperationFinished immediately after starting 1 job, which would result in the CollectionLocation destroying itself before the other jobs had a chance to run.) it also now deletes in parallel, rather than one at a time.
| |   |
| 68 | 68 | |
| 69 | 69 | return removed; |
| 70 | 70 | } |
| bool FileCollectionLocation::startNextRemoveJob() |
| void FileCollectionLocation::startRemoveJobs() |
| 72 | 72 | { |
| 73 | 73 | DEBUG_BLOCK |
| 74 | 74 | while ( !m_removetracks.isEmpty() ) |
| … | … | |
| 89 | 89 | |
| 90 | 90 | The::statusBar()->newProgressOperation( job, i18n( "Removing: %1", name ) ); |
| 91 | 91 | m_removejobs.insert( job, track ); |
| return true; |
| 93 | 92 | } |
| return false; |
| 95 | 93 | } |
| 96 | 94 | |
| 97 | 95 | void FileCollectionLocation::slotRemoveJobFinished(KJob* job) |
| … | … | |
| 112 | 112 | m_removejobs.remove( job ); |
| 113 | 113 | job->deleteLater(); |
| 114 | 114 | |
| if( !startNextRemoveJob() ) |
| { |
| if(m_removejobs.isEmpty()) { |
| 117 | 116 | slotRemoveOperationFinished(); |
| 118 | 117 | } |
| 119 | 118 | } |
| … | … | |
| 124 | 124 | m_removetracks = sources; |
| 125 | 125 | |
| 126 | 126 | debug() << "removing " << m_removetracks.size() << "tracks"; |
| if( !startNextRemoveJob() ) //this signal needs to be called no matter what, even if there are no job finishes to call it |
| { |
| slotRemoveOperationFinished(); |
| } |
| startRemoveJobs(); |
| 131 | 128 | } |
| 132 | 129 | |
| 133 | 130 | #include "FileCollectionLocation.moc" |
| |   |
| 40 | 40 | public slots: |
| 41 | 41 | void slotRemoveJobFinished( KJob *job ); |
| 42 | 42 | private: |
| bool startNextRemoveJob(); |
| void startRemoveJobs(); |
| 44 | 44 | |
| 45 | 45 | QMap<KJob*, Meta::TrackPtr> m_removejobs; |
| 46 | 46 | Meta::TrackList m_removetracks; |