Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Plasma
Bluedevil
Commits
349f45c5
Verified
Commit
349f45c5
authored
May 01, 2022
by
Fushan Wen
Browse files
DeviceItem: Port to contextualActionsModel
This improves the consistency.
parent
0d56d545
Pipeline
#170681
passed with stage
in 51 seconds
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
src/applet/package/contents/ui/DeviceItem.qml
View file @
349f45c5
...
...
@@ -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
{
h
eight
:
PlasmaCore
.
Units
.
smallSpacing
Layout.preferredH
eight
:
PlasmaCore
.
Units
.
smallSpacing
visible
:
mediaPlayerSeparator
.
visible
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment