Bug 363991 - Drag and drop does not work in folder view
Summary: Drag and drop does not work in folder view
Status: RESOLVED FIXED
Alias: None
Product: frameworks-kio
Classification: Frameworks and Libraries
Component: general (other bugs)
Version First Reported In: 5.22.0
Platform: openSUSE Linux
: NOR major
Target Milestone: ---
Assignee: David Faure
URL: https://en.wikipedia.org/wiki/Drag_an...
Keywords:
Depends on:
Blocks:
 
Reported: 2016-06-05 16:25 UTC by dusan.peterc
Modified: 2016-06-27 10:41 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.7.0
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description dusan.peterc 2016-06-05 16:25:46 UTC
I have program icons on desktop, and if I drag and drop a data file to the program icon, I get an error window with title "Err...sma" and a cryptic message "Access denied to .".
Drag and drop worked nicely on KDE4, and is really basic operation for a GUI desktop since the first Engelbart demo in 1968.
Functionality is equivalent as "open with", or running program with data file as a parameter.

Reproducible: Always

Steps to Reproduce:
1. Click on a file with left mouse button to select it
2. Drag it to program icon
3. Release the mouse

Actual Results:  
Error message  "Access denied to ."

Expected Results:  
Open the program with the data contained in the dragged file.
Comment 1 Kai Uwe Broulik 2016-06-05 16:30:32 UTC
I can confirm also on master. What this bug report is about:

1. Have a folderview set to desktop:/ folder
2. Have a desktop file to an application there (eg. drag Kate from kickoff there and link here)
3. now drag a file onto the "Kate" icon in the folderview

Instead of opening Kate with the file I just dropped, I get an error message saying "Access denied to ."
Comment 2 Kai Uwe Broulik 2016-06-05 16:34:43 UTC
Problem lies here in foldermodel.cpp I suppose:

if (file.readType() == QLatin1String("Link")) {
    dropTargetUrl = file.readUrl();
} else {
    dropTargetUrl = item.url();
}

If the desktop file is a Link to another location it should offer to move/copy/link to that location or else move/copy/link to where the desktop file is (. being the current directory). It nowhere handles the case of dropping something onto an Application type desktop file
Comment 3 Eike Hein 2016-06-06 06:41:28 UTC
It does -- KIO::drop() is responsible for that.
Comment 4 Kai Uwe Broulik 2016-06-06 12:11:05 UTC
Right, I can also reproduce with Dolphin. Either a bug in KIO or the desktop:/ kio slave. Re-assigning.
Comment 5 Kai Uwe Broulik 2016-06-06 21:56:08 UTC
It creates a DropJob with URL QUrl("desktop:/org.kde.kate.desktop") which is then rewritten *somewhere* (I suspect the rewriteUrl thing in the desktop KIO slave) to QUrl("file:///home/kaiuwe/Schreibtisch//foo"), note the double slash.

This ends up making QUrl::toLocalFile fail and return an empty QString in the DropJobPrivate::slotStart() so KDesktopFile::isDesktopFile returns false and it never actually tries to open the dropped file with the application.
Comment 6 David Faure 2016-06-16 13:36:45 UTC
Git commit f2772c4fe63944f71f797c0d34d2cdb37897a535 by David Faure.
Committed on 16/06/2016 at 13:34.
Pushed by dfaure into branch 'master'.

Fix DnD onto desktop:/ app desktop file.

We need to resolve from desktop:/ to file:/ so that DropJob
can handle application .desktop files.

M  +1    -1    src/panels/folders/folderspanel.cpp
M  +1    -1    src/views/dolphinview.cpp

http://commits.kde.org/dolphin/f2772c4fe63944f71f797c0d34d2cdb37897a535
Comment 7 Kai Uwe Broulik 2016-06-27 10:41:17 UTC
Git commit a79cbce0fed06c64ea32cd540b4824662e3a7e9e by Kai Uwe Broulik.
Committed on 27/06/2016 at 10:34.
Pushed by broulik into branch 'Plasma/5.7'.

[FolderModel] Use mostLocalUrl() to properly resolve desktop:/ URLs

This fixes dropping files onto applications in the desktop:/ folder.
FIXED-IN: 5.7.0

Differential Revision: https://phabricator.kde.org/D1915

M  +2    -2    containments/desktop/plugins/folder/foldermodel.cpp

http://commits.kde.org/plasma-desktop/a79cbce0fed06c64ea32cd540b4824662e3a7e9e