melawy-plasma-plasmoid-arch.../com.github.Melawy.ArchUpdate/contents/service/Updater.qml

45 lines
964 B
QML
Raw Normal View History

2023-04-17 12:12:12 +05:00
import QtQuick 2.15
import QtQuick.Layouts 1.15
import QtQuick.Controls 2.15
import org.kde.plasma.core 2.1 as PlasmaCore
import org.kde.plasma.plasmoid 2.0
Item {
function checkUpdates() {
cmd.exec(Plasmoid.configuration.commandForCheckingUpdates)
}
function upgrade() {
if (root.total == 0 || isNaN(root.total)){
root.createNotification("Обновлений нет")
2023-05-08 17:53:35 +05:00
root.listOfPackages = ""
2023-04-17 12:12:12 +05:00
return
}
else {
2023-05-24 00:29:25 +05:00
root.upgradeStatus = root.installingStatus
updateUi()
2023-04-17 12:12:12 +05:00
cmd.exec(Plasmoid.configuration.commandForUpgrade)
}
}
Timer {
id: timer
interval: Plasmoid.configuration.updateInterval * 60000 // minute to milisecond
running: true
repeat: true
triggeredOnStart: false
onTriggered: checkUpdates()
}
Timer {
id: startUpTimer
2023-05-24 00:29:25 +05:00
interval: 20000 // 20 seconds
2023-04-17 12:12:12 +05:00
running: true
repeat: false
triggeredOnStart: false
onTriggered: checkUpdates()
}
}