Bug 187152 - multiple selection undone when dragging files
Summary: multiple selection undone when dragging files
Status: RESOLVED FIXED
Alias: None
Product: ark
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: Ragnar Thomsen
URL:
Keywords:
: 188205 201221 201775 209752 217626 218042 238780 281711 297886 309534 319698 320405 328058 340626 359564 (view as bug list)
Depends on:
Blocks:
 
Reported: 2009-03-14 16:30 UTC by S. Burmeister
Modified: 2016-02-19 11:46 UTC (History)
50 users (show)

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


Attachments
dnd multiply extract (1.25 KB, patch)
2013-02-24 21:43 UTC, Vova
Details
KXMLGUIFactory (552 bytes, patch)
2013-02-24 21:44 UTC, Vova
Details

Note You need to log in before you can comment on or make changes to this bug.
Description S. Burmeister 2009-03-14 16:30:13 UTC
Version:            (using KDE 4.2.1)
OS:                Linux
Installed from:    SuSE RPMs

If one opens an archive and selects all files, e.g. by drawing a frame with the mouse, one would expect that clicking and holding on any of those would allow drag+drop to some place outside ark. Currently however, ark de-selects all but the file one clicked on.
Comment 1 Sergio PR 2009-05-01 20:51:42 UTC
Same problem here.

By the way, you can vote your own bug and give it 20 votes, just like I'll do :)
Comment 2 Sergio PR 2009-05-01 20:52:56 UTC
(In reply to comment #1)
> Same problem here.
> 
> By the way, you can vote your own bug and give it 20 votes, just like I'll do
> :)

I'm sorry, I didn't say anything about my system.

