aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Tilloy <olivier.tilloy@canonical.com>2012-10-09 18:45:05 +0000
committerTarmac <>2012-10-09 18:45:05 +0000
commitf8266c81af2ac03ac4b27c9da702f7d72b530c3e (patch)
tree8ac6c15e52de26463d0c361513f9e261bee5324c
parenta03e7e775a9751f87efb8fd7acf226b5eb25f4e3 (diff)
parentf5e0285a2027fc50ae7f47b56ed2d2b2738fe6b2 (diff)
downloadqmenumodel-f8266c81af2ac03ac4b27c9da702f7d72b530c3e.tar.gz
qmenumodel-f8266c81af2ac03ac4b27c9da702f7d72b530c3e.tar.bz2
qmenumodel-f8266c81af2ac03ac4b27c9da702f7d72b530c3e.zip
Reset the navigation history when the connection to the model is lost.. Approved by Renato Araujo Oliveira Filho, jenkins.
-rw-r--r--examples/render-menumodel.qml14
1 files changed, 12 insertions, 2 deletions
diff --git a/examples/render-menumodel.qml b/examples/render-menumodel.qml
index 1ad41c5..d7c650e 100644
--- a/examples/render-menumodel.qml
+++ b/examples/render-menumodel.qml
@@ -15,7 +15,11 @@ Item {
busType: DBus.SessionBus
busName: "com.canonical.testmenu"
objectPath: "/com/canonical/testmenu"
- onStatusChanged: console.log("status of menu model changed to", status)
+ onStatusChanged: {
+ if (status == DBus.Connecting) {
+ view.reset()
+ }
+ }
}
ListView {
@@ -28,7 +32,6 @@ Item {
anchors.margins: 10
spacing: 3
model: menuModel
- Component.onCompleted: menuModel.start()
delegate: Rectangle {
width: parent.width
height: 30
@@ -85,6 +88,11 @@ Item {
newback.pop()
view.__back = newback
}
+ function reset() {
+ while (view.__back.length > 0) {
+ goback()
+ }
+ }
}
Rectangle {
@@ -132,5 +140,7 @@ Item {
font.pixelSize: 11
}
}
+
+ Component.onCompleted: menuModel.start()
}