Bug 189322

Summary: Drap & drop to desktop folderview does not work
Product: [Applications] ark Reporter: Jerome Vizcaino <j.vizcaino>
Component: generalAssignee: Raphael Kubo da Costa <rakuco>
Status: RESOLVED FIXED    
Severity: normal CC: alessandro.ufms, i.semenov.kde, illumilore, nitanovidiu, sjakub
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Debian testing   
OS: Linux   
Latest Commit: Version Fixed In: 4.6.4
Sentry Crash Report:

Description Jerome Vizcaino 2009-04-10 23:07:35 UTC
Version:            (using KDE 4.2.2)
OS:                Linux
Installed from:    Debian testing/unstable Packages

My plasma uses a folderview widget on one of the two screens.
After opening an archive, you cannot drag a file and drop it on
the desktop (while dragging files from konqueror to the desktop
folderview works fine).
Comment 1 Raphael Kubo da Costa 2009-04-30 02:04:31 UTC
Drag and drop support has been implemented in trunk some time ago, so expect it 
in 4.3.

Marking as FIXED.
Comment 2 Harald Hvaal 2009-04-30 10:39:34 UTC
Raphael, are you sure about this? I was under the impression that dnd to folderview needs special code, and I have not done anything to implement this yet.
Comment 3 Raphael Kubo da Costa 2009-04-30 14:28:12 UTC
I was able to drag and drop to a folderview here, the only thing is that a menu pops up with two options - Copy and Link. Copy extracts the desired file with no problems, but link creates a .desktop file with an awkward name that "links" to the desired file URL inside the archive. It works, but it's ugly.

If dragging to the "desktop", it can either create an icon (and extract the file) or perform some special action - in the case of an image, you can create a picture frame of it, but this doesn't work.

I don't know how much control we have over these other actions, but you can reopen it if you want.
Comment 4 Raphael Kubo da Costa 2011-05-01 20:52:46 UTC
*** Bug 271268 has been marked as a duplicate of this bug. ***
Comment 5 Raphael Kubo da Costa 2011-05-01 20:54:17 UTC
Reopening, as described in bug 271286:

"OK, I tested it and I got the behaviour you described, but only with zip files.
Dealing with rar files still doesn't work. What's interesting is that drag&drop
from rar files work with regular dolphin windows, but not the folderview.
Dragging from zip files (I'm not sure what other formats, tried only zip and
rar) works with both folderview and dolphin windows.

I have also tried some other formats, and it doesn't work with 7zip and
tar+bzip2. It works with tar+gzip, but only if the file created has '.tar.gz'
extension. When it's '.tgz' it doesn't work anymore. The uncompressed '.tar'
works as well. Also, when I create the file with tar+bzip2, but with '.tar.gz'
extension it works."
Comment 6 Raphael Kubo da Costa 2011-05-01 20:55:01 UTC
If anyone else is willing to give this a shot: the problem seems to be in ArchiveModel::mimeData().
Comment 7 Raphael Kubo da Costa 2011-05-02 04:27:26 UTC
Git commit d37a244a3c6dd80f2f4403d6aaabc63b3700e3ca by Raphael Kubo da Costa.
Committed on 02/05/2011 at 04:35.
Pushed by rkcosta into branch 'KDE/4.6'.

Make folderview understand application/x-kde-dndextract.

The code was copied almost as-is from Dolphin's implementation. It
should now be possible to drag and drop files from any archive opened
in Ark to folderview.

It previously worked with some archive types due to a weird code path
in Ark which should not exist.

PS: Fredrik, I ended up using pathOrUrl() because I can't pass KUrl
via DBus.

Reviewed-by: Fredrik Höglund

CCMAIL: fredrik@kde.org
CCBUG: 189322

M  +18   -2    plasma/applets/folderview/iconview.cpp     

http://commits.kde.org/kde-baseapps/d37a244a3c6dd80f2f4403d6aaabc63b3700e3ca
Comment 8 Raphael Kubo da Costa 2011-05-02 04:29:31 UTC
Git commit f9656e750ca3dfa102e3f74fcbb3d1311a10dcb2 by Raphael Kubo da Costa.
Committed on 02/05/2011 at 04:35.
Pushed by rkcosta into branch 'master'.

Make folderview understand application/x-kde-dndextract.

The code was copied almost as-is from Dolphin's implementation. It
should now be possible to drag and drop files from any archive opened
in Ark to folderview.

