Dialog: Notify page stack change after closing
See also: https://github.com/gpodder/gpodder-bb10/issues/7
This commit is contained in:
parent
f7d6d6db15
commit
bc8241e99a
2 changed files with 17 additions and 1 deletions
|
@ -36,7 +36,10 @@ Rectangle {
|
||||||
pgst.topOfStackChanged();
|
pgst.topOfStackChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
Component.onDestruction: pgst.dialogsVisible = pgst.dialogsVisible - 1;
|
Component.onDestruction: {
|
||||||
|
pgst.dialogsVisible = pgst.dialogsVisible - 1;
|
||||||
|
pgst.onDialogDismissed(page);
|
||||||
|
}
|
||||||
|
|
||||||
default property alias children: contents.children
|
default property alias children: contents.children
|
||||||
property bool isDialog: true
|
property bool isDialog: true
|
||||||
|
|
|
@ -102,6 +102,19 @@ Item {
|
||||||
property string menuButtonIcon: ''
|
property string menuButtonIcon: ''
|
||||||
property string windowTitle: 'gPodder'
|
property string windowTitle: 'gPodder'
|
||||||
|
|
||||||
|
function onDialogDismissed(dialog) {
|
||||||
|
for (var i=0; i<children.length; i++) {
|
||||||
|
// If the dismissed dialog is not on top of the stack, it was
|
||||||
|
// dismissed while another page was pushed, so we need to do
|
||||||
|
// another topOfStackChanged() to get the right top item
|
||||||
|
// (see https://github.com/gpodder/gpodder-bb10/issues/7)
|
||||||
|
if (children[i] === dialog && i < children.length - 1) {
|
||||||
|
topOfStackChanged();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function topOfStackChanged(offset) {
|
function topOfStackChanged(offset) {
|
||||||
if (offset === undefined) {
|
if (offset === undefined) {
|
||||||
offset = 0;
|
offset = 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue