← Back to team overview

ubuntu-phone team mailing list archive

Re: "Can I use the internet?"

 

Hi,
Take a look on Hi take a look on http://doc-snapshot.qt-project.org/qt5-stable/qtnetwork/qnetworkconfiguration.html

I could achieve this on a Nokia N9 device using QNetworkConfiguration::bearerTypeName().

QNetworkConfigurationManager *manager = new QNetworkConfigurationManager(this); QList<QNetworkConfiguration> confs = manager->allConfigurations(QNetworkConfiguration::Active);
   for(int counter= 0 ; counter < confs.count(); counter++ )
   {
       const QNetworkConfiguration & netConf = confs[counter];

QNetworkSession <http://doc-snapshot.qt-project.org/qt5-stable/qtnetwork/qnetworksession.html> *session = new QNetworkSession(netConf);

       // session provides lots of information

// also a QNetworkInteface <http://doc-snapshot.qt-project.org/qt5-stable/qtnetwork/qnetworkinterface.html> QNetworkSession::interface()
       ...
    }

Regards,
Carlos


On 07/30/2013 02:22 PM, Manuel de la Pena wrote:



On Tue, Jul 30, 2013 at 5:50 PM, Iain Lane <laney@xxxxxxxxxx <mailto:laney@xxxxxxxxxx>> wrote:

    Hi Manuel,

    On Tue, Jul 30, 2013 at 04:09:05PM +0200, Manuel de la Pena wrote:
    > On Tue, Jul 30, 2013 at 3:50 PM, Iain Lane <laney@xxxxxxxxxx
    <mailto:laney@xxxxxxxxxx>> wrote:
    >
    > > On Tue, Jul 30, 2013 at 08:12:42AM -0500, Ted Gould wrote:
    > > > On Tue, 2013-07-30 at 10:44 +0100, Iain Lane wrote:
    > > >
    > > > > In implementing the Time and Date settings[0], I need to
    know how to
    > > > > answer the question in the subject. We have NM's D-Bus API
    - does that
    > > > > cover all cases (mobile data, flight mode, containment
    [ok, that's not
    > > > > relevant for system settings, but more generally], ...) or
    is there
    > > > > something else to use here?
    > > >
    > > >
    > > > To be clear, you shouldn't use the D-Bus API, but instead
    the library.
    > >
    > > Which library? libnm-glib? If so, why's that better?
    > >
    > >
    > I have been doing some work recently with QNetworkInfo (
    > http://qt.developpez.com/doc/5.0-snapshot/qnetworkinfo/). Is
    there anything
    > wrong with that?

    Admittedly I didn't know about it ;-) But looking at that API
    reference
    it seems to be more about mobile stuff whereas my question is a
    bit more
    generic than that --- I want to know if there's an internet
    connection of
    any type available.


networkStatus returns an enum wouldn't that be enough for your needs?? (No idea, that is why I'm asking :D)


    Maybe I can't see it on this API or maybe Qt has something else
    for that
    in which case I'd be happy to switch over.

    --
    Iain Lane                                  [
    iain@xxxxxxxxxxxxxxxxxxx <mailto:iain@xxxxxxxxxxxxxxxxxxx> ]
    Debian Developer                                   [
    laney@xxxxxxxxxx <mailto:laney@xxxxxxxxxx> ]
    Ubuntu Developer                                   [
    laney@xxxxxxxxxx <mailto:laney@xxxxxxxxxx> ]

    --
    Mailing list: https://launchpad.net/~ubuntu-phone
    <https://launchpad.net/%7Eubuntu-phone>
    Post to     : ubuntu-phone@xxxxxxxxxxxxxxxxxxx
    <mailto:ubuntu-phone@xxxxxxxxxxxxxxxxxxx>
    Unsubscribe : https://launchpad.net/~ubuntu-phone
    <https://launchpad.net/%7Eubuntu-phone>
    More help   : https://help.launchpad.net/ListHelp






References