ArchLinux i686, KDE 4.2.2 from KDEMod, Ark 2.12
Comment 3 Sergio PR 2009-05-24 00:12:50 UTC
This bug is still present in KDE 4.3 Beta 1
Comment 4 Sergio PR 2009-06-11 19:35:54 UTC
This bug is still present in KDE 4.3 Beta 2 :(
Tested from: http://home.kde.org/~binner/kde-four-live/
Comment 5 Sergio PR 2009-06-23 23:56:39 UTC
I think this problem is origined by:

void ArchiveView::slotClicked(const QModelIndex& index)
{
    if (KGlobalSettings::singleClick()) {
        if (m_mouseButtons != Qt::LeftButton) // FIXME: see Qt-issue 176832
            return;

        // If the user is pressing shift or control, more than one item is being selected
        const Qt::KeyboardModifiers modifier = QApplication::keyboardModifiers();
        if ((modifier & Qt::ShiftModifier) || (modifier & Qt::ControlModifier))
            return;

        emit itemTriggered(index);
    }
}

I couldn't try it, but I think this slot is called when you try to drag, so it causes that only one file is selected, unselecting everything else.

Could anyone check that?
Comment 6 Raphael Kubo da Costa 2009-06-24 00:30:11 UTC
Nope, that code is related to a different issue. The unselection is done at ArchiveView::startDrag.

It currently works that way due to the issue related to dragging and dropping multiple files from different folders with no common root node or no common direct ancestor. In this case, it's difficult to determine which files to extract and you might end up extracting all folders above the items you've selected, which isn't what you usually want when you're dragging your items to a folder or your desktop.

According to Harald, it was implemented this way in order to have any support for drag'n'drop for KDE 4.2 at all, and later neither of us have had the time to properly fix it.

As always, patches are welcome ;)
Comment 7 Raphael Kubo da Costa 2009-06-30 07:43:07 UTC
*** Bug 188205 has been marked as a duplicate of this bug. ***
Comment 8 Raphael Kubo da Costa 2009-07-23 17:46:29 UTC
*** Bug 201221 has been marked as a duplicate of this bug. ***
Comment 9 Raphael Kubo da Costa 2009-07-28 18:54:07 UTC
*** Bug 201775 has been marked as a duplicate of this bug. ***
Comment 10 Raphael Kubo da Costa 2009-10-07 14:15:55 UTC
*** Bug 209752 has been marked as a duplicate of this bug. ***
Comment 11 Alejandro Cobo López 2009-11-25 16:55:33 UTC
Same problem in KDE 4.3.2 under Mandriva One 2010.
Comment 12 Raphael Kubo da Costa 2009-12-06 20:45:45 UTC
*** Bug 217626 has been marked as a duplicate of this bug. ***
Comment 13 Raphael Kubo da Costa 2009-12-10 03:03:24 UTC
*** Bug 218042 has been marked as a duplicate of this bug. ***
Comment 14 Sergio PR 2010-03-03 19:35:41 UTC
This bug persists on KDE 4.4.1
Comment 15 Sergio PR 2010-05-02 23:59:51 UTC
This bug persists on KDE 4.4.3
Comment 16 Raphael Kubo da Costa 2010-05-25 22:40:06 UTC
*** Bug 238780 has been marked as a duplicate of this bug. ***
Comment 17 Alexey Shildyakov 2010-09-01 07:14:14 UTC
The bug exist in KDE 4.5.0
Comment 18 H.H. 2010-11-04 09:16:36 UTC
still present in kde-4.5.2
Comment 19 Raphael Kubo da Costa 2010-12-08 02:18:48 UTC
Changing the default assignee in the currently open Ark bug reports to me.
Comment 20 gameforge1 2011-04-11 23:56:51 UTC
This persists in 4.6.2, in fact this bug just had its two year anniversary.
Comment 21 Elias Probst 2011-05-16 14:24:29 UTC
Still present in 4.6.3
Comment 22 Raphael Kubo da Costa 2011-09-10 01:11:39 UTC
*** Bug 281711 has been marked as a duplicate of this bug. ***
Comment 23 Kai Uwe Broulik 2011-11-22 12:03:45 UTC
I think even the developers themselves now stopped using Ark … you know why.
Comment 24 Raphael Kubo da Costa 2011-11-22 12:21:57 UTC
I think we can all agree that your trollish behavior and lack of constructive suggestions or patches whatsoever clearly indicate you should be spending your time elsewhere. Please refrain from wasting everyone's time next time you feel like acting like a spoiled child.
Comment 25 Raphael Kubo da Costa 2012-04-11 14:52:52 UTC
*** Bug 297886 has been marked as a duplicate of this bug. ***
Comment 26 Roger Pixley 2012-05-21 14:44:46 UTC
Raphael Kubo da Costa: Just checking. The logic behind not allowing multiple individual files to be extracted through drag and drop is that if files are extracted from multiple folders in the archive it would be difficult to determine how to extract the files so that they come out in multiple directories. The issue comes from drag and drop being designed around having a single destination directory instead of multiple ones. If that is correct would it be possible to detect that there are multiple directories from the paths and simulate multiple Drag and Drop events to have multiple destinations?
Comment 27 Alexey Shildyakov 2012-05-22 10:26:36 UTC
I think its pretty simple. We have several selections in archive (it is possible to have selected folder and one file in it in addition).
We should unpack all selected in one destination. Just unpack sequentially. One selected after another. Unpack folders and save structure from the selected folder (not the path to that folder in archive).
Example:
Archive:
/folderA/fileA1
/folderA/fileA2
/file1
/folderB/folderC/fileBC1
/folderB/folderC/fileBC2
/folderB/fileB1

Selected to drag-n-drop:
folderA
fileA2
folderC
fileB1

Should be unpacked in ONE destination folder as:
folderA/fileA1
folderA/fileA2
fileA2
folderC/fileBC1
folderC/fileBC2
fileB1

It's simple, isn't it?
Comment 28 Roger Pixley 2012-05-22 21:10:58 UTC
Of course it is. Really simple. 

How would you handle the scenario of

Archive:
/folderA/fileA1
/folderA/fileA2
/fileB1
/folderB/folderC/fileBC1
/folderB/folderC/fileBC2
/folderB/fileB1
/folderD/FolderA/FileA3
/FolderD/FolderA/FileA4
FolderD/FolderA/FileA5

Selected to drag-n-drop:
folderA
fileB1
folderC
fileB1 
FolderA

?
Comment 29 Alexey Shildyakov 2012-05-23 04:00:34 UTC
after or before (this depend on how the Ark is unpacking: directly to destination or in temporary folder, then coping to destination) second fileB is unpacked the standard KDE dialog should be shown: the fileB already exist - change the name, skip or replace the file. This behavior also applied in case of folderA already exists in destination folder.
Comment 30 Roger Pixley 2012-05-23 05:57:19 UTC
That feels pretty ugly for most people esp as the number of files needed increases. Just occurred to me to see if  the archive kio tries to handle this scenario.
Comment 31 Alexey Shildyakov 2012-05-23 06:07:41 UTC
I think this scenario is the user problem. User should understand that filenames are the same. If he need to unpack these files - just unpack as many times as needed in any destination, but not for one time. My solution apply user to change the name, for example, if he forgot about same filenames in the archive.
Don't understand what you mean sad "the number of files needed increases". What is "needed files"?
Comment 32 Roger Pixley 2012-05-23 06:47:49 UTC
I meant as the user selects more and more files that they expect in a hierarchy. I would expect that as a user I would think without any other information that drag and drop would work the same way as selecting the files and clicking the extract button. having them be so radically different would be jarring everytime. 

