QML UI: present an undo dialog after delete

The dialog gives the user 3 seconds to undo the delete and then disappears
without any user interaction.

This isn't hooked up, yet.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2016-02-29 06:14:18 -08:00
parent 84769dc2f6
commit e39e9eee3b
2 changed files with 16 additions and 1 deletions

View file

@ -25,6 +25,7 @@ MobileComponents.Page {
property alias startpressure: detailsEdit.startpressureText
property alias endpressure: detailsEdit.endpressureText
property alias gasmix: detailsEdit.gasmixText
property QtObject notificationComponent
state: "view"
@ -63,8 +64,13 @@ MobileComponents.Page {
iconName: "trash-empty"
onTriggered: {
manager.deleteDive(diveDetailsListView.currentItem.modelData.dive.id)
stackView.pop()
var notification = notificationComponent.createObject(contentItem.parent);
notification.showNotification("Dive deleted", 3000, "Undo",
function() {
print("now I need to undo!")
});
contextDrawer.close()
stackView.pop()
}
}
]
@ -187,4 +193,12 @@ MobileComponents.Page {
id: detailsEdit
}
}
Component.onCompleted: {
notificationComponent = Qt.createComponent("PassiveNotification.qml");
if( notificationComponent.status != Component.Ready ) {
print("notificationComponent isn't ready with status " + notificationComponent.status)
if( notificationComponent.status == Component.Error )
print("Error:"+ notificationComponent.errorString() );
}
}
}

View file

@ -22,6 +22,7 @@
<file alias="context-menu.png">icons/context-menu.png</file>
<file alias="menu-edit.png">icons/menu-edit.png</file>
<file alias="menu-back.png">icons/menu-back.png</file>
<file alias="PassiveNotification.qml">mobilecomponents/private/PassiveNotification.qml</file>
</qresource>
<qresource prefix="/imports">
<file alias="org/kde/plasma/mobilecomponents/qmldir">mobilecomponents/qmldir</file>