<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>Thanks for the hints. So there is not easy way to wait for Internet before triggering a request :/<br><br>After tests, I've seen that it's the <tt>networkStatusChanged</tt> and the<tt> networkConfigurationChanged</tt> signals that are triggered when my Jolla connects to Internet.<br>So I can indeed in case of failure due to no connection, store the request and retry it when I receive those signals, but it's not super convenient. I will do that only when it's really needed, otherwise I will invite the user to connect to Internet and retry.<br><br>Thank you!<br>Sylvain.<br><br><div><hr id="stopSpelling">Date: Wed, 12 Feb 2014 19:02:39 +0600<br>From: coderusinbox@gmail.com<br>To: devel@lists.sailfishos.org<br>Subject: Re: [SailfishDevel] QNetworkAccessManager: how to wait for Internet?<br><br>
  
    
  
  
    <tt>    manager = new QNetworkConfigurationManager(this);</tt><tt><br>
    </tt><tt>    connect(manager,SIGNAL(onlineStateChanged(bool)),</tt><tt><br>
    </tt><tt>            this,SLOT(networkStatusChanged(bool)));</tt><tt><br>
    </tt><tt><br>
    </tt><tt>   
      connect(manager,SIGNAL(configurationChanged(QNetworkConfiguration)),</tt><tt><br>
    </tt><tt>           
      this,SLOT(networkConfigurationChanged(QNetworkConfiguration)));</tt><tt><br>
    </tt><tt><br>
    </tt><tt>    session = new
      QNetworkSession(manager->defaultConfiguration());</tt><tt><br>
    </tt><tt>    connect(session, SIGNAL(opened()), this,
      SLOT(networkSessionOpened()));</tt><tt><br>
    </tt><tt>    connect(session,
      SIGNAL(stateChanged(QNetworkSession::State)), this,<br>
                  SLOT(networkStateChanged(QNetworkSession::State)));</tt><br>
    <br>
    <div class="ecxmoz-cite-prefix">On 12.02.2014 18:57, Sylvain B. wrote:<br>
    </div>
    <blockquote cite="mid:DUB124-W572440B8D5C6838BA6977DF920@phx.gbl">
      <style><!--
.ExternalClass .ecxhmmessage P {
padding:0px;
}

.ExternalClass body.ecxhmmessage {
font-size:12pt;
font-family:Calibri;
}

--></style>
      <div dir="ltr">
        <div>Hello,</div>
        <div>QNetworkAccessManager does not behave like in Harmattan:
          when you were triggering a request while not connected to
          Internet, the "Select Internet connection" dialog was showing,
          and the request was waiting for the device to connect to the
          Internet.</div>
        <div>In Sailfish, triggering a request when the phone is not
          connected to Internet pop the "Select Internet connection"
          dialog, but the request immediately returns a
          HostNotFoundError.</div>
        <div><br>
        </div>
        <div>Is it something that will change in the future or do we
          have to handle that manually?</div>
        <div>If it needs to be done manually, could anyone share a clean
          way to do so?</div>
        <div><br>
        </div>
        <div>Thanks a lot,</div>
        <div><br>
        </div>
        <div>-- </div>
        <div>Sylvain.</div>
      </div>
      <br>
      <fieldset class="ecxmimeAttachmentHeader"></fieldset>
      <br>
      <pre>_______________________________________________
SailfishOS.org Devel mailing list</pre>
    </blockquote>
    <br>
  

<br>_______________________________________________
SailfishOS.org Devel mailing list</div>                                     </div></body>
</html>