Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[connectionagent] remove ask for roaming.
  • Loading branch information
Lorn Potter committed Aug 22, 2014
1 parent 4da45f2 commit 844e625
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 72 deletions.
78 changes: 23 additions & 55 deletions connd/qconnectionagent.cpp
Expand Up @@ -58,7 +58,6 @@ QConnectionAgent::QConnectionAgent(QObject *parent) :
ua(0),
netman(NetworkManagerFactory::createInstance()),
currentNetworkState(QString()),
askForRoaming(false),
isEthernet(false),
connmanAvailable(false),
oContext(0),
Expand All @@ -84,7 +83,6 @@ QConnectionAgent::QConnectionAgent(QObject *parent) :
}

connect(this,SIGNAL(configurationNeeded(QString)),this,SLOT(openConnectionDialog(QString)));
askForRoaming = askRoaming();

connect(netman,SIGNAL(servicesListChanged(QStringList)),this,SLOT(servicesListChanged(QStringList)));
connect(netman,SIGNAL(stateChanged(QString)),this,SLOT(networkStateChanged(QString)));
Expand Down Expand Up @@ -422,25 +420,6 @@ void QConnectionAgent::networkStateChanged(const QString &state)
}
}

bool QConnectionAgent::askRoaming() const
{
qDebug() << Q_FUNC_INFO;
bool roaming;
QSettings confFile;
confFile.beginGroup("Connectionagent");
roaming = confFile.value("askForRoaming").toBool();
return roaming;
}

void QConnectionAgent::setAskRoaming(bool value)
{
qDebug() << Q_FUNC_INFO;
QSettings confFile;
confFile.beginGroup("Connectionagent");
confFile.setValue("askForRoaming",value);
askForRoaming = value;
}

void QConnectionAgent::connmanAvailabilityChanged(bool b)
{
qDebug() << Q_FUNC_INFO;
Expand Down Expand Up @@ -660,10 +639,6 @@ void QConnectionAgent::serviceAutoconnectChanged(bool on)
mobileConnected = true;
}
}
if (!mobileConnected && service->roaming() && askRoaming() && !flightModeSuppression) {
Q_EMIT connectionRequest();
return;
}
}

if ((service->type() == "wifi" && mobileConnected)
Expand Down Expand Up @@ -747,38 +722,31 @@ QString QConnectionAgent::findBestConnectableService()
if (netman->defaultRoute()->type() == "wifi" && service->type() != "wifi")
return QString(); // prefer connected wifi

bool isCellRoaming = false;
if (service->type() == "cellular" && service->roaming() && !service->connected()) {

isCellRoaming = askForRoaming;

QOfonoManager oManager;
if (!oManager.available()) {
qDebug() << "ofono not available.";
}
if (oManager.modems().count() < 1)
return QString();

QOfonoConnectionManager oConnManager;
oConnManager.setModemPath(oManager.modems().at(0));

if (oConnManager.roamingAllowed()) {
if (askRoaming()) {
// ask user
if (!flightModeSuppression) {
Q_EMIT connectionRequest();
}
return QString();
}
}
//roaming and user doesnt want connection while roaming
qDebug() << "roaming not allowed";
return QString();
}
// if (service->type() == "cellular" && service->roaming() && !service->connected()) {
// QOfonoManager oManager;
// if (!oManager.available()) {
// qDebug() << "ofono not available.";
// }
// if (oManager.modems().count() < 1)
// return QString();
// QOfonoConnectionManager oConnManager;
// oConnManager.setModemPath(oManager.modems().at(0));
// if (oConnManager.roamingAllowed()) {
// if (askRoaming()) {
// // ask user
// if (!flightModeSuppression) {
// Q_EMIT connectionRequest();
// }
// return QString();
// }
// }
// //roaming and user doesnt want connection while roaming
// qDebug() << "roaming not allowed";
// return QString();
// }

if (isBestService(service)
&& service->favorite()
&& !isCellRoaming) {
&& service->favorite()) {
qDebug() << path;
return path;
}
Expand Down
4 changes: 0 additions & 4 deletions connd/qconnectionagent.h
Expand Up @@ -41,14 +41,11 @@ class QTimer;
class QConnectionAgent : public QObject
{
Q_OBJECT
Q_PROPERTY(bool askRoaming READ askRoaming WRITE setAskRoaming)

public:
~QConnectionAgent();

static QConnectionAgent &instance();
bool askRoaming() const;
void setAskRoaming(bool value);

Q_SIGNALS:

Expand Down Expand Up @@ -94,7 +91,6 @@ public Q_SLOTS:
QStringList orderedServicesList;

QStringList techPreferenceList;
bool askForRoaming;
bool isEthernet;
bool connmanAvailable;

Expand Down
10 changes: 0 additions & 10 deletions connectionagentplugin/connectionagentplugin.cpp
Expand Up @@ -172,16 +172,6 @@ void ConnectionAgentPlugin::onConnectionState(const QString &state, const QStrin
Q_EMIT connectionState(state, type);
}

bool ConnectionAgentPlugin::askRoaming() const
{
return connManagerInterface->askRoaming();
}

void ConnectionAgentPlugin::setAskRoaming(bool value)
{
connManagerInterface->setAskRoaming(value);
}

void ConnectionAgentPlugin::startTethering(const QString &type)
{
connManagerInterface->startTethering(type);
Expand Down
3 changes: 0 additions & 3 deletions connectionagentplugin/connectionagentplugin.h
Expand Up @@ -24,15 +24,12 @@ class NetworkManager;
class ConnectionAgentPlugin : public QObject
{
Q_OBJECT
Q_PROPERTY(bool askRoaming READ askRoaming WRITE setAskRoaming)

Q_DISABLE_COPY(ConnectionAgentPlugin)

public:
explicit ConnectionAgentPlugin(QObject *parent = 0);
~ConnectionAgentPlugin();
bool askRoaming() const;
void setAskRoaming(bool value);

public slots:
void sendUserReply(const QVariantMap &input);
Expand Down

0 comments on commit 844e625

Please sign in to comment.