It previously worked with some archive types due to a weird code path
in Ark which should not exist.

PS: Fredrik, I ended up using pathOrUrl() because I can't pass KUrl
via DBus.

Reviewed-by: Fredrik Höglund

CCMAIL: fredrik@kde.org
BUG: 189322
FIXED-IN: 4.6.4

(cherry picked from commit d37a244a3c6dd80f2f4403d6aaabc63b3700e3ca)

M  +18   -2    plasma/applets/folderview/iconview.cpp     

http://commits.kde.org/kde-baseapps/f9656e750ca3dfa102e3f74fcbb3d1311a10dcb2
Comment 9 Jakub Schmidtke 2011-05-02 22:20:18 UTC
I just tested this patch (with KDE 4.6.2) and it seems to work fine.

There are still other issues with D&D from Ark to both dolphin windows and the folderview - related to archives with subdirectories inside. Should I open new bug requests or describe those problems here?
Comment 10 Raphael Kubo da Costa 2011-05-02 23:18:22 UTC
Can you check if it's not bug 208384?
Comment 11 Jakub Schmidtke 2011-05-02 23:23:18 UTC
That one too. But I have more problems (opened a bug 272281).
Comment 12 Jakub Schmidtke 2011-05-02 23:35:15 UTC
And another one: bug 272282 (drag & drop on folderview that displays "desktop:/" location)
Comment 13 Raphael Kubo da Costa 2011-05-08 21:17:24 UTC
*** Bug 272808 has been marked as a duplicate of this bug. ***
Comment 14 Raphael Kubo da Costa 2011-05-17 15:05:42 UTC
*** Bug 273458 has been marked as a duplicate of this bug. ***
Comment 15 Ovidiu D. Niţan 2012-03-22 20:04:25 UTC
Seems that this is not working in KDE 4.8.1 (and in some earlier versions). Is this a regression? I use "Folder View" as desktop layout...
Comment 16 illumilore 2012-03-22 20:50:44 UTC
Just tried it myself, and dragging to the desktop wants to unzip the file to ~/documents for some reason (maybe because that is from where I added the test file from?). So yes, broken, again.
Comment 17 Raphael Kubo da Costa 2012-03-26 17:27:15 UTC
I'm running trunk/git master here. I added a Folder View widget to my desktop point to /tmp and then dragged a file from a tarball in Ark onto it. Everything worked as expected. Can you guys provide a step-by-step testcase?
Comment 18 Ovidiu D. Niţan 2012-03-26 19:24:50 UTC
(In reply to comment #17)
> I'm running trunk/git master here. I added a Folder View widget to my
> desktop point to /tmp and then dragged a file from a tarball in Ark onto it.
> Everything worked as expected. Can you guys provide a step-by-step testcase?

It's working when you drag'n'drop to a FolderView widget. It's not working when you drag'n'drop directly to desktop, when using Folder View Layout.
Comment 19 Raphael Kubo da Costa 2012-03-27 17:17:12 UTC
(In reply to comment #18)
> (In reply to comment #17)
> > I'm running trunk/git master here. I added a Folder View widget to my
> > desktop point to /tmp and then dragged a file from a tarball in Ark onto it.
> > Everything worked as expected. Can you guys provide a step-by-step testcase?
> 
> It's working when you drag'n'drop to a FolderView widget. It's not working
> when you drag'n'drop directly to desktop, when using Folder View Layout.

I've switched my desktop to using Folder View as the layout and set it to display /tmp. I then dragged files from both a zip and a tar.gz archive, and everything seemed to work fine (a top-level file in the tarball was extracted to /tmp, a file inside a folder in the zip archive was extrected into /tmp/folder/file.ext).

CC'ing Ignat Semenov, who's been working on the folder view code these days, in case he has anything to say here.
Comment 20 Raphael Kubo da Costa 2012-04-11 18:33:48 UTC
OK, I've finally managed to reproduce the issue. It's being tracked in bug 294904. As no code has changed in Ark's side, I guess it's a regression in the folder view code.
Comment 21 illumilore 2012-04-13 01:33:58 UTC
What about drag and drop from one zip file to another? That doesn't work between two ark windows for me.
Comment 22 Raphael Kubo da Costa 2012-04-14 00:59:16 UTC
(In reply to comment #21)
> What about drag and drop from one zip file to another? That doesn't work
> between two ark windows for me.

IIRC that's not implemented yet.