Commit 06024b03 authored by Ragnar Thomsen's avatar Ragnar Thomsen

A fix for drag'n'drop extraction

This is a fix for commit 2072d0d4. When
setting the root node by finding the topmost unselected parent,
unselected subfolders of a parent selected folder were not taken into
consideration. This resulted in files in the unselected subfolder having
the wrong root node and hence being extracted into a higher level
folder.

The issue was fixed by excluding unselected folders which are already
part of the index list (due to being subfolders of a selected parent
folder) as root nodes.
parent 44c19003
......@@ -771,9 +771,14 @@ QList<QVariant> Part::filesAndRootNodesForIndexes(const QModelIndexList& list) c
foreach (const QModelIndex& index, list) {
// Find the topmost unselected parent.
// Find the topmost unselected parent. This is done by iterating up
// through the directory hierarchy and see if each parent is included
// in the selection OR if the parent is already part of list.
// The latter is needed for unselected folders which are subfolders of
// a selected parent folder.
QModelIndex selectionRoot = index.parent();
while (m_view->selectionModel()->isSelected(selectionRoot)) {
while (m_view->selectionModel()->isSelected(selectionRoot) ||
list.contains(selectionRoot)) {
selectionRoot = selectionRoot.parent();
}
......@@ -781,6 +786,7 @@ QList<QVariant> Part::filesAndRootNodesForIndexes(const QModelIndexList& list) c
const QString rootInternalID =
m_model->entryForIndex(selectionRoot).value(InternalID).toString();
// Append index with root node to fileList.
QModelIndexList alist = QModelIndexList() << index;
foreach (const QVariant &file, filesForIndexes(alist)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment