add base update button handler
This commit is contained in:
27
Main.qml
27
Main.qml
@@ -19,6 +19,7 @@ ApplicationWindow {
|
||||
color: Theme.color1
|
||||
|
||||
property string packageManager: "yay"
|
||||
property string sessionPassword: ""
|
||||
property bool consoleOpen: false
|
||||
|
||||
Component.onCompleted: UpdateManager.checkUpdates()
|
||||
@@ -63,8 +64,13 @@ ApplicationWindow {
|
||||
|
||||
Pages.UpdatePg {
|
||||
id: pgUpdate
|
||||
isChecking: UpdateManager.isChecking
|
||||
packageCount: UpdateManager.packageCount
|
||||
isChecking: UpdateManager.isChecking
|
||||
isUpdating: UpdateManager.isUpdating
|
||||
isInstalling: UpdateManager.isInstalling
|
||||
onUpdateRequested: {
|
||||
root.requestPrivileged("update", "")
|
||||
}
|
||||
}
|
||||
|
||||
Pages.InstallPg {
|
||||
@@ -100,4 +106,23 @@ ApplicationWindow {
|
||||
// title: root.consoleTitle
|
||||
// consoleLogData: root.consoleLogData
|
||||
// }
|
||||
|
||||
function requestPrivileged(action, packageName) {
|
||||
if (root.sessionPassword !== "") {
|
||||
root.runPrivileged(action, packageName, root.sessionPassword)
|
||||
return
|
||||
}
|
||||
|
||||
console.log("requestPrivileged")
|
||||
// passwordDialog.action = action
|
||||
// passwordDialog.packageName = packageName
|
||||
// passwordDialog.open()
|
||||
}
|
||||
|
||||
function runPrivileged(action, packageName, password) {
|
||||
console.log("runPrivileged")
|
||||
// if (action == "update") UpdateManager.update(password, root.packageManager)
|
||||
// else if (action === "install") UpdateManager.installPackage(packageName, password)
|
||||
// else UpdateManager.removePackage(packageName, password)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,9 +17,9 @@ Button {
|
||||
|
||||
background: Rectangle {
|
||||
radius: 1
|
||||
color: !root.enabled ? "#313244" : root.down ? "#6f8fd8" : root.hovered ? "#89b4fa" : "#8CAAEE"
|
||||
color: !root.enabled ? Theme.color5 : root.down ? Theme.color11 : root.hovered ? Theme.color6 : Theme.color10
|
||||
border.width: root.visualFocus ? 2 : 0
|
||||
border.color: "#cdd6f4"
|
||||
border.color: Theme.color2
|
||||
|
||||
Behavior on color { ColorAnimation { duration: 100 } }
|
||||
}
|
||||
@@ -27,7 +27,7 @@ Button {
|
||||
contentItem: Text {
|
||||
text: root.text
|
||||
font: root.font
|
||||
color: root.enabled ? "#1e1e2e" : "#585b70"
|
||||
color: root.enabled ? Theme.color8 : Theme.color12
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
}
|
||||
|
||||
@@ -8,6 +8,9 @@ Item {
|
||||
|
||||
property int packageCount: 0
|
||||
property bool isChecking: true
|
||||
property bool isUpdating: false
|
||||
property bool isInstalling: false
|
||||
signal updateRequested()
|
||||
|
||||
ColumnLayout {
|
||||
anchors.fill: parent
|
||||
@@ -25,6 +28,11 @@ Item {
|
||||
|
||||
Buttons.UpdateBtn {
|
||||
Layout.fillWidth: true
|
||||
packageCount: root.packageCount
|
||||
isChecking: root.isChecking
|
||||
isUpdating: root.isUpdating
|
||||
isInstalling: root.isInstalling
|
||||
onClicked: root.updateRequested()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,9 @@ QtObject {
|
||||
readonly property color color7: "#f9e2af"
|
||||
readonly property color color8: "#1e1e2e"
|
||||
readonly property color color9: "#242439"
|
||||
readonly property color color10: "#8CAAEE"
|
||||
readonly property color color11: "#6f8fd8"
|
||||
readonly property color color12: "#585b70"
|
||||
|
||||
readonly property int fontSize: 12
|
||||
readonly property int fontTitleSize: 20
|
||||
|
||||
Reference in New Issue
Block a user