Fix integration with new table view

Only a single selected item for the moment.

Contributes to issue CURA-8686.
This commit is contained in:
Ghostkeeper 2022-01-25 18:11:30 +01:00
parent 59494cdace
commit a7da4e4ef9
No known key found for this signature in database
GPG key ID: D2A8871EE34EC59A

View file

@ -73,54 +73,12 @@ Item
TableModelColumn { display: "uploadedAt" } TableModelColumn { display: "uploadedAt" }
rows: manager.digitalFactoryFileModel.items rows: manager.digitalFactoryFileModel.items
} }
}
/*Cura.TableView onCurrentRowChanged:
{ {
id: filesTableView manager.setSelectedFileIndices([currentRow]);
anchors.fill: parent
model: manager.digitalFactoryFileModel
visible: model.count != 0 && manager.retrievingFileStatus != DF.RetrievalStatus.InProgress
selectionMode: OldControls.SelectionMode.SingleSelection
onDoubleClicked:
{
manager.setSelectedFileIndices([row]);
openFilesButton.clicked();
}
OldControls.TableViewColumn
{
id: fileNameColumn
role: "fileName"
title: "Name"
width: Math.round(filesTableView.width / 3)
}
OldControls.TableViewColumn
{
id: usernameColumn
role: "username"
title: "Uploaded by"
width: Math.round(filesTableView.width / 3)
}
OldControls.TableViewColumn
{
role: "uploadedAt"
title: "Uploaded at"
}
Connections
{
target: filesTableView.selection
function onSelectionChanged()
{
let newSelection = [];
filesTableView.selection.forEach(function(rowIndex) { newSelection.push(rowIndex); });
manager.setSelectedFileIndices(newSelection);
} }
} }
}*/
Label Label
{ {
@ -178,7 +136,6 @@ Item
{ {
// Make sure no files are selected when the file model changes // Make sure no files are selected when the file model changes
filesTableView.currentRow = -1 filesTableView.currentRow = -1
filesTableView.selection.clear()
} }
} }
} }
@ -204,7 +161,7 @@ Item
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.right: parent.right anchors.right: parent.right
text: "Open" text: "Open"
enabled: filesTableView.selection.count > 0 enabled: filesTableView.currentRow >= 0
onClicked: onClicked:
{ {
manager.openSelectedFiles() manager.openSelectedFiles()