Qt: How to use an accesspoint throughout the application?

1.3k Views Asked by At

I'm developing an application for Symbian S60 phones using the Qt Nokia SDK, which sends requests and receives responses from a webservice in every view i have.

The problem with this, is that it always asks the user to choose a accesspoint.

So what i want is to choose an accesspoint when the application starts, and use that throughout the application.

So i found this example: http://wiki.forum.nokia.com/index.php/How_to_set_default_access_point_using_Qt_Mobility_APIs

but i got following error:

undefined reference to 'QtMobility::QNetworkConfigurationManager::QNetworkConfigurationManager(QObject*)

i'm also getting more of these errors from other classes from QMobillity, like:

undefined reference to 'QtMobility::QNetworkSession::open()

.pro file:

CONFIG += mobility
MOBILITY += bearer

header:

#include <qmobilityglobal.h>
#include <QtNetwork>
#include <QNetworkSession>
#include <QNetworkConfigurationManager>

QTM_USE_NAMESPACE;

cpp file:

        QNetworkConfigurationManager manager;
        const bool selectIap = (manager.capabilities()& QNetworkConfigurationManager::CanStartAndStopInterfaces);
        QNetworkConfiguration defaultIap = manager.defaultConfiguration();

        if(!defaultIap.isValid() && (!selectIap && defaultIap.state() != QNetworkConfiguration::Active))
        {
            qDebug() << "Network access point NOT found";

            // let the user know that there is no access point available
            msgBox->setText(tr("Error"));
            msgBox->setInformativeText(tr("No default access point available"));
            msgBox->setStandardButtons(QMessageBox::Ok);
            msgBox->setDefaultButton(QMessageBox::Ok);
            msgBox->topLevelWidget();
            msgBox->exec();
        }
        else
        {
            qDebug() << "Network access point found and chosen";
        }

        session = new QNetworkSession(defaultIap,this);
        session->open();

Anyone got an idea of what could be wrong?

1

There are 1 best solutions below

0
On

Have you tried adding this to the .PRO file?

CONFIG += network