Skip to content

Commit aa7c764

Browse files
add action for one update
1 parent 50b2de1 commit aa7c764

File tree

5 files changed

+63
-22
lines changed

5 files changed

+63
-22
lines changed

a2n.archupdate.plasmoid/contents/config/main.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
3939
<default>yay</default>
4040
</entry>
4141

42+
<entry name="updateCommandOne" type="String">
43+
<default>yay -Sy</default>
44+
</entry>
45+
4246
<entry name="countArchCommand" type="String">
4347
<default>checkupdates | wc -l</default>
4448
</entry>

a2n.archupdate.plasmoid/contents/service/Updater.qml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Item {
1313
property string listArchCommand: Plasmoid.configuration.listArchCommand
1414
property string listAurCommand: Plasmoid.configuration.listAurCommand
1515
property string updateCommand: Plasmoid.configuration.updateCommand
16+
property string updateCommandOne: Plasmoid.configuration.updateCommandOne
1617
property bool notCloseCommand: Plasmoid.configuration.notCloseCommand
1718

1819
function countArch() {
@@ -48,6 +49,16 @@ Item {
4849
}
4950
}
5051

52+
function launchOneUpdate(packageName) {
53+
if (updateCommandOne !== '' && packageName) {
54+
if (notCloseCommand) {
55+
cmd.exec("konsole --noclose -e '" + updateCommandOne + " " + packageName + "'")
56+
} else {
57+
cmd.exec("konsole -e '" + updateCommandOne + " " + packageName + "'")
58+
}
59+
}
60+
}
61+
5162
function killProcess(process) {
5263
cmd.exec("kill -9 " + process)
5364
}

a2n.archupdate.plasmoid/contents/ui/Full.qml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,15 +100,25 @@ PlasmaExtras.Representation {
100100
id: updateIcon
101101
height: Kirigami.Units.iconSizes.medium
102102
icon.name: "install-symbolic"
103+
display: PlasmaComponents.AbstractButton.IconOnly
104+
text: i18n("Install all update")
103105
onClicked: update()
104106
visible: main.hasUpdate()
107+
PlasmaComponents.ToolTip {
108+
text: parent.text
109+
}
105110
}
106111

107112
PlasmaComponents.ToolButton {
108113
id: checkUpdatesIcon
109114
height: Kirigami.Units.iconSizes.medium
110115
icon.name: "view-refresh-symbolic"
116+
display: PlasmaComponents.AbstractButton.IconOnly
117+
text: i18n("Refresh list")
111118
onClicked: refresh()
119+
PlasmaComponents.ToolTip {
120+
text: parent.text
121+
}
112122
}
113123
}
114124
}

a2n.archupdate.plasmoid/contents/ui/components/ListItem.qml

Lines changed: 31 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ PlasmaComponents.ItemDelegate {
1616

1717
width: parent.width
1818

19+
function updateOne() {
20+
updater.launchOneUpdate(name)
21+
}
22+
1923
// generate & style the name of the package
2024
function generateName() {
2125
const nc = plasmoid.configuration.nameUseCustomColor ? plasmoid.configuration.nameColor : Kirigami.Theme.textColor
@@ -31,30 +35,36 @@ PlasmaComponents.ItemDelegate {
3135
return '<font color="' + fvc + '">' + fv + '</font><font color="' + sc + '"> ' + plasmoid.configuration.separatorText + ' </font><font color="' + tvc + '">' + tv + '</font>'
3236
}
3337

34-
// Add MouseArea to detect mouse hover
35-
MouseArea {
36-
id: mouseArea
37-
anchors.fill: parent
38-
hoverEnabled: true
39-
onEntered: listItem.highlighted = true
40-
onExited: listItem.highlighted = false
41-
}
38+
contentItem: RowLayout {
39+
ColumnLayout {
40+
spacing: 2
4241

43-
contentItem: ColumnLayout {
44-
spacing: 2
42+
Kirigami.Heading {
43+
id: itemHeading
44+
level: 3
45+
width: parent.width
46+
text: generateName()
47+
}
4548

46-
Kirigami.Heading {
47-
id: itemHeading
48-
level: 3
49-
width: parent.width
50-
text: generateName()
49+
Controls.Label {
50+
id: itemLabel
51+
width: parent.width
52+
wrapMode: Text.Wrap
53+
text: generateVersion()
54+
}
5155
}
52-
53-
Controls.Label {
54-
id: itemLabel
55-
width: parent.width
56-
wrapMode: Text.Wrap
57-
text: generateVersion()
56+
ColumnLayout {
57+
Layout.alignment: Qt.AlignRight
58+
PlasmaComponents.ToolButton {
59+
id: actionToolButton
60+
icon.name: "system-run-symbolic"
61+
display: PlasmaComponents.AbstractButton.IconOnly
62+
text: i18n("Update " + name)
63+
onClicked: updateOne()
64+
PlasmaComponents.ToolTip {
65+
text: parent.text
66+
}
67+
}
5868
}
5969
}
6070

a2n.archupdate.plasmoid/contents/ui/config/configCommand.qml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Kirigami.ScrollablePage {
1313
property alias cfg_notCloseCommand: notCloseBox.checked
1414

1515
property alias cfg_updateCommand: updateCommandInput.text
16+
property alias cfg_updateCommandOne: updateCommandOneInput.text
1617
property alias cfg_countArchCommand: countArchCommandInput.text
1718
property alias cfg_countAurCommand: countAurCommandInput.text
1819

@@ -124,7 +125,12 @@ Kirigami.ScrollablePage {
124125

125126
Controls.TextField {
126127
id: updateCommandInput
127-
Kirigami.FormData.label: "Update command: "
128+
Kirigami.FormData.label: "Update all command: "
129+
}
130+
131+
Controls.TextField {
132+
id: updateCommandOneInput
133+
Kirigami.FormData.label: "Update one command: "
128134
}
129135

130136
}

0 commit comments

Comments
 (0)