From 3c1f22c73ca2800d2246f18f82146d31edb25983 Mon Sep 17 00:00:00 2001 From: Valeria Fadeeva Date: Wed, 24 May 2023 12:47:45 +0500 Subject: [PATCH] Update --- .../contents/service/Updater.qml | 6 +++--- .../contents/ui/Compact.qml | 2 +- .../contents/ui/main.qml | 18 ++++++++++++------ 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/com.github.Melawy.ArchUpdate/contents/service/Updater.qml b/com.github.Melawy.ArchUpdate/contents/service/Updater.qml index 6d7f372..0ca0e58 100644 --- a/com.github.Melawy.ArchUpdate/contents/service/Updater.qml +++ b/com.github.Melawy.ArchUpdate/contents/service/Updater.qml @@ -13,12 +13,12 @@ Item { function upgrade() { if (root.total == 0 || isNaN(root.total)){ root.createNotification("Обновлений нет") - root.listOfPackages = "" + // root.listOfPackages = "" return } else { root.upgradeStatus = root.installingStatus - updateUi() + root.updateUi() cmd.exec(Plasmoid.configuration.commandForUpgrade) } } @@ -34,7 +34,7 @@ Item { Timer { id: startUpTimer - interval: 20000 // 20 seconds + interval: 10000 running: true repeat: false triggeredOnStart: false diff --git a/com.github.Melawy.ArchUpdate/contents/ui/Compact.qml b/com.github.Melawy.ArchUpdate/contents/ui/Compact.qml index 678cb4a..46ea678 100644 --- a/com.github.Melawy.ArchUpdate/contents/ui/Compact.qml +++ b/com.github.Melawy.ArchUpdate/contents/ui/Compact.qml @@ -38,7 +38,7 @@ Item { } Text { - text: (root.total < 99 || isNaN(root.total)) ? root.total : "99+" + text: root.badgeText font.pointSize: 6 color: "White" anchors.centerIn: circle diff --git a/com.github.Melawy.ArchUpdate/contents/ui/main.qml b/com.github.Melawy.ArchUpdate/contents/ui/main.qml index 8d9e99b..61690a3 100644 --- a/com.github.Melawy.ArchUpdate/contents/ui/main.qml +++ b/com.github.Melawy.ArchUpdate/contents/ui/main.qml @@ -22,7 +22,8 @@ Item { property string mainIcon: iconDefault - property string total: "0" + property int total: 0 + property string badgeText: "" property bool badgeVisible: false @@ -84,12 +85,12 @@ Item { break case checkingUpdatesStatus: mainIcon = iconRefresh - //total = 0 + // badgeText = "↻" badgeVisible = false - //total = "↻" break case readyStatus: mainIcon = iconReadyToUpgrade + badgeText = (total < 99 || isNaN(total)) ? total : "99+" badgeVisible = true break case installingStatus: @@ -98,12 +99,10 @@ Item { break case errorStatus: mainIcon = iconError - total = 0 badgeVisible = false break default: mainIcon = iconDefault - total = 0 badgeVisible = false } } @@ -238,7 +237,14 @@ Item { } function onConnected(source) { - upgradeStatus = checkingUpdatesStatus + // Если запущена проверка обновлений + if (source == Plasmoid.configuration.commandForCheckingUpdates) { + upgradeStatus = checkingUpdatesStatus + updateUi() + return + } + + upgradeStatus = installingStatus updateUi() } }