What would be the logic behind having them do that?
Comment 33 Alexey Shildyakov 2012-05-23 11:42:07 UTC
Because this is standard behavior in other archive programs. If I need only one file from many-level structure in destination, I don't need the whole structure with folder, folder inside first folder, folder inside second folder is inside first folder and so on. I just need the one file.
This scenario (when many file with the same name will be unpacked in one directory) is rare, I think.
When you extract files from Extract button you can change the behavior by clicking checkbox "Preserve paths when extracting". Because this could be changed I couldn't expect the one of these 2 behaviors, cause I don't remember which state I use at the last time.
Just only we - 2 people said the opinion. 25 users are CC'ed to this bug. I think we need their voice about this problem.
If you want, it might be more complicated. For example, after drag-n-drop Ark may show additional menu to user (like dolphin's drag-n-drop produce) with 2 values:
- Make the whole paths structure
- Don't make additional paths
(the text should be another)
Comment 34 Raphael Kubo da Costa 2012-05-24 20:16:48 UTC
(In reply to comment #26)
> Raphael Kubo da Costa: Just checking. The logic behind not allowing multiple
> individual files to be extracted through drag and drop is that if files are
> extracted from multiple folders in the archive it would be difficult to
> determine how to extract the files so that they come out in multiple
> directories. The issue comes from drag and drop being designed around having
> a single destination directory instead of multiple ones. If that is correct
> would it be possible to detect that there are multiple directories from the
> paths and simulate multiple Drag and Drop events to have multiple
> destinations?

I might have started to forget things, but IIRC your explanation is correct, and your solution might work. In the end, this and bug 208384 have pretty much the same cause (and possibly the same solution).
Comment 35 oracle2b 2012-06-06 18:18:48 UTC
Until i found this bug report, I was wondering why I couldn't drag and drop multiple files into a folder. Please make this a priority, I can't believe this has to be requested in 2012.
Comment 36 Raphael Kubo da Costa 2012-11-04 20:13:19 UTC
*** Bug 309534 has been marked as a duplicate of this bug. ***
Comment 37 madura.x86 2012-11-11 14:28:02 UTC
This is the only *bug* that I see in stable KDE versions 4.8 and 4.9 please fix and make KDE the ultimate!
Comment 38 Vova 2013-02-24 21:43:06 UTC
Created attachment 77556 [details]
dnd multiply extract
Comment 39 Vova 2013-02-24 21:44:23 UTC
Created attachment 77557 [details]
KXMLGUIFactory
Comment 40 Vova 2013-02-24 21:45:40 UTC
It`s not a bug, it`s seems deliberate restriction. I don`t know why developer doing that, but that patch(^^^ se above message) remove restriction and make it usefull. No have problem allmost, work propertly. Second patch remove message about KXMLGUIFactory ololo, bla bla bla. and avoid(?) leaks, crashs and other terrible problems described in the debug message :)
Comment 41 Elias Probst 2013-02-24 22:57:58 UTC
(In reply to comment #40)
> It`s not a bug, it`s seems deliberate restriction. I don`t know why
> developer doing that, but that patch(^^^ se above message) remove
> restriction and make it usefull. No have problem allmost, work propertly.
> Second patch remove message about KXMLGUIFactory ololo, bla bla bla. and
> avoid(?) leaks, crashs and other terrible problems described in the debug
> message :)

Please create a review on https://git.reviewboard.kde.org where the responsible developer (and others) can comment on details of the patches until they're ready to get their "Ship it".
Comment 42 Raphael Kubo da Costa 2013-05-12 08:44:21 UTC
*** Bug 319698 has been marked as a duplicate of this bug. ***
Comment 43 yannanth 2013-05-12 20:57:16 UTC
This is literally one of the very few weak links of the standard distribution of KDE SC. I can't believe Ark doesn't do this and it's unbelievably infuriating for me who often works with large archives.
Comment 44 Raphael Kubo da Costa 2013-05-29 08:29:28 UTC
*** Bug 320405 has been marked as a duplicate of this bug. ***
Comment 45 illumilore 2013-06-02 01:37:02 UTC
Who is the main developer/maintainer of ark?
Comment 46 Vova 2013-06-02 09:43:07 UTC
(In reply to comment #45)
> Who is the main developer/maintainer of ark?

See about in ark. Also, I`m pushed patches on review board. Still awaiting... Already tired always patching myself package when upgrading.
Comment 47 S. Burmeister 2013-06-03 14:53:25 UTC
(In reply to comment #46)
> See about in ark. Also, I`m pushed patches on review board. Still
> awaiting... Already tired always patching myself package when upgrading.

You should ask on the kde-devel mailinglist for somebody to review your patches and to change the maintainer.
Comment 48 Sergey Zolotarev 2013-06-21 16:31:01 UTC
Even GNOME's archive manager can do this...
Comment 49 Christoph Feck 2013-11-25 21:21:27 UTC
*** Bug 328058 has been marked as a duplicate of this bug. ***
Comment 50 G360 2013-12-11 02:37:02 UTC
Vova, if you patch works, it would be great to have it integrated in ark. Have you submitted it to https://git.reviewboard.kde.org ?
Comment 51 Vasil Svetoslavov 2013-12-25 21:16:33 UTC
When using drag-n-drop the last selected settings from the extract dialog could be used. Thus you'll have consistent behaviour (the drag-n-drop would work the same as the extract button) and better usability - the user will be able to do drag-n-drop for multiple files). Also, I guess this could also be achieved by making the drag-n-drop as clicking the "Extract" button while passing a path as parameter.
Comment 52 Vasil Svetoslavov 2013-12-25 21:22:50 UTC
(In reply to comment #51)
> When using drag-n-drop the last selected settings from the extract dialog
> could be used. Thus you'll have consistent behaviour (the drag-n-drop would
> work the same as the extract button) and better usability - the user will be
> able to do drag-n-drop for multiple files). Also, I guess this could also be
> achieved by making the drag-n-drop as clicking the "Extract" button while
> passing a path as parameter.

While not the best or most elegant solution in the world, this will be usable. Then later on this can be changed to something like having an option whether to show some UI when dropping multiple files, similar to the "extract" dialog, but adapted for the case of drag-n-drop.

Actually, as a user, I will accept and get used to anything that does the trick. I guess most users will also do.
Comment 53 JKAbrams 2014-01-13 19:40:27 UTC
As for the specification how this should be done to me, it is very simple:
Ark should use the exact same logic as in dolphin, the problem is solved there and works as expected (what I refer to is dolphins ability to show the contents of folders 'inline', allowing multiple selections). 
Is this what the suggested patches do?
Could Ark reuse the code from Dolphin?
Comment 54 Ruman Gerst 2014-05-10 13:38:38 UTC
Still in KDE 4.13 - EXTREMLY+++ annoying!
Comment 55 Daniele Scasciafratte 2014-05-18 20:29:40 UTC
very annoying :-(
Comment 56 luminoso 2014-07-09 12:35:22 UTC
Vova, any news about the patch being accepted?
Comment 57 Albert Astals Cid 2014-07-09 17:29:39 UTC
Vova, can we have a link to your reviewboard request?
Comment 58 Christoph Feck 2014-07-09 20:39:55 UTC
He posted comment #38 as https://git.reviewboard.kde.org/r/110672/
Comment 59 Ruman Gerst 2014-07-14 22:48:29 UTC
(In reply to comment #58)
> He posted comment #38 as https://git.reviewboard.kde.org/r/110672/

Cool. Finally (?)

... wait ... "by removing the code that singles the selection." ... who had this _great_ idea of making the selection single ... ? o_o
Comment 60 Albert Astals Cid 2014-08-06 22:24:21 UTC
Git commit 52ac4aea6f391cfe43dec0994891095d39364bd2 by Albert Astals Cid, on behalf of Alim Gokkaya.
Committed on 06/08/2014 at 22:22.
Pushed by aacid into branch 'KDE/4.14'.

Allow multiple selection in archiveview

REVIEW: 110672
FIXED-IN: 4.14.0

M  +0    -2    part/archiveview.cpp
M  +0    -7    part/part.cpp

http://commits.kde.org/ark/52ac4aea6f391cfe43dec0994891095d39364bd2
Comment 61 Raphael Kubo da Costa 2014-08-07 21:37:48 UTC
Git commit 4429a4ebbb58f44e4c96603f6bc519da8c0ce5da by Raphael Kubo da Costa.
Committed on 07/08/2014 at 21:29.
Pushed by rkcosta into branch 'KDE/4.14'.

Revert "Allow multiple selection in archiveview"

The commit being reverted seems to work fine for the ZIP and LHA
backends, but for libarchive and RAR it can extract files with the wrong
name, a varying hierarchy depending on which of the selected entries is
being dragged or sometimes even leave selected entries out.

While it is certainly bad to go back to the previous state, it is worse
to have this working at varying degrees in each backend, the worst case
including partial extraction with wrong names.

This reverts commit 52ac4aea6f391cfe43dec0994891095d39364bd2.

M  +2    -0    part/archiveview.cpp
M  +7    -0    part/part.cpp

http://commits.kde.org/ark/4429a4ebbb58f44e4c96603f6bc519da8c0ce5da
Comment 62 Raphael Kubo da Costa 2014-11-04 12:29:28 UTC
*** Bug 340626 has been marked as a duplicate of this bug. ***
Comment 63 Harald Hvaal 2015-07-23 21:25:33 UTC
I'm the guy who originally intentionally made it like that (as former Ark maintainer) for technical reasons like Roger Pixley describes here: https://bugs.kde.org/show_bug.cgi?id=187152#c26 . Before those commits, I don't think dnd was even supported. I eventually realized how complex multiple selections are to support with regards to destination directories and just made it force it into a single selection in order to even support dnd at all. The timeline after this is unfortunately a pretty common one in FOSS: you either lose interest or other life events keep you from spending time on the project.
I'm sorry I'm not able to be of any help.
Comment 64 Ragnar Thomsen 2015-07-24 13:03:09 UTC
Multiple drag'n'drop selection has actually been implemented and is currently undergoing review:
https://git.reviewboard.kde.org/r/124018/

Hopefully, we can merge it before 15.08 final release :)
Comment 65 Ragnar Thomsen 2015-09-10 11:56:58 UTC
Git commit 2072d0d49a8946b62ebb8b3cb961c512ad1f8a25 by Ragnar Thomsen.
Committed on 10/09/2015 at 11:55.
Pushed by rthomsen into branch 'Applications/15.08'.

Fix drag'n'drop extraction of multiple selected archive entries

This commit implements multi-selection drag'n'drop extraction. This is
used when dragging multiple files from Ark to e.g. Dolphin for
extraction. It's based partially on work done by Raphael in
the multiple-dnd-selection git branch.

Dragged files are extracted without path. Dragged folders are extracted
without path, but with all folders/files beneath them
extracted with relative path (i.e. path beneath the selected folder).

A struct called FileRootNodePair is added to Kerfuffle::Archive, which
contains two strings (the filename with path and a root node).
A FileRootNodePair is passed for each entry to be extracted in a
QVariantList to ArchiveModel::extractFiles(), which creates the
ExtractJob. All children of folders are added to the QVariantList. The
QVariantList is in turn passed to CliPlugin::copyFiles and hence
LibArchiveInterface::copyFiles(). The latter is modified to remove the
specific rootnode from each file when extracting.

The CLI plugins, e.g. clizip and clirar, still extract with full path,
due to not supporting individual RootNodes. However, this is a separate
issue and should be fixed separately.
FIXED-IN: 15.08.1
REVIEW: 124018

M  +9    -0    kerfuffle/archive_kerfuffle.cpp
M  +39   -0    kerfuffle/archive_kerfuffle.h
M  +1    -1    kerfuffle/cliinterface.cpp
M  +1    -1    kerfuffle/jobs.cpp
M  +1    -1    part/archivemodel.cpp
M  +0    -2    part/archiveview.cpp
M  +48   -65   part/part.cpp
M  +3    -2    part/part.h
M  +44   -13   plugins/libarchive/libarchivehandler.cpp

http://commits.kde.org/ark/2072d0d49a8946b62ebb8b3cb961c512ad1f8a25
Comment 66 Elvis Angelaccio 2016-02-19 11:46:54 UTC
*** Bug 359564 has been marked as a duplicate of this bug. ***