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

45 lines
959 B
QML

import QtQuick
import QtQuick.Layouts
import QtQuick.Controls
import org.kde.plasma.core as PlasmaCore
import org.kde.plasma.plasmoid
Item {
function checkUpdates() {
cmd.exec(Plasmoid.configuration.commandForCheckingUpdates)
}
function upgrade() {
if (root.total == 0 || isNaN(root.total)){
root.createNotification(i18n("Nothing update"))
// root.listOfPackages = ""
return
}
else {
root.upgradeStatus = root.installingStatus
root.updateUi()
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
interval: 10000
running: Plasmoid.configuration.checkOnStart
repeat: false
triggeredOnStart: false
onTriggered: checkUpdates()
}
}