Bug 238915 - When deleting newly copied tracks from media devices, Amarok tries to delete files in local collection
Summary: When deleting newly copied tracks from media devices, Amarok tries to delete ...
Status: RESOLVED FIXED
Alias: None
Product: amarok
Classification: Applications
Component: Collections/Media Devices (show other bugs)
Version: 2.3.1-GIT
Platform: Unlisted Binaries Linux
: NOR critical
Target Milestone: 2.4.0
Assignee: Amarok Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-26 19:20 UTC by Hakan Bayindir
Modified: 2011-01-04 15:48 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 2.4


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Hakan Bayindir 2010-05-26 19:20:24 UTC
Version:           2.3.0.90 (using KDE 4.4.3) 
OS:                Linux

When deleting freshly copied tracks from a UMS media device such as USB flash disk, Amarok wants to delete files in the local collection, not on the flash disk.

Reproducible: Always

Steps to Reproduce:
1- Open Amarok
2- Plug your USB media device
3- Mount it, amarok will automount it.
4- If not auto-enabled, enabled your device as a collection.
5- Try to copy your favorite music to the device but fumble/disorient/etc. and include some other music which is not wanted.
6- After copying finishes, realize the situation and want to delete them from the media device by right clicking and selecting delete tracks.

Actual Results:  
- Amarok asks for confirmation to remove files from your local collection, not from the media device (I'm not very adventurous to try clicking delete).

Expected Results:  
- Amarok asks for confirmation to remove files from your media device and giving permission removed unwanted tracks from media device.

Packages: Debian experimental
OS: Linux (i686) release 2.6.32-3-686-bigmem
Compiler: cc
Comment 1 Frank Steinmetzger 2010-08-18 22:11:49 UTC
I just confirmed this with 2.3.1-git on Debian Testing with KDE 4.4.5.
Comment 2 Myriam Schweingruber 2010-08-19 00:53:18 UTC
Setting status to confirmed.
Comment 3 Mikko C. 2010-10-09 09:35:33 UTC
indeed I can confirm this too: it's pretty bad.
I'm not sure whom to CC for this.
Comment 4 Sergey Ivanov 2011-01-02 20:37:55 UTC
commit d2bbcd7c9cb7562e744380420c08f84448733067
branch master
Author: Sergey Ivanov <123kash@gmail.com>
Date:   Sun Jan 2 22:37:16 2011 +0300

    Fixed issue with UMS Collection that made amarok to delete original track instead
    of newly copied one.
    BUG: 238915

diff --git a/ChangeLog b/ChangeLog
index d1813d6..2d3beba 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -10,6 +10,8 @@ VERSION 2.4-Beta 2
     * Fixed some broken radio stream URLs.
 
   BUGFIXES:
+    * Fixed issue with UMS Collection that made amarok to delete original track
+      instead of newly copied one. (BR 238915)
     * Fixed issue with Audio CDs that do not provide CDDB information. Patch by
       Andriy Gapon <avg@icyb.net.ua>. (BR 257818)
     * Fixed issue with the Organize Files Dialog that prevented presets from being
diff --git a/src/core-impl/collections/umscollection/handler/UmsHandler.cpp b/src/core-impl/collections/umscollection/handler/UmsHandler.cpp
index be57c07..4535ae1 100644
--- a/src/core-impl/collections/umscollection/handler/UmsHandler.cpp
+++ b/src/core-impl/collections/umscollection/handler/UmsHandler.cpp
@@ -610,7 +610,6 @@ UmsHandler::findPathToCopy( const Meta::TrackPtr &srcTrack, const Meta::MediaDev
 bool
 UmsHandler::libCopyTrack( const Meta::TrackPtr &srcTrack, Meta::MediaDeviceTrackPtr &destTrack )
 {
-    Q_UNUSED( destTrack )
     DEBUG_BLOCK
 
     KUrl srcurl = KUrl::fromPath( srcTrack->playableUrl().path() );
@@ -692,8 +691,6 @@ UmsHandler::fileTransferred( KJob *job )  //SLOT
 void
 UmsHandler::slotCopyingDone( KIO::Job* job, KUrl from, KUrl to, time_t mtime, bool directory, bool renamed)
 {
-    Q_UNUSED( job )
-    Q_UNUSED( to )
     Q_UNUSED( mtime )
     Q_UNUSED( directory )
     Q_UNUSED( renamed )
@@ -705,6 +702,7 @@ UmsHandler::slotCopyingDone( KIO::Job* job, KUrl from, KUrl to, time_t mtime, bo
     {
         Meta::TrackPtr metafiletrack( new MetaFile::Track( to ) );
         Meta::MediaDeviceTrackPtr destTrack = m_srctodest.value( track );
+        destTrack->setPlayableUrl( to );
         m_umstrackhash.insert( destTrack, metafiletrack );
         m_files.insert( to.path(), destTrack );
         slotFinalizeTrackCopy( track );
diff --git a/src/core/collections/CollectionLocation.cpp b/src/core/collections/CollectionLocation.cpp
index b16b275..c5b07ac 100644
--- a/src/core/collections/CollectionLocation.cpp
+++ b/src/core/collections/CollectionLocation.cpp
@@ -156,7 +156,6 @@ CollectionLocation::prepareMove( Meta::TrackPtr track, CollectionLocation *desti
 void
 CollectionLocation::prepareMove( const Meta::TrackList &tracks, CollectionLocation *destination )
 {
-    debug() << "prepare move"<<tracks.count()<<"tracks from"<<collection()->collectionId()<<"to"<<(destination->collection()?destination->collection()->collectionId():"no destination. probably trash");
     DEBUG_BLOCK
     if( !destination->isWritable() )
     {