cancel download from button, not from visibility

previously was canceling twice
remove delete button for custom images
This commit is contained in:
Dmitry Degtyarev 2020-10-30 18:22:46 +04:00
parent 5047ef7b57
commit 1ad5388912
2 changed files with 6 additions and 28 deletions

View File

@ -42,16 +42,6 @@ Dialog {
writeArrow.color = palette.text
}
onVisibleChanged: {
if (!visible) {
if (drives.selected)
drives.selected.cancel()
releases.variant.cancelDownload()
releases.variant.resetStatus()
}
reset()
}
Connections {
target: releases
onSelectedChanged: {
@ -191,10 +181,6 @@ Dialog {
dialog.close()
}
}
PropertyChanges {
target: deleteButton
state: releases.selected.isLocal ? "hidden" : "ready"
}
},
State {
name: "failed_verification_no_drives"
@ -499,20 +485,6 @@ Dialog {
Layout.fillHeight: true
}
DeleteButton {
id: deleteButton
Layout.fillWidth: true
Layout.fillHeight: true
Layout.maximumWidth: parent.width - leftButton.width - rightButton.width - parent.spacing * 2
state: "hidden"
errorText: qsTr("It was not possible to delete the file")
onStarted: {
if (releases.variant.erase())
state = "success"
else
state = "error"
}
}
AdwaitaButton {
id: leftButton
Layout.alignment: Qt.AlignRight
@ -523,7 +495,11 @@ Dialog {
if (drives.selected)
drives.selected.cancel()
releases.variant.resetStatus()
releases.variant.cancelDownload()
dialog.close()
if (drives.selected)
drives.selected.cancel()
reset()
}
}
AdwaitaButton {

View File

@ -1062,6 +1062,8 @@ void ReleaseVariant::download() {
const QString md5sumUrl = m_url.left(cutoffIndex) + "/MD5SUM";
QNetworkReply *reply = makeNetworkRequest(md5sumUrl, 5000);
mDebug() << "Downloading MD5SUM";
const auto onMd5sumDownloadFinished =
[this, reply]() {
mDebug() << this->metaObject()->className() << "Downloaded MD5SUM";