This commit is contained in:
Valeria Fadeeva 2023-05-24 12:47:45 +05:00
parent 284748ebf0
commit 3c1f22c73c
3 changed files with 16 additions and 10 deletions

View File

@ -13,12 +13,12 @@ Item {
function upgrade() { function upgrade() {
if (root.total == 0 || isNaN(root.total)){ if (root.total == 0 || isNaN(root.total)){
root.createNotification("Обновлений нет") root.createNotification("Обновлений нет")
root.listOfPackages = "" // root.listOfPackages = ""
return return
} }
else { else {
root.upgradeStatus = root.installingStatus root.upgradeStatus = root.installingStatus
updateUi() root.updateUi()
cmd.exec(Plasmoid.configuration.commandForUpgrade) cmd.exec(Plasmoid.configuration.commandForUpgrade)
} }
} }
@ -34,7 +34,7 @@ Item {
Timer { Timer {
id: startUpTimer id: startUpTimer
interval: 20000 // 20 seconds interval: 10000
running: true running: true
repeat: false repeat: false
triggeredOnStart: false triggeredOnStart: false

View File

@ -38,7 +38,7 @@ Item {
} }
Text { Text {
text: (root.total < 99 || isNaN(root.total)) ? root.total : "99+" text: root.badgeText
font.pointSize: 6 font.pointSize: 6
color: "White" color: "White"
anchors.centerIn: circle anchors.centerIn: circle

View File

@ -22,7 +22,8 @@ Item {
property string mainIcon: iconDefault property string mainIcon: iconDefault
property string total: "0" property int total: 0
property string badgeText: ""
property bool badgeVisible: false property bool badgeVisible: false
@ -84,12 +85,12 @@ Item {
break break
case checkingUpdatesStatus: case checkingUpdatesStatus:
mainIcon = iconRefresh mainIcon = iconRefresh
//total = 0 // badgeText = ""
badgeVisible = false badgeVisible = false
//total = ""
break break
case readyStatus: case readyStatus:
mainIcon = iconReadyToUpgrade mainIcon = iconReadyToUpgrade
badgeText = (total < 99 || isNaN(total)) ? total : "99+"
badgeVisible = true badgeVisible = true
break break
case installingStatus: case installingStatus:
@ -98,12 +99,10 @@ Item {
break break
case errorStatus: case errorStatus:
mainIcon = iconError mainIcon = iconError
total = 0
badgeVisible = false badgeVisible = false
break break
default: default:
mainIcon = iconDefault mainIcon = iconDefault
total = 0
badgeVisible = false badgeVisible = false
} }
} }
@ -238,7 +237,14 @@ Item {
} }
function onConnected(source) { function onConnected(source) {
upgradeStatus = checkingUpdatesStatus // Если запущена проверка обновлений
if (source == Plasmoid.configuration.commandForCheckingUpdates) {
upgradeStatus = checkingUpdatesStatus
updateUi()
return
}
upgradeStatus = installingStatus
updateUi() updateUi()
} }
} }