Disable refresh button while addons are busy.

This commit is contained in:
woblight
2018-06-20 08:30:15 +02:00
parent 2ad9fad47b
commit 8a3729661d
+10
View File
@@ -28,6 +28,7 @@ ApplicationWindow {
id: window id: window
property int availableUpdates: 0 property int availableUpdates: 0
property bool addonsReady: false
Component.onCompleted: { Component.onCompleted: {
availableUpdates = Qt.binding(function(){ availableUpdates = Qt.binding(function(){
var count = 0 var count = 0
@@ -38,6 +39,14 @@ ApplicationWindow {
} }
return count return count
}) })
addonsReady = Qt.binding(function(){
for (var i = 0; i < Engine.addons.length; i++) {
var addon = Engine.addons[i]
if (addon.status == Addon.Status.Busy)
return false
}
return true
})
} }
function updateAll() { function updateAll() {
@@ -71,6 +80,7 @@ ApplicationWindow {
icon.name: "view-refresh" icon.name: "view-refresh"
onTriggered: Engine.scanForAddons() onTriggered: Engine.scanForAddons()
shortcut: StandardKey.Refresh shortcut: StandardKey.Refresh
enabled: Control.status == Control.Ready && addonsReady
} }
Action { Action {
id: addAction id: addAction