Bug 235722 - Dropping files (from drag&drop) to the Amarok Playlist (from Konqueror) Not Working
Summary: Dropping files (from drag&drop) to the Amarok Playlist (from Konqueror) Not W...
Status: RESOLVED FIXED
Alias: None
Product: amarok
Classification: Applications
Component: general (show other bugs)
Version: 2.3.0.90
Platform: Mandriva RPMs Linux
: NOR normal
Target Milestone: ---
Assignee: Amarok Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-04-29 15:00 UTC by Shlomi Fish
Modified: 2010-06-09 10:41 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 2.3.2


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Shlomi Fish 2010-04-29 15:00:32 UTC
Version:           amarok-2.3.0.90-1mdv2010.1 (using KDE 4.4.2)
Compiler:          gcc-c++-4.4.3-2mnb2 
OS:                Linux
Installed from:    Mandriva RPMs

When I drag and drop a file from Konqueror to the Amarok playlist (on Mandriva Cooker - tested on both x86-32 and x86-64 using amarok-2.3.0.90-1mdv2010.1 ), then the first file is dropped correctly, but the second one is causing problems and pops a copy of the existing file. I've tried with .mp3-s , .flv-s and .ogg-s - all yield the same problem.

It's very annoying and prevents me from properly using Amarok.
Comment 1 Sven Krohlas 2010-04-30 13:08:49 UTC
Drag and drop works fine for me with Dolphin. So maybe this is a configuration problem of some problem with Konqueror.

