From e39e9eee3ba1a8192c2a643b0ecafc5e139c39f8 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Mon, 29 Feb 2016 06:14:18 -0800 Subject: 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 --- qt-mobile/qml/DiveDetails.qml | 16 +++++++++++++++- qt-mobile/qml/mobile-resources.qrc | 1 + 2 files changed, 16 insertions(+), 1 deletion(-) (limited to 'qt-mobile') diff --git a/qt-mobile/qml/DiveDetails.qml b/qt-mobile/qml/DiveDetails.qml index 83a8b3a93..43b6c5e88 100644 --- a/qt-mobile/qml/DiveDetails.qml +++ b/qt-mobile/qml/DiveDetails.qml @@ -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() ); + } + } } diff --git a/qt-mobile/qml/mobile-resources.qrc b/qt-mobile/qml/mobile-resources.qrc index 77a78c918..a96910494 100644 --- a/qt-mobile/qml/mobile-resources.qrc +++ b/qt-mobile/qml/mobile-resources.qrc @@ -22,6 +22,7 @@ icons/context-menu.png icons/menu-edit.png icons/menu-back.png + mobilecomponents/private/PassiveNotification.qml mobilecomponents/qmldir -- cgit v1.2.3-70-g09d2