Verified Commit 349f45c5 authored by Fushan Wen's avatar Fushan Wen
Browse files

DeviceItem: Port to contextualActionsModel

This improves the consistency.
parent 0d56d545
Pipeline #170681 passed with stage
in 51 seconds
......@@ -35,94 +35,65 @@ PlasmaExtras.ExpandableListItem {
text: model.Connected ? i18n("Disconnect") : i18n("Connect")
onTriggered: connectToDevice()
}
customExpandedViewContent: Component {
id: expandedView
ColumnLayout {
spacing: 0
contextualActionsModel: [
Action {
id: browseFilesButton
enabled: Uuids.indexOf(BluezQt.Services.ObexFileTransfer) !== -1
icon.name: "folder"
text: i18n("Browse Files")
PlasmaCore.SvgItem {
id: detailsSeparator
Layout.fillWidth: true
Layout.preferredHeight: lineSvg.elementSize("horizontal-line").height
elementId: "horizontal-line"
svg: PlasmaCore.Svg {
id: lineSvg
imagePath: "widgets/line"
}
onTriggered: {
var url = "obexftp://%1/".arg(Address.replace(/:/g, "-"));
Qt.openUrlExternally(url);
}
},
Action {
id: sendFileButton
enabled: Uuids.indexOf(BluezQt.Services.ObexObjectPush) !== -1
icon.name: "folder-download"
text: i18n("Send File")
onTriggered: {
PlasmaBt.LaunchApp.runCommand("bluedevil-sendfile", ["-u", Ubi]);
}
}
]
// Actions
GridLayout {
columns: 2
rowSpacing: 0
Item {
width: PlasmaCore.Units.iconSizes.medium
Layout.rowSpan: 2
}
PlasmaComponents3.ToolButton {
id: browseFilesButton
text: i18n("Browse Files")
icon.name: "folder"
visible: Uuids.indexOf(BluezQt.Services.ObexFileTransfer) !== -1
onClicked: {
var url = "obexftp://%1/".arg(Address.replace(/:/g, "-"));
Qt.openUrlExternally(url);
}
}
PlasmaComponents3.ToolButton {
id: sendFileButton
text: i18n("Send File")
icon.name: "folder-download"
visible: Uuids.indexOf(BluezQt.Services.ObexObjectPush) !== -1
customExpandedViewContent: Component {
id: expandedView
onClicked: {
PlasmaBt.LaunchApp.runCommand("bluedevil-sendfile", ["-u", Ubi]);
}
}
}
ColumnLayout {
spacing: 0
PlasmaCore.SvgItem {
id: actionsSeparator
// Media Player
MediaPlayerItem {
id: mediaPlayer
Layout.leftMargin: PlasmaCore.Units.gridUnit + PlasmaCore.Units.smallSpacing * 3
Layout.fillWidth: true
Layout.preferredHeight: lineSvg.elementSize("horizontal-line").height
visible: browseFilesButton.visible || sendFileButton.visible
elementId: "horizontal-line"
svg: lineSvg
visible: MediaPlayer
}
Item {
height: PlasmaCore.Units.smallSpacing
}
// Media Player
RowLayout {
Item {
width: PlasmaCore.Units.iconSizes.medium
}
MediaPlayerItem {
id: mediaPlayer
Layout.fillWidth: true
visible: MediaPlayer
}
Layout.preferredHeight: PlasmaCore.Units.smallSpacing
visible: mediaPlayer.visible
}
PlasmaCore.SvgItem {
id: mediaPlayerSeparator
Layout.fillWidth: true
Layout.preferredHeight: lineSvg.elementSize("horizontal-line").height
visible: mediaPlayer.visible
elementId: "horizontal-line"
svg: lineSvg
visible: mediaPlayer.visible
|| (!mediaPlayer.visible && !(browseFilesButton.enabled || sendFileButton.enabled))
svg: PlasmaCore.Svg {
id: lineSvg
imagePath: "widgets/line"
}
}
Item {
height: PlasmaCore.Units.smallSpacing
Layout.preferredHeight: PlasmaCore.Units.smallSpacing
visible: mediaPlayerSeparator.visible
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment