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

45 lines
951 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)){
2024-01-03 20:41:39 +05:00
root.createNotification(i18n("Nothing update"))
2023-05-24 12:47:45 +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
2023-05-24 12:47:45 +05:00
root.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 12:47:45 +05:00
interval: 10000
2023-04-17 12:12:12 +05:00
running: true
repeat: false
triggeredOnStart: false
onTriggered: checkUpdates()
}
}