plasmoid: use Kirigami components for session list delegates
Replace plain ItemDelegate/Label with Kirigami.BasicListItem and proper icon sources for state indicators.
This commit is contained in:
parent
d1d113b5fd
commit
a86d7391b2
|
|
@ -131,30 +131,33 @@ Item {
|
|||
clip: true
|
||||
model: dbus.sessions
|
||||
|
||||
delegate: ItemDelegate {
|
||||
delegate: Kirigami.BasicListItem {
|
||||
id: sessionDelegate
|
||||
width: sessionList.width
|
||||
highlighted: modelData.id === dbus.activeSessionId
|
||||
activeBackgroundColor: Kirigami.Theme.highlightColor
|
||||
activeTextColor: Kirigami.Theme.highlightedTextColor
|
||||
|
||||
property bool renaming: false
|
||||
|
||||
contentItem: RowLayout {
|
||||
spacing: 6
|
||||
|
||||
Label {
|
||||
text: {
|
||||
Kirigami.Icon {
|
||||
implicitWidth: Kirigami.Units.iconSizes.small
|
||||
implicitHeight: Kirigami.Units.iconSizes.small
|
||||
source: {
|
||||
var state = modelData.state
|
||||
if (state === "idle") return "○"
|
||||
if (state.startsWith("calling")) return "⚡"
|
||||
return "●"
|
||||
if (state === "idle") return "media-playback-paused"
|
||||
if (state.startsWith("calling")) return "system-run"
|
||||
return "media-playback-start"
|
||||
}
|
||||
font.bold: true
|
||||
color: modelData.state !== "idle"
|
||||
? Kirigami.Theme.positiveTextColor
|
||||
: Kirigami.Theme.textColor
|
||||
}
|
||||
|
||||
Label {
|
||||
PlasmaComponents.Label {
|
||||
id: sessionLabel
|
||||
text: modelData.id
|
||||
Layout.fillWidth: true
|
||||
|
|
@ -192,7 +195,7 @@ Item {
|
|||
}
|
||||
}
|
||||
|
||||
Label {
|
||||
PlasmaComponents.Label {
|
||||
text: modelData.agent
|
||||
opacity: 0.7
|
||||
font.pointSize: Kirigami.Theme.defaultFont.pointSize
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import org.kde.plasma.plasmoid
|
|||
import org.kde.plasma.components as PlasmaComponents
|
||||
import org.kde.plasma.extras as PlasmaExtras
|
||||
import org.kde.kirigami as Kirigami
|
||||
import org.kde.kirigami.delegates as KirigamiDelegates
|
||||
import org.ollie.private as Ollie
|
||||
|
||||
PlasmoidItem {
|
||||
|
|
@ -138,7 +139,7 @@ PlasmoidItem {
|
|||
clip: true
|
||||
model: dbus.sessions
|
||||
|
||||
delegate: ItemDelegate {
|
||||
delegate: KirigamiDelegates.RoundedItemDelegate {
|
||||
id: sessionDelegate
|
||||
width: sessionList.width
|
||||
highlighted: modelData.id === dbus.activeSessionId
|
||||
|
|
@ -148,20 +149,21 @@ PlasmoidItem {
|
|||
contentItem: RowLayout {
|
||||
spacing: 6
|
||||
|
||||
Label {
|
||||
text: {
|
||||
Kirigami.Icon {
|
||||
implicitWidth: Kirigami.Units.iconSizes.small
|
||||
implicitHeight: Kirigami.Units.iconSizes.small
|
||||
source: {
|
||||
let state = modelData.state
|
||||
if (state === "idle") return "○"
|
||||
if (state.startsWith("calling")) return "⚡"
|
||||
return "●"
|
||||
if (state === "idle") return "media-playback-paused"
|
||||
if (state.startsWith("calling")) return "system-run"
|
||||
return "media-playback-start"
|
||||
}
|
||||
font.bold: true
|
||||
color: modelData.state !== "idle"
|
||||
? Kirigami.Theme.positiveTextColor
|
||||
: Kirigami.Theme.textColor
|
||||
}
|
||||
|
||||
Label {
|
||||
PlasmaComponents.Label {
|
||||
id: sessionLabel
|
||||
text: modelData.id
|
||||
Layout.fillWidth: true
|
||||
|
|
@ -199,7 +201,7 @@ PlasmoidItem {
|
|||
}
|
||||
}
|
||||
|
||||
Label {
|
||||
PlasmaComponents.Label {
|
||||
text: modelData.agent
|
||||
opacity: 0.7
|
||||
font.pixelSize: Kirigami.Theme.smallFont.pixelSize
|
||||
|
|
|
|||
Reference in New Issue