From d24e5b455f4c52c59fe70f047f9ca0a6c30fcaa6 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Thu, 3 Mar 2016 19:35:33 +0100 Subject: use the global showPassiveNotification function don't create a local PassiveNotification copy, use the global show/hidePassiveNotification from ApplicationWindow, now that it works Signed-off-by: Marco Martin Signed-off-by: Dirk Hohndel --- qt-mobile/qml/DiveDetails.qml | 12 +----------- qt-mobile/qml/main.qml | 8 ++------ qt-mobile/qml/mobile-resources.qrc | 2 +- 3 files changed, 4 insertions(+), 18 deletions(-) diff --git a/qt-mobile/qml/DiveDetails.qml b/qt-mobile/qml/DiveDetails.qml index c5fb0e4f0..19a3466db 100644 --- a/qt-mobile/qml/DiveDetails.qml +++ b/qt-mobile/qml/DiveDetails.qml @@ -25,7 +25,6 @@ MobileComponents.Page { property alias startpressure: detailsEdit.startpressureText property alias endpressure: detailsEdit.endpressureText property alias gasmix: detailsEdit.gasmixText - property QtObject notificationComponent state: "view" @@ -65,8 +64,7 @@ MobileComponents.Page { onTriggered: { var deletedId = diveDetailsListView.currentItem.modelData.dive.id manager.deleteDive(deletedId) - var notification = notificationComponent.createObject(contentItem.parent); - notification.showNotification("Dive deleted", 3000, "Undo", + showPassiveNotification("Dive deleted", 3000, "Undo", function() { manager.undoDelete(deletedId) }); @@ -194,12 +192,4 @@ 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/main.qml b/qt-mobile/qml/main.qml index 19655e7e5..6e9bb767c 100644 --- a/qt-mobile/qml/main.qml +++ b/qt-mobile/qml/main.qml @@ -13,17 +13,13 @@ MobileComponents.ApplicationWindow { title: qsTr("Subsurface-mobile") property bool fullscreen: true property int oldStatus: -1 - property alias sharedNotificationComponent: detailsWindow.notificationComponent property alias accessingCloud: manager.accessingCloud property QtObject notification: null onAccessingCloudChanged: { if (accessingCloud) { - notification = sharedNotificationComponent.createObject(rootItem); - notification.showNotification("Accessing Subsurface Cloud Storage", 5000); + showPassiveNotification("Accessing Subsurface Cloud Storage", 5000); } else { - if (notification) { - notification.hideNotification(); - } + hidePassiveNotification(); } } diff --git a/qt-mobile/qml/mobile-resources.qrc b/qt-mobile/qml/mobile-resources.qrc index a96910494..1039e9c32 100644 --- a/qt-mobile/qml/mobile-resources.qrc +++ b/qt-mobile/qml/mobile-resources.qrc @@ -22,7 +22,6 @@ icons/context-menu.png icons/menu-edit.png icons/menu-back.png - mobilecomponents/private/PassiveNotification.qml mobilecomponents/qmldir @@ -45,6 +44,7 @@ mobilecomponents/private/ActionButtonArrow.qml mobilecomponents/private/AbstractDrawer.qml mobilecomponents/private/PageStack.js + mobilecomponents/private/PassiveNotification.qml mobilecomponents/icons/go-next.svg mobilecomponents/icons/go-previous.svg mobilecomponents/icons/distribute-horizontal-x.svg -- cgit v1.2.3-70-g09d2