I did a maybe less dirty workaround yesterday:

    function openWelcomeDialog()
    {
        console.log("working!")
        if (status == PageStatus.Active)
        {
            mainPage.statusChanged.disconnect(openWelcomeDialog)
            var component = Qt.createComponent("WelcomeDialog.qml")
            var popup = component.createObject(mainPage)
            popup.open()
        }
    }

    Component.onCompleted: mainPage.statusChanged.connect(openWelcomeDialog)

This way The check will be done only 4 times in my case and not each time
something happens with the Page.
Note, that queuing would be a great idea. In my case the busy check was
false (pageStack wasn't busy) but a while after it was and Dialog couldn't
be pushed.

--
Marcin


2014-07-17 0:50 GMT+02:00 Matthew Vogt <matthew.v...@jolla.com>:

> Yes, fair point.
>
> IIRC, we decided there weren't enough motivating examples to make it worth
> adding action-queueing behaviour to the PageStack.  If people keep hitting
> this problem, though, it could be worth revisiting.
>
> That said, working around the problem is usually simple, and making the
> PageStack support more complicated API patterns could lead users to get
> themselves into deeper trouble, that's harder to diagnose and fix :-)
>
> Matt
> ________________________________________
> From: devel-boun...@lists.sailfishos.org [
> devel-boun...@lists.sailfishos.org] on behalf of J-P Nurmi [
> jpnu...@gmail.com]
> Sent: Thursday, July 17, 2014 7:45 AM
> To: Sailfish OS Developers
> Subject: Re: [SailfishDevel] A welcome dialog and pageStack's operation in
>      progress.
>
> On Wed, Jul 16, 2014 at 11:25 PM, Matthew Vogt <matthew.v...@jolla.com>
> wrote:
> >
> > Hi, 'Page.status' is the correct property to watch for avoiding this
> problem.
> >
> > Here is an example of what you could do:
> >
> > import QtQuick 2.0
> > import Sailfish.Silica 1.0
> >
> > ApplicationWindow {
> >
> >         initialPage: Component {
> >                 Page {
> >                         anchors.fill: parent
> >
> >                         Label {
> >                                 anchors.centerIn: parent
> >                                 text: 'Main page'
> >                         }
> >
> >                         property bool showSplash: true
> >                         onStatusChanged: {
> >                                 if (status == PageStatus.Active &&
> showSplash) {
> >                                         showSplash = false
> >                                         pageStack.push(splashPage)
> >                                 }
> >                         }
> >                 }
> >         }
> >
> >         Component {
> >                 id: splashPage
> >
> >                 Page {
> >                         Label {
> >                                 anchors.centerIn: parent
> >                                 text: 'Splash page'
> >                         }
> >                 }
> >         }
> > }
> >
> > Thanks,
> > Matt
>
>
> Hi Matt,
>
> Notice that essentially the same problem occurs when a dialog/page is
> triggered by an external event. User navigates the UI meanwhile eg. a
> network event triggers a dialog => PageStack is busy so it just bails
> out and user misses the dialog. As a workaround, waiting until
> PageStack is no longer busy gets pretty ugly.
>
> --
> J-P Nurmi
> _______________________________________________
> SailfishOS.org Devel mailing list
> To unsubscribe, please send a mail to
> devel-unsubscr...@lists.sailfishos.org
> _______________________________________________
> SailfishOS.org Devel mailing list
> To unsubscribe, please send a mail to
> devel-unsubscr...@lists.sailfishos.org
>
_______________________________________________
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org

Reply via email to