Skip to content

Commit

Permalink
[connectionagent] fix connecting after flight mode.
Browse files Browse the repository at this point in the history
After flight mode it is ok to conenct to previous connect.

Code removed was for trying to not automatically connect back to
autoconnect service when user disconnected. It didnt work anyway.
  • Loading branch information
Lorn Potter committed Oct 21, 2013
1 parent d68bd5b commit 80d9292
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
20 changes: 9 additions & 11 deletions connd/qconnectionmanager.cpp
Expand Up @@ -62,7 +62,7 @@ QConnectionManager::QConnectionManager(QObject *parent) :
handoverInProgress(0),
oContext(0),
tetheringWifiTech(0),
tetheringEnabled(0)
tetheringEnabled(false)
{
qDebug() << Q_FUNC_INFO;
connect(netman,SIGNAL(availabilityChanged(bool)),this,SLOT(connmanAvailabilityChanged(bool)));
Expand Down Expand Up @@ -235,7 +235,6 @@ void QConnectionManager::serviceStateChanged(const QString &state)
if (serviceInProgress == service->path())
serviceInProgress.clear();

previousConnectedService = service->path();
if (service->type() == "ethernet") { //keep this alive
NetworkTechnology tech;
tech.setPath(netman->technologyPathForService(service->path()));
Expand Down Expand Up @@ -466,18 +465,16 @@ QString QConnectionManager::findBestConnectableService()
QString path = orderedServicesList.at(i);

NetworkService *service = servicesMap.value(path);
qDebug() << "looking at" << service->name() << service->autoConnect();

bool online = isStateOnline(netman->defaultRoute()->state());
if (online && netman->defaultRoute()->path() == service->path())
return QString();//best already connected
qDebug() << "looking at" << service->name() << service->autoConnect() << online;

if (!service->autoConnect()) {
continue;
if (online && netman->defaultRoute()->path() == service->path()) {
qDebug() << "best already connected";
return QString();//best already connected
}
qDebug() << previousConnectedService << service->path();

if (!online && previousConnectedService == service->path()) {
if (!service->autoConnect()) {
continue;
}

Expand All @@ -494,7 +491,7 @@ QString QConnectionManager::findBestConnectableService()
if (isBestService(service->path())
&& service->favorite()
&& !isCellRoaming) {
qDebug() << path;
qDebug() <<"best connectable is"<< path;
return path;
}
}
Expand Down Expand Up @@ -587,7 +584,6 @@ void QConnectionManager::setup()
updateServicesMap();

if (isStateOnline(netman->state())) {
previousConnectedService = netman->defaultRoute()->path();

if (netman->defaultRoute()->type() == "ethernet")
isEthernet = true;
Expand All @@ -610,12 +606,14 @@ void QConnectionManager::setup()
void QConnectionManager::technologyPowerChanged(bool b)
{
NetworkTechnology *tech = static_cast<NetworkTechnology *>(sender());
qDebug() << tech->type();
if (b && (tech->type() == "wifi" || tech->type() == "cellular"))
tech->scan();
}

void QConnectionManager::techChanged()
{
qDebug() << Q_FUNC_INFO;
Q_FOREACH(const NetworkTechnology *technology,netman->getTechnologies()) {
connect(technology,SIGNAL(poweredChanged(bool)),this,SLOT(technologyPowerChanged(bool)));
}
Expand Down
1 change: 0 additions & 1 deletion connd/qconnectionmanager.h
Expand Up @@ -96,7 +96,6 @@ public Q_SLOTS:
bool isEthernet;
bool connmanAvailable;
bool handoverInProgress;
QString previousConnectedService;
bool manualConnected;
QString serviceInProgress;
QString autoConnectService;
Expand Down

0 comments on commit 80d9292

Please sign in to comment.