From a7da4e4ef90293830fec53ba239fd5a742f590bb Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 25 Jan 2022 18:11:30 +0100 Subject: [PATCH] Fix integration with new table view Only a single selected item for the moment. Contributes to issue CURA-8686. --- .../resources/qml/OpenProjectFilesPage.qml | 55 ++----------------- 1 file changed, 6 insertions(+), 49 deletions(-) diff --git a/plugins/DigitalLibrary/resources/qml/OpenProjectFilesPage.qml b/plugins/DigitalLibrary/resources/qml/OpenProjectFilesPage.qml index 8e77c853a3..e0009d20e3 100644 --- a/plugins/DigitalLibrary/resources/qml/OpenProjectFilesPage.qml +++ b/plugins/DigitalLibrary/resources/qml/OpenProjectFilesPage.qml @@ -73,55 +73,13 @@ Item TableModelColumn { display: "uploadedAt" } rows: manager.digitalFactoryFileModel.items } + + onCurrentRowChanged: + { + manager.setSelectedFileIndices([currentRow]); + } } - /*Cura.TableView - { - id: filesTableView - 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 { id: emptyProjectLabel @@ -178,7 +136,6 @@ Item { // Make sure no files are selected when the file model changes filesTableView.currentRow = -1 - filesTableView.selection.clear() } } } @@ -204,7 +161,7 @@ Item anchors.bottom: parent.bottom anchors.right: parent.right text: "Open" - enabled: filesTableView.selection.count > 0 + enabled: filesTableView.currentRow >= 0 onClicked: { manager.openSelectedFiles()