Version: 2.3.0. (using KDE 4.4.1) OS: Linux Installed from: Ubuntu Packages When I click "Organise Files" on a single file and choose a pattern such that source == destination, amarok fails to do anything, i.e. bar at the bottom says: "Moving files: 0%" If there are several files on the queue it will fail to proceed. Also If source != destination, the file is moved, and _after_ that I am asked whether or not I really want to delete the file. (wtf?) Choosing "Delete" or "Cancel" yield the same result: nothing happens.
Confirmed, happens here too.
commit b99209d8a021275614f8ab7847cd3e457a2181c3 Author: Casey Link <unnamedrambler@gmail.com> Date: Sat Apr 3 13:33:48 2010 -0400 Fix bug that stalled an organize operation when src == dest BUG: 233181 diff --git a/src/core-impl/collections/sqlcollection/SqlCollectionLocation.cpp b/src/core-impl/collections/sqlcollection/SqlCollectionLocation.cpp index 851cd51..1ac258f 100644 --- a/src/core-impl/collections/sqlcollection/SqlCollectionLocation.cpp +++ b/src/core-impl/collections/sqlcollection/SqlCollectionLocation.cpp @@ -523,11 +523,15 @@ bool SqlCollectionLocation::startNextJob() return true; // Attempt to copy/move the next item in m_sources } } - if( src == dest) { - //no changes, so leave the database alone, and don't erase anything - return true; // Attempt to copy/move the next item in m_sources + if( src.equals( dest ) ) + { + debug() << "move to itself found"; + source()->transferSuccessful( track ); + m_transferjob->slotJobFinished( 0 ); + if( m_sources.isEmpty() ) + return false; + return true; } - //we should only move it directly if we're moving within the same collection else if( isGoingToRemoveSources() && source()->collection() == collection() ) { debug() << "moving!"; @@ -535,7 +539,7 @@ bool SqlCollectionLocation::startNextJob() } else { - //later on in the case that remove is called, the file will be deleted because we didn't apply moveByDestination to the track + //later on in the case that remove is called, the file will be deleted because we didn't apply moveByDestination to the track job = KIO::file_copy( src, dest, -1, flags ); } if( job ) //just to be safe @@ -629,15 +633,16 @@ void TransferJob::doWork() setProcessedAmount( KJob::Files, 0 ); if( !m_location->startNextJob() ) { - if( hasSubjobs() ) + if( !hasSubjobs() ) emitResult(); } } void TransferJob::slotJobFinished( KJob* job ) { - Q_UNUSED( job ); DEBUG_BLOCK + if( job ) + removeSubjob( job ); if( m_killed ) { debug() << "slotJobFinished entered, but it should be killed!"; @@ -648,9 +653,12 @@ void TransferJob::slotJobFinished( KJob* job ) debug() << "processed" << processedAmount( KJob::Files ) << " totalAmount" << totalAmount( KJob::Files ); if( !m_location->startNextJob() ) { + debug() << "sources empty"; // don't quit if there are still subjobs - if( hasSubjobs() ) + if( !hasSubjobs() ) emitResult(); + else + debug() << "have subjobs"; } } diff --git a/src/core-impl/collections/sqlcollection/SqlCollectionLocation.h b/src/core-impl/collections/sqlcollection/SqlCollectionLocation.h index 149423a..cbfe9b7 100644 --- a/src/core-impl/collections/sqlcollection/SqlCollectionLocation.h +++ b/src/core-impl/collections/sqlcollection/SqlCollectionLocation.h @@ -46,14 +46,13 @@ class TransferJob : public KCompositeJob virtual bool addSubjob( KJob* job ); void emitInfo( const QString &message ); - - protected slots: - void doWork(); - + public slots: /** * A move or copy job finished */ void slotJobFinished( KJob *job ); + protected slots: + void doWork(); protected: virtual bool doKill(); private: