Thanks for the hints. So there is not easy way to wait for Internet before 
triggering a request :/

After tests, I've seen that it's the networkStatusChanged and the 
networkConfigurationChanged signals that are triggered when my Jolla connects 
to Internet.
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.

Thank you!
Sylvain.

Date: Wed, 12 Feb 2014 19:02:39 +0600
From: coderusin...@gmail.com
To: devel@lists.sailfishos.org
Subject: Re: [SailfishDevel] QNetworkAccessManager: how to wait for Internet?


  
    
  
  
        manager = new QNetworkConfigurationManager(this);

        connect(manager,SIGNAL(onlineStateChanged(bool)),

                this,SLOT(networkStatusChanged(bool)));

    

       
      connect(manager,SIGNAL(configurationChanged(QNetworkConfiguration)),

               
      this,SLOT(networkConfigurationChanged(QNetworkConfiguration)));

    

        session = new
      QNetworkSession(manager->defaultConfiguration());

        connect(session, SIGNAL(opened()), this,
      SLOT(networkSessionOpened()));

        connect(session,
      SIGNAL(stateChanged(QNetworkSession::State)), this,

                  SLOT(networkStateChanged(QNetworkSession::State)));

    

    On 12.02.2014 18:57, Sylvain B. wrote:

    
    
      
      
        Hello,
        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.
        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.
        

        
        Is it something that will change in the future or do we
          have to handle that manually?
        If it needs to be done manually, could anyone share a clean
          way to do so?
        

        
        Thanks a lot,
        

        
        -- 
        Sylvain.
      
      

      
      

      _______________________________________________
SailfishOS.org Devel mailing list
    
    

  


_______________________________________________
SailfishOS.org Devel mailing list                                         
_______________________________________________
SailfishOS.org Devel mailing list

Reply via email to