Bug 147404

Summary: Radio Streams drag-and-drop severely broken
Product: [Applications] amarok Reporter: Tristan Miller <psychonaut>
Component: generalAssignee: Amarok Developers <amarok-bugs-dist>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Tristan Miller 2007-06-30 23:14:29 UTC
Version:            (using KDE KDE 3.5.7)
Installed from:    SuSE RPMs

In the Radio Streams folder of the Playlist tab are displayed a number of folders with radio streams which ship with Amarok (I'll call these "factory streams"), plus user-defined folders.  It is sometimes possible for the user to drag a radio stream from one folder to another.  However, there are many related bugs:

1. Wrong cursor icon when moving streams

When dragging from a factory folder to a user folder, the mouse pointer changes to a "copy" pointer.  However, the actual operation is to *move*, not copy -- the radio stream disappears from the original factory folder.

2. Can't copy streams from factory folder to user folder

It's not possible to copy a stream from a factory folder to a user folder, even if one holds down the Shift key while dragging.  All such drags are moves.

3. Can't move streams to an expanded folder

When the user initiates drag-and-drop from one folder to another folder which is expanded, highlight bars appear between the items in the list indicating that the GUI is willing to accept a drop there.  However, unless the user moves the cursor over the folder icon so that the highlight bar appears at the bottom of the expanded folder list, the drop will not take.

4. Can't undo bad moves or copies

If a user moves a factory stream to a user folder, or if he copies a factory stream to a different factory folder, there is no way to undo it.  That is, there is no "Undo" function, nor is there any way of moving a stream from a user folder back to a factory folder, nor is there any way of deleting a stream from a factory folder.  (The issue of not being able to delete streams was raised in Bug 139109 and marked as WONTFIX.)
Comment 1 Mark Kretschmann 2007-07-01 00:48:55 UTC
Amarok version?
Comment 2 Tristan Miller 2007-07-01 01:55:09 UTC
1.4.5
Comment 3 Seb Ruiz 2007-07-01 07:37:21 UTC
Some comments:

1) I agree, it should be a copy

2) Actually, it is a copy but the GUI just lies.

3) Confirmed

4) Most of this point is moot as from my response to 2). But otherwise, there won't be an undo functionality implemented.

Confirming only for number 2 & 3.
Comment 4 Seb Ruiz 2007-07-01 07:53:44 UTC
SVN commit 681998 by seb:

Accept playlistbrowser drops on items, and assign the new item to the category of the item dropped on.
BUG: 147404


 M  +9 -5      playlistbrowser.cpp  


--- branches/stable/extragear/multimedia/amarok/src/playlistbrowser.cpp #681997:681998
@@ -2782,10 +2782,17 @@
 
 void PlaylistBrowserView::moveSelectedItems( QListViewItem *newParent )
 {
-    if( !newParent || isDynamic( newParent ) || isPodcastChannel( newParent ) ||
-         isSmartPlaylist( newParent ) || isPodcastEpisode( newParent ) )
+    if( !newParent )
         return;
 
+    QListViewItem *after=0;
+    if( isDynamic( newParent ) || isPodcastChannel( newParent ) ||
+        isSmartPlaylist( newParent ) || isPodcastEpisode( newParent ) || isStream( newParent ) )
+    {
+        after = newParent;
+        newParent = newParent->parent();
+    }
+
     #define newParent static_cast<PlaylistBrowserEntry*>(newParent)
     if( !newParent->isKept() )
         return;
@@ -2801,7 +2808,6 @@
         selected.append( *it );
     }
 
-    QListViewItem *after=0;
     for( QListViewItem *item = selected.first(); item; item = selected.next() )
     {
         QListViewItem *itemParent = item->parent();
@@ -2889,8 +2895,6 @@
 
 void PlaylistBrowserView::startDrag()
 {
-    DEBUG_BLOCK
-
     KURL::List urls;
     KURL::List itemList; // this is for CollectionDB::createDragPixmap()
     KURL::List podList;  // used to add podcast episodes of the same channel in reverse order (usability)
Comment 5 Seb Ruiz 2007-07-01 08:06:14 UTC
SVN commit 682001 by seb:

Copy streams from coolstreams category
CCBUG: 147404


 M  +12 -2     playlistbrowser.cpp  


--- branches/stable/extragear/multimedia/amarok/src/playlistbrowser.cpp #682000:682001
@@ -2844,8 +2844,18 @@
             base == PlaylistBrowser::instance()->m_smartCategory && isSmartPlaylist( item ) ||
             base == PlaylistBrowser::instance()->m_dynamicCategory && isDynamic( item )      )
         {
-            itemParent->takeItem( item );
-            newParent->insertItem( item );
+            // if the item is from the cool streams dir, copy it.
+            if( item->parent() == PlaylistBrowser::instance()->m_coolStreams )
+            {
+                #define item static_cast<StreamEntry*>(item)
+                StreamEntry *copiedStream = new StreamEntry( newParent, after, item->url(), item->title() );
+                #undef  item
+            }
+            else // otherwise, we move it
+            {
+                itemParent->takeItem( item );
+                newParent->insertItem( item );
+            }
             newParent->sortChildItems( 0, true );
         }
         else if( base == PlaylistBrowser::instance()->m_podcastCategory && isPodcastChannel( item ) )