QML UI: support sliding action to allow the user to delete GPS fixes

This is just the UI, the actual deletion is not yet implemented.

I really like this interaction with the list items. Slide them to the left and
you see icons for actions. Right now we have just one and that may seem like
overkill (hey, we could just have the delete icon instead of the application
menu icon, right?) but once we allow the ability to show the GPS location on a
map we'll have two operations and this will make more sense.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2016-01-08 21:48:53 -08:00
parent 7c459f87cd
commit b34a507d51
3 changed files with 14 additions and 2 deletions

View file

@ -28,11 +28,12 @@ MobileComponents.Page {
Component {
id: gpsDelegate
MobileComponents.ListItem {
MobileComponents.ListItemWithActions {
id: gpsFix
enabled: true
width: parent.width
property int horizontalPadding: MobileComponents.Units.gridUnit / 2 - MobileComponents.Units.smallSpacing + 1
Item {
width: parent.width - MobileComponents.Units.gridUnit
height: childrenRect.height - MobileComponents.Units.smallSpacing
@ -84,8 +85,16 @@ MobileComponents.Page {
font.pointSize: subsurfaceTheme.smallPointSize
}
}
}
actions: [
Action {
iconName: "dialog-cancel"
onTriggered: {
print("delete this!")
}
}
]
}
}

View file

@ -32,6 +32,7 @@
<file alias="org/kde/plasma/mobilecomponents/PageRow.qml">mobilecomponents/PageRow.qml</file>
<file alias="org/kde/plasma/mobilecomponents/Label.qml">mobilecomponents/Label.qml</file>
<file alias="org/kde/plasma/mobilecomponents/ListItem.qml">mobilecomponents/ListItem.qml</file>
<file alias="org/kde/plasma/mobilecomponents/ListItemWithActions.qml">mobilecomponents/ListItemWithActions.qml</file>
<file alias="org/kde/plasma/mobilecomponents/OverlayDrawer.qml">mobilecomponents/OverlayDrawer.qml</file>
<file alias="org/kde/plasma/mobilecomponents/Theme.qml">mobilecomponents/Theme.qml</file>
<file alias="org/kde/plasma/mobilecomponents/Units.qml">mobilecomponents/Units.qml</file>
@ -46,5 +47,6 @@
<file alias="org/kde/plasma/mobilecomponents/icons/document-save.svg">mobilecomponents/icons/document-save.svg</file>
<file alias="org/kde/plasma/mobilecomponents/icons/view-readermode.svg">mobilecomponents/icons/view-readermode.svg</file>
<file alias="org/kde/plasma/mobilecomponents/icons/dialog-cancel.svg">mobilecomponents/icons/dialog-cancel.svg</file>
<file alias="org/kde/plasma/mobilecomponents/icons/application-menu.svg">mobilecomponents/icons/application-menu.svg</file>
</qresource>
</RCC>

View file

@ -51,5 +51,6 @@ cp $BREEZE/icons/actions/24/document-save.svg $MC/icons
cp $BREEZE/icons/actions/24/go-next.svg $MC/icons
cp $BREEZE/icons/actions/24/go-previous.svg $MC/icons
cp $BREEZE/icons/actions/16/view-readermode.svg $MC/icons
cp $BREEZE/icons/actions/24/application-menu.svg $MC/icons
echo org.kde.plasma.mobilecomponents synced from upstream