Bug 369611

Summary: Dolphin cannot create links to files, only directories
Product: [Frameworks and Libraries] frameworks-kio Reporter: Guo Yunhe <i>
Component: generalAssignee: David Faure <faure>
Status: RESOLVED DUPLICATE    
Severity: normal CC: kdelibs-bugs, nate
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
See Also: https://bugreports.qt.io/browse/QTBUG-720
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Guo Yunhe 2016-10-01 16:48:29 UTC
Screenshot http://imgur.com/Ze1GYVz



Reproducible: Always

Steps to Reproduce:
1. Write click, open context menu. choose create symbol link to file or directory, open the dialog.
2. Choose New --> Create symbol link to file or directory. Open input dialog.
3. Click the "open" icon, open file dialog.
4. Select file in file dialog.

Actual Results:  
Can only select directory in file dialog. Cannot select not file. So cannot create file link.

Expected Results:  
The file dialog should allows to choose both files and folders.
Comment 1 Nate Graham 2017-08-18 16:17:22 UTC
Confirmed.
Comment 2 Nate Graham 2017-08-18 21:47:26 UTC
Digging into this, the problem is in KIO. In kio/src/filewidgets/knameandurlinputdialog.cpp, the file picker is called with:

d->m_urlRequester->setMode(KFile::File | KFile::Directory);

The intention seems to have been to make it accept both file and directory input, but the actual result appears to be to limit it to directory-only input.
Comment 3 Nate Graham 2017-08-19 19:07:40 UTC
It turns out this is impossible as currently implemented, because the QT file picker does not have a mode that allow the selection of either files or directories--only one at a time (https://bugreports.qt.io/browse/QTBUG-720). We could change it to show files, but then it wouldn't accept directories as input.

Until and unless the QT file dialog gains that ability, we need to rewrite how we handle this use case to account for the lack of this feature.
Comment 4 Guo Yunhe 2017-08-19 21:52:09 UTC
One quick idea:

Have two context menu entries and dialog:

1. Link to a file --> use a file picker
2. Link to a folder --> use a folder picker

This will give users the function they want before Qt support this feature.
Comment 5 Nate Graham 2017-08-19 22:44:04 UTC
Yes, that was my thought as well. However changing it to that approach involves a lot of work given the way this feature is currently implemented, and it also has translation implications (changing one already-translated string to two new ones).
Comment 6 Nate Graham 2017-11-20 04:43:30 UTC

*** This bug has been marked as a duplicate of bug 357171 ***