Does it work from other apps than Konqueror for you?
Comment 2 Shlomi Fish 2010-04-30 16:18:05 UTC
(In reply to comment #1)
> Drag and drop works fine for me with Dolphin. So maybe this is a configuration
> problem of some problem with Konqueror.
> 
> Does it work from other apps than Konqueror for you?

I tried dragging and dropping (at least while a file in Amarok is playing) from all of these:

1. Dolphin.

2. Konqueror.

3. Nautilus.

In all cases, it popped up the pop up and did not drop the file. Dragging and dropping a file to Kaffeine works fine from all apps, so it's a problem with Amarok.

I should note that I:

1. Drop a single file.

2. Start playing it.

3. Try to drop other files into Kaffeine (from any of the file managers.)

Furthermore, dropping a file from the Amarok file browser to the playlist works fine, but I don't have a tree view or tabs there, which is why I prefer Konqueror or something similar.
Comment 3 Shlomi Fish 2010-05-01 10:50:39 UTC
OK, now I tried it with the git master version of Amarok started with:

$ KDEDIRS=/home/shlomi/apps/multimedia/amarok-svn/ \
  /home/shlomi/apps/multimedia/amarok-svn/bin/amarok

And the bug is still exhibited there - I get a pop-up for every dragged file and it does not get dragged there. I noticed that after a few drags and drops the problem disappears.

I should note that I'm still using the underlying patched Mandriva KDE and Qt libraries, so it might be a problem there.
Comment 4 Shlomi Fish 2010-05-16 21:02:50 UTC
I should note that the version of Amarok before the Mandriva upgrade to 2.3.0.90 worked fine in this respect (the stable version - 2.3.x or 2.2.x).
Comment 5 Shlomi Fish 2010-05-16 21:29:40 UTC
I believe that I can now consistently reproduce the strange image popup of the file due to the droppping to the playlist by first deleting an item from the playlist in Amarok. 

Here is some --debug information from that Amarok snapshot of a while ago after the .mp3 file was dropped and I was given a popup error:

{{{{
shlomi:~$ amarok: BEGIN: virtual void Playlist::PrettyListView::startDrag(Qt::DropActions) 
amarok:   BEGIN: PopupDropper* PopupDropperFactory::createPopupDropper(QWidget*) 
link XMLID_9_ hasn't been detected!
link XMLID_9_ hasn't been detected!
link XMLID_9_ hasn't been detected!
link XMLID_9_ hasn't been detected!
Could not resolve property : linearGradient5167
Could not resolve property : linearGradient3563
Could not resolve property : linearGradient3563-3
Could not resolve property : linearGradient3563-3
amarok:   END__: PopupDropper* PopupDropperFactory::createPopupDropper(QWidget*) - Took 0.17s 
svgHandler SVG renderer is  KSvgRenderer(0x9618e28) 
m_pd SVG renderer is  KSvgRenderer(0x9618e28) 
does play exist in renderer?  true 
amarok:   BEGIN: void MainWindow::saveLayout() 
amarok:   END__: void MainWindow::saveLayout() - Took 0.024s 
amarok:   BEGIN: virtual void Playlist::PrettyListView::dropEvent(QDropEvent*) 
amarok:     BEGIN: int Playlist::Controller::moveRows(QList<int>&, int) 
amarok:       BEGIN: void Playlist::Controller::moveRows(QList<int>&, QList<int>&) 
amarok:         [Playlist::Controller] moving rows: 19 18 
amarok:         [Playlist::Controller] moving rows: 20 19 
amarok:         [Playlist::Controller] moving rows: 21 20 
amarok:         [Playlist::Controller] moving rows: 22 21 
amarok:         [Playlist::Controller] moving rows: 18 22 
amarok:         BEGIN: virtual void Playlist::MoveTracksCmd::redo() 
amarok:           BEGIN: void Playlist::Model::moveTracksCommand(const Playlist::MoveCmdList&, bool) 
amarok:             [Playlist::Model] moveTracksCommand: 5 false 
amarok:             BEGIN: void StatusBar::updateTotalPlaylistLength() 
amarok:             END__: void StatusBar::updateTotalPlaylistLength() - Took 0.00073s 
amarok:           END__: void Playlist::Model::moveTracksCommand(const Playlist::MoveCmdList&, bool) - Took 0.0018s 
amarok:         END__: virtual void Playlist::MoveTracksCmd::redo() - Took 0.0022s 
amarok:       END__: void Playlist::Controller::moveRows(QList<int>&, QList<int>&) - Took 0.0035s 
amarok:     END__: int Playlist::Controller::moveRows(QList<int>&, int) - Took 0.0038s 
amarok:   END__: virtual void Playlist::PrettyListView::dropEvent(QDropEvent*) - Took 0.056s 
amarok:   [Playlist::PrettyListView] After the drag! 
amarok:   [Playlist::PrettyListView] clearing PUD 
amarok: END__: virtual void Playlist::PrettyListView::startDrag(Qt::DropActions) - DELAY Took (quite long) 5.3s 
}}}}
Comment 6 Rick W. Chen 2010-06-09 09:37:20 UTC
commit f4fde86a49186b6402b1d45787f8449abda13b92
Author: Rick W. Chen <stuffcorpse@archlinux.us>
Date:   Wed Jun 9 04:54:24 2010 +1200

    Implement custom dragEnterEvent in the playlist
    
    BUG: 235722

diff --git a/ChangeLog b/ChangeLog
index ac023b5..76ebc2a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -28,6 +28,7 @@ VERSION 2.3.2-Beta 1
       Patch by Richard Longland <rlongland@hotmail.com>.
 
   BUGFIXES:
+    * Fixed dropping files to playlist from Konqueror. (BR 235722)
     * Fixed keyboard shortcuts of actions from scripts lost after restart.
       Thanks to Martin Blumenstingl <darklight.xdarklight@googlemail.com>.
       (BR 223165)
diff --git a/src/playlist/view/listview/PrettyListView.cpp b/src/playlist/view/listview/PrettyListView.cpp
index 0e26c5f..25a897c 100644
--- a/src/playlist/view/listview/PrettyListView.cpp
+++ b/src/playlist/view/listview/PrettyListView.cpp
@@ -26,6 +26,7 @@
 #include "PrettyListView.h"
 
 #include "amarokconfig.h"
+#include "AmarokMimeData.h"
 #include "context/ContextView.h"
 #include "context/popupdropper/libpud/PopupDropperItem.h"
 #include "context/popupdropper/libpud/PopupDropper.h"
@@ -417,6 +418,20 @@ Playlist::PrettyListView::findInSource()
 }
 
 void
+Playlist::PrettyListView::dragEnterEvent( QDragEnterEvent *event )
+{
+    const QMimeData *mime = event->mimeData();
+    if( mime->hasUrls() ||
+        mime->hasFormat( AmarokMimeData::TRACK_MIME ) ||
+        mime->hasFormat( AmarokMimeData::PLAYLIST_MIME ) ||
+        mime->hasFormat( AmarokMimeData::PODCASTEPISODE_MIME ) ||
+        mime->hasFormat( AmarokMimeData::PODCASTCHANNEL_MIME ) )
+    {
+        event->acceptProposedAction();
+    }
+}
+
+void
 Playlist::PrettyListView::dragMoveEvent( QDragMoveEvent* event )
 {
     QModelIndex index = indexAt( event->pos() );
diff --git a/src/playlist/view/listview/PrettyListView.h b/src/playlist/view/listview/PrettyListView.h
index a4cb57e..e4893e3 100644
--- a/src/playlist/view/listview/PrettyListView.h
+++ b/src/playlist/view/listview/PrettyListView.h
@@ -89,6 +89,7 @@ public slots:
 protected:
     void showEvent( QShowEvent* );
     void contextMenuEvent( QContextMenuEvent* );
+    void dragEnterEvent( QDragEnterEvent *event );
     void dragLeaveEvent( QDragLeaveEvent* );
     void dragMoveEvent( QDragMoveEvent* );
     void dropEvent( QDropEvent* );